mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 13:15:55 +01:00
HMC factories
This commit is contained in:
parent
87e8aad5a0
commit
0157274762
@ -35,10 +35,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
namespace Grid {
|
namespace Grid {
|
||||||
namespace QCD {
|
namespace QCD {
|
||||||
|
|
||||||
|
class HMCBase{
|
||||||
|
public:
|
||||||
|
virtual void Run() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class Implementation,
|
template <class Implementation,
|
||||||
template <typename, typename, typename> class Integrator,
|
template <typename, typename, typename> class Integrator,
|
||||||
class RepresentationsPolicy = NoHirep>
|
class RepresentationsPolicy = NoHirep>
|
||||||
class HMCWrapperTemplate {
|
class HMCWrapperTemplate: public HMCBase {
|
||||||
public:
|
public:
|
||||||
INHERIT_FIELD_TYPES(Implementation);
|
INHERIT_FIELD_TYPES(Implementation);
|
||||||
typedef Implementation ImplPolicy; // visible from outside
|
typedef Implementation ImplPolicy; // visible from outside
|
||||||
@ -134,6 +141,7 @@ class HMCWrapperTemplate {
|
|||||||
Resources.AddRNGs();
|
Resources.AddRNGs();
|
||||||
Field U(UGrid);
|
Field U(UGrid);
|
||||||
|
|
||||||
|
// Can move this outside?
|
||||||
typedef IntegratorType<SmearingPolicy> TheIntegrator;
|
typedef IntegratorType<SmearingPolicy> TheIntegrator;
|
||||||
TheIntegrator MDynamics(UGrid, MDparameters, TheAction, Smearing);
|
TheIntegrator MDynamics(UGrid, MDparameters, TheAction, Smearing);
|
||||||
|
|
||||||
|
@ -44,11 +44,13 @@ directory
|
|||||||
namespace Grid {
|
namespace Grid {
|
||||||
namespace QCD {
|
namespace QCD {
|
||||||
|
|
||||||
struct HMCparameters {
|
struct HMCparameters: Serializable {
|
||||||
Integer StartTrajectory;
|
GRID_SERIALIZABLE_CLASS_MEMBERS(HMCparameters,
|
||||||
Integer Trajectories; /* @brief Number of sweeps in this run */
|
Integer, StartTrajectory,
|
||||||
bool MetropolisTest;
|
Integer, Trajectories, /* @brief Number of sweeps in this run */
|
||||||
Integer NoMetropolisUntil;
|
bool, MetropolisTest,
|
||||||
|
Integer, NoMetropolisUntil,
|
||||||
|
)
|
||||||
|
|
||||||
// nest here the MDparameters and make all serializable
|
// nest here the MDparameters and make all serializable
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class BinaryCPModule: public CheckPointerModule< ImplementationPolicy> {
|
|||||||
template<class ImplementationPolicy>
|
template<class ImplementationPolicy>
|
||||||
class NerscCPModule: public CheckPointerModule< ImplementationPolicy> {
|
class NerscCPModule: public CheckPointerModule< ImplementationPolicy> {
|
||||||
typedef CheckPointerModule< ImplementationPolicy> CPBase;
|
typedef CheckPointerModule< ImplementationPolicy> CPBase;
|
||||||
using CPBase::CPBase; // for constructors
|
using CPBase::CPBase; // for constructors inheritance
|
||||||
|
|
||||||
// acquire resource
|
// acquire resource
|
||||||
virtual void initialize(){
|
virtual void initialize(){
|
||||||
@ -140,6 +140,8 @@ class ILDGCPModule: public CheckPointerModule< ImplementationPolicy> {
|
|||||||
|
|
||||||
extern char cp_string[];
|
extern char cp_string[];
|
||||||
|
|
||||||
|
|
||||||
|
// use macros?
|
||||||
static Registrar<QCD::BinaryCPModule<QCD::PeriodicGimplR>, HMC_CPModuleFactory<cp_string, QCD::PeriodicGimplR, XmlReader> > __CPBinarymodXMLInit("Binary");
|
static Registrar<QCD::BinaryCPModule<QCD::PeriodicGimplR>, HMC_CPModuleFactory<cp_string, QCD::PeriodicGimplR, XmlReader> > __CPBinarymodXMLInit("Binary");
|
||||||
static Registrar<QCD::NerscCPModule<QCD::PeriodicGimplR> , HMC_CPModuleFactory<cp_string, QCD::PeriodicGimplR, XmlReader> > __CPNerscmodXMLInit("Nersc");
|
static Registrar<QCD::NerscCPModule<QCD::PeriodicGimplR> , HMC_CPModuleFactory<cp_string, QCD::PeriodicGimplR, XmlReader> > __CPNerscmodXMLInit("Nersc");
|
||||||
static Registrar<QCD::ILDGCPModule<QCD::PeriodicGimplR> , HMC_CPModuleFactory<cp_string, QCD::PeriodicGimplR, XmlReader> > __CPILDGmodXMLInit("ILDG");
|
static Registrar<QCD::ILDGCPModule<QCD::PeriodicGimplR> , HMC_CPModuleFactory<cp_string, QCD::PeriodicGimplR, XmlReader> > __CPILDGmodXMLInit("ILDG");
|
||||||
|
@ -173,7 +173,7 @@ typedef WilsonGModule<PeriodicGimplR> WilsonGMod;
|
|||||||
// Factory is perfectly fine
|
// Factory is perfectly fine
|
||||||
// Registar must be changed because I do not want to use the ModuleFactory
|
// Registar must be changed because I do not want to use the ModuleFactory
|
||||||
|
|
||||||
// ref to LatticeGaugeField must be changed
|
// explicit ref to LatticeGaugeField must be changed
|
||||||
typedef HMCModuleBase< QCD::Action< QCD::LatticeGaugeField > > HMC_LGTActionModBase;
|
typedef HMCModuleBase< QCD::Action< QCD::LatticeGaugeField > > HMC_LGTActionModBase;
|
||||||
|
|
||||||
template <char const *str, class ReaderClass >
|
template <char const *str, class ReaderClass >
|
||||||
@ -196,17 +196,10 @@ class HMC_LGTActionModuleFactory
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
then rewrite the registar
|
|
||||||
|
|
||||||
when this is done we have all the modules that contain the pointer to the objects
|
|
||||||
(actions, integrators, checkpointers, solvers)
|
|
||||||
|
|
||||||
factory will create only the modules and prepare the parameters
|
|
||||||
when needed a pointer is released
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -226,6 +219,8 @@ class Registrar {
|
|||||||
|
|
||||||
extern char gauge_string[];
|
extern char gauge_string[];
|
||||||
static Registrar<QCD::WilsonGMod, HMC_LGTActionModuleFactory<gauge_string, XmlReader> > __WGmodXMLInit("Wilson");
|
static Registrar<QCD::WilsonGMod, HMC_LGTActionModuleFactory<gauge_string, XmlReader> > __WGmodXMLInit("Wilson");
|
||||||
|
// add here the registration for other implementations and readers
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user