1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Trying to work out why LapEvec constructor not being called

This commit is contained in:
Michael Marshall 2019-01-23 15:19:51 +00:00
parent 2062a8d578
commit 7c5a06f6d0
3 changed files with 54 additions and 11 deletions

View File

@ -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<int>(gridHD->_ndimension)};
std::vector<int> latt_size = gridHD->_fdimensions;
latt_size[nd-1] = 1;
std::vector<int> simd_layout = GridDefaultSimd(nd-1, vComplex::Nsimd());
simd_layout.push_back( 1 );
std::vector<int> mpi_layout = gridHD->_processors;
mpi_layout[nd-1] = 1;
return new GridCartesian(latt_size,simd_layout,mpi_layout,*gridHD);
}
/******************************************************************************
Perambulator object
******************************************************************************/

View File

@ -123,9 +123,10 @@ class TLapEvec: public Module<LapEvecPar>
{
public:
// constructor
TLapEvec();
TLapEvec(const std::string name);
// destructor
virtual ~TLapEvec(void) {};
virtual ~TLapEvec(void);
// dependency relation
virtual std::vector<std::string> getInput(void);
virtual std::vector<std::string> 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<FIMPL>, MDistil);
@ -142,9 +145,25 @@ MODULE_REGISTER_TMP(LapEvec, TLapEvec<FIMPL>, MDistil);
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
template <typename FImpl>
TLapEvec<FImpl>::TLapEvec(const std::string name)
: Module<LapEvecPar>(name)
{}
TLapEvec<FImpl>::TLapEvec(const std::string name) : Module<LapEvecPar>(name)
{
// NB: This constructor isn't used!!!
LOG(Message) << "TLapEvec constructor : TLapEvec<FImpl>::TLapEvec(const std::string name)" << std::endl;
LOG(Message) << "TLapEvec constructor : Setting gridLD=nullptr" << std::endl;
gridLD = nullptr;
}
// destructor /////////////////////////////////////////////////////////////////
template <typename FImpl>
TLapEvec<FImpl>::~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 <typename FImpl>
@ -169,6 +188,12 @@ void TLapEvec<FImpl>::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;
}

View File

@ -236,10 +236,10 @@ void test_LapEvec(Application &application)
// gauge field
application.createModule<MGauge::Unit>("gauge");
// Now make an instance of the LapEvec object
MDistil::LapEvecPar levPar;
levPar.Stout.steps = 173;
levPar.Stout.parm = -9.87654321;
application.createModule<MDistil::LapEvec>("LapEvec",levPar);
MDistil::LapEvecPar par;
par.Stout.steps = 173;
par.Stout.parm = -9.87654321;
application.createModule<MDistil::LapEvec>("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