1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 15:27:06 +01:00

Code cleaning, the fermion implementation can be sepcified using the macro FIMPL

This commit is contained in:
2016-11-27 16:47:22 +09:00
parent 7a1a7a685e
commit a8843c9af6
12 changed files with 33 additions and 24 deletions

View File

@ -49,6 +49,8 @@ public:
class ADWF: public Module<ADWFPar>
{
public:
typedef FermionOperator<FIMPL> FMat;
public:
// constructor
ADWF(const std::string name);

View File

@ -47,6 +47,8 @@ public:
class AWilson: public Module<AWilsonPar>
{
public:
typedef FermionOperator<FIMPL> FMat;
public:
// constructor
AWilson(const std::string name);

View File

@ -76,7 +76,7 @@ void MQuark::execute(void)
<< std::endl;
LatticePropagator &prop = *env().createLattice<LatticePropagator>(propName);
LatticePropagator &fullSrc = *env().getObject<LatticePropagator>(par().source);
Environment::Solver &solver = *env().getObject<Environment::Solver>(par().solver);
Solver &solver = *env().getObject<Solver>(par().solver);
if (Ls_ > 1)
{
env().createLattice<LatticePropagator>(getName());

View File

@ -47,6 +47,9 @@ public:
class MQuark: public Module<MQuarkPar>
{
public:
typedef FIMPL::FermionField FermionField;
typedef std::function<void(FermionField &, const FermionField &)> Solver;
public:
// constructor
MQuark(const std::string name);
@ -60,8 +63,8 @@ public:
// execution
virtual void execute(void);
private:
unsigned int Ls_;
Environment::Solver *solver_{nullptr};
unsigned int Ls_;
Solver *solver_{nullptr};
};
MODULE_REGISTER(MQuark);

View File

@ -66,7 +66,7 @@ void SolRBPrecCG::setup(void)
// execution ///////////////////////////////////////////////////////////////////
void SolRBPrecCG::execute(void)
{
auto &mat = *(env().getObject<Environment::FMat>(par().action));
auto &mat = *(env().getObject<FMat>(par().action));
auto solver = [&mat, this](LatticeFermion &sol,
const LatticeFermion &source)
{
@ -79,5 +79,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 Environment::Solver(solver));
env().setObject(getName(), new Solver(solver));
}

View File

@ -47,6 +47,10 @@ public:
class SolRBPrecCG: public Module<SolRBPrecCGPar>
{
public:
typedef FermionOperator<FIMPL> FMat;
typedef FIMPL::FermionField FermionField;
typedef std::function<void(FermionField &, const FermionField &)> Solver;
public:
// constructor
SolRBPrecCG(const std::string name);