mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	Hadrons: big module reorganisation
This commit is contained in:
		@@ -54,7 +54,7 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
typedef FermionOperator<FIMPL> FMat;
 | 
			
		||||
typedef FIMPL::FermionField    FermionField;
 | 
			
		||||
typedef FIMPL::PropagatorField PropagatorField;
 | 
			
		||||
typedef std::function<void(FermionField &, const FermionField &)> Solver;
 | 
			
		||||
typedef std::function<void(FermionField &, const FermionField &)> SolverFn;
 | 
			
		||||
 | 
			
		||||
// logger
 | 
			
		||||
class HadronsLogger: public Logger
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ directory.
 | 
			
		||||
 | 
			
		||||
BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
// module registration macro
 | 
			
		||||
// module registration macros
 | 
			
		||||
#define MODULE_REGISTER(mod)\
 | 
			
		||||
class mod##ModuleRegistrar\
 | 
			
		||||
{\
 | 
			
		||||
@@ -49,6 +49,21 @@ public:\
 | 
			
		||||
};\
 | 
			
		||||
static mod##ModuleRegistrar mod##ModuleRegistrarInstance;
 | 
			
		||||
 | 
			
		||||
#define MODULE_REGISTER_NS(mod, ns)\
 | 
			
		||||
class ns##mod##ModuleRegistrar\
 | 
			
		||||
{\
 | 
			
		||||
public:\
 | 
			
		||||
    ns##mod##ModuleRegistrar(void)\
 | 
			
		||||
    {\
 | 
			
		||||
        ModuleFactory &modFac = ModuleFactory::getInstance();\
 | 
			
		||||
        modFac.registerBuilder(#ns "::" #mod, [&](const std::string name)\
 | 
			
		||||
                              {\
 | 
			
		||||
                                  return std::unique_ptr<ns::mod>(new ns::mod(name));\
 | 
			
		||||
                              });\
 | 
			
		||||
    }\
 | 
			
		||||
};\
 | 
			
		||||
static ns##mod##ModuleRegistrar ns##mod##ModuleRegistrarInstance;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                            Module class                                    *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
#include <Grid/Hadrons/Modules/ADWF.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/AWilson.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/CMeson.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/GLoad.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/GRandom.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/GUnit.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MAction/DWF.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MContraction/Meson.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MGauge/Load.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MGauge/Random.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MQuark.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/SolRBPrecCG.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/SrcPoint.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/SrcZ2.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MSource/Z2.hpp>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/ADWF.cc
 | 
			
		||||
Source file: programs/Hadrons/DWF.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,28 +25,29 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/ADWF.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MAction/DWF.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MAction;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                          ADWF implementation                                *
 | 
			
		||||
*                          DWF implementation                                *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
ADWF::ADWF(const std::string name)
 | 
			
		||||
: Module<ADWFPar>(name)
 | 
			
		||||
DWF::DWF(const std::string name)
 | 
			
		||||
: Module<DWFPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> ADWF::getInput(void)
 | 
			
		||||
std::vector<std::string> DWF::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in = {par().gauge};
 | 
			
		||||
    
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> ADWF::getOutput(void)
 | 
			
		||||
std::vector<std::string> DWF::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -54,7 +55,7 @@ std::vector<std::string> ADWF::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void ADWF::setup(void)
 | 
			
		||||
void DWF::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    unsigned int size;
 | 
			
		||||
    
 | 
			
		||||
