2019-04-26 07:39:05 +01:00
|
|
|
/*************************************************************************************
|
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: Hadrons/Modules/MDistil/LoadPerambulator.hpp
|
|
|
|
|
|
|
|
Copyright (C) 2019
|
|
|
|
|
|
|
|
Author: Felix Erben <ferben@ed.ac.uk>
|
|
|
|
Author: Michael Marshall <Michael.Marshall@ed.ac.uk>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
See the full license in the file "LICENSE" in the top level distribution directory
|
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
|
|
|
|
2019-03-22 13:50:47 +00:00
|
|
|
#ifndef Hadrons_MIO_LoadPerambulator_hpp_
|
|
|
|
#define Hadrons_MIO_LoadPerambulator_hpp_
|
|
|
|
|
|
|
|
#include <Hadrons/Global.hpp>
|
|
|
|
#include <Hadrons/Module.hpp>
|
|
|
|
#include <Hadrons/ModuleFactory.hpp>
|
|
|
|
#include <Hadrons/EigenPack.hpp>
|
2019-04-26 07:39:05 +01:00
|
|
|
#include <Hadrons/Distil.hpp>
|
2019-03-22 13:50:47 +00:00
|
|
|
|
|
|
|
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 <typename FImpl>
|
|
|
|
class TLoadPerambulator: public Module<LoadPerambulatorPar>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
TLoadPerambulator(const std::string name);
|
|
|
|
// destructor
|
|
|
|
virtual ~TLoadPerambulator(void) {};
|
|
|
|
// dependency relation
|
|
|
|
virtual std::vector<std::string> getInput(void);
|
|
|
|
virtual std::vector<std::string> getOutput(void);
|
|
|
|
// setup
|
|
|
|
virtual void setup(void);
|
|
|
|
// execution
|
|
|
|
virtual void execute(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_REGISTER_TMP(LoadPerambulator, TLoadPerambulator<FIMPL>, MIO);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* TLoadPerambulator implementation *
|
|
|
|
******************************************************************************/
|
|
|
|
// constructor /////////////////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
TLoadPerambulator<FImpl>::TLoadPerambulator(const std::string name)
|
|
|
|
: Module<LoadPerambulatorPar>(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
// dependencies/products ///////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
std::vector<std::string> TLoadPerambulator<FImpl>::getInput(void)
|
|
|
|
{
|
|
|
|
std::vector<std::string> in;
|
|
|
|
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename FImpl>
|
|
|
|
std::vector<std::string> TLoadPerambulator<FImpl>::getOutput(void)
|
|
|
|
{
|
|
|
|
std::vector<std::string> out = {getName()};
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// setup ///////////////////////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
void TLoadPerambulator<FImpl>::setup(void)
|
|
|
|
{
|
2019-04-30 23:53:57 +01:00
|
|
|
DISTIL_PARAMETERS_DEFINE( true );
|
|
|
|
//std::array<std::string,6> sIndexNames{"Nt", "nvec", "LI", "nnoise", "Nt_inv", "SI"};
|
|
|
|
envCreate(MDistil::Perambulator, getName(), 1, MDistil::PerambIndexNames,Nt,nvec,LI,nnoise,Nt_inv,SI);
|
2019-03-22 13:50:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// execution ///////////////////////////////////////////////////////////////////
|
|
|
|
template <typename FImpl>
|
|
|
|
void TLoadPerambulator<FImpl>::execute(void)
|
|
|
|
{
|
2019-04-30 23:53:57 +01:00
|
|
|
auto &perambulator = envGet(MDistil::Perambulator, getName());
|
2019-04-28 17:53:42 +01:00
|
|
|
const std::string sPerambName{par().PerambFileName + "." + std::to_string(vm().getTrajectory())};
|
2019-04-28 20:23:44 +01:00
|
|
|
perambulator.read(sPerambName.c_str());
|
2019-03-22 13:50:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
END_MODULE_NAMESPACE
|
|
|
|
|
|
|
|
END_HADRONS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // Hadrons_MIO_LoadPerambulator_hpp_
|