mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
creating the necessary caches for the FFT EM scalar propagator
This commit is contained in:
parent
fc760016b3
commit
ad98b6193d
@ -1,4 +1,5 @@
|
|||||||
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
|
||||||
|
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
@ -15,7 +16,7 @@ TChargedProp::TChargedProp(const std::string name)
|
|||||||
// dependencies/products ///////////////////////////////////////////////////////
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
std::vector<std::string> TChargedProp::getInput(void)
|
std::vector<std::string> TChargedProp::getInput(void)
|
||||||
{
|
{
|
||||||
std::vector<std::string> in;
|
std::vector<std::string> in = {par().source, par().emField};
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
@ -30,11 +31,72 @@ std::vector<std::string> TChargedProp::getOutput(void)
|
|||||||
// setup ///////////////////////////////////////////////////////////////////////
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
void TChargedProp::setup(void)
|
void TChargedProp::setup(void)
|
||||||
{
|
{
|
||||||
|
freeMomPropName_ = FREEMOMPROP(par().mass);
|
||||||
|
shiftedMomPropName_.clear();
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
shiftedMomPropName_.push_back(freeMomPropName_ + "_"
|
||||||
|
+ std::to_string(mu));
|
||||||
|
}
|
||||||
|
if (!env().hasRegisteredObject(freeMomPropName_))
|
||||||
|
{
|
||||||
|
env().registerLattice<ScalarField>(freeMomPropName_);
|
||||||
|
}
|
||||||
|
if (!env().hasRegisteredObject(shiftedMomPropName_[0]))
|
||||||
|
{
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
env().registerLattice<ScalarField>(shiftedMomPropName_[mu]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
env().registerLattice<ScalarField>(getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
void TChargedProp::execute(void)
|
void TChargedProp::execute(void)
|
||||||
{
|
{
|
||||||
|
ScalarField &prop = *env().createLattice<ScalarField>(getName());
|
||||||
|
ScalarField &source = *env().getObject<ScalarField>(par().source);
|
||||||
|
ScalarField *freeMomProp;
|
||||||
|
std::vector<ScalarField *> shiftedMomProp;
|
||||||
|
Complex ci(0.0,1.0);
|
||||||
|
|
||||||
|
if (!env().hasCreatedObject(freeMomPropName_))
|
||||||
|
{
|
||||||
|
LOG(Message) << "Caching momentum space free scalar propagator"
|
||||||
|
<< " (mass= " << par().mass << ")..." << std::endl;
|
||||||
|
freeMomProp = env().createLattice<ScalarField>(freeMomPropName_);
|
||||||
|
Scalar<SIMPL>::MomentumSpacePropagator(*freeMomProp, par().mass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
freeMomProp = env().getObject<ScalarField>(freeMomPropName_);
|
||||||
|
}
|
||||||
|
if (!env().hasCreatedObject(shiftedMomPropName_[0]))
|
||||||
|
{
|
||||||
|
std::vector<int> &l = env().getGrid()->_fdimensions;
|
||||||
|
|
||||||
|
LOG(Message) << "Caching shifted momentum space free scalar propagator"
|
||||||
|
<< " (mass= " << par().mass << ")..." << std::endl;
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
Real twoPiL = M_PI*2./l[mu];
|
||||||
|
|
||||||
|
shiftedMomProp.push_back(
|
||||||
|
env().createLattice<ScalarField>(shiftedMomPropName_[mu]));
|
||||||
|
LatticeCoordinate(*(shiftedMomProp[mu]), mu);
|
||||||
|
*(shiftedMomProp[mu]) = exp(ci*twoPiL*(*(shiftedMomProp[mu])))
|
||||||
|
*(*freeMomProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
shiftedMomProp.push_back(
|
||||||
|
env().getObject<ScalarField>(shiftedMomPropName_[mu]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,16 @@ class ChargedPropPar: Serializable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GRID_SERIALIZABLE_CLASS_MEMBERS(ChargedPropPar,
|
GRID_SERIALIZABLE_CLASS_MEMBERS(ChargedPropPar,
|
||||||
unsigned int, i);
|
std::string, emField,
|
||||||
|
std::string, source,
|
||||||
|
double, mass,
|
||||||
|
std::string, output);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TChargedProp: public Module<ChargedPropPar>
|
class TChargedProp: public Module<ChargedPropPar>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
SCALAR_TYPE_ALIASES(SIMPL,);
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TChargedProp(const std::string name);
|
TChargedProp(const std::string name);
|
||||||
@ -33,6 +38,9 @@ public:
|
|||||||
virtual void setup(void);
|
virtual void setup(void);
|
||||||
// execution
|
// execution
|
||||||
virtual void execute(void);
|
virtual void execute(void);
|
||||||
|
private:
|
||||||
|
std::string freeMomPropName_;
|
||||||
|
std::vector<std::string> shiftedMomPropName_;
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_REGISTER_NS(ChargedProp, TChargedProp, MScalar);
|
MODULE_REGISTER_NS(ChargedProp, TChargedProp, MScalar);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user