@@ -63,7 +64,7 @@ void ADWF::setup(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void ADWF::execute(void)
 | 
			
		||||
void DWF::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Setting up domain wall fermion matrix with m= "
 | 
			
		||||
                 << par().mass << ", M5= " << par().M5 << " and Ls= "
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/ADWF.hpp
 | 
			
		||||
Source file: programs/Hadrons/DWF.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_ADWF_hpp_
 | 
			
		||||
#define Hadrons_ADWF_hpp_
 | 
			
		||||
#ifndef Hadrons_DWF_hpp_
 | 
			
		||||
#define Hadrons_DWF_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -37,34 +37,37 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                     Domain wall quark action                               *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class ADWFPar: Serializable
 | 
			
		||||
namespace MAction
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    GRID_SERIALIZABLE_CLASS_MEMBERS(ADWFPar, 
 | 
			
		||||
                                    std::string, gauge,
 | 
			
		||||
                                    unsigned int, Ls,
 | 
			
		||||
                                    double      , mass,
 | 
			
		||||
                                    double      , M5);
 | 
			
		||||
};
 | 
			
		||||
    class DWFPar: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(DWFPar,
 | 
			
		||||
                                        std::string, gauge,
 | 
			
		||||
                                        unsigned int, Ls,
 | 
			
		||||
                                        double      , mass,
 | 
			
		||||
                                        double      , M5);
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    class DWF: public Module<DWFPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        DWF(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~DWF(void) = default;
 | 
			
		||||
        // 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);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ADWF: public Module<ADWFPar>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    ADWF(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~ADWF(void) = default;
 | 
			
		||||
    // 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(ADWF);
 | 
			
		||||
MODULE_REGISTER_NS(DWF, MAction);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_ADWF_hpp_
 | 
			
		||||
#endif // Hadrons_DWF_hpp_
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/AWilson.cc
 | 
			
		||||
Source file: programs/Hadrons/Wilson.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,28 +25,29 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/AWilson.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MAction;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                         AWilson implementation                              *
 | 
			
		||||
*                         Wilson implementation                              *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
AWilson::AWilson(const std::string name)
 | 
			
		||||
: Module<AWilsonPar>(name)
 | 
			
		||||
Wilson::Wilson(const std::string name)
 | 
			
		||||
: Module<WilsonPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> AWilson::getInput(void)
 | 
			
		||||
std::vector<std::string> Wilson::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in = {par().gauge};
 | 
			
		||||
    
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> AWilson::getOutput(void)
 | 
			
		||||
std::vector<std::string> Wilson::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -54,7 +55,7 @@ std::vector<std::string> AWilson::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void AWilson::setup(void)
 | 
			
		||||
void Wilson::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    unsigned int size;
 | 
			
		||||
    
 | 
			
		||||
@@ -63,7 +64,7 @@ void AWilson::setup(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void AWilson::execute()
 | 
			
		||||
void Wilson::execute()
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Setting up Wilson fermion matrix with m= " << par().mass
 | 
			
		||||
                 << " using gauge field '" << par().gauge << "'" << std::endl;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/AWilson.hpp
 | 
			
		||||
Source file: programs/Hadrons/Wilson.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_AWilson_hpp_
 | 
			
		||||
#define Hadrons_AWilson_hpp_
 | 
			
		||||
#ifndef Hadrons_Wilson_hpp_
 | 
			
		||||
#define Hadrons_Wilson_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -37,32 +37,35 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                            Wilson quark action                             *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class AWilsonPar: Serializable
 | 
			
		||||
namespace MAction
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    GRID_SERIALIZABLE_CLASS_MEMBERS(AWilsonPar,
 | 
			
		||||
                                    std::string, gauge,
 | 
			
		||||
                                    double     , mass);
 | 
			
		||||
};
 | 
			
		||||
    class WilsonPar: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonPar,
 | 
			
		||||
                                        std::string, gauge,
 | 
			
		||||
                                        double     , mass);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
