#ifndef Hadrons_MIO_LoadPerambulator_hpp_ #define Hadrons_MIO_LoadPerambulator_hpp_ #include #include #include #include #include BEGIN_HADRONS_NAMESPACE /****************************************************************************** * LoadPerambulator * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MIO) class LoadPerambulatorPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(LoadPerambulatorPar, std::string, PerambFileName, //stem!!! int, nvec, MDistil::DistilParameters, Distil); }; template class TLoadPerambulator: public Module { public: // constructor TLoadPerambulator(const std::string name); // destructor virtual ~TLoadPerambulator(void) {}; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup virtual void setup(void); // execution virtual void execute(void); }; MODULE_REGISTER_TMP(LoadPerambulator, TLoadPerambulator, MIO); /****************************************************************************** * TLoadPerambulator implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TLoadPerambulator::TLoadPerambulator(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template std::vector TLoadPerambulator::getInput(void) { std::vector in; return in; } template std::vector TLoadPerambulator::getOutput(void) { std::vector out = {getName()}; return out; } // setup /////////////////////////////////////////////////////////////////////// template void TLoadPerambulator::setup(void) { const int nvec{par().nvec}; const MDistil::DistilParameters & Distil{par().Distil}; const int LI{Distil.LI}; const int nnoise{Distil.nnoise}; const int Nt_inv{Distil.Nt_inv}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI; const int Ns{Distil.Ns}; std::array sIndexNames{"Nt", "nvec", "LI", "nnoise", "Nt_inv", "SI"}; envCreate(MDistil::Perambulator, getName(), 1, sIndexNames,Distil.Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI); } // execution /////////////////////////////////////////////////////////////////// template void TLoadPerambulator::execute(void) { auto &perambulator = envGet(MDistil::Perambulator, getName()); const std::string &PerambFileName{par().PerambFileName + "." + std::to_string(vm().getTrajectory())}; std::cout << "reading perambulator from file " << PerambFileName << std::endl; perambulator.ReadBinary(PerambFileName); } END_MODULE_NAMESPACE END_HADRONS_NAMESPACE #endif // Hadrons_MIO_LoadPerambulator_hpp_