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

Hadrons: Schur convention globally defined through a macro

This commit is contained in:
Antonin Portelli 2018-02-27 18:45:23 +00:00
parent 4828226095
commit 16ebbfff29
3 changed files with 24 additions and 9 deletions

View File

@ -181,6 +181,18 @@ typedef XmlWriter ResultWriter;
#define RESULT_FILE_NAME(name) \
name + "." + std::to_string(vm().getTrajectory()) + "." + resultFileExt
// default Schur convention
#ifndef HADRONS_DEFAULT_SCHUR
#define HADRONS_DEFAULT_SCHUR DiagMooee
#endif
#define _HADRONS_SCHUR_OP_(conv) Schur##conv##Operator
#define HADRONS_SCHUR_OP(conv) _HADRONS_SCHUR_OP_(conv)
#define HADRONS_DEFAULT_SCHUR_OP HADRONS_SCHUR_OP(HADRONS_DEFAULT_SCHUR)
#define _HADRONS_SCHUR_SOLVE_(conv) SchurRedBlack##conv##Solve
#define HADRONS_SCHUR_SOLVE(conv) _HADRONS_SCHUR_SOLVE_(conv)
#define HADRONS_DEFAULT_SCHUR_SOLVE HADRONS_SCHUR_SOLVE(HADRONS_DEFAULT_SCHUR)
END_HADRONS_NAMESPACE
#include <Grid/Hadrons/Exceptions.hpp>

View File

@ -63,7 +63,7 @@ public:
typedef LCL<FImpl, nBasis> LCL;
typedef FineEigenPack<FImpl> FineEigenPack;
typedef CoarseEigenPack<FImpl, nBasis> CoarseEigenPack;
typedef SchurDiagMooeeOperator<FMat, FermionField> SchurFMat;
typedef HADRONS_DEFAULT_SCHUR_OP<FMat, FermionField> SchurFMat;
public:
// constructor
TLocalCoherenceLanczos(const std::string name);

View File

@ -45,6 +45,7 @@ class RBPrecCGPar: Serializable
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(RBPrecCGPar ,
std::string , action,
unsigned int , maxIteration,
double , residual);
};
@ -117,14 +118,16 @@ void TRBPrecCG<FImpl>::setup(void)
auto &mat = envGet(FMat, par().action);
auto solver = [&mat, this](FermionField &sol, const FermionField &source)
{
ConjugateGradient<FermionField> cg(par().residual, 10000);
SchurRedBlackDiagMooeeSolve<FermionField> schurSolver(cg);
ConjugateGradient<FermionField> cg(par().residual,
par().maxIteration);
HADRONS_DEFAULT_SCHUR_SOLVE<FermionField> schurSolver(cg);
schurSolver(mat, source, sol);
};
envCreate(SolverFn, getName(), Ls, solver);
}
// execution ///////////////////////////////////////////////////////////////////
template <typename FImpl>
void TRBPrecCG<FImpl>::execute(void)