1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 04:37:05 +01:00

Hadrons: big update after templating of get/createGrid

This commit is contained in:
2018-09-21 18:15:18 +01:00
parent 4af6c7e7aa
commit c012899ed5
31 changed files with 203 additions and 172 deletions

View File

@ -31,44 +31,4 @@ using namespace Grid;
using namespace Hadrons;
using namespace MIO;
/******************************************************************************
* TLoadNersc implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
TLoadNersc::TLoadNersc(const std::string name)
: Module<LoadNerscPar>(name)
{}
// dependencies/products ///////////////////////////////////////////////////////
std::vector<std::string> TLoadNersc::getInput(void)
{
std::vector<std::string> in;
return in;
}
std::vector<std::string> TLoadNersc::getOutput(void)
{
std::vector<std::string> out = {getName()};
return out;
}
// setup ///////////////////////////////////////////////////////////////////////
void TLoadNersc::setup(void)
{
envCreateLat(LatticeGaugeField, getName());
}
// execution ///////////////////////////////////////////////////////////////////
void TLoadNersc::execute(void)
{
FieldMetaData header;
std::string fileName = par().file + "."
+ std::to_string(vm().getTrajectory());
LOG(Message) << "Loading NERSC configuration from file '" << fileName
<< "'" << std::endl;
auto &U = envGet(LatticeGaugeField, getName());
NerscIO::readConfiguration(U, header, fileName);
}
template class Grid::Hadrons::MIO::TLoadNersc<GIMPL>;

View File

@ -46,8 +46,11 @@ public:
std::string, file);
};
template <typename GImpl>
class TLoadNersc: public Module<LoadNerscPar>
{
public:
GAUGE_TYPE_ALIASES(GImpl,);
public:
// constructor
TLoadNersc(const std::string name);
@ -62,7 +65,54 @@ public:
virtual void execute(void);
};
MODULE_REGISTER(LoadNersc, TLoadNersc, MIO);
MODULE_REGISTER_TMP(LoadNersc, TLoadNersc<GIMPL>, MIO);
/******************************************************************************
* TLoadNersc implementation *
******************************************************************************/
// constructor /////////////////////////////////////////////////////////////////
template <typename GImpl>
TLoadNersc<GImpl>::TLoadNersc(const std::string name)
: Module<LoadNerscPar>(name)
{}
// dependencies/products ///////////////////////////////////////////////////////
template <typename GImpl>
std::vector<std::string> TLoadNersc<GImpl>::getInput(void)
{
std::vector<std::string> in;
return in;
}
template <typename GImpl>
std::vector<std::string> TLoadNersc<GImpl>::getOutput(void)
{
std::vector<std::string> out = {getName()};
return out;
}
// setup ///////////////////////////////////////////////////////////////////////
template <typename GImpl>
void TLoadNersc<GImpl>::setup(void)
{
envCreateLat(GaugeField, getName());
}
// execution ///////////////////////////////////////////////////////////////////
template <typename GImpl>
void TLoadNersc<GImpl>::execute(void)
{
FieldMetaData header;
std::string fileName = par().file + "."
+ std::to_string(vm().getTrajectory());
LOG(Message) << "Loading NERSC configuration from file '" << fileName
<< "'" << std::endl;
auto &U = envGet(GaugeField, getName());
NerscIO::readConfiguration(U, header, fileName);
}
END_MODULE_NAMESPACE