1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-12 20:27:06 +01:00

HMC factories

This commit is contained in:
Guido Cossu
2017-01-17 10:46:49 +00:00
parent 87e8aad5a0
commit 0157274762
5 changed files with 26 additions and 19 deletions

View File

@ -35,10 +35,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
namespace Grid {
namespace QCD {
class HMCBase{
public:
virtual void Run() = 0;
};
template <class Implementation,
template <typename, typename, typename> class Integrator,
class RepresentationsPolicy = NoHirep>
class HMCWrapperTemplate {
class HMCWrapperTemplate: public HMCBase {
public:
INHERIT_FIELD_TYPES(Implementation);
typedef Implementation ImplPolicy; // visible from outside
@ -134,6 +141,7 @@ class HMCWrapperTemplate {
Resources.AddRNGs();
Field U(UGrid);
// Can move this outside?
typedef IntegratorType<SmearingPolicy> TheIntegrator;
TheIntegrator MDynamics(UGrid, MDparameters, TheAction, Smearing);

View File

@ -44,11 +44,13 @@ directory
namespace Grid {
namespace QCD {
struct HMCparameters {
Integer StartTrajectory;
Integer Trajectories; /* @brief Number of sweeps in this run */
bool MetropolisTest;
Integer NoMetropolisUntil;
struct HMCparameters: Serializable {
GRID_SERIALIZABLE_CLASS_MEMBERS(HMCparameters,
Integer, StartTrajectory,
Integer, Trajectories, /* @brief Number of sweeps in this run */
bool, MetropolisTest,
Integer, NoMetropolisUntil,
)
// nest here the MDparameters and make all serializable

View File

@ -103,7 +103,7 @@ class BinaryCPModule: public CheckPointerModule< ImplementationPolicy> {
// acquire resource
virtual void initialize(){
this->CheckPointPtr.reset(new BinaryHmcCheckpointer<ImplementationPolicy>(this->Par_));
this->CheckPointPtr.reset(new BinaryHmcCheckpointer<ImplementationPolicy>(this->Par_));
}
};
@ -112,7 +112,7 @@ class BinaryCPModule: public CheckPointerModule< ImplementationPolicy> {
template<class ImplementationPolicy>
class NerscCPModule: public CheckPointerModule< ImplementationPolicy> {
typedef CheckPointerModule< ImplementationPolicy> CPBase;
using CPBase::CPBase; // for constructors
using CPBase::CPBase; // for constructors inheritance
// acquire resource
virtual void initialize(){
@ -140,6 +140,8 @@ class ILDGCPModule: public CheckPointerModule< ImplementationPolicy> {
extern char cp_string[];
// use macros?
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::ILDGCPModule<QCD::PeriodicGimplR> , HMC_CPModuleFactory<cp_string, QCD::PeriodicGimplR, XmlReader> > __CPILDGmodXMLInit("ILDG");