1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-04 11:15:55 +01:00

More uniform cache name for scalar momentum propagators

This commit is contained in:
Antonin Portelli 2017-01-11 18:39:58 +00:00
parent 2da86f7dae
commit fc760016b3
5 changed files with 20 additions and 12 deletions

View File

@ -8,6 +8,7 @@
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
#include <Grid/Hadrons/Modules/MSource/SeqGamma.hpp>

View File

@ -1,6 +1,5 @@
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
#define KERNAME "_" + getName() + "_momKernel"
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
using namespace Grid;
using namespace Hadrons;
@ -32,11 +31,11 @@ std::vector<std::string> TFreeProp::getOutput(void)
// setup ///////////////////////////////////////////////////////////////////////
void TFreeProp::setup(void)
{
std::string kerName = KERNAME;
freeMomPropName_ = FREEMOMPROP(par().mass);
if (!env().hasRegisteredObject(kerName))
if (!env().hasRegisteredObject(freeMomPropName_))
{
env().registerLattice<ScalarField>(kerName);
env().registerLattice<ScalarField>(freeMomPropName_);
}
env().registerLattice<ScalarField>(getName());
}
@ -46,22 +45,21 @@ void TFreeProp::execute(void)
{
ScalarField &prop = *env().createLattice<ScalarField>(getName());
ScalarField &source = *env().getObject<ScalarField>(par().source);
ScalarField *momKernel;
std::string kerName = KERNAME;
ScalarField *freeMomProp;
if (!env().hasCreatedObject(kerName))
if (!env().hasCreatedObject(freeMomPropName_))
{
LOG(Message) << "Caching momentum space free scalar propagator"
<< " (mass= " << par().mass << ")..." << std::endl;
momKernel = env().createLattice<ScalarField>(kerName);
Scalar<SIMPL>::MomentumSpacePropagator(*momKernel, par().mass);
freeMomProp = env().createLattice<ScalarField>(freeMomPropName_);
Scalar<SIMPL>::MomentumSpacePropagator(*freeMomProp, par().mass);
}
else
{
momKernel = env().getObject<ScalarField>(kerName);
freeMomProp = env().getObject<ScalarField>(freeMomPropName_);
}
LOG(Message) << "Computing free scalar propagator..." << std::endl;
Scalar<SIMPL>::FreePropagator(source, prop, *momKernel);
Scalar<SIMPL>::FreePropagator(source, prop, *freeMomProp);
if (!par().output.empty())
{

View File

@ -37,6 +37,8 @@ public:
virtual void setup(void);
// execution
virtual void execute(void);
private:
std::string freeMomPropName_;
};
MODULE_REGISTER_NS(FreeProp, TFreeProp, MScalar);

View File

@ -0,0 +1,6 @@
#ifndef Hadrons_Scalar_hpp_
#define Hadrons_Scalar_hpp_
#define FREEMOMPROP(m) "_scalar_mom_prop_" + std::to_string(m)
#endif // Hadrons_Scalar_hpp_

View File

@ -17,6 +17,7 @@ modules_hpp =\
Modules/MGauge/Unit.hpp \
Modules/MScalar/ChargedProp.hpp \
Modules/MScalar/FreeProp.hpp \
Modules/MScalar/Scalar.hpp \
Modules/MSolver/RBPrecCG.hpp \
Modules/MSource/Point.hpp \
Modules/MSource/SeqGamma.hpp \