From 3d3e8f4f9fe79d3089c6566e7fc89dd635886b63 Mon Sep 17 00:00:00 2001 From: Michael Marshall Date: Wed, 23 Jan 2019 12:59:55 +0000 Subject: [PATCH] Structured objects passed into LapEvec --- Hadrons/Modules/MDistil/LapEvec.hpp | 83 +++++++++++++++++++++++----- tests/hadrons/Test_hadrons_distil.cc | 5 +- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/Hadrons/Modules/MDistil/LapEvec.hpp b/Hadrons/Modules/MDistil/LapEvec.hpp index 06be0bbc..aac71ea3 100644 --- a/Hadrons/Modules/MDistil/LapEvec.hpp +++ b/Hadrons/Modules/MDistil/LapEvec.hpp @@ -42,23 +42,30 @@ BEGIN_HADRONS_NAMESPACE BEGIN_MODULE_NAMESPACE(MDistil) /****************************************************************************** - * LapEvec * - ***** TEST ***** + + Laplacian eigenvectors - parameters + ******************************************************************************/ - -class LapEvecPar: Serializable -{ -public: - GRID_SERIALIZABLE_CLASS_MEMBERS(LapEvecPar, - // StoutParameters, +struct StoutParameters: Serializable { + GRID_SERIALIZABLE_CLASS_MEMBERS(StoutParameters, int, steps, - double, parm, - // ChebyshevParameters, + double, parm) + StoutParameters() = default; + template StoutParameters(Reader& Reader){read(Reader,"StoutSmearing",*this);} +}; + +struct ChebyshevParameters: Serializable { + GRID_SERIALIZABLE_CLASS_MEMBERS(ChebyshevParameters, int, PolyOrder, double, alpha, - double, beta, - // LanczosParameters, + double, beta) + ChebyshevParameters() = default; + template ChebyshevParameters(Reader& Reader){read(Reader,"Chebyshev",*this);} +}; + +struct LanczosParameters: Serializable { + GRID_SERIALIZABLE_CLASS_MEMBERS(LanczosParameters, int, Nstart, int, Nvec, int, Nk, @@ -66,9 +73,51 @@ public: int, Np, int, MaxIt, int, MinRes, - double, resid); + double, resid) + LanczosParameters() = default; + template LanczosParameters(Reader& Reader){read(Reader,"Lanczos",*this);} }; +struct DistilParameters: Serializable { + GRID_SERIALIZABLE_CLASS_MEMBERS(DistilParameters, + int, TI, + int, LI, + int, Nnoise, + int, Ls, // For makeFiveDimGrid + int, tSrc) + DistilParameters() = default; + template DistilParameters(Reader& Reader){read(Reader,"Distil",*this);} +}; + +struct SolverParameters: Serializable { + GRID_SERIALIZABLE_CLASS_MEMBERS(SolverParameters, + double, CGPrecision, + int, MaxIterations, + double, mass, + double, M5) + SolverParameters() = default; + template SolverParameters(Reader& Reader){read(Reader,"Solver",*this);} +}; + +// These are the actual parameters passed to the module during construction + +class LapEvecPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(LapEvecPar, + StoutParameters, Stout, + ChebyshevParameters, Cheby, + LanczosParameters, Lanczos, + DistilParameters, Distil, + SolverParameters, Solver); +}; + +/****************************************************************************** + + Laplacian eigenvectors - Module (class) definition + + ******************************************************************************/ + template class TLapEvec: public Module { @@ -118,14 +167,18 @@ std::vector TLapEvec::getOutput(void) template void TLapEvec::setup(void) { - + LOG(Message) << "setup() : start" << std::endl; + LOG(Message) << "Stout.steps=" << par().Stout.steps << ", Stout.parm=" << par().Stout.parm << std::endl; + LOG(Message) << "setup() : end" << std::endl; } // execution /////////////////////////////////////////////////////////////////// template void TLapEvec::execute(void) { - + LOG(Message) << "execute() : start" << std::endl; + LOG(Message) << "Stout.steps=" << par().Stout.steps << ", Stout.parm=" << par().Stout.parm << std::endl; + LOG(Message) << "execute() : end" << std::endl; } END_MODULE_NAMESPACE diff --git a/tests/hadrons/Test_hadrons_distil.cc b/tests/hadrons/Test_hadrons_distil.cc index 1d16b086..276a69f7 100644 --- a/tests/hadrons/Test_hadrons_distil.cc +++ b/tests/hadrons/Test_hadrons_distil.cc @@ -236,7 +236,10 @@ void test_LapEvec(Application &application) // gauge field application.createModule("gauge"); // Now make an instance of the LapEvec object - application.createModule("LapEvecInstance"); + MDistil::LapEvecPar levPar; + levPar.Stout.steps = 173; + levPar.Stout.parm = -9.87654321; + application.createModule("LapEvec",levPar); } /////////////////////////////////////////////////////////////