CHROMA
eoprec_constdet_two_flavor_ratio_conv_conv_monomial5d_w.cc
Go to the documentation of this file.
1 /*! @file
2  * @brief Two-flavor collection of even-odd preconditioned 4D ferm monomials
3  */
4 
5 #include "chromabase.h"
8 
11 
14 
16 
17 
18 namespace Chroma
19 {
20 
21  namespace EvenOddPrecConstDetTwoFlavorRatioConvConvWilsonTypeFermMonomial5DEnv
22  {
23  namespace
24  {
25  //! Callback function for the factory
27  multi1d<LatticeColorMatrix> >* createMonomial(XMLReader& xml, const std::string& path)
28  {
31  }
32 
33  //! Local registration flag
34  bool registered = false;
35  }
36 
37  const std::string name("TWO_FLAVOR_EOPREC_CONSTDET_RATIO_CONV_CONV_FERM_MONOMIAL5D");
38 
39  //! Register all the factories
40  bool registerAll()
41  {
42  bool success = true;
43  if (! registered)
44  {
46  success &= TheMonomialFactory::Instance().registerObject(name, createMonomial);
47  registered = true;
48  }
49  return success;
50  }
51  } //end namespace EvenOddPrec TwoFlavorWilsonFermMonomialEnv
52 
53 
54  // Constructor
57  {
58  START_CODE();
59 
60  QDPIO::cout << "Constructor: " << __func__ << std::endl;
61 
62  invParam_num = param.numer.invParam;
63 
64  //*********************************************************************
65  // Fermion action
66  {
67  std::istringstream is(param.numer.fermact.xml);
68  XMLReader fermact_reader(is);
69  QDPIO::cout << "Construct fermion action= " << param.numer.fermact.id << std::endl;
70 
71  WilsonTypeFermAct5D<T,P,Q>* tmp_act =
72  TheWilsonTypeFermAct5DFactory::Instance().createObject(param.numer.fermact.id, fermact_reader, param.numer.fermact.path);
73 
75  dynamic_cast<EvenOddPrecConstDetWilsonTypeFermAct5D<T,P,Q>*>(tmp_act);
76 
77  // Check success of the downcast
78  if( downcast == 0x0 ) {
79  QDPIO::cerr << __func__ << ": unable to downcast FermAct to EvenOddPrecConstDetWilsonTypeFermAct5D" << std::endl;
80  QDP_abort(1);
81  }
82 
83  fermact_num = downcast;
84  }
85 
86  //*********************************************************************
87  // Fermion action
88  {
89  std::istringstream is(param.denom.fermact.xml);
90  XMLReader fermact_reader(is);
91  QDPIO::cout << "Construct fermion action= " << param.denom.fermact.id << std::endl;
92 
93  WilsonTypeFermAct5D<T,P,Q>* tmp_act =
94  TheWilsonTypeFermAct5DFactory::Instance().createObject(param.denom.fermact.id, fermact_reader, param.denom.fermact.path);
95 
97  dynamic_cast<EvenOddPrecConstDetWilsonTypeFermAct5D<T,P,Q>*>(tmp_act);
98 
99  // Check success of the downcast
100  if( downcast == 0x0 ) {
101  QDPIO::cerr << __func__ << ": unable to downcast FermAct to EvenOddPrecConstDetWilsonTypeFermAct5D" << std::endl;
102  QDP_abort(1);
103  }
104 
105  fermact_den = downcast;
106  }
107  //*********************************************************************
108 
109  if (fermact_num->size() != fermact_den->size())
110  {
111  QDPIO::cerr << "Error: numerator action has to have the same length in the 5th dimension as the denominator action." << std::endl;
112  QDPIO::cerr << "N5 in FermionActionNum " << fermact_num->size() << std::endl;
113  QDPIO::cerr << "N5 in FermionActionDen " << fermact_den->size() << std::endl;
114  QDP_abort(1);
115  }
116 
117 
118  //*********************************************************************
119  // Get Chronological predictor
120  {
122  if( param.predictor.xml == "" ) {
123  // No predictor specified use zero guess
125  }
126  else
127  {
128  try
129  {
130  std::istringstream chrono_is(param.predictor.xml);
131  XMLReader chrono_xml(chrono_is);
133  fermact_num->size(),
134  chrono_xml,
135  param.predictor.path);
136  }
137  catch(const std::string& e ) {
138  QDPIO::cerr << "Caught Exception Reading XML: " << e << std::endl;
139  QDP_abort(1);
140  }
141  }
142 
143  if( tmp == 0x0 ) {
144  QDPIO::cerr << "Failed to create the 4D ChronoPredictor" << std::endl;
145  QDP_abort(1);
146  }
148  }
149  //*********************************************************************
150 
151  QDPIO::cout << "Initing PF field" << std::endl;
152  getPhi().resize( fermact_num->size() );
153 
154  QDPIO::cout << "Finished constructing: " << __func__ << std::endl;
155 
156  END_CODE();
157  }
158 
159 } //end namespace Chroma
160 
161 
Primary include file for CHROMA library code.
Chronological predictor for HMC.
Monomial factories.
Even-odd preconditioned Wilson-like fermion actions including derivatives.
An abstract monomial class, for inexact algorithms.
Definition: abs_monomial.h:43
static T & Instance()
Definition: singleton.h:432
Wilson-like fermion actions.
Definition: fermact.orig.h:403
Zero initial guess predictor.
Two-flavor collection of even-odd preconditioned 4D ferm monomials.
Fermion action factories.
All Wilson-type fermion actions.
Monomial factories.
static bool registered
Local registration flag.
const std::string name("TWO_FLAVOR_EOPREC_CONSTDET_RATIO_CONV_CONV_FERM_MONOMIAL5D")
Monomial< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createMonomial(XMLReader &xml, const std::string &path)
Callback function for the factory.
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
Zero initial guess predictor.