CHROMA
unprec_two_flavor_ratio_conv_conv_monomial5d_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 UnprecTwoFlavorRatioConvConvWilsonTypeFermMonomial5DEnv
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_MONOMIAL5D");
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  invParam_num = param.numer.invParam;
61 
62  //*********************************************************************
63  // Fermion action
64  {
65  std::istringstream is(param.numer.fermact.xml);
66  XMLReader fermact_reader(is);
67  QDPIO::cout << "Construct fermion action= " << param.numer.fermact.id << std::endl;
68 
69  WilsonTypeFermAct5D<T,P,Q>* tmp_act =
70  TheWilsonTypeFermAct5DFactory::Instance().createObject(param.numer.fermact.id, fermact_reader, param.numer.fermact.path);
71 
73  dynamic_cast<UnprecWilsonTypeFermAct5D<T,P,Q>*>(tmp_act);
74 
75  // Check success of the downcast
76  if( downcast == 0x0 ) {
77  QDPIO::cerr << __func__ << ": unable to downcast FermAct to UnprecWilsonTypeFermAct5D" << std::endl;
78  QDP_abort(1);
79  }
80 
81  fermact_num = downcast;
82  }
83 
84  //*********************************************************************
85  // Fermion action
86  {
87  std::istringstream is(param.denom.fermact.xml);
88  XMLReader fermact_reader(is);
89  QDPIO::cout << "Construct fermion action= " << param.denom.fermact.id << std::endl;
90 
91  WilsonTypeFermAct5D<T,P,Q>* tmp_act =
92  TheWilsonTypeFermAct5DFactory::Instance().createObject(param.denom.fermact.id, fermact_reader, param.denom.fermact.path);
93 
95  dynamic_cast<UnprecWilsonTypeFermAct5D<T,P,Q>*>(tmp_act);
96 
97  // Check success of the downcast
98  if( downcast == 0x0 ) {
99  QDPIO::cerr << __func__ << ": unable to downcast FermAct to UnprecWilsonTypeFermAct5D" << std::endl;
100  QDP_abort(1);
101  }
102 
103  fermact_den = downcast;
104  }
105  //*********************************************************************
106 
107  if (fermact_num->size() != fermact_den->size())
108  {
109  QDPIO::cerr << "Error: numerator action has to have the same length in the 5th dimension as the denominator action." << std::endl;
110  QDPIO::cerr << "N5 in FermionActionNum " << fermact_num->size() << std::endl;
111  QDPIO::cerr << "N5 in FermionActionDen " << fermact_den->size() << std::endl;
112  QDP_abort(1);
113  }
114 
115 
116  //*********************************************************************
117  // Get Chronological predictor
118  {
120  if( param.predictor.xml == "" ) {
121  // No predictor specified use zero guess
123  }
124  else
125  {
126  try
127  {
128  std::istringstream chrono_is(param.predictor.xml);
129  XMLReader chrono_xml(chrono_is);
131  fermact_num->size(),
132  chrono_xml,
133  param.predictor.path);
134  }
135  catch(const std::string& e ) {
136  QDPIO::cerr << "Caught Exception Reading XML: " << e << std::endl;
137  QDP_abort(1);
138  }
139  }
140 
141  if( tmp == 0x0 ) {
142  QDPIO::cerr << "Failed to create the 4D ChronoPredictor" << std::endl;
143  QDP_abort(1);
144  }
146  }
147  //*********************************************************************
148 
149  QDPIO::cout << "Initing PF field" << std::endl;
150  getPhi().resize( fermact_num->size() );
151 
152  QDPIO::cout << "Finished constructing: " << __func__ << std::endl;
153 
154  END_CODE();
155  }
156 
157 } //end namespace Chroma
158 
159 
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 in extra dims with derivatives.
Definition: fermact.orig.h:571
Wilson-like fermion actions.
Definition: fermact.orig.h:403
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_MONOMIAL5D")
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.