mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Hadrons: big update after templating of get/createGrid
This commit is contained in:
parent
4af6c7e7aa
commit
c012899ed5
@ -45,19 +45,13 @@ Environment::Environment(void)
|
|||||||
{
|
{
|
||||||
dim_ = GridDefaultLatt();
|
dim_ = GridDefaultLatt();
|
||||||
nd_ = dim_.size();
|
nd_ = dim_.size();
|
||||||
defaultGrid_ = {typeHash<vComplex>(), 1};
|
createGrid<vComplex>(1);
|
||||||
grid4d_[defaultGrid_].reset(
|
|
||||||
SpaceTimeGrid::makeFourDimGrid(dim_,
|
|
||||||
GridDefaultSimd(nd_, vComplex::Nsimd()),
|
|
||||||
GridDefaultMpi()));
|
|
||||||
gridRb4d_[defaultGrid_].reset(
|
|
||||||
SpaceTimeGrid::makeFourDimRedBlackGrid(grid4d_[defaultGrid_].get()));
|
|
||||||
vol_ = 1.;
|
vol_ = 1.;
|
||||||
for (auto d: dim_)
|
for (auto d: dim_)
|
||||||
{
|
{
|
||||||
vol_ *= d;
|
vol_ *= d;
|
||||||
}
|
}
|
||||||
rng4d_.reset(new GridParallelRNG(grid4d_[defaultGrid_].get()));
|
rng4d_.reset(new GridParallelRNG(getGrid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// grids ///////////////////////////////////////////////////////////////////////
|
// grids ///////////////////////////////////////////////////////////////////////
|
||||||
|
@ -174,7 +174,6 @@ private:
|
|||||||
bool protect_{true};
|
bool protect_{true};
|
||||||
// grids
|
// grids
|
||||||
std::vector<int> dim_;
|
std::vector<int> dim_;
|
||||||
FineGridKey defaultGrid_;
|
|
||||||
std::map<FineGridKey, GridPt> grid4d_;
|
std::map<FineGridKey, GridPt> grid4d_;
|
||||||
std::map<FineGridKey, GridPt> grid5d_;
|
std::map<FineGridKey, GridPt> grid5d_;
|
||||||
std::map<FineGridKey, GridRbPt> gridRb4d_;
|
std::map<FineGridKey, GridRbPt> gridRb4d_;
|
||||||
|
@ -96,19 +96,20 @@ using Grid::operator>>;
|
|||||||
BEGIN_HADRONS_NAMESPACE
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
// type aliases
|
// type aliases
|
||||||
#define FERM_TYPE_ALIASES(FImpl, suffix)\
|
#define BASIC_TYPE_ALIASES(Impl, suffix)\
|
||||||
typedef FermionOperator<FImpl> FMat##suffix; \
|
typedef typename Impl::Field ScalarField##suffix;\
|
||||||
typedef typename FImpl::FermionField FermionField##suffix; \
|
typedef typename Impl::PropagatorField PropagatorField##suffix;\
|
||||||
typedef typename FImpl::PropagatorField PropagatorField##suffix; \
|
typedef typename Impl::SitePropagator::scalar_object SitePropagator##suffix;\
|
||||||
typedef typename FImpl::SitePropagator::scalar_object SitePropagator##suffix; \
|
typedef std::vector<SitePropagator##suffix> SlicedPropagator##suffix;
|
||||||
typedef std::vector<SitePropagator##suffix> SlicedPropagator##suffix;
|
|
||||||
|
|
||||||
#define GAUGE_TYPE_ALIASES(FImpl, suffix)\
|
#define FERM_TYPE_ALIASES(FImpl, suffix)\
|
||||||
|
BASIC_TYPE_ALIASES(FImpl, suffix);\
|
||||||
|
typedef FermionOperator<FImpl> FMat##suffix;\
|
||||||
|
typedef typename FImpl::FermionField FermionField##suffix;\
|
||||||
typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix;
|
typedef typename FImpl::DoubledGaugeField DoubledGaugeField##suffix;
|
||||||
|
|
||||||
#define SCALAR_TYPE_ALIASES(SImpl, suffix)\
|
#define GAUGE_TYPE_ALIASES(GImpl, suffix)\
|
||||||
typedef typename SImpl::Field ScalarField##suffix;\
|
typedef typename GImpl::GaugeField GaugeField##suffix;
|
||||||
typedef typename SImpl::Field PropagatorField##suffix;
|
|
||||||
|
|
||||||
#define SOLVER_TYPE_ALIASES(FImpl, suffix)\
|
#define SOLVER_TYPE_ALIASES(FImpl, suffix)\
|
||||||
typedef Solver<FImpl> Solver##suffix;
|
typedef Solver<FImpl> Solver##suffix;
|
||||||
@ -117,10 +118,6 @@ typedef Solver<FImpl> Solver##suffix;
|
|||||||
typedef std::function<SlicedPropagator##suffix\
|
typedef std::function<SlicedPropagator##suffix\
|
||||||
(const PropagatorField##suffix &)> SinkFn##suffix;
|
(const PropagatorField##suffix &)> SinkFn##suffix;
|
||||||
|
|
||||||
#define FG_TYPE_ALIASES(FImpl, suffix)\
|
|
||||||
FERM_TYPE_ALIASES(FImpl, suffix)\
|
|
||||||
GAUGE_TYPE_ALIASES(FImpl, suffix)
|
|
||||||
|
|
||||||
// logger
|
// logger
|
||||||
class HadronsLogger: public Logger
|
class HadronsLogger: public Logger
|
||||||
{
|
{
|
||||||
|
@ -67,6 +67,12 @@ MODULE_REGISTER(mod, ARG(base), ns);
|
|||||||
#define ARG(...) __VA_ARGS__
|
#define ARG(...) __VA_ARGS__
|
||||||
#define MACRO_REDIRECT(arg1, arg2, arg3, macro, ...) macro
|
#define MACRO_REDIRECT(arg1, arg2, arg3, macro, ...) macro
|
||||||
|
|
||||||
|
#define envCreateGrid(latticeType, Ls)\
|
||||||
|
env().template createGrid<typename latticeType::vector_type>(Ls)
|
||||||
|
|
||||||
|
#define envGetGrid(latticeType, Ls)\
|
||||||
|
env().template getGrid<typename latticeType::vector_type>(Ls)
|
||||||
|
|
||||||
#define envGet(type, name)\
|
#define envGet(type, name)\
|
||||||
*env().template getObject<type>(name)
|
*env().template getObject<type>(name)
|
||||||
|
|
||||||
@ -86,10 +92,10 @@ env().template createObject<type>(name, Environment::Storage::object, Ls, __VA_A
|
|||||||
env().template createDerivedObject<base, type>(name, Environment::Storage::object, Ls, __VA_ARGS__)
|
env().template createDerivedObject<base, type>(name, Environment::Storage::object, Ls, __VA_ARGS__)
|
||||||
|
|
||||||
#define envCreateLat4(type, name)\
|
#define envCreateLat4(type, name)\
|
||||||
envCreate(type, name, 1, env().getGrid())
|
envCreate(type, name, 1, env().template getGrid<typename type::vector_type>())
|
||||||
|
|
||||||
#define envCreateLat5(type, name, Ls)\
|
#define envCreateLat5(type, name, Ls)\
|
||||||
envCreate(type, name, Ls, env().getGrid(Ls))
|
envCreate(type, name, Ls, env().template getGrid<typename type::vector_type>(Ls))
|
||||||
|
|
||||||
#define envCreateLat(...)\
|
#define envCreateLat(...)\
|
||||||
MACRO_REDIRECT(__VA_ARGS__, envCreateLat5, envCreateLat4)(__VA_ARGS__)
|
MACRO_REDIRECT(__VA_ARGS__, envCreateLat5, envCreateLat4)(__VA_ARGS__)
|
||||||
@ -98,10 +104,10 @@ MACRO_REDIRECT(__VA_ARGS__, envCreateLat5, envCreateLat4)(__VA_ARGS__)
|
|||||||
env().template createObject<type>(name, Environment::Storage::cache, Ls, __VA_ARGS__)
|
env().template createObject<type>(name, Environment::Storage::cache, Ls, __VA_ARGS__)
|
||||||
|
|
||||||
#define envCacheLat4(type, name)\
|
#define envCacheLat4(type, name)\
|
||||||
envCache(type, name, 1, env().getGrid())
|
envCache(type, name, 1, env().template getGrid<typename type::vector_type>())
|
||||||
|
|
||||||
#define envCacheLat5(type, name, Ls)\
|
#define envCacheLat5(type, name, Ls)\
|
||||||
envCache(type, name, Ls, env().getGrid(Ls))
|
envCache(type, name, Ls, env().template getGrid<typename type::vector_type>(Ls))
|
||||||
|
|
||||||
#define envCacheLat(...)\
|
#define envCacheLat(...)\
|
||||||
MACRO_REDIRECT(__VA_ARGS__, envCacheLat5, envCacheLat4)(__VA_ARGS__)
|
MACRO_REDIRECT(__VA_ARGS__, envCacheLat5, envCacheLat4)(__VA_ARGS__)
|
||||||
@ -111,10 +117,10 @@ env().template createObject<type>(getName() + "_tmp_" + name, \
|
|||||||
Environment::Storage::temporary, Ls, __VA_ARGS__)
|
Environment::Storage::temporary, Ls, __VA_ARGS__)
|
||||||
|
|
||||||
#define envTmpLat4(type, name)\
|
#define envTmpLat4(type, name)\
|
||||||
envTmp(type, name, 1, env().getGrid())
|
envTmp(type, name, 1, env().template getGrid<typename type::vector_type>())
|
||||||
|
|
||||||
#define envTmpLat5(type, name, Ls)\
|
#define envTmpLat5(type, name, Ls)\
|
||||||
envTmp(type, name, Ls, env().getGrid(Ls))
|
envTmp(type, name, Ls, env().template getGrid<typename type::vector_type>(Ls))
|
||||||
|
|
||||||
#define envTmpLat(...)\
|
#define envTmpLat(...)\
|
||||||
MACRO_REDIRECT(__VA_ARGS__, envTmpLat5, envTmpLat4)(__VA_ARGS__)
|
MACRO_REDIRECT(__VA_ARGS__, envTmpLat5, envTmpLat4)(__VA_ARGS__)
|
||||||
|
@ -56,7 +56,7 @@ template <typename FImpl>
|
|||||||
class TDWF: public Module<DWFPar>
|
class TDWF: public Module<DWFPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TDWF(const std::string name);
|
TDWF(const std::string name);
|
||||||
|
@ -56,7 +56,7 @@ template <typename FImpl>
|
|||||||
class TMobiusDWF: public Module<MobiusDWFPar>
|
class TMobiusDWF: public Module<MobiusDWFPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TMobiusDWF(const std::string name);
|
TMobiusDWF(const std::string name);
|
||||||
|
@ -55,7 +55,7 @@ template <typename FImpl>
|
|||||||
class TScaledDWF: public Module<ScaledDWFPar>
|
class TScaledDWF: public Module<ScaledDWFPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TScaledDWF(const std::string name);
|
TScaledDWF(const std::string name);
|
||||||
|
@ -54,7 +54,7 @@ template <typename FImpl>
|
|||||||
class TWilson: public Module<WilsonPar>
|
class TWilson: public Module<WilsonPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TWilson(const std::string name);
|
TWilson(const std::string name);
|
||||||
|
@ -59,7 +59,7 @@ template <typename FImpl>
|
|||||||
class TWilsonClover: public Module<WilsonCloverPar>
|
class TWilsonClover: public Module<WilsonCloverPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TWilsonClover(const std::string name);
|
TWilsonClover(const std::string name);
|
||||||
|
@ -57,7 +57,7 @@ template <typename FImpl>
|
|||||||
class TZMobiusDWF: public Module<ZMobiusDWFPar>
|
class TZMobiusDWF: public Module<ZMobiusDWFPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TZMobiusDWF(const std::string name);
|
TZMobiusDWF(const std::string name);
|
||||||
|
@ -77,7 +77,7 @@ class TMeson: public Module<MesonPar>
|
|||||||
public:
|
public:
|
||||||
FERM_TYPE_ALIASES(FImpl1, 1);
|
FERM_TYPE_ALIASES(FImpl1, 1);
|
||||||
FERM_TYPE_ALIASES(FImpl2, 2);
|
FERM_TYPE_ALIASES(FImpl2, 2);
|
||||||
FERM_TYPE_ALIASES(ScalarImplCR, Scalar);
|
BASIC_TYPE_ALIASES(ScalarImplCR, Scalar);
|
||||||
SINK_TYPE_ALIASES(Scalar);
|
SINK_TYPE_ALIASES(Scalar);
|
||||||
class Result: Serializable
|
class Result: Serializable
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ template <typename FImpl>
|
|||||||
class TFreeProp: public Module<FreePropPar>
|
class TFreeProp: public Module<FreePropPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TFreeProp(const std::string name);
|
TFreeProp(const std::string name);
|
||||||
|
@ -56,7 +56,7 @@ template <typename FImpl>
|
|||||||
class TGaugeProp: public Module<GaugePropPar>
|
class TGaugeProp: public Module<GaugePropPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
SOLVER_TYPE_ALIASES(FImpl,);
|
SOLVER_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// 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
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
|
|
||||||
#include <Hadrons/Modules/MGauge/Random.hpp>
|
#include <Hadrons/Modules/MGauge/Random.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
using namespace MGauge;
|
using namespace MGauge;
|
||||||
|
|
||||||
/******************************************************************************
|
template class Grid::Hadrons::MGauge::TRandom<GIMPL>;
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
@ -40,8 +40,11 @@ BEGIN_HADRONS_NAMESPACE
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
BEGIN_MODULE_NAMESPACE(MGauge)
|
BEGIN_MODULE_NAMESPACE(MGauge)
|
||||||
|
|
||||||
|
template <typename GImpl>
|
||||||
class TRandom: public Module<NoPar>
|
class TRandom: public Module<NoPar>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
GAUGE_TYPE_ALIASES(GImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TRandom(const std::string name);
|
TRandom(const std::string name);
|
||||||
@ -57,7 +60,50 @@ protected:
|
|||||||
virtual void execute(void);
|
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
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ template <typename GImpl>
|
|||||||
class TStoutSmearing: public Module<StoutSmearingPar>
|
class TStoutSmearing: public Module<StoutSmearingPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename GImpl::Field GaugeField;
|
GAUGE_TYPE_ALIASES(GImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TStoutSmearing(const std::string name);
|
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
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
|
|
||||||
#include <Hadrons/Modules/MGauge/Unit.hpp>
|
#include <Hadrons/Modules/MGauge/Unit.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
using namespace MGauge;
|
using namespace MGauge;
|
||||||
|
|
||||||
/******************************************************************************
|
template class Grid::Hadrons::MGauge::TUnit<GIMPL>;
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
@ -40,8 +40,11 @@ BEGIN_HADRONS_NAMESPACE
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
BEGIN_MODULE_NAMESPACE(MGauge)
|
BEGIN_MODULE_NAMESPACE(MGauge)
|
||||||
|
|
||||||
|
template <typename GImpl>
|
||||||
class TUnit: public Module<NoPar>
|
class TUnit: public Module<NoPar>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
GAUGE_TYPE_ALIASES(GImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TUnit(const std::string name);
|
TUnit(const std::string name);
|
||||||
@ -57,7 +60,48 @@ protected:
|
|||||||
virtual void execute(void);
|
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
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
@ -31,44 +31,4 @@ using namespace Grid;
|
|||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
using namespace MIO;
|
using namespace MIO;
|
||||||
|
|
||||||
/******************************************************************************
|
template class Grid::Hadrons::MIO::TLoadNersc<GIMPL>;
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
@ -46,8 +46,11 @@ public:
|
|||||||
std::string, file);
|
std::string, file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename GImpl>
|
||||||
class TLoadNersc: public Module<LoadNerscPar>
|
class TLoadNersc: public Module<LoadNerscPar>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
GAUGE_TYPE_ALIASES(GImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TLoadNersc(const std::string name);
|
TLoadNersc(const std::string name);
|
||||||
@ -62,7 +65,54 @@ public:
|
|||||||
virtual void execute(void);
|
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
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
class TChargedProp: public Module<ChargedPropPar>
|
class TChargedProp: public Module<ChargedPropPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
BASIC_TYPE_ALIASES(SIMPL,);
|
||||||
typedef PhotonR::GaugeField EmField;
|
typedef PhotonR::GaugeField EmField;
|
||||||
typedef PhotonR::GaugeLinkField EmComp;
|
typedef PhotonR::GaugeLinkField EmComp;
|
||||||
class Result: Serializable
|
class Result: Serializable
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
class TFreeProp: public Module<FreePropPar>
|
class TFreeProp: public Module<FreePropPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
BASIC_TYPE_ALIASES(SIMPL,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TFreeProp(const std::string name);
|
TFreeProp(const std::string name);
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
class TScalarVP: public Module<ScalarVPPar>
|
class TScalarVP: public Module<ScalarVPPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
BASIC_TYPE_ALIASES(SIMPL,);
|
||||||
typedef PhotonR::GaugeField EmField;
|
typedef PhotonR::GaugeField EmField;
|
||||||
typedef PhotonR::GaugeLinkField EmComp;
|
typedef PhotonR::GaugeLinkField EmComp;
|
||||||
class Result: Serializable
|
class Result: Serializable
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
class TVPCounterTerms: public Module<VPCounterTermsPar>
|
class TVPCounterTerms: public Module<VPCounterTermsPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCALAR_TYPE_ALIASES(SIMPL,);
|
BASIC_TYPE_ALIASES(SIMPL,);
|
||||||
class Result: Serializable
|
class Result: Serializable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -53,7 +53,7 @@ template <typename FImpl>
|
|||||||
class TPoint: public Module<PointPar>
|
class TPoint: public Module<PointPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FERM_TYPE_ALIASES(FImpl,);
|
BASIC_TYPE_ALIASES(FImpl,);
|
||||||
SINK_TYPE_ALIASES();
|
SINK_TYPE_ALIASES();
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -58,8 +58,8 @@ template <typename FImplInner, typename FImplOuter, int nBasis>
|
|||||||
class TMixedPrecisionRBPrecCG: public Module<MixedPrecisionRBPrecCGPar>
|
class TMixedPrecisionRBPrecCG: public Module<MixedPrecisionRBPrecCGPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImplInner, Inner);
|
FERM_TYPE_ALIASES(FImplInner, Inner);
|
||||||
FG_TYPE_ALIASES(FImplOuter, Outer);
|
FERM_TYPE_ALIASES(FImplOuter, Outer);
|
||||||
SOLVER_TYPE_ALIASES(FImplOuter,);
|
SOLVER_TYPE_ALIASES(FImplOuter,);
|
||||||
typedef HADRONS_DEFAULT_SCHUR_OP<FMatInner, FermionFieldInner> SchurFMatInner;
|
typedef HADRONS_DEFAULT_SCHUR_OP<FMatInner, FermionFieldInner> SchurFMatInner;
|
||||||
typedef HADRONS_DEFAULT_SCHUR_OP<FMatOuter, FermionFieldOuter> SchurFMatOuter;
|
typedef HADRONS_DEFAULT_SCHUR_OP<FMatOuter, FermionFieldOuter> SchurFMatOuter;
|
||||||
|
@ -58,7 +58,7 @@ template <typename FImpl, int nBasis>
|
|||||||
class TRBPrecCG: public Module<RBPrecCGPar>
|
class TRBPrecCG: public Module<RBPrecCGPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
SOLVER_TYPE_ALIASES(FImpl,);
|
SOLVER_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -63,7 +63,7 @@ template <typename FImpl>
|
|||||||
class TPoint: public Module<PointPar>
|
class TPoint: public Module<PointPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FERM_TYPE_ALIASES(FImpl,);
|
BASIC_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TPoint(const std::string name);
|
TPoint(const std::string name);
|
||||||
|
@ -71,7 +71,7 @@ template <typename FImpl>
|
|||||||
class TSeqGamma: public Module<SeqGammaPar>
|
class TSeqGamma: public Module<SeqGammaPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FG_TYPE_ALIASES(FImpl,);
|
FERM_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TSeqGamma(const std::string name);
|
TSeqGamma(const std::string name);
|
||||||
@ -125,7 +125,7 @@ template <typename FImpl>
|
|||||||
void TSeqGamma<FImpl>::setup(void)
|
void TSeqGamma<FImpl>::setup(void)
|
||||||
{
|
{
|
||||||
envCreateLat(PropagatorField, getName());
|
envCreateLat(PropagatorField, getName());
|
||||||
envCacheLat(Lattice<iScalar<vInteger>>, tName_);
|
envCache(Lattice<iScalar<vInteger>>, tName_, 1, env().getGrid());
|
||||||
envCacheLat(LatticeComplex, momphName_);
|
envCacheLat(LatticeComplex, momphName_);
|
||||||
envTmpLat(LatticeComplex, "coor");
|
envTmpLat(LatticeComplex, "coor");
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ template <typename FImpl>
|
|||||||
class TZ2: public Module<Z2Par>
|
class TZ2: public Module<Z2Par>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FERM_TYPE_ALIASES(FImpl,);
|
BASIC_TYPE_ALIASES(FImpl,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TZ2(const std::string name);
|
TZ2(const std::string name);
|
||||||
@ -120,7 +120,7 @@ template <typename FImpl>
|
|||||||
void TZ2<FImpl>::setup(void)
|
void TZ2<FImpl>::setup(void)
|
||||||
{
|
{
|
||||||
envCreateLat(PropagatorField, getName());
|
envCreateLat(PropagatorField, getName());
|
||||||
envCacheLat(Lattice<iScalar<vInteger>>, tName_);
|
envCache(Lattice<iScalar<vInteger>>, tName_, 1, env().getGrid());
|
||||||
envTmpLat(LatticeComplex, "eta");
|
envTmpLat(LatticeComplex, "eta");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +96,15 @@ std::vector<std::string> TRandomVectors<Field>::getOutput(void)
|
|||||||
template <typename Field>
|
template <typename Field>
|
||||||
void TRandomVectors<Field>::setup(void)
|
void TRandomVectors<Field>::setup(void)
|
||||||
{
|
{
|
||||||
envCreate(std::vector<Field>, getName(), par().Ls, par().size,
|
if (par().Ls > 1)
|
||||||
env().getGrid(par().Ls));
|
{
|
||||||
|
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 ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user