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:
@ -56,7 +56,7 @@ template <typename FImpl>
|
||||
class TDWF: public Module<DWFPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TDWF(const std::string name);
|
||||
|
@ -56,7 +56,7 @@ template <typename FImpl>
|
||||
class TMobiusDWF: public Module<MobiusDWFPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TMobiusDWF(const std::string name);
|
||||
|
@ -55,7 +55,7 @@ template <typename FImpl>
|
||||
class TScaledDWF: public Module<ScaledDWFPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TScaledDWF(const std::string name);
|
||||
|
@ -54,7 +54,7 @@ template <typename FImpl>
|
||||
class TWilson: public Module<WilsonPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TWilson(const std::string name);
|
||||
|
@ -59,7 +59,7 @@ template <typename FImpl>
|
||||
class TWilsonClover: public Module<WilsonCloverPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TWilsonClover(const std::string name);
|
||||
|
@ -57,7 +57,7 @@ template <typename FImpl>
|
||||
class TZMobiusDWF: public Module<ZMobiusDWFPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TZMobiusDWF(const std::string name);
|
||||
|
@ -77,7 +77,7 @@ class TMeson: public Module<MesonPar>
|
||||
public:
|
||||
FERM_TYPE_ALIASES(FImpl1, 1);
|
||||
FERM_TYPE_ALIASES(FImpl2, 2);
|
||||
FERM_TYPE_ALIASES(ScalarImplCR, Scalar);
|
||||
BASIC_TYPE_ALIASES(ScalarImplCR, Scalar);
|
||||
SINK_TYPE_ALIASES(Scalar);
|
||||
class Result: Serializable
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ template <typename FImpl>
|
||||
class TFreeProp: public Module<FreePropPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TFreeProp(const std::string name);
|
||||
|
@ -56,7 +56,7 @@ template <typename FImpl>
|
||||
class TGaugeProp: public Module<GaugePropPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
SOLVER_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
|
@ -25,47 +25,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
See the full license in the file "LICENSE" in the top level distribution directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
|
||||
#include <Hadrons/Modules/MGauge/Random.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
using namespace MGauge;
|
||||
|
||||
/******************************************************************************
|
||||
* TRandom implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
TRandom::TRandom(const std::string name)
|
||||
: Module<NoPar>(name)
|
||||
{}
|
||||
|
||||
// dependencies/products ///////////////////////////////////////////////////////
|
||||
std::vector<std::string> TRandom::getInput(void)
|
||||
{
|
||||
std::vector<std::string> in;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
std::vector<std::string> TRandom::getOutput(void)
|
||||
{
|
||||
std::vector<std::string> out = {getName()};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
void TRandom::setup(void)
|
||||
{
|
||||
envCreateLat(LatticeGaugeField, getName());
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
void TRandom::execute(void)
|
||||
{
|
||||
LOG(Message) << "Generating random gauge configuration" << std::endl;
|
||||
|
||||
auto &U = envGet(LatticeGaugeField, getName());
|
||||
SU3::HotConfiguration(rng4d(), U);
|
||||
}
|
||||
template class Grid::Hadrons::MGauge::TRandom<GIMPL>;
|
||||
|
@ -40,8 +40,11 @@ BEGIN_HADRONS_NAMESPACE
|
||||
******************************************************************************/
|
||||
BEGIN_MODULE_NAMESPACE(MGauge)
|
||||
|
||||
template <typename GImpl>
|
||||
class TRandom: public Module<NoPar>
|
||||
{
|
||||
public:
|
||||
GAUGE_TYPE_ALIASES(GImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TRandom(const std::string name);
|
||||
@ -57,7 +60,50 @@ protected:
|
||||
virtual void execute(void);
|
||||
};
|
||||
|
||||
MODULE_REGISTER(Random, TRandom, MGauge);
|
||||
MODULE_REGISTER_TMP(Random, TRandom<GIMPL>, MGauge);
|
||||
|
||||
/******************************************************************************
|
||||
* TRandom implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
TRandom<GImpl>::TRandom(const std::string name)
|
||||
: Module<NoPar>(name)
|
||||
{}
|
||||
|
||||
// dependencies/products ///////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
std::vector<std::string> TRandom<GImpl>::getInput(void)
|
||||
{
|
||||
std::vector<std::string> in;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
template <typename GImpl>
|
||||
std::vector<std::string> TRandom<GImpl>::getOutput(void)
|
||||
{
|
||||
std::vector<std::string> out = {getName()};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
void TRandom<GImpl>::setup(void)
|
||||
{
|
||||
envCreateLat(GaugeField, getName());
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
void TRandom<GImpl>::execute(void)
|
||||
{
|
||||
LOG(Message) << "Generating random gauge configuration" << std::endl;
|
||||
|
||||
auto &U = envGet(GaugeField, getName());
|
||||
GImpl::HotConfiguration(rng4d(), U);
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
||||
|
@ -52,7 +52,7 @@ template <typename GImpl>
|
||||
class TStoutSmearing: public Module<StoutSmearingPar>
|
||||
{
|
||||
public:
|
||||
typedef typename GImpl::Field GaugeField;
|
||||
GAUGE_TYPE_ALIASES(GImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TStoutSmearing(const std::string name);
|
||||
|
@ -25,45 +25,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
See the full license in the file "LICENSE" in the top level distribution directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
|
||||
#include <Hadrons/Modules/MGauge/Unit.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
using namespace MGauge;
|
||||
|
||||
/******************************************************************************
|
||||
* TUnit implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
TUnit::TUnit(const std::string name)
|
||||
: Module<NoPar>(name)
|
||||
{}
|
||||
|
||||
// dependencies/products ///////////////////////////////////////////////////////
|
||||
std::vector<std::string> TUnit::getInput(void)
|
||||
{
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
std::vector<std::string> TUnit::getOutput(void)
|
||||
{
|
||||
std::vector<std::string> out = {getName()};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
void TUnit::setup(void)
|
||||
{
|
||||
envCreateLat(LatticeGaugeField, getName());
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
void TUnit::execute(void)
|
||||
{
|
||||
LOG(Message) << "Creating unit gauge configuration" << std::endl;
|
||||
|
||||
auto &U = envGet(LatticeGaugeField, getName());
|
||||
SU3::ColdConfiguration(rng4d(), U);
|
||||
}
|
||||
template class Grid::Hadrons::MGauge::TUnit<GIMPL>;
|
||||
|
@ -40,8 +40,11 @@ BEGIN_HADRONS_NAMESPACE
|
||||
******************************************************************************/
|
||||
BEGIN_MODULE_NAMESPACE(MGauge)
|
||||
|
||||
template <typename GImpl>
|
||||
class TUnit: public Module<NoPar>
|
||||
{
|
||||
public:
|
||||
GAUGE_TYPE_ALIASES(GImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TUnit(const std::string name);
|
||||
@ -57,7 +60,48 @@ protected:
|
||||
virtual void execute(void);
|
||||
};
|
||||
|
||||
MODULE_REGISTER(Unit, TUnit, MGauge);
|
||||
MODULE_REGISTER_TMP(Unit, TUnit<GIMPL>, MGauge);
|
||||
|
||||
/******************************************************************************
|
||||
* TUnit implementation *
|
||||
******************************************************************************/
|
||||
// constructor /////////////////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
TUnit<GImpl>::TUnit(const std::string name)
|
||||
: Module<NoPar>(name)
|
||||
{}
|
||||
|
||||
// dependencies/products ///////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
std::vector<std::string> TUnit<GImpl>::getInput(void)
|
||||
{
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
template <typename GImpl>
|
||||
std::vector<std::string> TUnit<GImpl>::getOutput(void)
|
||||
{
|
||||
std::vector<std::string> out = {getName()};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
// setup ///////////////////////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
void TUnit<GImpl>::setup(void)
|
||||
{
|
||||
envCreateLat(GaugeField, getName());
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
template <typename GImpl>
|
||||
void TUnit<GImpl>::execute(void)
|
||||
{
|
||||
LOG(Message) << "Creating unit gauge configuration" << std::endl;
|
||||
|
||||
auto &U = envGet(GaugeField, getName());
|
||||
GImpl::ColdConfiguration(rng4d(), U);
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
||||
|
@ -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>;
|
||||
|
@ -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
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
class TChargedProp: public Module<ChargedPropPar>
|
||||
{
|
||||
public:
|
||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
||||
BASIC_TYPE_ALIASES(SIMPL,);
|
||||
typedef PhotonR::GaugeField EmField;
|
||||
typedef PhotonR::GaugeLinkField EmComp;
|
||||
class Result: Serializable
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
class TFreeProp: public Module<FreePropPar>
|
||||
{
|
||||
public:
|
||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
||||
BASIC_TYPE_ALIASES(SIMPL,);
|
||||
public:
|
||||
// constructor
|
||||
TFreeProp(const std::string name);
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
class TScalarVP: public Module<ScalarVPPar>
|
||||
{
|
||||
public:
|
||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
||||
BASIC_TYPE_ALIASES(SIMPL,);
|
||||
typedef PhotonR::GaugeField EmField;
|
||||
typedef PhotonR::GaugeLinkField EmComp;
|
||||
class Result: Serializable
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
class TVPCounterTerms: public Module<VPCounterTermsPar>
|
||||
{
|
||||
public:
|
||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
||||
BASIC_TYPE_ALIASES(SIMPL,);
|
||||
class Result: Serializable
|
||||
{
|
||||
public:
|
||||
|
@ -53,7 +53,7 @@ template <typename FImpl>
|
||||
class TPoint: public Module<PointPar>
|
||||
{
|
||||
public:
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
BASIC_TYPE_ALIASES(FImpl,);
|
||||
SINK_TYPE_ALIASES();
|
||||
public:
|
||||
// constructor
|
||||
|
@ -58,8 +58,8 @@ template <typename FImplInner, typename FImplOuter, int nBasis>
|
||||
class TMixedPrecisionRBPrecCG: public Module<MixedPrecisionRBPrecCGPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImplInner, Inner);
|
||||
FG_TYPE_ALIASES(FImplOuter, Outer);
|
||||
FERM_TYPE_ALIASES(FImplInner, Inner);
|
||||
FERM_TYPE_ALIASES(FImplOuter, Outer);
|
||||
SOLVER_TYPE_ALIASES(FImplOuter,);
|
||||
typedef HADRONS_DEFAULT_SCHUR_OP<FMatInner, FermionFieldInner> SchurFMatInner;
|
||||
typedef HADRONS_DEFAULT_SCHUR_OP<FMatOuter, FermionFieldOuter> SchurFMatOuter;
|
||||
|
@ -58,7 +58,7 @@ template <typename FImpl, int nBasis>
|
||||
class TRBPrecCG: public Module<RBPrecCGPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
SOLVER_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
|
@ -63,7 +63,7 @@ template <typename FImpl>
|
||||
class TPoint: public Module<PointPar>
|
||||
{
|
||||
public:
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
BASIC_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TPoint(const std::string name);
|
||||
|
@ -71,7 +71,7 @@ template <typename FImpl>
|
||||
class TSeqGamma: public Module<SeqGammaPar>
|
||||
{
|
||||
public:
|
||||
FG_TYPE_ALIASES(FImpl,);
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TSeqGamma(const std::string name);
|
||||
@ -125,7 +125,7 @@ template <typename FImpl>
|
||||
void TSeqGamma<FImpl>::setup(void)
|
||||
{
|
||||
envCreateLat(PropagatorField, getName());
|
||||
envCacheLat(Lattice<iScalar<vInteger>>, tName_);
|
||||
envCache(Lattice<iScalar<vInteger>>, tName_, 1, env().getGrid());
|
||||
envCacheLat(LatticeComplex, momphName_);
|
||||
envTmpLat(LatticeComplex, "coor");
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ template <typename FImpl>
|
||||
class TZ2: public Module<Z2Par>
|
||||
{
|
||||
public:
|
||||
FERM_TYPE_ALIASES(FImpl,);
|
||||
BASIC_TYPE_ALIASES(FImpl,);
|
||||
public:
|
||||
// constructor
|
||||
TZ2(const std::string name);
|
||||
@ -120,7 +120,7 @@ template <typename FImpl>
|
||||
void TZ2<FImpl>::setup(void)
|
||||
{
|
||||
envCreateLat(PropagatorField, getName());
|
||||
envCacheLat(Lattice<iScalar<vInteger>>, tName_);
|
||||
envCache(Lattice<iScalar<vInteger>>, tName_, 1, env().getGrid());
|
||||
envTmpLat(LatticeComplex, "eta");
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,15 @@ std::vector<std::string> TRandomVectors<Field>::getOutput(void)
|
||||
template <typename Field>
|
||||
void TRandomVectors<Field>::setup(void)
|
||||
{
|
||||
envCreate(std::vector<Field>, getName(), par().Ls, par().size,
|
||||
env().getGrid(par().Ls));
|
||||
if (par().Ls > 1)
|
||||
{
|
||||
envCreate(std::vector<Field>, getName(), par().Ls, par().size,
|
||||
env().getGrid(par().Ls));
|
||||
}
|
||||
else
|
||||
{
|
||||
envCreate(std::vector<Field>, getName(), 1, par().size, env().getGrid());
|
||||
}
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user