CHROMA
unprec_two_flavor_monomial_w.cc
Go to the documentation of this file.
1 /*! @file
2  * @brief Two-flavor collection of unpreconditioned 4D ferm monomials
3  */
4 
5 #include "chromabase.h"
8 
11 
14 
15 
16 namespace Chroma
17 {
18 
19  namespace UnprecTwoFlavorWilsonTypeFermMonomialEnv
20  {
21  namespace
22  {
23  //! Callback function for the factory
25  multi1d<LatticeColorMatrix> >* createMonomial(XMLReader& xml, const std::string& path)
26  {
29  }
30 
31  //! Local registration flag
32  bool registered = false;
33  }
34 
35  const std::string name("TWO_FLAVOR_UNPREC_FERM_MONOMIAL");
36 
37  //! Register all the factories
38  bool registerAll()
39  {
40  bool success = true;
41  if (! registered)
42  {
44  success &= TheMonomialFactory::Instance().registerObject(name, createMonomial);
45  registered = true;
46  }
47  return success;
48  }
49  } //end namespace Unprec TwoFlavorWilsonFermMonomialEnv
50 
51 
52 
53  // Constructor
56  {
57  START_CODE();
58 
59  inv_param = param.inv_param;
60 
61  std::istringstream is(param.fermact.xml);
62  XMLReader fermact_reader(is);
63  QDPIO::cout << "UnprecTwoFlavorWilsonTypeFermMonomial: construct " << param.fermact.id << std::endl;
64 
65  WilsonTypeFermAct<T,P,Q>* downcast
66  = TheWilsonTypeFermActFactory::Instance().createObject(param.fermact.id, fermact_reader, param.fermact.path);
67 
68  // UnprecWilsonTypeFermAct<T,P,Q>* downcast =
69  // dynamic_cast<UnprecWilsonTypeFermAct<T,P,Q>*>(tmp_act);
70 
71 
72  // Check success of the downcast
73  if( downcast == 0x0 ) {
74  QDPIO::cerr << "Unable to downcast FermAct to UnprecWilsonTypeFermAct in UnprecTwoFlavorWilsonTypeFermMonomial()" << std::endl;
75  QDP_abort(1);
76  }
77 
78  fermact = downcast;
79 
80  // Get Chronological predictor
82  if( param.predictor.xml == "" )
83  {
84  // No predictor specified use zero guess
86  }
87  else
88  {
89  try
90  {
91  std::istringstream chrono_is(param.predictor.xml);
92  XMLReader chrono_xml(chrono_is);
94  chrono_xml,
95  param.predictor.path);
96  }
97  catch(const std::string& e ) {
98  QDPIO::cerr << "Caught Exception Reading XML: " << e << std::endl;
99  QDP_abort(1);
100  }
101  }
102 
103  if( tmp == 0x0 ) {
104  QDPIO::cerr << "Failed to create the 4D ChronoPredictor" << std::endl;
105  QDP_abort(1);
106  }
108 
109  QDPIO::cout << "UnprecTwoFlavorWilsonTypeFermMonomial: finished " << param.fermact.id << std::endl;
110 
111  END_CODE();
112  }
113 
114 } //end namespace Chroma
115 
116 
Primary include file for CHROMA library code.
Monomial factories.
An abstract monomial class, for inexact algorithms.
Definition: abs_monomial.h:43
static T & Instance()
Definition: singleton.h:432
Wrapper class for 2-flavor unprec ferm monomials.
Handle< const WilsonTypeFermAct< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > fermact
Handle< AbsChronologicalPredictor4D< LatticeFermion > > chrono_predictor
Wilson-like fermion actions.
Definition: fermact.orig.h:344
Zero initial guess predictor.
Fermion action factories.
All Wilson-type fermion actions.
Monomial factories.
static bool registered
Local registration flag.
Monomial< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createMonomial(XMLReader &xml, const std::string &path)
Callback function for the factory.
const std::string name("TWO_FLAVOR_UNPREC_FERM_MONOMIAL")
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
START_CODE()
::std::string string
Definition: gtest.h:1979
Two-flavor collection of unpreconditioned 4D ferm monomials.
Zero initial guess predictor.