mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 15:55:37 +00:00
Add functions momD1 and momD2 to ScalarVP
This commit is contained in:
parent
4512dbdf58
commit
9f755e0379
@ -36,11 +36,77 @@ std::vector<std::string> TScalarVP::getOutput(void)
|
|||||||
// setup ///////////////////////////////////////////////////////////////////////
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
void TScalarVP::setup(void)
|
void TScalarVP::setup(void)
|
||||||
{
|
{
|
||||||
|
phaseName_.clear();
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
phaseName_.push_back("_shiftphase_" + std::to_string(mu));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
void TScalarVP::execute(void)
|
void TScalarVP::execute(void)
|
||||||
{
|
{
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
phase_.push_back(env().getObject<ScalarField>(phaseName_[mu]));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TScalarVP::momD1(ScalarField &s, EmField &A, FFT &fft)
|
||||||
|
{
|
||||||
|
ScalarField buf(env().getGrid()), result(env().getGrid()),
|
||||||
|
Amu(env().getGrid());
|
||||||
|
Complex ci(0.0,1.0);
|
||||||
|
|
||||||
|
result = zero;
|
||||||
|
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
Amu = peekLorentz(A, mu);
|
||||||
|
buf = (*phase_[mu])*s;
|
||||||
|
fft.FFT_all_dim(buf, buf, FFT::backward);
|
||||||
|
buf = Amu*buf;
|
||||||
|
fft.FFT_all_dim(buf, buf, FFT::forward);
|
||||||
|
result = result - ci*buf;
|
||||||
|
}
|
||||||
|
fft.FFT_all_dim(s, s, FFT::backward);
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
Amu = peekLorentz(A, mu);
|
||||||
|
buf = Amu*s;
|
||||||
|
fft.FFT_all_dim(buf, buf, FFT::forward);
|
||||||
|
result = result + ci*adj(*phase_[mu])*buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TScalarVP::momD2(ScalarField &s, EmField &Asquared, FFT &fft)
|
||||||
|
{
|
||||||
|
ScalarField buf(env().getGrid()), result(env().getGrid()),
|
||||||
|
A2mu(env().getGrid());
|
||||||
|
|
||||||
|
result = zero;
|
||||||
|
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
A2mu = peekLorentz(Asquared, mu);
|
||||||
|
buf = (*phase_[mu])*s;
|
||||||
|
fft.FFT_all_dim(buf, buf, FFT::backward);
|
||||||
|
buf = A2mu*buf;
|
||||||
|
fft.FFT_all_dim(buf, buf, FFT::forward);
|
||||||
|
result = result + .5*buf;
|
||||||
|
}
|
||||||
|
fft.FFT_all_dim(s, s, FFT::backward);
|
||||||
|
for (unsigned int mu = 0; mu < env().getNd(); ++mu)
|
||||||
|
{
|
||||||
|
A2mu = peekLorentz(Asquared, mu);
|
||||||
|
buf = A2mu*s;
|
||||||
|
fft.FFT_all_dim(buf, buf, FFT::forward);
|
||||||
|
result = result + .5*adj(*phase_[mu])*buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = result;
|
||||||
|
}
|
||||||
|
@ -41,8 +41,13 @@ public:
|
|||||||
virtual void setup(void);
|
virtual void setup(void);
|
||||||
// execution
|
// execution
|
||||||
virtual void execute(void);
|
virtual void execute(void);
|
||||||
|
private:
|
||||||
|
void momD1(ScalarField &s, EmField &A, FFT &fft);
|
||||||
|
void momD2(ScalarField &s, EmField &Asquared, FFT &fft);
|
||||||
private:
|
private:
|
||||||
std::string prop0Name_, propD1Name_, propD1D1Name_, propD2Name_;
|
std::string prop0Name_, propD1Name_, propD1D1Name_, propD2Name_;
|
||||||
|
std::vector<std::string> phaseName_;
|
||||||
|
std::vector<ScalarField *> phase_;
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_REGISTER_NS(ScalarVP, TScalarVP, MScalar);
|
MODULE_REGISTER_NS(ScalarVP, TScalarVP, MScalar);
|
||||||
|
Loading…
Reference in New Issue
Block a user