#ifndef Hadrons_MomSource_hpp_ #define Hadrons_MomSource_hpp_ #include #include #include BEGIN_HADRONS_NAMESPACE /* Plane Wave source ----------------- src_x = e^i2pi/L * p *position */ /****************************************************************************** * TPlane * ******************************************************************************/ BEGIN_MODULE_NAMESPACE(MSource) class MomSourcePar: Serializable { public: //What is meant by serializable in this context GRID_SERIALIZABLE_CLASS_MEMBERS(MomSourcePar, std::string, mom); }; template class TMomSource: public Module { public: FERM_TYPE_ALIASES(FImpl,); public: // constructor TMomSource(const std::string name); // destructor virtual ~TMomSource(void) = default; // dependency relation virtual std::vector getInput(void); virtual std::vector getOutput(void); // setup virtual void setup(void); // execution virtual void execute(void); }; MODULE_REGISTER_TMP(MomSource, TMomSource, MSource); //MODULE_REGISTER_NS(MomSource, TMomSource, MSource); /****************************************************************************** * TMomSource template implementation * ******************************************************************************/ // constructor ///////////////////////////////////////////////////////////////// template TMomSource::TMomSource(const std::string name) : Module(name) {} // dependencies/products /////////////////////////////////////////////////////// template std::vector TMomSource::getInput(void) { std::vector in; return in; } template std::vector TMomSource::getOutput(void) { std::vector out = {getName()}; return out; } // setup /////////////////////////////////////////////////////////////////////// template void TMomSource::setup(void) { envCreateLat(PropagatorField, getName()); } //execution////////////////////////////////////////////////////////////////// template void TMomSource::execute(void) { LOG(Message) << "Generating planewave momentum source with momentum " << par().mom << std::endl; //what does this env do? PropagatorField &src = envGet(PropagatorField, getName()); Lattice> t(env().getGrid()); LatticeComplex C(env().getGrid()), coor(env().getGrid()); std::vector p; std::vector latt_size(GridDefaultLatt().begin(), GridDefaultLatt().end()); Complex i(0.0,1.0); LOG(Message) << " " << std::endl; //get the momentum from parameters p = strToVec(par().mom); C = zero; LOG(Message) << "momentum converted from string - " << std::to_string(p[0]) <