mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Hadrons: modules moved in their own directory & utility script to add new modules
This commit is contained in:
parent
29dfe99e7c
commit
84fa2bdce6
@ -1,4 +1,4 @@
|
|||||||
AM_CXXFLAGS = -I$(top_srcdir)/programs -I$(top_srcdir)/lib
|
AM_CXXFLAGS = -I$(top_srcdir)/programs -I../$(top_srcdir)/programs -I$(top_srcdir)/lib
|
||||||
AM_LDFLAGS = -L$(top_builddir)/lib
|
AM_LDFLAGS = -L$(top_builddir)/lib
|
||||||
|
|
||||||
bin_PROGRAMS = Hadrons
|
bin_PROGRAMS = Hadrons
|
||||||
@ -11,31 +11,8 @@ Hadrons_SOURCES = \
|
|||||||
Hadrons.cc \
|
Hadrons.cc \
|
||||||
Module.cc
|
Module.cc
|
||||||
|
|
||||||
# general modules
|
# modules
|
||||||
Hadrons_SOURCES += \
|
include modules.inc
|
||||||
MQuark.cc
|
Hadrons_SOURCES += $(modules)
|
||||||
|
|
||||||
# fermion actions
|
|
||||||
Hadrons_SOURCES += \
|
|
||||||
AWilson.cc
|
|
||||||
|
|
||||||
# contraction modules
|
|
||||||
Hadrons_SOURCES += \
|
|
||||||
CMeson.cc
|
|
||||||
|
|
||||||
# gauge modules
|
|
||||||
Hadrons_SOURCES += \
|
|
||||||
GLoad.cc \
|
|
||||||
GRandom.cc \
|
|
||||||
GUnit.cc
|
|
||||||
|
|
||||||
# solver modules
|
|
||||||
Hadrons_SOURCES += \
|
|
||||||
SolRBPrecCG.cc
|
|
||||||
|
|
||||||
# source modules
|
|
||||||
Hadrons_SOURCES += \
|
|
||||||
SrcPoint.cc \
|
|
||||||
SrcZ2.cc
|
|
||||||
|
|
||||||
Hadrons_LDADD = -lGrid
|
Hadrons_LDADD = -lGrid
|
||||||
|
45
programs/Hadrons/Module.cc.template
Normal file
45
programs/Hadrons/Module.cc.template
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include <Hadrons/Modules/___FILEBASENAME___.hpp>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Hadrons;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* ___FILEBASENAME___ implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
___FILEBASENAME___::___FILEBASENAME___(const std::string name)
|
||||||
|
: Module(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// parse parameters ////////////////////////////////////////////////////////////
|
||||||
|
void ___FILEBASENAME___::parseParameters(XmlReader &reader, const std::string name)
|
||||||
|
{
|
||||||
|
read(reader, name, par_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
programs/Hadrons/Module.hpp.template
Normal file
43
programs/Hadrons/Module.hpp.template
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#ifndef Hadrons____FILEBASENAME____hpp_
|
||||||
|
#define Hadrons____FILEBASENAME____hpp_
|
||||||
|
|
||||||
|
#include <Hadrons/Global.hpp>
|
||||||
|
#include <Hadrons/Module.hpp>
|
||||||
|
#include <Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* ___FILEBASENAME___ *
|
||||||
|
******************************************************************************/
|
||||||
|
class ___FILEBASENAME___: public Module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
class Par: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(Par, unsigned int, i);
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
___FILEBASENAME___(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~___FILEBASENAME___(void) = default;
|
||||||
|
// parse parameters
|
||||||
|
virtual void parseParameters(XmlReader &reader, const std::string name);
|
||||||
|
// 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);
|
||||||
|
private:
|
||||||
|
Par par_;
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER(___FILEBASENAME___);
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons____FILEBASENAME____hpp_
|
15
programs/Hadrons/add_module.sh
Executable file
15
programs/Hadrons/add_module.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if (( $# != 1 )); then
|
||||||
|
echo "usage: `basename $0` <module name>" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
NAME=$1
|
||||||
|
|
||||||
|
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" Module.cc.template > Modules/${NAME}.cc
|
||||||
|
sed "s/___FILEBASENAME___/${NAME}/g" Module.hpp.template > Modules/${NAME}.hpp
|
||||||
|
./make_module_list.sh
|
4
programs/Hadrons/make_module_list.sh
Executable file
4
programs/Hadrons/make_module_list.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo 'modules =\' > modules.inc
|
||||||
|
find Modules -name '*.cc' -type f -print | sed 's/^/ /;$q;s/$/ \\/' >> modules.inc
|
10
programs/Hadrons/modules.inc
Normal file
10
programs/Hadrons/modules.inc
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
modules =\
|
||||||
|
Modules/AWilson.cc \
|
||||||
|
Modules/CMeson.cc \
|
||||||
|
Modules/GLoad.cc \
|
||||||
|
Modules/GRandom.cc \
|
||||||
|
Modules/GUnit.cc \
|
||||||
|
Modules/MQuark.cc \
|
||||||
|
Modules/SolRBPrecCG.cc \
|
||||||
|
Modules/SrcPoint.cc \
|
||||||
|
Modules/SrcZ2.cc
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/AWilson.hpp>
|
#include <Hadrons/Modules/AWilson.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/CMeson.hpp>
|
#include <Hadrons/Modules/CMeson.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace QCD;
|
using namespace QCD;
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/GLoad.hpp>
|
#include <Hadrons/Modules/GLoad.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
@ -25,13 +25,13 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/GRandom.hpp>
|
#include <Hadrons/Modules/GRandom.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* GRandom implementation *
|
* GRandom implementation *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
// constructor /////////////////////////////////////////////////////////////////
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
GRandom::GRandom(const std::string name)
|
GRandom::GRandom(const std::string name)
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/GUnit.hpp>
|
#include <Hadrons/Modules/GUnit.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/MQuark.hpp>
|
#include <Hadrons/Modules/MQuark.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace QCD;
|
using namespace QCD;
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/SolRBPrecCG.hpp>
|
#include <Hadrons/Modules/SolRBPrecCG.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace QCD;
|
using namespace QCD;
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/SrcPoint.hpp>
|
#include <Hadrons/Modules/SrcPoint.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
@ -25,7 +25,7 @@ See the full license in the file "LICENSE" in the top level distribution
|
|||||||
directory.
|
directory.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include <Hadrons/SrcZ2.hpp>
|
#include <Hadrons/Modules/SrcZ2.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
Loading…
x
Reference in New Issue
Block a user