From 4240ad5ca8a37aba9acaf0c9e3a19b14a04ad8e0 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 19 May 2023 21:21:55 -0400 Subject: [PATCH] Preparing for FTHMC --- Grid/qcd/smearing/GaugeConfiguration.h | 48 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/Grid/qcd/smearing/GaugeConfiguration.h b/Grid/qcd/smearing/GaugeConfiguration.h index 0ff7fc25..df4ec1be 100644 --- a/Grid/qcd/smearing/GaugeConfiguration.h +++ b/Grid/qcd/smearing/GaugeConfiguration.h @@ -7,26 +7,40 @@ NAMESPACE_BEGIN(Grid); -//trivial class for no smearing template< class Impl > -class NoSmearing +class ConfigurationBase { public: INHERIT_FIELD_TYPES(Impl); - Field* ThinField; + ConfigurationBase() {} + virtual ~ConfigurationBase() {} + virtual void set_Field(Field& U) =0; + virtual void smeared_force(Field&) const = 0; + virtual Field& get_SmearedU() =0; + virtual Field &get_U(bool smeared = false) = 0; +}; - NoSmearing(): ThinField(NULL) {} +//trivial class for no smearing +template< class Impl > +class NoSmearing : public ConfigurationBase +{ +public: + INHERIT_FIELD_TYPES(Impl); - void set_Field(Field& U) { ThinField = &U; } + Field* ThinLinks; + + NoSmearing(): ThinLinks(NULL) {} + + void set_Field(Field& U) { ThinLinks = &U; } void smeared_force(Field&) const {} - Field& get_SmearedU() { return *ThinField; } + Field& get_SmearedU() { return *ThinLinks; } Field &get_U(bool smeared = false) { - return *ThinField; + return *ThinLinks; } }; @@ -42,7 +56,7 @@ public: It stores a list of smeared configurations. */ template -class SmearedConfiguration +class SmearedConfiguration : public ConfigurationBase { public: INHERIT_GIMPL_TYPES(Gimpl); @@ -51,10 +65,15 @@ private: const unsigned int smearingLevels; Smear_Stout *StoutSmearing; std::vector SmearedSet; - +public: + GaugeField* ThinLinks; /* Pointer to the thin links configuration */ // move to base??? +private: + // Member functions //==================================================================== - void fill_smearedSet(GaugeField &U) + + // Overridden in masked version + virtual void fill_smearedSet(GaugeField &U) { ThinLinks = &U; // attach the smearing routine to the field U @@ -82,9 +101,10 @@ private: } } } - //==================================================================== - GaugeField AnalyticSmearedForce(const GaugeField& SigmaKPrime, - const GaugeField& GaugeK) const + + //overridden in masked verson + virtual GaugeField AnalyticSmearedForce(const GaugeField& SigmaKPrime, + const GaugeField& GaugeK) const { GridBase* grid = GaugeK.Grid(); GaugeField C(grid), SigmaK(grid), iLambda(grid); @@ -213,8 +233,6 @@ private: //==================================================================== public: - GaugeField* - ThinLinks; /* Pointer to the thin links configuration */ /* Standard constructor */ SmearedConfiguration(GridCartesian* UGrid, unsigned int Nsmear,