class AWilson: public Module<AWilsonPar>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    AWilson(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~AWilson(void) = default;
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    virtual std::vector<std::string> getInput(void);
 | 
			
		||||
    virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
    // setup
 | 
			
		||||
    virtual void setup(void);
 | 
			
		||||
    // execution
 | 
			
		||||
    virtual void execute(void);
 | 
			
		||||
};
 | 
			
		||||
    class Wilson: public Module<WilsonPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        Wilson(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~Wilson(void) = default;
 | 
			
		||||
        // dependencies/products
 | 
			
		||||
        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(AWilson);
 | 
			
		||||
MODULE_REGISTER_NS(Wilson, MAction);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_AWilson_hpp_
 | 
			
		||||
#endif // Hadrons_Wilson_hpp_
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/CMeson.cc
 | 
			
		||||
Source file: programs/Hadrons/Meson.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2015
 | 
			
		||||
 | 
			
		||||
@@ -25,29 +25,30 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/CMeson.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MContraction/Meson.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace QCD;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MContraction;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                          CMeson implementation                             *
 | 
			
		||||
 *                          Meson implementation                             *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
CMeson::CMeson(const std::string name)
 | 
			
		||||
: Module<CMesonPar>(name)
 | 
			
		||||
Meson::Meson(const std::string name)
 | 
			
		||||
: Module<MesonPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> CMeson::getInput(void)
 | 
			
		||||
std::vector<std::string> Meson::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> input = {par().q1, par().q2};
 | 
			
		||||
    
 | 
			
		||||
    return input;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> CMeson::getOutput(void)
 | 
			
		||||
std::vector<std::string> Meson::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> output = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -55,7 +56,7 @@ std::vector<std::string> CMeson::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void CMeson::execute(void)
 | 
			
		||||
void Meson::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Computing meson contraction '" << getName() << "' using"
 | 
			
		||||
                 << " quarks '" << par().q1 << "' and '" << par().q2 << "'"
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/CMeson.hpp
 | 
			
		||||
Source file: programs/Hadrons/Meson.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2015
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_CMeson_hpp_
 | 
			
		||||
#define Hadrons_CMeson_hpp_
 | 
			
		||||
#ifndef Hadrons_Meson_hpp_
 | 
			
		||||
#define Hadrons_Meson_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -35,40 +35,43 @@ directory.
 | 
			
		||||
BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                               CMeson                                       *
 | 
			
		||||
 *                                Meson                                       *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class CMesonPar: Serializable
 | 
			
		||||
namespace MContraction
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    GRID_SERIALIZABLE_CLASS_MEMBERS(CMesonPar,
 | 
			
		||||
                                    std::string, q1,
 | 
			
		||||
                                    std::string, q2,
 | 
			
		||||
                                    std::string, output);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class CMeson: public Module<CMesonPar>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    class Result: Serializable
 | 
			
		||||
    class MesonPar: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
 | 
			
		||||
                        std::vector<std::vector<std::vector<Complex>>>, corr);
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(MesonPar,
 | 
			
		||||
                                        std::string, q1,
 | 
			
		||||
                                        std::string, q2,
 | 
			
		||||
                                        std::string, output);
 | 
			
		||||
    };
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    CMeson(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~CMeson(void) = default;
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    virtual std::vector<std::string> getInput(void);
 | 
			
		||||
    virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
    // execution
 | 
			
		||||
    virtual void execute(void);
 | 
			
		||||
};
 | 
			
		||||
    
 | 
			
		||||
    class Meson: public Module<MesonPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        class Result: Serializable
 | 
			
		||||
        {
 | 
			
		||||
        public:
 | 
			
		||||
            GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
 | 
			
		||||
                                            std::vector<std::vector<std::vector<Complex>>>, corr);
 | 
			
		||||
        };
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        Meson(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~Meson(void) = default;
 | 
			
		||||
        // dependencies/products
 | 
			
		||||
        virtual std::vector<std::string> getInput(void);
 | 
			
		||||
        virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
        // execution
 | 
			
		||||
        virtual void execute(void);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MODULE_REGISTER(CMeson);
 | 
			
		||||
MODULE_REGISTER_NS(Meson, MContraction);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_CMeson_hpp_
 | 
			
		||||
#endif // Hadrons_Meson_hpp_
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/GLoad.cc
 | 
			
		||||
Source file: programs/Hadrons/Load.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,28 +25,29 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/GLoad.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MGauge/Load.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MGauge;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                          GLoad implementation                               *
 | 
			
		||||
*                          Load implementation                               *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
GLoad::GLoad(const std::string name)
 | 
			
		||||
: Module<GLoadPar>(name)
 | 
			
		||||
Load::Load(const std::string name)
 | 
			
		||||
: Module<LoadPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> GLoad::getInput(void)
 | 
			
		||||
std::vector<std::string> Load::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in;
 | 
			
		||||
    
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> GLoad::getOutput(void)
 | 
			
		||||
std::vector<std::string> Load::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -54,13 +55,13 @@ std::vector<std::string> GLoad::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void GLoad::setup(void)
 | 
			
		||||
void Load::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    env().registerLattice<LatticeGaugeField>(getName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void GLoad::execute(void)
 | 
			
		||||
void Load::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    NerscField  header;
 | 
			
		||||
    std::string fileName = par().file + "."
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/GLoad.hpp
 | 
			
		||||
Source file: programs/Hadrons/Load.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_GLoad_hpp_
 | 
			
		||||
#define Hadrons_GLoad_hpp_
 | 
			
		||||
#ifndef Hadrons_Load_hpp_
 | 
			
		||||
#define Hadrons_Load_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -37,31 +37,34 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                         Load a NERSC configuration                         *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class GLoadPar: Serializable
 | 
			
		||||
namespace MGauge
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    GRID_SERIALIZABLE_CLASS_MEMBERS(GLoadPar,
 | 
			
		||||
                                    std::string, file);
 | 
			
		||||
};
 | 
			
		||||
    class LoadPar: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(LoadPar,
 | 
			
		||||
                                        std::string, file);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
class GLoad: public Module<GLoadPar>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    GLoad(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~GLoad(void) = default;
 | 
			
		||||
    // 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);
 | 
			
		||||
};
 | 
			
		||||
    class Load: public Module<LoadPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        Load(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~Load(void) = default;
 | 
			
		||||
        // 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(GLoad);
 | 
			
		||||
MODULE_REGISTER_NS(Load, MGauge);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_GLoad_hpp_
 | 
			
		||||
#endif // Hadrons_Load_hpp_
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/GRandom.cc
 | 
			
		||||
Source file: programs/Hadrons/Random.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,26 +25,27 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/GRandom.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MGauge/Random.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MGauge;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                          GRandom implementation                             *
 | 
			
		||||
*                          Random implementation                             *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
GRandom::GRandom(const std::string name)
 | 
			
		||||
Random::Random(const std::string name)
 | 
			
		||||
: Module<NoPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> GRandom::getInput(void)
 | 
			
		||||
std::vector<std::string> Random::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    return std::vector<std::string>();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> GRandom::getOutput(void)
 | 
			
		||||
std::vector<std::string> Random::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -52,13 +53,13 @@ std::vector<std::string> GRandom::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void GRandom::setup(void)
 | 
			
		||||
void Random::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    env().registerLattice<LatticeGaugeField>(getName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void GRandom::execute(void)
 | 
			
		||||
void Random::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Generating random gauge configuration" << std::endl;
 | 
			
		||||
    LatticeGaugeField &U = *env().createLattice<LatticeGaugeField>(getName());
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/GRandom.hpp
 | 
			
		||||
Source file: programs/Hadrons/Random.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_GRandom_hpp_
 | 
			
		||||
#define Hadrons_GRandom_hpp_
 | 
			
		||||
#ifndef Hadrons_Random_hpp_
 | 
			
		||||
#define Hadrons_Random_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -37,24 +37,27 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                             Random gauge                                   *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class GRandom: public Module<NoPar>
 | 
			
		||||
namespace MGauge
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    GRandom(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~GRandom(void) = default;
 | 
			
		||||
    // 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);
 | 
			
		||||
};
 | 
			
		||||
    class Random: public Module<NoPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        Random(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~Random(void) = default;
 | 
			
		||||
        // 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(GRandom);
 | 
			
		||||
MODULE_REGISTER_NS(Random, MGauge);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_GRandom_hpp_
 | 
			
		||||
#endif // Hadrons_Random_hpp_
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/GUnit.cc
 | 
			
		||||
Source file: programs/Hadrons/Unit.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,26 +25,27 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/GUnit.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MGauge;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                            GUnit implementation                             *
 | 
			
		||||
*                            Unit implementation                             *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
GUnit::GUnit(const std::string name)
 | 
			
		||||
Unit::Unit(const std::string name)
 | 
			
		||||
: Module<NoPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> GUnit::getInput(void)
 | 
			
		||||
std::vector<std::string> Unit::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    return std::vector<std::string>();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> GUnit::getOutput(void)
 | 
			
		||||
std::vector<std::string> Unit::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -52,13 +53,13 @@ std::vector<std::string> GUnit::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void GUnit::setup(void)
 | 
			
		||||
void Unit::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    env().registerLattice<LatticeGaugeField>(getName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void GUnit::execute(void)
 | 
			
		||||
void Unit::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Creating unit gauge configuration" << std::endl;
 | 
			
		||||
    LatticeGaugeField &U = *env().createLattice<LatticeGaugeField>(getName());
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/GUnit.hpp
 | 
			
		||||
Source file: programs/Hadrons/Unit.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_GUnit_hpp_
 | 
			
		||||
#define Hadrons_GUnit_hpp_
 | 
			
		||||
#ifndef Hadrons_Unit_hpp_
 | 
			
		||||
#define Hadrons_Unit_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -37,24 +37,27 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                              Unit gauge                                    *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class GUnit: public Module<NoPar>
 | 
			
		||||
namespace MGauge
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    GUnit(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~GUnit(void) = default;
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    virtual std::vector<std::string> getInput(void);
 | 
			
		||||
    virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
    // setup
 | 
			
		||||
    virtual void setup(void);
 | 
			
		||||
    // execution
 | 
			
		||||
    virtual void execute(void);
 | 
			
		||||
};
 | 
			
		||||
    class Unit: public Module<NoPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        Unit(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~Unit(void) = default;
 | 
			
		||||
        // dependencies/products
 | 
			
		||||
        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(GUnit);
 | 
			
		||||
MODULE_REGISTER_NS(Unit, MGauge);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_GUnit_hpp_
 | 
			
		||||
#endif // Hadrons_Unit_hpp_
 | 
			
		||||
@@ -76,7 +76,7 @@ void MQuark::execute(void)
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LatticePropagator   &prop    = *env().createLattice<LatticePropagator>(propName);
 | 
			
		||||
    LatticePropagator   &fullSrc = *env().getObject<LatticePropagator>(par().source);
 | 
			
		||||
    Solver              &solver  = *env().getObject<Solver>(par().solver);
 | 
			
		||||
    SolverFn            &solver  = *env().getObject<SolverFn>(par().solver);
 | 
			
		||||
    if (Ls_ > 1)
 | 
			
		||||
    {
 | 
			
		||||
        env().createLattice<LatticePropagator>(getName());
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ public:
 | 
			
		||||
    virtual void execute(void);
 | 
			
		||||
private:
 | 
			
		||||
    unsigned int Ls_;
 | 
			
		||||
    Solver       *solver_{nullptr};
 | 
			
		||||
    SolverFn     *solver_{nullptr};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
MODULE_REGISTER(MQuark);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/SolRBPrecCG.cc
 | 
			
		||||
Source file: programs/Hadrons/RBPrecCG.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,29 +25,30 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/SolRBPrecCG.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace QCD;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MSolver;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                       SolRBPrecCG implementation                            *
 | 
			
		||||
*                       RBPrecCG implementation                            *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
SolRBPrecCG::SolRBPrecCG(const std::string name)
 | 
			
		||||
RBPrecCG::RBPrecCG(const std::string name)
 | 
			
		||||
: Module(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> SolRBPrecCG::getInput(void)
 | 
			
		||||
std::vector<std::string> RBPrecCG::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in = {par().action};
 | 
			
		||||
    
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> SolRBPrecCG::getOutput(void)
 | 
			
		||||
std::vector<std::string> RBPrecCG::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -55,7 +56,7 @@ std::vector<std::string> SolRBPrecCG::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void SolRBPrecCG::setup(void)
 | 
			
		||||
void RBPrecCG::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    auto Ls = env().getObjectLs(par().action);
 | 
			
		||||
    
 | 
			
		||||
@@ -64,7 +65,7 @@ void SolRBPrecCG::setup(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void SolRBPrecCG::execute(void)
 | 
			
		||||
void RBPrecCG::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    auto &mat   = *(env().getObject<FMat>(par().action));
 | 
			
		||||
    auto solver = [&mat, this](LatticeFermion &sol,
 | 
			
		||||
@@ -79,5 +80,5 @@ void SolRBPrecCG::execute(void)
 | 
			
		||||
    LOG(Message) << "setting up Schur red-black preconditioned CG for"
 | 
			
		||||
                 << " action '" << par().action << "' with residual "
 | 
			
		||||
                 << par().residual << std::endl;
 | 
			
		||||
    env().setObject(getName(), new Solver(solver));
 | 
			
		||||
    env().setObject(getName(), new SolverFn(solver));
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/SolRBPrecCG.hpp
 | 
			
		||||
Source file: programs/Hadrons/RBPrecCG.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_SolRBPrecCG_hpp_
 | 
			
		||||
#define Hadrons_SolRBPrecCG_hpp_
 | 
			
		||||
#ifndef Hadrons_RBPrecCG_hpp_
 | 
			
		||||
#define Hadrons_RBPrecCG_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -37,32 +37,35 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                     Schur red-black preconditioned CG                      *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class SolRBPrecCGPar: Serializable
 | 
			
		||||
namespace MSolver
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    GRID_SERIALIZABLE_CLASS_MEMBERS(SolRBPrecCGPar,
 | 
			
		||||
                                    std::string, action,
 | 
			
		||||
                                    double     , residual);
 | 
			
		||||
};
 | 
			
		||||
    class RBPrecCGPar: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(RBPrecCGPar,
 | 
			
		||||
                                        std::string, action,
 | 
			
		||||
                                        double     , residual);
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    class RBPrecCG: public Module<RBPrecCGPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        RBPrecCG(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~RBPrecCG(void) = default;
 | 
			
		||||
        // dependencies/products
 | 
			
		||||
        virtual std::vector<std::string> getInput(void);
 | 
			
		||||
        virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
        // setup
 | 
			
		||||
        virtual void setup(void);
 | 
			
		||||
        // execution
 | 
			
		||||
        virtual void execute(void);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class SolRBPrecCG: public Module<SolRBPrecCGPar>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    SolRBPrecCG(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~SolRBPrecCG(void) = default;
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    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(SolRBPrecCG);
 | 
			
		||||
MODULE_REGISTER_NS(RBPrecCG, MSolver);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_SolRBPrecCG_hpp_
 | 
			
		||||
#endif // Hadrons_RBPrecCG_hpp_
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/SrcPoint.cc
 | 
			
		||||
Source file: programs/Hadrons/Point.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,28 +25,29 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/SrcPoint.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MSource;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                         SrcPoint implementation                             *
 | 
			
		||||
*                           Point implementation                              *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
SrcPoint::SrcPoint(const std::string name)
 | 
			
		||||
: Module<SrcPointPar>(name)
 | 
			
		||||
Point::Point(const std::string name)
 | 
			
		||||
: Module<PointPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> SrcPoint::getInput(void)
 | 
			
		||||
std::vector<std::string> Point::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in;
 | 
			
		||||
    
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> SrcPoint::getOutput(void)
 | 
			
		||||
std::vector<std::string> Point::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -54,13 +55,13 @@ std::vector<std::string> SrcPoint::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void SrcPoint::setup(void)
 | 
			
		||||
void Point::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    env().registerLattice<PropagatorField>(getName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void SrcPoint::execute(void)
 | 
			
		||||
void Point::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<int> position = strToVec<int>(par().position);
 | 
			
		||||
    SpinColourMatrix id;
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/SrcPoint.hpp
 | 
			
		||||
Source file: programs/Hadrons/Point.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_SrcPoint_hpp_
 | 
			
		||||
#define Hadrons_SrcPoint_hpp_
 | 
			
		||||
#ifndef Hadrons_Point_hpp_
 | 
			
		||||
#define Hadrons_Point_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -46,33 +46,36 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                                SrcPoint                                    *
 | 
			
		||||
 *                                  Point                                     *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class SrcPointPar: Serializable
 | 
			
		||||
namespace MSource
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    GRID_SERIALIZABLE_CLASS_MEMBERS(SrcPointPar,
 | 
			
		||||
                                    std::string, position);
 | 
			
		||||
};
 | 
			
		||||
    class PointPar: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(PointPar,
 | 
			
		||||
                                        std::string, position);
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    class Point: public Module<PointPar>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        Point(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~Point(void) = default;
 | 
			
		||||
        // 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);
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class SrcPoint: public Module<SrcPointPar>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    SrcPoint(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~SrcPoint(void) = default;
 | 
			
		||||
    // 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(SrcPoint);
 | 
			
		||||
MODULE_REGISTER_NS(Point, MSource);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_SrcPoint_hpp_
 | 
			
		||||
#endif // Hadrons_Point_hpp_
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/SrcZ2.cc
 | 
			
		||||
Source file: programs/Hadrons/Z2.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,28 +25,29 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Modules/SrcZ2.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/MSource/Z2.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MSource;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                           SrcZ2 implementation                              *
 | 
			
		||||
*                              Z2 implementation                              *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
SrcZ2::SrcZ2(const std::string name)
 | 
			
		||||
: Module<SrcZ2Par>(name)
 | 
			
		||||
Z2::Z2(const std::string name)
 | 
			
		||||
: Module<Z2Par>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> SrcZ2::getInput(void)
 | 
			
		||||
std::vector<std::string> Z2::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in;
 | 
			
		||||
    
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> SrcZ2::getOutput(void)
 | 
			
		||||
std::vector<std::string> Z2::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
@@ -54,13 +55,13 @@ std::vector<std::string> SrcZ2::getOutput(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void SrcZ2::setup(void)
 | 
			
		||||
void Z2::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    env().registerLattice<PropagatorField>(getName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void SrcZ2::execute(void)
 | 
			
		||||
void Z2::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    Lattice<iScalar<vInteger>> t(env().getGrid());
 | 
			
		||||
    LatticeComplex             eta(env().getGrid());
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: programs/Hadrons/SrcZ2.hpp
 | 
			
		||||
Source file: programs/Hadrons/Z2.hpp
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2016
 | 
			
		||||
 | 
			
		||||
@@ -25,8 +25,8 @@ See the full license in the file "LICENSE" in the top level distribution
 | 
			
		||||
directory.
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef Hadrons_SrcZ2_hpp_
 | 
			
		||||
#define Hadrons_SrcZ2_hpp_
 | 
			
		||||
#ifndef Hadrons_Z2_hpp_
 | 
			
		||||
#define Hadrons_Z2_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
@@ -47,34 +47,37 @@ BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                               SrcZ2                                        *
 | 
			
		||||
 *                                 Z2                                         *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
class SrcZ2Par: Serializable
 | 
			
		||||
namespace MSource
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    GRID_SERIALIZABLE_CLASS_MEMBERS(SrcZ2Par,
 | 
			
		||||
                                    unsigned int, tA,
 | 
			
		||||
                                    unsigned int, tB);
 | 
			
		||||
};
 | 
			
		||||
    class Z2Par: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(Z2Par,
 | 
			
		||||
                                        unsigned int, tA,
 | 
			
		||||
                                        unsigned int, tB);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
class SrcZ2: public Module<SrcZ2Par>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    SrcZ2(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~SrcZ2(void) = default;
 | 
			
		||||
    // 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);
 | 
			
		||||
};
 | 
			
		||||
    class Z2: public Module<Z2Par>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        Z2(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~Z2(void) = default;
 | 
			
		||||
        // 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(SrcZ2);
 | 
			
		||||
MODULE_REGISTER_NS(Z2, MSource);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_SrcZ2_hpp_
 | 
			
		||||
#endif // Hadrons_Z2_hpp_
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
#include <Hadrons/___FILEBASENAME___.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Modules/___FILEBASENAME___.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
#ifndef Hadrons____FILEBASENAME____hpp_
 | 
			
		||||
#define Hadrons____FILEBASENAME____hpp_
 | 
			
		||||
 | 
			
		||||
#include <Hadrons/Global.hpp>
 | 
			
		||||
#include <Hadrons/Module.hpp>
 | 
			
		||||
#include <Hadrons/ModuleFactory.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
#include <Grid/Hadrons/ModuleFactory.hpp>
 | 
			
		||||
 | 
			
		||||
BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										40
									
								
								extras/Hadrons/Modules/templates/Module_in_NS.cc.template
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								extras/Hadrons/Modules/templates/Module_in_NS.cc.template
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
#include <Grid/Hadrons/Modules/___NAMESPACE___/___FILEBASENAME___.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace ___NAMESPACE___;
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                  ___FILEBASENAME___ implementation                             *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
___FILEBASENAME___::___FILEBASENAME___(const std::string name)
 | 
			
		||||
: Module<___FILEBASENAME___Par>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
std::vector<std::string> ___FILEBASENAME___::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in;
 | 
			
		||||
    
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<std::string> ___FILEBASENAME___::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    
 | 
			
		||||
    return out;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
void ___FILEBASENAME___::setup(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
void ___FILEBASENAME___::execute(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								extras/Hadrons/Modules/templates/Module_in_NS.hpp.template
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								extras/Hadrons/Modules/templates/Module_in_NS.hpp.template
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
#ifndef Hadrons____FILEBASENAME____hpp_
 | 
			
		||||
#define Hadrons____FILEBASENAME____hpp_
 | 
			
		||||
 | 
			
		||||
#include <Grid/Hadrons/Global.hpp>
 | 
			
		||||
#include <Grid/Hadrons/Module.hpp>
 | 
			
		||||
#include <Grid/Hadrons/ModuleFactory.hpp>
 | 
			
		||||
 | 
			
		||||
BEGIN_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                         ___FILEBASENAME___                                 *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
namespace ___NAMESPACE___
 | 
			
		||||
{
 | 
			
		||||
    class ___FILEBASENAME___Par: Serializable
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        GRID_SERIALIZABLE_CLASS_MEMBERS(___FILEBASENAME___Par,
 | 
			
		||||
                                        unsigned int, i);
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    class ___FILEBASENAME___: public Module<___FILEBASENAME___Par>
 | 
			
		||||
    {
 | 
			
		||||
    public:
 | 
			
		||||
        // constructor
 | 
			
		||||
        ___FILEBASENAME___(const std::string name);
 | 
			
		||||
        // destructor
 | 
			
		||||
        virtual ~___FILEBASENAME___(void) = default;
 | 
			
		||||
        // 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_NS(___FILEBASENAME___, ___NAMESPACE___);
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons____FILEBASENAME____hpp_
 | 
			
		||||
@@ -1,15 +1,31 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
if (( $# != 1 )); then
 | 
			
		||||
    echo "usage: `basename $0` <module name>" 1>&2
 | 
			
		||||
if (( $# != 1 && $# != 2)); then
 | 
			
		||||
    echo "usage: `basename $0` <module name> [<namespace>]" 1>&2
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
NAME=$1
 | 
			
		||||
NS=$2
 | 
			
		||||
 | 
			
		||||
if [ -e "Modules/${NAME}.cc" ] || [ -e "Modules/${NAME}.hpp" ]; then
 | 
			
		||||
    echo "error: files Modules/${NAME}.* already exists" 1>&2
 | 
			
		||||
    exit 1
 | 
			
		||||
if (( $# == 1 )); then
 | 
			
		||||
	if [ -e "Modules/${NAME}.cc" ] || [ -e "Modules/${NAME}.hpp" ]; then
 | 
			
		||||
	    echo "error: files Modules/${NAME}.* already exists" 1>&2
 | 
			
		||||
	    exit 1
 | 
			
		||||
	fi
 | 
			
		||||
	sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module.cc.template > Modules/${NAME}.cc
 | 
			
		||||
	sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module.hpp.template > Modules/${NAME}.hpp
 | 
			
		||||
elif (( $# == 2 )); then
 | 
			
		||||
	mkdir -p Modules/${NS}
 | 
			
		||||
	if [ -e "Modules/${NS}/${NAME}.cc" ] || [ -e "Modules/${NS}/${NAME}.hpp" ]; then
 | 
			
		||||
	    echo "error: files Modules/${NS}/${NAME}.* already exists" 1>&2
 | 
			
		||||
	    exit 1
 | 
			
		||||
	fi
 | 
			
		||||
	TMPCC=".${NS}.${NAME}.tmp.cc"
 | 
			
		||||
	TMPHPP=".${NS}.${NAME}.tmp.hpp"
 | 
			
		||||
	sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_in_NS.cc.template  > ${TMPCC}
 | 
			
		||||
	sed "s/___FILEBASENAME___/${NAME}/g" Modules/templates/Module_in_NS.hpp.template > ${TMPHPP}
 | 
			
		||||
	sed "s/___NAMESPACE___/${NS}/g" ${TMPCC}  > Modules/${NS}/${NAME}.cc
 | 
			
		||||
	sed "s/___NAMESPACE___/${NS}/g" ${TMPHPP} > Modules/${NS}/${NAME}.hpp
 | 
			
		||||
	rm -f ${TMPCC} ${TMPHPP}
 | 
			
		||||
fi
 | 
			
		||||
sed "s/___FILEBASENAME___/${NAME}/g" Module.cc.template > Modules/${NAME}.cc
 | 
			
		||||
sed "s/___FILEBASENAME___/${NAME}/g" Module.hpp.template > Modules/${NAME}.hpp
 | 
			
		||||
./make_module_list.sh
 | 
			
		||||
 
 | 
			
		||||
@@ -1,24 +1,24 @@
 | 
			
		||||
modules_cc =\
 | 
			
		||||
  Modules/ADWF.cc \
 | 
			
		||||
  Modules/AWilson.cc \
 | 
			
		||||
  Modules/CMeson.cc \
 | 
			
		||||
  Modules/GLoad.cc \
 | 
			
		||||
  Modules/GRandom.cc \
 | 
			
		||||
  Modules/GUnit.cc \
 | 
			
		||||
  Modules/MAction/DWF.cc \
 | 
			
		||||
  Modules/MAction/Wilson.cc \
 | 
			
		||||
  Modules/MContraction/Meson.cc \
 | 
			
		||||
  Modules/MGauge/Load.cc \
 | 
			
		||||
  Modules/MGauge/Random.cc \
 | 
			
		||||
  Modules/MGauge/Unit.cc \
 | 
			
		||||
  Modules/MQuark.cc \
 | 
			
		||||
  Modules/SolRBPrecCG.cc \
 | 
			
		||||
  Modules/SrcPoint.cc \
 | 
			
		||||
  Modules/SrcZ2.cc
 | 
			
		||||
  Modules/MSolver/RBPrecCG.cc \
 | 
			
		||||
  Modules/MSource/Point.cc \
 | 
			
		||||
  Modules/MSource/Z2.cc
 | 
			
		||||
 | 
			
		||||
modules_hpp =\
 | 
			
		||||
  Modules/ADWF.hpp \
 | 
			
		||||
  Modules/AWilson.hpp \
 | 
			
		||||
  Modules/CMeson.hpp \
 | 
			
		||||
  Modules/GLoad.hpp \
 | 
			
		||||
  Modules/GRandom.hpp \
 | 
			
		||||
  Modules/GUnit.hpp \
 | 
			
		||||
  Modules/MAction/DWF.hpp \
 | 
			
		||||
  Modules/MAction/Wilson.hpp \
 | 
			
		||||
  Modules/MContraction/Meson.hpp \
 | 
			
		||||
  Modules/MGauge/Load.hpp \
 | 
			
		||||
  Modules/MGauge/Random.hpp \
 | 
			
		||||
  Modules/MGauge/Unit.hpp \
 | 
			
		||||
  Modules/MQuark.hpp \
 | 
			
		||||
  Modules/SolRBPrecCG.hpp \
 | 
			
		||||
  Modules/SrcPoint.hpp \
 | 
			
		||||
  Modules/SrcZ2.hpp
 | 
			
		||||
  Modules/MSolver/RBPrecCG.hpp \
 | 
			
		||||
  Modules/MSource/Point.hpp \
 | 
			
		||||
  Modules/MSource/Z2.hpp
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user