diff --git a/programs/Hadrons/AWilson.cc b/programs/Hadrons/AWilson.cc index f9de0926..ad5cae2a 100644 --- a/programs/Hadrons/AWilson.cc +++ b/programs/Hadrons/AWilson.cc @@ -26,18 +26,16 @@ directory. *******************************************************************************/ #include -#include using namespace Grid; -using namespace QCD; using namespace Hadrons; /****************************************************************************** -* AWilson implementation * +* AWilson implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// AWilson::AWilson(const std::string name) -: FermionAction(name) +: Module(name) {} // parse parameters //////////////////////////////////////////////////////////// @@ -46,12 +44,28 @@ void AWilson::parseParameters(XmlReader &reader, const std::string name) read(reader, name, par_); } -// create operator ///////////////////////////////////////////////////////////// -void AWilson::create(Environment &env) +// dependencies/products /////////////////////////////////////////////////////// +std::vector AWilson::getInput(void) { - auto &U = *env.getGauge(); + std::vector in = {par_.gauge}; + + return in; +} + +std::vector AWilson::getOutput(void) +{ + std::vector out = {getName()}; + + return out; +} + +// execution /////////////////////////////////////////////////////////////////// +void AWilson::execute(Environment &env) +{ + auto &U = *env.getGauge(par_.gauge); auto &grid = *env.getGrid(); auto &gridRb = *env.getRbGrid(); - setFMat(new WilsonFermionR(U, grid, gridRb, par_.mass)); + env.addFermionMatrix(getName(), + new WilsonFermionR(U, grid, gridRb, par_.mass)); } diff --git a/programs/Hadrons/AWilson.hpp b/programs/Hadrons/AWilson.hpp index aa40b99d..cf21eff3 100644 --- a/programs/Hadrons/AWilson.hpp +++ b/programs/Hadrons/AWilson.hpp @@ -29,21 +29,22 @@ directory. #define Hadrons_AWilson_hpp_ #include -#include -#include +#include +#include BEGIN_HADRONS_NAMESPACE /****************************************************************************** - * Wilson fermions * + * Wilson quark action * ******************************************************************************/ -class AWilson: public FermionAction +class AWilson: public Module { public: class Par: Serializable { public: - GRID_SERIALIZABLE_CLASS_MEMBERS(Par, double, mass); + GRID_SERIALIZABLE_CLASS_MEMBERS(Par, std::string, gauge, + double , mass); }; public: // constructor @@ -52,13 +53,16 @@ public: virtual ~AWilson(void) = default; // parse parameters virtual void parseParameters(XmlReader &reader, const std::string name); - // create operator - virtual void create(Environment &env); + // dependencies/products + virtual std::vector getInput(void); + virtual std::vector getOutput(void); + // execution + virtual void execute(Environment &env); private: Par par_; }; -ACTION_REGISTER(AWilson); +MODULE_REGISTER(AWilson); END_HADRONS_NAMESPACE diff --git a/programs/Hadrons/Application.cc b/programs/Hadrons/Application.cc index 1a24f8b6..d8b0d0da 100644 --- a/programs/Hadrons/Application.cc +++ b/programs/Hadrons/Application.cc @@ -39,17 +39,10 @@ using namespace Hadrons; Application::Application(const std::string parameterFileName) : parameterFileName_(parameterFileName) , env_(Environment::getInstance()) -, actionFactory_(FermionActionFactory::getInstance()) , modFactory_(ModuleFactory::getInstance()) { - LOG(Message) << "Fermion actions available:" << std::endl; - auto list = actionFactory_.getBuilderList(); - for (auto &m: list) - { - LOG(Message) << " " << m << std::endl; - } LOG(Message) << "Modules available:" << std::endl; - list = modFactory_.getBuilderList(); + auto list = modFactory_.getBuilderList(); for (auto &m: list) { LOG(Message) << " " << m << std::endl; @@ -84,18 +77,6 @@ void Application::parseParameterFile(void) LOG(Message) << "Reading '" << parameterFileName_ << "'..." << std::endl; read(reader, "parameters", par_); - push(reader, "actions"); - push(reader, "action"); - do - { - read(reader, "id", id); - env_.addFermionAction(actionFactory_.create(id.type, id.name)); - auto &action = *env_.getFermionAction(id.name); - action.parseParameters(reader, "options"); - action.create(env_); - } while (reader.nextElement("action")); - pop(reader); - pop(reader); push(reader, "modules"); push(reader, "module"); do @@ -190,7 +171,6 @@ void Application::configLoop(void) { LOG(Message) << "Starting measurement for trajectory " << t << std::endl; - env_.loadUnitGauge(); execute(program_); env_.freeAll(); } @@ -219,8 +199,8 @@ unsigned int Application::execute(const std::vector &program) } for (unsigned int i = 0; i < program.size(); ++i) { - LOG(Message) << "Measurement step (" << i+1 << "/" << program.size() - << ")" << std::endl; + LOG(Message) << "Measurement step " << i+1 << "/" << program.size() + << " (module '" << program[i] << "')" << std::endl; (*module_[program[i]])(env_); LOG(Message) << "allocated propagators: " << env_.nProp() << std::endl; if (env_.nProp() > memPeak) diff --git a/programs/Hadrons/Application.hpp b/programs/Hadrons/Application.hpp index a5e0e3c4..de788956 100644 --- a/programs/Hadrons/Application.hpp +++ b/programs/Hadrons/Application.hpp @@ -29,7 +29,6 @@ directory. #define Hadrons_Application_hpp_ #include -#include #include #include @@ -90,7 +89,6 @@ private: std::string parameterFileName_; GlobalPar par_; Environment &env_; - FermionActionFactory &actionFactory_; ModuleFactory &modFactory_; std::map> module_; std::map associatedModule_; diff --git a/programs/Hadrons/CMeson.cc b/programs/Hadrons/CMeson.cc index a6e958f9..eb746061 100644 --- a/programs/Hadrons/CMeson.cc +++ b/programs/Hadrons/CMeson.cc @@ -45,7 +45,7 @@ void CMeson::parseParameters(XmlReader &reader, const std::string name) read(reader, name, par_); } -// dependency relation ///////////////////////////////////////////////////////// +// dependencies/products /////////////////////////////////////////////////////// std::vector CMeson::getInput(void) { std::vector input = {par_.q1, par_.q2}; diff --git a/programs/Hadrons/CMeson.hpp b/programs/Hadrons/CMeson.hpp index 5e18cfbf..29620726 100644 --- a/programs/Hadrons/CMeson.hpp +++ b/programs/Hadrons/CMeson.hpp @@ -61,7 +61,7 @@ public: virtual ~CMeson(void) = default; // parse parameters virtual void parseParameters(XmlReader &reader, const std::string name); - // dependency relation + // dependencies/products virtual std::vector getInput(void); virtual std::vector getOutput(void); // execution diff --git a/programs/Hadrons/Environment.cc b/programs/Hadrons/Environment.cc index ebd8d010..c72e1fca 100644 --- a/programs/Hadrons/Environment.cc +++ b/programs/Hadrons/Environment.cc @@ -42,8 +42,6 @@ Environment::Environment(void) GridDefaultMpi())); gridRb4d_.reset(SpaceTimeGrid::makeFourDimRedBlackGrid(grid4d_.get())); rng4d_.reset(new GridParallelRNG(grid4d_.get())); - gauge_.reset(new LatticeGaugeField(grid4d_.get())); - loadUnitGauge(); } // dry run ///////////////////////////////////////////////////////////////////// @@ -97,22 +95,22 @@ GridRedBlackCartesian * Environment::getRbGrid(const unsigned int Ls) const } // fermion actions ///////////////////////////////////////////////////////////// -void Environment::addFermionAction(FActionPt action) +void Environment::addFermionMatrix(const std::string name, FMat *fMat) { - fAction_[action->getName()] = std::move(action); + fMat_[name].reset(fMat); } -FermionAction * Environment::getFermionAction(const std::string name) const +Environment::FMat * Environment::getFermionMatrix(const std::string name) const { try { - return fAction_.at(name).get(); + return fMat_.at(name).get(); } catch(std::out_of_range &) { try { - return fAction_.at(solverAction_.at(name)).get(); + return fMat_.at(solverAction_.at(name)).get(); } catch (std::out_of_range &) { @@ -143,9 +141,9 @@ void Environment::callSolver(const std::string name, LatticeFermion &sol, } // quark propagators /////////////////////////////////////////////////////////// -void Environment::addProp(const std::string name, const unsigned int Ls) +void Environment::createProp(const std::string name, const unsigned int Ls) { - GridCartesian *p4 = grid4d_.get(); + GridCartesian *g4 = getGrid(); if (propExists(name)) { @@ -153,21 +151,21 @@ void Environment::addProp(const std::string name, const unsigned int Ls) } if (Ls > 1) { - GridCartesian *p; + GridCartesian *g; try { - p = grid5d_.at(Ls).get(); + g = grid5d_.at(Ls).get(); } catch(std::out_of_range &) { - grid5d_[Ls].reset(SpaceTimeGrid::makeFiveDimGrid(Ls, p4)); - gridRb5d_[Ls].reset(SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls, p4)); - p = grid5d_[Ls].get(); + grid5d_[Ls].reset(SpaceTimeGrid::makeFiveDimGrid(Ls, g4)); + gridRb5d_[Ls].reset(SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls, g4)); + g = grid5d_[Ls].get(); } if (!isDryRun()) { - prop_[name].reset(new LatticePropagator(p)); + prop_[name].reset(new LatticePropagator(g)); } else { @@ -179,7 +177,7 @@ void Environment::addProp(const std::string name, const unsigned int Ls) { if (!isDryRun()) { - prop_[name].reset(new LatticePropagator(p4)); + prop_[name].reset(new LatticePropagator(g4)); } else { @@ -269,19 +267,44 @@ unsigned int Environment::nProp(void) const } // gauge configuration ///////////////////////////////////////////////////////// -LatticeGaugeField * Environment::getGauge(void) const +void Environment::createGauge(const std::string name) { - return gauge_.get(); + if (gaugeExists(name)) + { + HADRON_ERROR("gauge field '" + name + "' already exists"); + } + gauge_[name].reset(new LatticeGaugeField(getGrid())); } -void Environment::loadUnitGauge(void) +void Environment::freeGauge(const std::string name) { - SU3::ColdConfiguration(*rng4d_, *gauge_); + if (gaugeExists(name)) + { + gauge_.erase(name); + } + else + { + HADRON_ERROR("trying to free unknown gauge field '" + name + "'"); + } } -void Environment::loadRandomGauge(void) +LatticeGaugeField * Environment::getGauge(const std::string name) const { - SU3::HotConfiguration(*rng4d_, *gauge_); + if (gaugeExists(name)) + { + return gauge_.at(name).get(); + } + else + { + HADRON_ERROR("gauge field '" + name + "' unknown"); + + return nullptr; + } +} + +bool Environment::gaugeExists(const std::string name) const +{ + return (gauge_.find(name) != gauge_.end()); } // random number generator ///////////////////////////////////////////////////// @@ -300,13 +323,19 @@ void Environment::free(const std::string name) { if (propExists(name)) { - LOG(Message) << "freeing '" << name << "'" << std::endl; + LOG(Message) << "freeing propagator '" << name << "'" << std::endl; freeProp(name); } + else if (gaugeExists(name)) + { + LOG(Message) << "freeing gauge field '" << name << "'" << std::endl; + freeGauge(name); + } } void Environment::freeAll(void) { prop_.clear(); propSize_.clear(); + gauge_.clear(); } diff --git a/programs/Hadrons/Environment.hpp b/programs/Hadrons/Environment.hpp index 906c5aa1..91f0ec23 100644 --- a/programs/Hadrons/Environment.hpp +++ b/programs/Hadrons/Environment.hpp @@ -29,7 +29,6 @@ directory. #define Hadrons_Environment_hpp_ #include -#include BEGIN_HADRONS_NAMESPACE @@ -40,12 +39,13 @@ class Environment { SINGLETON(Environment); public: + typedef FermionOperator FMat; typedef std::function Solver; typedef std::unique_ptr GridPt; typedef std::unique_ptr GridRbPt; typedef std::unique_ptr RngPt; - typedef std::unique_ptr FActionPt; + typedef std::unique_ptr FMatPt; typedef std::unique_ptr PropPt; typedef std::unique_ptr GaugePt; public: @@ -56,8 +56,8 @@ public: GridCartesian * getGrid(const unsigned int Ls = 1) const; GridRedBlackCartesian * getRbGrid(const unsigned int Ls = 1) const; // fermion actions - void addFermionAction(FActionPt action); - FermionAction * getFermionAction(const std::string name) const; + void addFermionMatrix(const std::string name, FMat *mat); + FMat * getFermionMatrix(const std::string name) const; // solvers void addSolver(const std::string name, Solver s, const std::string actionName); @@ -65,18 +65,19 @@ public: LatticeFermion &sol, const LatticeFermion &src) const; // quark propagators - void addProp(const std::string name, - const unsigned int Ls = 1); + void createProp(const std::string name, + const unsigned int Ls = 1); void freeProp(const std::string name); bool isProp5d(const std::string name) const; unsigned int getPropLs(const std::string name) const; LatticePropagator * getProp(const std::string name) const; bool propExists(const std::string name) const; unsigned int nProp(void) const; - // gauge configuration - LatticeGaugeField * getGauge(void) const; - void loadUnitGauge(void); - void loadRandomGauge(void); + // gauge configurations + void createGauge(const std::string name); + void freeGauge(const std::string name); + LatticeGaugeField * getGauge(const std::string name) const; + bool gaugeExists(const std::string name) const; // random number generator void setSeed(const std::vector &seed); GridParallelRNG * get4dRng(void) const; @@ -90,13 +91,12 @@ private: GridRbPt gridRb4d_; std::map gridRb5d_; RngPt rng4d_; - std::map fAction_; + std::map fMat_; std::map solver_; std::map solverAction_; std::map prop_; std::map propSize_; - GaugePt gauge_; - + std::map gauge_; }; END_HADRONS_NAMESPACE diff --git a/programs/Hadrons/FermionAction.hpp b/programs/Hadrons/FermionAction.hpp deleted file mode 100644 index f3cd1cf7..00000000 --- a/programs/Hadrons/FermionAction.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* -Grid physics library, www.github.com/paboyle/Grid - -Source file: programs/Hadrons/FermionAction.hpp - -Copyright (C) 2016 - -Author: Antonin Portelli - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -See the full license in the file "LICENSE" in the top level distribution -directory. -*******************************************************************************/ - -#ifndef Hadrons_FermionAction_hpp_ -#define Hadrons_FermionAction_hpp_ - -#include - -BEGIN_HADRONS_NAMESPACE - -// action registration macro -#define ACTION_REGISTER(action)\ -class action##ActionRegistrar\ -{\ -public:\ - action##ActionRegistrar(void)\ - {\ - FermionActionFactory &actionFac = FermionActionFactory::getInstance();\ - actionFac.registerBuilder(#action, [&](const std::string name)\ - {\ - return std::unique_ptr(\ - new action(name));\ - });\ - }\ -};\ -static action##ActionRegistrar action##ActionRegistrarInstance; - -/****************************************************************************** - * FermionAction * - ******************************************************************************/ -class Environment; - -class FermionAction -{ -public: - typedef FermionOperator FMat; - typedef std::unique_ptr FMatPt; -public: - // constructor - FermionAction(const std::string name); - // destructor - virtual ~FermionAction(void) = default; - // access - std::string getName(void) const; - virtual unsigned int getLs(void) const; - void setFMat(FMat *fMat); - FMat * getFMat(void); - // parse parameters - virtual void parseParameters(XmlReader &reader, const std::string name) = 0; - // create operator - virtual void create(Environment &env) = 0; -private: - std::string name_; - FMatPt fMat_; -}; - -END_HADRONS_NAMESPACE - -#endif // Hadrons_FermionAction_hpp_ diff --git a/programs/Hadrons/FermionAction.cc b/programs/Hadrons/GUnit.cc similarity index 59% rename from programs/Hadrons/FermionAction.cc rename to programs/Hadrons/GUnit.cc index fdd9530c..ce406612 100644 --- a/programs/Hadrons/FermionAction.cc +++ b/programs/Hadrons/GUnit.cc @@ -1,7 +1,7 @@ /******************************************************************************* Grid physics library, www.github.com/paboyle/Grid -Source file: programs/Hadrons/FermionAction.cc +Source file: programs/Hadrons/GUnit.cc Copyright (C) 2016 @@ -25,37 +25,41 @@ See the full license in the file "LICENSE" in the top level distribution directory. *******************************************************************************/ -#include +#include using namespace Grid; -using namespace QCD; using namespace Hadrons; /****************************************************************************** - * FermionAction implementation * - ******************************************************************************/ +* GUnit implementation * +******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// -FermionAction::FermionAction(const std::string name) -: name_(name) +GUnit::GUnit(const std::string name) +: Module(name) {} -// access ////////////////////////////////////////////////////////////////////// -std::string FermionAction::getName(void) const +// dependencies/products /////////////////////////////////////////////////////// +std::vector GUnit::getInput(void) { - return name_; + return std::vector(); } -unsigned int FermionAction::getLs(void) const +std::vector GUnit::getOutput(void) { - return 1; + std::vector out = {getName()}; + + return out; } -void FermionAction::setFMat(FMat *fMat) +// allocation ////////////////////////////////////////////////////////////////// +void GUnit::allocate(Environment &env) { - fMat_.reset(fMat); + env.createGauge(getName()); + gauge_ = env.getGauge(getName()); } -FermionAction::FMat * FermionAction::getFMat(void) +// execution /////////////////////////////////////////////////////////////////// +void GUnit::execute(Environment &env) { - return fMat_.get(); + SU3::ColdConfiguration(*env.get4dRng(), *gauge_); } diff --git a/programs/Hadrons/FermionActionFactory.hpp b/programs/Hadrons/GUnit.hpp similarity index 64% rename from programs/Hadrons/FermionActionFactory.hpp rename to programs/Hadrons/GUnit.hpp index d9522c31..21e9a15f 100644 --- a/programs/Hadrons/FermionActionFactory.hpp +++ b/programs/Hadrons/GUnit.hpp @@ -1,7 +1,7 @@ /******************************************************************************* Grid physics library, www.github.com/paboyle/Grid -Source file: programs/Hadrons/FermionActionFactory.hpp +Source file: programs/Hadrons/GUnit.hpp Copyright (C) 2016 @@ -25,23 +25,38 @@ See the full license in the file "LICENSE" in the top level distribution directory. *******************************************************************************/ -#ifndef Hadrons_FermionActionFactory_hpp_ -#define Hadrons_FermionActionFactory_hpp_ +#ifndef Hadrons_GUnit_hpp_ +#define Hadrons_GUnit_hpp_ #include -#include -#include +#include +#include BEGIN_HADRONS_NAMESPACE /****************************************************************************** - * FermionActionFactory * + * Unit gauge * ******************************************************************************/ -class FermionActionFactory: public Factory +class GUnit: public Module { - SINGLETON_DEFCTOR(FermionActionFactory) +public: + // constructor + GUnit(const std::string name); + // destructor + virtual ~GUnit(void) = default; + // dependencies/products + virtual std::vector getInput(void); + virtual std::vector getOutput(void); + // allocation + virtual void allocate(Environment &env); + // execution + virtual void execute(Environment &env); +private: + LatticeGaugeField *gauge_ = nullptr; }; +MODULE_REGISTER(GUnit); + END_HADRONS_NAMESPACE -#endif // Hadrons_FermionActionFactory_hpp_ +#endif // Hadrons_GUnit_hpp_ diff --git a/programs/Hadrons/MQuark.cc b/programs/Hadrons/MQuark.cc index 04f9042d..b95493e7 100644 --- a/programs/Hadrons/MQuark.cc +++ b/programs/Hadrons/MQuark.cc @@ -39,13 +39,13 @@ MQuark::MQuark(const std::string name) : Module(name) {} -// parse parameters +// parse parameters //////////////////////////////////////////////////////////// void MQuark::parseParameters(XmlReader &reader, const std::string name) { read(reader, name, par_); } -// dependency relation +// dependencies/products /////////////////////////////////////////////////////// std::vector MQuark::getInput(void) { std::vector in = {par_.source, par_.solver}; @@ -63,22 +63,31 @@ std::vector MQuark::getOutput(void) // setup /////////////////////////////////////////////////////////////////////// void MQuark::setup(Environment &env) { - Ls_ = env.getFermionAction(par_.solver)->getLs(); + auto dim = env.getFermionMatrix(par_.solver)->Grid()->GlobalDimensions(); + + if (dim.size() == Nd) + { + Ls_ = 1; + } + else + { + Ls_ = dim[0]; + } } // allocation ////////////////////////////////////////////////////////////////// void MQuark::allocate(Environment &env) { - env.addProp(getName()); + env.createProp(getName()); quark_ = env.getProp(getName()); if (Ls_ > 1) { - env.addProp(getName() + "_5d", Ls_); + env.createProp(getName() + "_5d", Ls_); quark5d_ = env.getProp(getName() + "_5d"); } } -// execution +// execution /////////////////////////////////////////////////////////////////// void MQuark::execute(Environment &env) { LatticePropagator *fullSource; diff --git a/programs/Hadrons/MQuark.hpp b/programs/Hadrons/MQuark.hpp index 90e5f0e4..5b14d0aa 100644 --- a/programs/Hadrons/MQuark.hpp +++ b/programs/Hadrons/MQuark.hpp @@ -53,7 +53,7 @@ public: virtual ~MQuark(void) = default; // parse parameters virtual void parseParameters(XmlReader &reader, const std::string name); - // dependency relation + // dependencies/products virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup diff --git a/programs/Hadrons/MSource.cc b/programs/Hadrons/MSource.cc index 3897db7c..923d5e94 100644 --- a/programs/Hadrons/MSource.cc +++ b/programs/Hadrons/MSource.cc @@ -41,13 +41,13 @@ MSource::MSource(const std::string name) : Module(name) {} -// parse parameters +// parse parameters //////////////////////////////////////////////////////////// void MSource::parseParameters(XmlReader &reader, const std::string name) { read(reader, name, par_); } -// dependency relation +// dependencies/products /////////////////////////////////////////////////////// std::vector MSource::getInput(void) { return std::vector(); @@ -68,7 +68,7 @@ void MSource::allocate(Environment &env) // 4D sources case Grid::SourceType::point: case Grid::SourceType::z2Band: - env.addProp(getName()); + env.createProp(getName()); src_ = env.getProp(getName()); break; // error diff --git a/programs/Hadrons/MSource.hpp b/programs/Hadrons/MSource.hpp index 3bc901ad..490be342 100644 --- a/programs/Hadrons/MSource.hpp +++ b/programs/Hadrons/MSource.hpp @@ -84,7 +84,7 @@ public: virtual ~MSource(void) = default; // parse parameters virtual void parseParameters(XmlReader &reader, const std::string name); - // dependency relation + // dependencies/products virtual std::vector getInput(void); virtual std::vector getOutput(void); // allocation diff --git a/programs/Hadrons/Makefile.am b/programs/Hadrons/Makefile.am index 41da337e..499122ac 100644 --- a/programs/Hadrons/Makefile.am +++ b/programs/Hadrons/Makefile.am @@ -3,30 +3,33 @@ AM_LDFLAGS = -L$(top_builddir)/lib bin_PROGRAMS = Hadrons -## general sources +# general sources Hadrons_SOURCES = \ Application.cc \ Environment.cc \ - FermionAction.cc\ Global.cc \ Hadrons.cc \ Module.cc -## fermion actions -Hadrons_SOURCES += \ - AWilson.cc - -## general modules +# general modules Hadrons_SOURCES += \ MQuark.cc \ MSource.cc -## solver modules +# fermion actions Hadrons_SOURCES += \ - SRBPrecCG.cc + AWilson.cc -## contraction modules +# contraction modules Hadrons_SOURCES += \ CMeson.cc +# gauge modules +Hadrons_SOURCES += \ + GUnit.cc + +# solver modules +Hadrons_SOURCES += \ + SRBPrecCG.cc + Hadrons_LDADD = -lGrid diff --git a/programs/Hadrons/Module.hpp b/programs/Hadrons/Module.hpp index 4153e77b..1f529944 100644 --- a/programs/Hadrons/Module.hpp +++ b/programs/Hadrons/Module.hpp @@ -62,8 +62,8 @@ public: // access std::string getName(void) const; // parse parameters - virtual void parseParameters(XmlReader &reader, const std::string name) = 0; - // dependency relation + virtual void parseParameters(XmlReader &reader, const std::string name) {}; + // dependencies/products virtual std::vector getInput(void) = 0; virtual std::vector getOutput(void) = 0; // setup diff --git a/programs/Hadrons/SRBPrecCG.cc b/programs/Hadrons/SRBPrecCG.cc index ff4a50d5..42ee332f 100644 --- a/programs/Hadrons/SRBPrecCG.cc +++ b/programs/Hadrons/SRBPrecCG.cc @@ -39,16 +39,18 @@ SRBPrecCG::SRBPrecCG(const std::string name) : Module(name) {} -// parse parameters +// parse parameters //////////////////////////////////////////////////////////// void SRBPrecCG::parseParameters(XmlReader &reader, const std::string name) { read(reader, name, par_); } -// dependency relation +// dependencies/products /////////////////////////////////////////////////////// std::vector SRBPrecCG::getInput(void) { - return std::vector(); + std::vector in = {par_.action}; + + return in; } std::vector SRBPrecCG::getOutput(void) @@ -61,7 +63,7 @@ std::vector SRBPrecCG::getOutput(void) // execution /////////////////////////////////////////////////////////////////// void SRBPrecCG::execute(Environment &env) { - auto &mat = *(env.getFermionAction(par_.action)->getFMat()); + auto &mat = *(env.getFermionMatrix(par_.action)); auto solver = [&mat, this](LatticeFermion &sol, const LatticeFermion &source) { diff --git a/programs/Hadrons/SRBPrecCG.hpp b/programs/Hadrons/SRBPrecCG.hpp index 1b072c37..f657bd50 100644 --- a/programs/Hadrons/SRBPrecCG.hpp +++ b/programs/Hadrons/SRBPrecCG.hpp @@ -35,7 +35,7 @@ directory. BEGIN_HADRONS_NAMESPACE /****************************************************************************** - * SRBPrecCG * + * Schur red-black preconditioned CG * ******************************************************************************/ class SRBPrecCG: public Module { @@ -53,7 +53,7 @@ public: virtual ~SRBPrecCG(void) = default; // parse parameters virtual void parseParameters(XmlReader &reader, const std::string name); - // dependency relation + // dependencies/products virtual std::vector getInput(void); virtual std::vector getOutput(void); // execution