mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Hadrons: big update after templating of get/createGrid
This commit is contained in:
		@@ -45,19 +45,13 @@ Environment::Environment(void)
 | 
			
		||||
{
 | 
			
		||||
    dim_         = GridDefaultLatt();
 | 
			
		||||
    nd_          = dim_.size();
 | 
			
		||||
    defaultGrid_ = {typeHash<vComplex>(), 1};
 | 
			
		||||
    grid4d_[defaultGrid_].reset(
 | 
			
		||||
        SpaceTimeGrid::makeFourDimGrid(dim_, 
 | 
			
		||||
                                       GridDefaultSimd(nd_, vComplex::Nsimd()),
 | 
			
		||||
                                       GridDefaultMpi()));
 | 
			
		||||
    gridRb4d_[defaultGrid_].reset(
 | 
			
		||||
        SpaceTimeGrid::makeFourDimRedBlackGrid(grid4d_[defaultGrid_].get()));
 | 
			
		||||
    createGrid<vComplex>(1);
 | 
			
		||||
    vol_ = 1.;
 | 
			
		||||
    for (auto d: dim_)
 | 
			
		||||
    {
 | 
			
		||||
        vol_ *= d;
 | 
			
		||||
    }
 | 
			
		||||
    rng4d_.reset(new GridParallelRNG(grid4d_[defaultGrid_].get()));
 | 
			
		||||
    rng4d_.reset(new GridParallelRNG(getGrid()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// grids ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
@@ -174,7 +174,6 @@ private:
 | 
			
		||||
    bool                                protect_{true};
 | 
			
		||||
    // grids
 | 
			
		||||
    std::vector<int>                    dim_;
 | 
			
		||||
    FineGridKey                         defaultGrid_;
 | 
			
		||||
    std::map<FineGridKey, GridPt>       grid4d_;
 | 
			
		||||
    std::map<FineGridKey, GridPt>       grid5d_;
 | 
			
		||||
    std::map<FineGridKey, GridRbPt>     gridRb4d_;
 | 
			
		||||
 
 | 
			
		||||
@@ -96,19 +96,20 @@ using Grid::operator>>;
 | 
			
		||||
BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
// type aliases
 | 
			
		||||
#define FERM_TYPE_ALIASES(FImpl, suffix)\
 | 
			
		||||
typedef FermionOperator<FImpl>                        FMat##suffix;            \
 | 
			
		||||
typedef typename FImpl::FermionField                  FermionField##suffix;    \
 | 
			
		||||
typedef typename FImpl::PropagatorField               PropagatorField##suffix; \
 | 
			
		||||
typedef typename FImpl::SitePropagator::scalar_object SitePropagator##suffix;  \
 | 
			
		||||
#define BASIC_TYPE_ALIASES(Impl, suffix)\
 | 
			
		||||
typedef typename Impl::Field                         ScalarField##suffix;\
 | 
			
		||||
typedef typename Impl::PropagatorField               PropagatorField##suffix;\
 | 
			
		||||
typedef typename Impl::SitePropagator::scalar_object SitePropagator##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;
 | 
			
		||||
 | 
			
		||||
#define SCALAR_TYPE_ALIASES(SImpl, suffix)\
 | 
			
		||||
typedef typename SImpl::Field ScalarField##suffix;\
 | 
			
		||||
typedef typename SImpl::Field PropagatorField##suffix;
 | 
			
		||||
#define GAUGE_TYPE_ALIASES(GImpl, suffix)\
 | 
			
		||||
typedef typename GImpl::GaugeField GaugeField##suffix;
 | 
			
		||||
 | 
			
		||||
#define SOLVER_TYPE_ALIASES(FImpl, suffix)\
 | 
			
		||||
typedef Solver<FImpl> Solver##suffix;
 | 
			
		||||
@@ -117,10 +118,6 @@ typedef Solver<FImpl> Solver##suffix;
 | 
			
		||||
typedef std::function<SlicedPropagator##suffix\
 | 
			
		||||
                      (const PropagatorField##suffix &)> SinkFn##suffix;
 | 
			
		||||
 | 
			
		||||
#define FG_TYPE_ALIASES(FImpl, suffix)\
 | 
			
		||||
FERM_TYPE_ALIASES(FImpl, suffix)\
 | 
			
		||||
GAUGE_TYPE_ALIASES(FImpl, suffix)
 | 
			
		||||
 | 
			
		||||
// logger
 | 
			
		||||
class HadronsLogger: public Logger
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,12 @@ MODULE_REGISTER(mod, ARG(base), ns);
 | 
			
		||||
#define ARG(...) __VA_ARGS__
 | 
			
		||||
#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)\
 | 
			
		||||
*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__)
 | 
			
		||||
 | 
			
		||||
#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)\
 | 
			
		||||
envCreate(type, name, Ls, env().getGrid(Ls))
 | 
			
		||||
envCreate(type, name, Ls, env().template getGrid<typename type::vector_type>(Ls))
 | 
			
		||||
 | 
			
		||||
#define envCreateLat(...)\
 | 
			
		||||
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__)
 | 
			
		||||
 | 
			
		||||
#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)\
 | 
			
		||||
envCache(type, name, Ls, env().getGrid(Ls))
 | 
			
		||||
envCache(type, name, Ls, env().template getGrid<typename type::vector_type>(Ls))
 | 
			
		||||
 | 
			
		||||
#define envCacheLat(...)\
 | 
			
		||||
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__)
 | 
			
		||||
 | 
			
		||||
#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)\
 | 
			
		||||
envTmp(type, name, Ls, env().getGrid(Ls))
 | 
			
		||||
envTmp(type, name, Ls, env().template getGrid<typename type::vector_type>(Ls))
 | 
			
		||||
 | 
			
		||||
#define envTmpLat(...)\
 | 
			
		||||
MACRO_REDIRECT(__VA_ARGS__, envTmpLat5, envTmpLat4)(__VA_ARGS__)
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
{
 | 
			
		||||
    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