eoprec_constdet_two_flavor_ratio_conv_rat_monomial5d_w.cc

Go to the documentation of this file.
00001 // $Id: eoprec_constdet_two_flavor_ratio_conv_rat_monomial5d_w.cc,v 3.1 2008/05/23 21:31:33 edwards Exp $
00002 /*! @file
00003  * @brief Two-flavor collection of even-odd preconditioned 4D ferm monomials
00004  */
00005 
00006 #include "chromabase.h"
00007 #include "update/molecdyn/monomial/eoprec_constdet_two_flavor_ratio_conv_rat_monomial5d_w.h"
00008 #include "update/molecdyn/monomial/monomial_factory.h"
00009 
00010 #include "update/molecdyn/monomial/rat_approx_factory.h"
00011 #include "update/molecdyn/monomial/rat_approx_aggregate.h"
00012 
00013 #include "actions/ferm/fermacts/fermacts_aggregate_w.h"
00014 #include "actions/ferm/fermacts/fermact_factory_w.h"
00015 
00016 #include "update/molecdyn/predictor/chrono_predictor.h"
00017 #include "update/molecdyn/predictor/chrono_predictor_factory.h"
00018 
00019 #include "update/molecdyn/predictor/zero_guess_predictor.h"
00020 
00021 
00022 namespace Chroma 
00023 { 
00024  
00025   namespace EvenOddPrecConstDetTwoFlavorRatioConvRatWilsonTypeFermMonomial5DEnv 
00026   {
00027     namespace
00028     {
00029       //! Callback function for the factory
00030       Monomial< multi1d<LatticeColorMatrix>,
00031                 multi1d<LatticeColorMatrix> >* createMonomial(XMLReader& xml, const string& path) 
00032       {
00033         return new EvenOddPrecConstDetTwoFlavorRatioConvRatWilsonTypeFermMonomial5D(
00034           TwoFlavorRatioConvRatWilsonTypeFermMonomialParams(xml, path));
00035       }
00036     
00037       //! Local registration flag
00038       bool registered = false;
00039     }
00040 
00041     const std::string name("TWO_FLAVOR_EOPREC_CONSTDET_RATIO_CONV_RAT_FERM_MONOMIAL5D");
00042 
00043     //! Register all the factories
00044     bool registerAll() 
00045     {
00046       bool success = true; 
00047       if (! registered)
00048       {
00049         success &= WilsonTypeFermActs5DEnv::registerAll();
00050         success &= TheMonomialFactory::Instance().registerObject(name, createMonomial);
00051         registered = true;
00052       }
00053       return success;
00054     }
00055   } //end namespace EvenOddPrec TwoFlavorWilsonFermMonomialEnv
00056 
00057 
00058   // Constructor
00059   EvenOddPrecConstDetTwoFlavorRatioConvRatWilsonTypeFermMonomial5D::EvenOddPrecConstDetTwoFlavorRatioConvRatWilsonTypeFermMonomial5D(
00060     const TwoFlavorRatioConvRatWilsonTypeFermMonomialParams& param) 
00061   {
00062     START_CODE();
00063 
00064     QDPIO::cout << "Constructor: " << __func__ << endl;
00065 
00066     invParam_num       = param.numer.invParam;
00067     actionInvParam_den = param.denom.action.invParam;
00068     forceInvParam_den  = param.denom.force.invParam;
00069 
00070     //*********************************************************************
00071     // Fermion action
00072     {
00073       std::istringstream is(param.numer.fermact.xml);
00074       XMLReader fermact_reader(is);
00075       QDPIO::cout << "Construct fermion action= " << param.numer.fermact.id << endl;
00076 
00077       WilsonTypeFermAct5D<T,P,Q>* tmp_act = 
00078         TheWilsonTypeFermAct5DFactory::Instance().createObject(param.numer.fermact.id, 
00079                                                              fermact_reader, 
00080                                                              param.numer.fermact.path);
00081 
00082       EvenOddPrecConstDetWilsonTypeFermAct5D<T,P,Q>* downcast=dynamic_cast<EvenOddPrecConstDetWilsonTypeFermAct5D<T,P,Q>*>(tmp_act);
00083 
00084       // Check success of the downcast 
00085       if( downcast == 0x0 ) 
00086       {
00087         QDPIO::cerr << __func__ << ": unable to downcast FermAct5D to EvenOddPrecConstDetWilsonTypeFermAct5D" << endl;
00088         QDP_abort(1);
00089       }
00090 
00091       fermact_num = downcast;    
00092     }
00093     //*********************************************************************
00094 
00095     //*********************************************************************
00096     // Fermion action
00097     {
00098       std::istringstream is(param.denom.fermact.xml);
00099       XMLReader fermact_reader(is);
00100       QDPIO::cout << "Construct fermion action= " << param.denom.fermact.id << endl;
00101 
00102       WilsonTypeFermAct5D<T,P,Q>* tmp_act = 
00103         TheWilsonTypeFermAct5DFactory::Instance().createObject(param.denom.fermact.id, 
00104                                                                fermact_reader, 
00105                                                                param.denom.fermact.path);
00106       
00107       EvenOddPrecConstDetWilsonTypeFermAct5D<T,P,Q>* downcast=dynamic_cast<EvenOddPrecConstDetWilsonTypeFermAct5D<T,P,Q>*>(tmp_act);
00108 
00109       // Check success of the downcast 
00110       if( downcast == 0x0 ) 
00111       {
00112         QDPIO::cerr << __func__ << ": unable to downcast FermAct5D to EvenOddPrecConstDetWilsonTypeFermAct5D" << endl;
00113         QDP_abort(1);
00114       }
00115 
00116       fermact_den = downcast;    
00117     }
00118 
00119     //*********************************************************************
00120     // Action rational approx
00121     {
00122       std::istringstream is(param.denom.action.ratApprox.xml);
00123       XMLReader approx_reader(is);
00124       QDPIO::cout << "Construct action rational approx= " << param.denom.action.ratApprox.id << endl;
00125 
00126       Handle<RationalApprox> approx(TheRationalApproxFactory::Instance().createObject(
00127                                       param.denom.action.ratApprox.id, 
00128                                       approx_reader, 
00129                                       param.denom.action.ratApprox.path));
00130 
00131       (*approx)(spfe_den, sipfe_den);
00132     }
00133 
00134     //*********************************************************************
00135     // Force rational approx
00136     {
00137       std::istringstream is(param.denom.force.ratApprox.xml);
00138       XMLReader approx_reader(is);
00139       QDPIO::cout << "Construct force rational approx= " << param.denom.force.ratApprox.id << endl;
00140 
00141       Handle<RationalApprox> approx(TheRationalApproxFactory::Instance().createObject(
00142                                       param.denom.force.ratApprox.id, 
00143                                       approx_reader, 
00144                                       param.denom.force.ratApprox.path));
00145 
00146       RemezCoeff_t  fipfe_den;  // discard
00147       (*approx)(fpfe_den, fipfe_den);
00148     }
00149     //*********************************************************************
00150 
00151     //*********************************************************************
00152     // Get Chronological predictor
00153     {
00154       AbsChronologicalPredictor5D<LatticeFermion>* tmp = 0x0;
00155       if( param.predictor.xml == "" ) {
00156         // No predictor specified use zero guess
00157         tmp = new ZeroGuess5DChronoPredictor(fermact_num->size());
00158       }
00159       else 
00160       {
00161         try 
00162         {
00163           std::istringstream chrono_is(param.predictor.xml);
00164           XMLReader chrono_xml(chrono_is);
00165           tmp = The5DChronologicalPredictorFactory::Instance().createObject(param.predictor.id, 
00166                                                                             fermact_num->size(), 
00167                                                                             chrono_xml, 
00168                                                                             param.predictor.path);
00169 
00170         }
00171         catch(const std::string& e ) { 
00172           QDPIO::cerr << "Caught Exception Reading XML: " << e << endl;
00173           QDP_abort(1);
00174         }
00175       }
00176      
00177       if( tmp == 0x0 ) { 
00178         QDPIO::cerr << "Failed to create ZeroGuess5DChronoPredictor" << endl;
00179         QDP_abort(1);
00180       }
00181 
00182       chrono_predictor = tmp;
00183     }
00184     //*********************************************************************
00185 
00186     QDPIO::cout << "Finished constructing: " << __func__ << endl;
00187     
00188     END_CODE();
00189   }
00190 
00191 } //end namespace Chroma
00192 
00193 

Generated on Sun Mar 14 04:29:21 2010 for CHROMA by  doxygen 1.4.7