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) \ #define RESULT_FILE_NAME(name) \
name + "." + std::to_string(vm().getTrajectory()) + "." + resultFileExt 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 END_HADRONS_NAMESPACE
#include <Grid/Hadrons/Exceptions.hpp> #include <Grid/Hadrons/Exceptions.hpp>

View File

@ -60,10 +60,10 @@ class TLocalCoherenceLanczos: public Module<LocalCoherenceLanczosPar>
{ {
public: public:
FERM_TYPE_ALIASES(FImpl,); FERM_TYPE_ALIASES(FImpl,);
typedef LCL<FImpl, nBasis> LCL; typedef LCL<FImpl, nBasis> LCL;
typedef FineEigenPack<FImpl> FineEigenPack; typedef FineEigenPack<FImpl> FineEigenPack;
typedef CoarseEigenPack<FImpl, nBasis> CoarseEigenPack; typedef CoarseEigenPack<FImpl, nBasis> CoarseEigenPack;
typedef SchurDiagMooeeOperator<FMat, FermionField> SchurFMat; typedef HADRONS_DEFAULT_SCHUR_OP<FMat, FermionField> SchurFMat;
public: public:
// constructor // constructor
TLocalCoherenceLanczos(const std::string name); TLocalCoherenceLanczos(const std::string name);

View File

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