1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hadrons: namespace macro to tackle GCC 5 bug

This commit is contained in:
Antonin Portelli 2016-12-05 14:29:32 +09:00
parent 7a1ac45679
commit 7ae734103e
11 changed files with 252 additions and 237 deletions

View File

@ -39,8 +39,13 @@ namespace Hadrons {\
using Grid::operator<<; using Grid::operator<<;
#define END_HADRONS_NAMESPACE }} #define END_HADRONS_NAMESPACE }}
#define BEGIN_MODULE_NAMESPACE(name)\
namespace name {\
using Grid::operator<<;
#define END_MODULE_NAMESPACE }
/* the 'using Grid::operator<<;' statement prevents a very nasty compilation /* the 'using Grid::operator<<;' statement prevents a very nasty compilation
* error with GCC (clang compiles fine without it). * error with GCC 5 (clang & GCC 6 compile fine without it).
*/ */
// FIXME: find a way to do that in a more general fashion // FIXME: find a way to do that in a more general fashion

View File

@ -37,34 +37,35 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Domain wall quark action * * Domain wall quark action *
******************************************************************************/ ******************************************************************************/
namespace MAction BEGIN_MODULE_NAMESPACE(MAction)
{
class DWFPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(DWFPar,
std::string, gauge,
unsigned int, Ls,
double , mass,
double , M5);
};
class DWF: public Module<DWFPar> class DWFPar: Serializable
{ {
public: public:
// constructor GRID_SERIALIZABLE_CLASS_MEMBERS(DWFPar,
DWF(const std::string name); std::string, gauge,
// destructor unsigned int, Ls,
virtual ~DWF(void) = default; double , mass,
// dependency relation double , M5);
virtual std::vector<std::string> getInput(void); };
virtual std::vector<std::string> getOutput(void);
// setup class DWF: public Module<DWFPar>
virtual void setup(void); {
// execution public:
virtual void execute(void); // 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(DWF, MAction); MODULE_REGISTER_NS(DWF, MAction);

View File

@ -37,32 +37,33 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Wilson quark action * * Wilson quark action *
******************************************************************************/ ******************************************************************************/
namespace MAction BEGIN_MODULE_NAMESPACE(MAction)
{
class WilsonPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonPar,
std::string, gauge,
double , mass);
};
class Wilson: public Module<WilsonPar> class WilsonPar: Serializable
{ {
public: public:
// constructor GRID_SERIALIZABLE_CLASS_MEMBERS(WilsonPar,
Wilson(const std::string name); std::string, gauge,
// destructor double , mass);
virtual ~Wilson(void) = default; };
// dependencies/products
virtual std::vector<std::string> getInput(void); class Wilson: public Module<WilsonPar>
virtual std::vector<std::string> getOutput(void); {
// setup public:
virtual void setup(void); // constructor
// execution Wilson(const std::string name);
virtual void execute(void); // 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(Wilson, MAction); MODULE_REGISTER_NS(Wilson, MAction);

View File

@ -37,38 +37,39 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Meson * * Meson *
******************************************************************************/ ******************************************************************************/
namespace MContraction BEGIN_MODULE_NAMESPACE(MContraction)
{
class MesonPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(MesonPar,
std::string, q1,
std::string, q2,
std::string, output);
};
class Meson: public Module<MesonPar> class MesonPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(MesonPar,
std::string, q1,
std::string, q2,
std::string, output);
};
class Meson: public Module<MesonPar>
{
public:
class Result: Serializable
{ {
public: public:
class Result: Serializable GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
{ std::vector<std::vector<std::vector<Complex>>>, corr);
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);
}; };
} 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(Meson, MContraction); MODULE_REGISTER_NS(Meson, MContraction);

View File

@ -37,31 +37,32 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Load a NERSC configuration * * Load a NERSC configuration *
******************************************************************************/ ******************************************************************************/
namespace MGauge BEGIN_MODULE_NAMESPACE(MGauge)
{
class LoadPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(LoadPar,
std::string, file);
};
class Load: public Module<LoadPar> class LoadPar: Serializable
{ {
public: public:
// constructor GRID_SERIALIZABLE_CLASS_MEMBERS(LoadPar,
Load(const std::string name); std::string, file);
// destructor };
virtual ~Load(void) = default;
// dependency relation class Load: public Module<LoadPar>
virtual std::vector<std::string> getInput(void); {
virtual std::vector<std::string> getOutput(void); public:
// setup // constructor
virtual void setup(void); Load(const std::string name);
// execution // destructor
virtual void execute(void); 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(Load, MGauge); MODULE_REGISTER_NS(Load, MGauge);

View File

@ -37,24 +37,25 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Random gauge * * Random gauge *
******************************************************************************/ ******************************************************************************/
namespace MGauge BEGIN_MODULE_NAMESPACE(MGauge)
class Random: public Module<NoPar>
{ {
class Random: public Module<NoPar> public:
{ // constructor
public: Random(const std::string name);
// constructor // destructor
Random(const std::string name); virtual ~Random(void) = default;
// destructor // dependency relation
virtual ~Random(void) = default; virtual std::vector<std::string> getInput(void);
// dependency relation virtual std::vector<std::string> getOutput(void);
virtual std::vector<std::string> getInput(void); // setup
virtual std::vector<std::string> getOutput(void); virtual void setup(void);
// setup // execution
virtual void setup(void); virtual void execute(void);
// execution };
virtual void execute(void);
}; END_MODULE_NAMESPACE
}
MODULE_REGISTER_NS(Random, MGauge); MODULE_REGISTER_NS(Random, MGauge);

View File

@ -37,24 +37,25 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Unit gauge * * Unit gauge *
******************************************************************************/ ******************************************************************************/
namespace MGauge BEGIN_MODULE_NAMESPACE(MGauge)
class Unit: public Module<NoPar>
{ {
class Unit: public Module<NoPar> public:
{ // constructor
public: Unit(const std::string name);
// constructor // destructor
Unit(const std::string name); virtual ~Unit(void) = default;
// destructor // dependencies/products
virtual ~Unit(void) = default; virtual std::vector<std::string> getInput(void);
// dependencies/products virtual std::vector<std::string> getOutput(void);
virtual std::vector<std::string> getInput(void); // setup
virtual std::vector<std::string> getOutput(void); virtual void setup(void);
// setup // execution
virtual void setup(void); virtual void execute(void);
// execution };
virtual void execute(void);
}; END_MODULE_NAMESPACE
}
MODULE_REGISTER_NS(Unit, MGauge); MODULE_REGISTER_NS(Unit, MGauge);

View File

@ -37,32 +37,33 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Schur red-black preconditioned CG * * Schur red-black preconditioned CG *
******************************************************************************/ ******************************************************************************/
namespace MSolver BEGIN_MODULE_NAMESPACE(MSolver)
{
class RBPrecCGPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(RBPrecCGPar,
std::string, action,
double , residual);
};
class RBPrecCG: public Module<RBPrecCGPar> class RBPrecCGPar: Serializable
{ {
public: public:
// constructor GRID_SERIALIZABLE_CLASS_MEMBERS(RBPrecCGPar,
RBPrecCG(const std::string name); std::string, action,
// destructor double , residual);
virtual ~RBPrecCG(void) = default; };
// dependencies/products
virtual std::vector<std::string> getInput(void); class RBPrecCG: public Module<RBPrecCGPar>
virtual std::vector<std::string> getOutput(void); {
// setup public:
virtual void setup(void); // constructor
// execution RBPrecCG(const std::string name);
virtual void execute(void); // 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(RBPrecCG, MSolver); MODULE_REGISTER_NS(RBPrecCG, MSolver);

View File

@ -48,31 +48,32 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Point * * Point *
******************************************************************************/ ******************************************************************************/
namespace MSource BEGIN_MODULE_NAMESPACE(MSource)
{
class PointPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(PointPar,
std::string, position);
};
class Point: public Module<PointPar> class PointPar: Serializable
{ {
public: public:
// constructor GRID_SERIALIZABLE_CLASS_MEMBERS(PointPar,
Point(const std::string name); std::string, position);
// destructor };
virtual ~Point(void) = default;
// dependency relation class Point: public Module<PointPar>
virtual std::vector<std::string> getInput(void); {
virtual std::vector<std::string> getOutput(void); public:
// setup // constructor
virtual void setup(void); Point(const std::string name);
// execution // destructor
virtual void execute(void); 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(Point, MSource); MODULE_REGISTER_NS(Point, MSource);

View File

@ -49,32 +49,33 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* Z2 * * Z2 *
******************************************************************************/ ******************************************************************************/
namespace MSource BEGIN_MODULE_NAMESPACE(MSource)
{
class Z2Par: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(Z2Par,
unsigned int, tA,
unsigned int, tB);
};
class Z2: public Module<Z2Par> class Z2Par: Serializable
{ {
public: public:
// constructor GRID_SERIALIZABLE_CLASS_MEMBERS(Z2Par,
Z2(const std::string name); unsigned int, tA,
// destructor unsigned int, tB);
virtual ~Z2(void) = default; };
// dependency relation
virtual std::vector<std::string> getInput(void); class Z2: public Module<Z2Par>
virtual std::vector<std::string> getOutput(void); {
// setup public:
virtual void setup(void); // constructor
// execution Z2(const std::string name);
virtual void execute(void); // 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(Z2, MSource); MODULE_REGISTER_NS(Z2, MSource);

View File

@ -10,31 +10,32 @@ BEGIN_HADRONS_NAMESPACE
/****************************************************************************** /******************************************************************************
* ___FILEBASENAME___ * * ___FILEBASENAME___ *
******************************************************************************/ ******************************************************************************/
namespace ___NAMESPACE___ BEGIN_MODULE_NAMESPACE(___NAMESPACE___)
{
class ___FILEBASENAME___Par: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(___FILEBASENAME___Par,
unsigned int, i);
};
class ___FILEBASENAME___: public Module<___FILEBASENAME___Par> class ___FILEBASENAME___Par: Serializable
{ {
public: public:
// constructor GRID_SERIALIZABLE_CLASS_MEMBERS(___FILEBASENAME___Par,
___FILEBASENAME___(const std::string name); unsigned int, i);
// destructor };
virtual ~___FILEBASENAME___(void) = default;
// dependency relation class ___FILEBASENAME___: public Module<___FILEBASENAME___Par>
virtual std::vector<std::string> getInput(void); {
virtual std::vector<std::string> getOutput(void); public:
// setup // constructor
virtual void setup(void); ___FILEBASENAME___(const std::string name);
// execution // destructor
virtual void execute(void); 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);
};
END_MODULE_NAMESPACE
MODULE_REGISTER_NS(___FILEBASENAME___, ___NAMESPACE___); MODULE_REGISTER_NS(___FILEBASENAME___, ___NAMESPACE___);