CHROMA
unprec_two_flavor_ratio_conv_conv_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 UnprecTwoFlavorRatioConvConvWilsonTypeFermMonomialEnv
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_RATIO_CONV_CONV_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 TwoFlavorRatioConvConvWilsonFermMonomialEnv
50 
51 
52  // Constructor
55  {
56  START_CODE();
57 
58  QDPIO::cout << "Constructor: " << __func__ << std::endl;
59 
60  if( param.numer.invParam.id == "NULL" ) {
61  QDPIO::cerr << "Numerator inverter params are NULL" << std::endl;
62  QDP_abort(1);
63  }
64 
65  invParam_num = param.numer.invParam;
66 
67  if( param.denom.invParam.id == "NULL" ) {
68  QDPIO::cerr << "WARNING: No inverter params provided for denominator." << std::endl;
69  QDPIO::cerr << "WARNING: Assuming same as for numerator " << std::endl;
70  invParam_den = param.numer.invParam;
71  }
72  else {
73  invParam_den = param.denom.invParam;
74  }
75 
76 
77  //*********************************************************************
78  // Fermion action
79  {
80  std::istringstream is(param.numer.fermact.xml);
81  XMLReader fermact_reader(is);
82  QDPIO::cout << "Construct numer fermion action= " << param.numer.fermact.id << std::endl;
83 
84  WilsonTypeFermAct<T,P,Q>* tmp_act =
86  fermact_reader,
87  param.numer.fermact.path);
88 
89  UnprecWilsonTypeFermAct<T,P,Q>* downcast=dynamic_cast<UnprecWilsonTypeFermAct<T,P,Q>*>(tmp_act);
90 
91  // Check success of the downcast
92  if( downcast == 0x0 )
93  {
94  QDPIO::cerr << __func__ << ": unable to downcast FermAct to UnprecWilsonTypeFermAct" << std::endl;
95  QDP_abort(1);
96  }
97 
98  fermact_num = downcast;
99  }
100 
101  //*********************************************************************
102  // Fermion action
103  {
104  std::istringstream is(param.denom.fermact.xml);
105  XMLReader fermact_reader(is);
106  QDPIO::cout << "Construct denom fermion action= " << param.denom.fermact.id << std::endl;
107 
108  WilsonTypeFermAct<T,P,Q>* tmp_act =
110  fermact_reader,
111  param.denom.fermact.path);
112 
113  UnprecWilsonTypeFermAct<T,P,Q>* downcast=dynamic_cast<UnprecWilsonTypeFermAct<T,P,Q>*>(tmp_act);
114 
115  // Check success of the downcast
116  if( downcast == 0x0 )
117  {
118  QDPIO::cerr << __func__ << ": unable to downcast FermAct to UnprecWilsonTypeFermAct" << std::endl;
119  QDP_abort(1);
120  }
121 
122  fermact_den = downcast;
123  }
124  //*********************************************************************
125 
126  //*********************************************************************
127  // Get Chronological predictor
128  {
130  if( param.predictor.xml == "" ) {
131  // No predictor specified use zero guess
133  }
134  else
135  {
136  try
137  {
138  std::istringstream chrono_is(param.predictor.xml);
139  XMLReader chrono_xml(chrono_is);
141  chrono_xml,
142  param.predictor.path);
143  }
144  catch(const std::string& e ) {
145  QDPIO::cerr << "Caught Exception Reading XML: " << e << std::endl;
146  QDP_abort(1);
147  }
148  }
149 
150  if( tmp == 0x0 ) {
151  QDPIO::cerr << "Failed to create the 4D ChronoPredictor" << std::endl;
152  QDP_abort(1);
153  }
155  }
156  //*********************************************************************
157 
158  QDPIO::cout << "Finished constructing: " << __func__ << std::endl;
159 
160  END_CODE();
161  }
162 
163 } //end namespace Chroma
164 
165 
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
Unpreconditioned Wilson-like fermion actions with derivatives.
Definition: fermact.orig.h:491
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_RATIO_CONV_CONV_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.