diff --git a/Hadrons/Modules/MDistil/Distil.hpp b/Hadrons/Modules/MDistil/Distil.hpp index 3e86651c..38672dfb 100644 --- a/Hadrons/Modules/MDistil/Distil.hpp +++ b/Hadrons/Modules/MDistil/Distil.hpp @@ -100,6 +100,24 @@ BEGIN_HADRONS_NAMESPACE BEGIN_MODULE_NAMESPACE(MDistil) +/****************************************************************************** + Make a lower dimensional grid + ******************************************************************************/ + +inline GridCartesian * MakeLowerDimGrid( GridCartesian * gridHD ) +{ + int nd{static_cast(gridHD->_ndimension)}; + std::vector latt_size = gridHD->_fdimensions; + latt_size[nd-1] = 1; + + std::vector simd_layout = GridDefaultSimd(nd-1, vComplex::Nsimd()); + simd_layout.push_back( 1 ); + + std::vector mpi_layout = gridHD->_processors; + mpi_layout[nd-1] = 1; + return new GridCartesian(latt_size,simd_layout,mpi_layout,*gridHD); +} + /****************************************************************************** Perambulator object ******************************************************************************/ diff --git a/Hadrons/Modules/MDistil/LapEvec.hpp b/Hadrons/Modules/MDistil/LapEvec.hpp index aac71ea3..62062f03 100644 --- a/Hadrons/Modules/MDistil/LapEvec.hpp +++ b/Hadrons/Modules/MDistil/LapEvec.hpp @@ -123,9 +123,10 @@ class TLapEvec: public Module { public: // constructor + TLapEvec(); TLapEvec(const std::string name); // destructor - virtual ~TLapEvec(void) {}; + virtual ~TLapEvec(void); // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); @@ -133,6 +134,8 @@ public: virtual void setup(void); // execution virtual void execute(void); +public: + GridCartesian * gridLD = nullptr; }; MODULE_REGISTER_TMP(LapEvec, TLapEvec, MDistil); @@ -142,9 +145,25 @@ MODULE_REGISTER_TMP(LapEvec, TLapEvec, MDistil); ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template -TLapEvec::TLapEvec(const std::string name) -: Module(name) -{} +TLapEvec::TLapEvec(const std::string name) : Module(name) +{ + // NB: This constructor isn't used!!! + LOG(Message) << "TLapEvec constructor : TLapEvec::TLapEvec(const std::string name)" << std::endl; + LOG(Message) << "TLapEvec constructor : Setting gridLD=nullptr" << std::endl; + gridLD = nullptr; +} + +// destructor ///////////////////////////////////////////////////////////////// +template +TLapEvec::~TLapEvec() +{ + if( gridLD != nullptr ) { + LOG(Message) << "Destroying lower dimensional grid" << std::endl; + delete gridLD; + } + else + LOG(Message) << "Lower dimensional grid was never created" << std::endl; +} // dependencies/products /////////////////////////////////////////////////////// template @@ -169,6 +188,12 @@ void TLapEvec::setup(void) { LOG(Message) << "setup() : start" << std::endl; LOG(Message) << "Stout.steps=" << par().Stout.steps << ", Stout.parm=" << par().Stout.parm << std::endl; + if( gridLD ) { + LOG(Message) << "Didn't expect to need to destroy gridLD here!" << std::endl; + delete gridLD; + } + LOG(Message) << "Creating lower dimensional grid" << std::endl; + gridLD = MakeLowerDimGrid( env().getGrid() ); LOG(Message) << "setup() : end" << std::endl; } diff --git a/tests/hadrons/Test_hadrons_distil.cc b/tests/hadrons/Test_hadrons_distil.cc index a2d13c63..93796f94 100644 --- a/tests/hadrons/Test_hadrons_distil.cc +++ b/tests/hadrons/Test_hadrons_distil.cc @@ -236,10 +236,10 @@ void test_LapEvec(Application &application) // gauge field application.createModule("gauge"); // Now make an instance of the LapEvec object - MDistil::LapEvecPar levPar; - levPar.Stout.steps = 173; - levPar.Stout.parm = -9.87654321; - application.createModule("LapEvec",levPar); + MDistil::LapEvecPar par; + par.Stout.steps = 173; + par.Stout.parm = -9.87654321; + application.createModule("LapEvec",par); } ///////////////////////////////////////////////////////////// @@ -252,9 +252,9 @@ void test_Perambulators(Application &application) // global parameters Application::GlobalPar globalPar; - globalPar.trajCounter.start = 1500; - globalPar.trajCounter.end = 1520; - globalPar.trajCounter.step = 20; + globalPar.trajCounter.start = 3000; + globalPar.trajCounter.end = 3040; + globalPar.trajCounter.step = 40; globalPar.runId = "test"; application.setPar(globalPar); // gauge field