mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Hadrons: NPR and gauge fixing linking fix
This commit is contained in:
		@@ -33,61 +33,4 @@ using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MGauge;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                            TGaugeFix implementation                             *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
TGaugeFix<GImpl>::TGaugeFix(const std::string name)
 | 
			
		||||
: Module<GaugeFixPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
std::vector<std::string> TGaugeFix<GImpl>::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in = {par().gauge};
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
std::vector<std::string> TGaugeFix<GImpl>::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    return out;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
void TGaugeFix<GImpl>::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    envCreateLat(GaugeField, getName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
void TGaugeFix<GImpl>::execute(void)
 | 
			
		||||
//Loads the gauge and fixes it
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
    std::cout << "executing" << std::endl;
 | 
			
		||||
    LOG(Message) << "Fixing the Gauge" << std::endl;
 | 
			
		||||
    LOG(Message) << par().gauge << std::endl;
 | 
			
		||||
    auto &U     = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &Umu   = envGet(GaugeField, getName());
 | 
			
		||||
    LOG(Message) << "Gauge Field fetched" << std::endl;
 | 
			
		||||
    //do we allow maxiter etc to be user set?
 | 
			
		||||
    Real alpha     = par().alpha;
 | 
			
		||||
    int  maxiter   = par().maxiter;
 | 
			
		||||
    Real Omega_tol = par().Omega_tol;
 | 
			
		||||
    Real Phi_tol   = par().Phi_tol;
 | 
			
		||||
    bool Fourier   = par().Fourier;
 | 
			
		||||
    FourierAcceleratedGaugeFixer<PeriodicGimplR>::SteepestDescentGaugeFix(U,alpha,maxiter,Omega_tol,Phi_tol,Fourier);
 | 
			
		||||
    Umu = U;
 | 
			
		||||
    LOG(Message) << "Gauge Fixed" << std::endl;
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template class Grid::Hadrons::MGauge::TGaugeFix<GIMPL>;
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    TGaugeFix(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~TGaugeFix(void) = default;
 | 
			
		||||
    virtual ~TGaugeFix(void) {};
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    virtual std::vector<std::string> getInput(void);
 | 
			
		||||
    virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
@@ -74,6 +74,60 @@ public:
 | 
			
		||||
 | 
			
		||||
MODULE_REGISTER_TMP(GaugeFix, TGaugeFix<GIMPL>, MGauge);
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                            TGaugeFix implementation                             *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
TGaugeFix<GImpl>::TGaugeFix(const std::string name)
 | 
			
		||||
: Module<GaugeFixPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
std::vector<std::string> TGaugeFix<GImpl>::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in = {par().gauge};
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
std::vector<std::string> TGaugeFix<GImpl>::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    return out;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
void TGaugeFix<GImpl>::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    envCreateLat(GaugeField, getName());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// execution ///////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename GImpl>
 | 
			
		||||
void TGaugeFix<GImpl>::execute(void)
 | 
			
		||||
//Loads the gauge and fixes it
 | 
			
		||||
{
 | 
			
		||||
    std::cout << "executing" << std::endl;
 | 
			
		||||
    LOG(Message) << "Fixing the Gauge" << std::endl;
 | 
			
		||||
    LOG(Message) << par().gauge << std::endl;
 | 
			
		||||
    auto &U     = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &Umu   = envGet(GaugeField, getName());
 | 
			
		||||
    LOG(Message) << "Gauge Field fetched" << std::endl;
 | 
			
		||||
    //do we allow maxiter etc to be user set?
 | 
			
		||||
    Real alpha     = par().alpha;
 | 
			
		||||
    int  maxiter   = par().maxiter;
 | 
			
		||||
    Real Omega_tol = par().Omega_tol;
 | 
			
		||||
    Real Phi_tol   = par().Phi_tol;
 | 
			
		||||
    bool Fourier   = par().Fourier;
 | 
			
		||||
    FourierAcceleratedGaugeFixer<PeriodicGimplR>::SteepestDescentGaugeFix(U,alpha,maxiter,Omega_tol,Phi_tol,Fourier);
 | 
			
		||||
    Umu = U;
 | 
			
		||||
    LOG(Message) << "Gauge Fixed" << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
END_MODULE_NAMESPACE
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    TAmputate(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~TAmputate(void) = default;
 | 
			
		||||
    virtual ~TAmputate(void) {};
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    virtual std::vector<std::string> getInput(void);
 | 
			
		||||
    virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    TBilinear(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~TBilinear(void) = default;
 | 
			
		||||
    virtual ~TBilinear(void) {};
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    virtual std::vector<std::string> getInput(void);
 | 
			
		||||
    virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ public:
 | 
			
		||||
    // constructor
 | 
			
		||||
    TFourQuark(const std::string name);
 | 
			
		||||
    // destructor
 | 
			
		||||
    virtual ~TFourQuark(void) = default;
 | 
			
		||||
    virtual ~TFourQuark(void) {};
 | 
			
		||||
    // dependencies/products
 | 
			
		||||
    virtual std::vector<std::string> getInput(void);
 | 
			
		||||
    virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
 
 | 
			
		||||
@@ -4,5 +4,5 @@ using namespace Grid;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
using namespace MSource;
 | 
			
		||||
 | 
			
		||||
template class Grid::Hadrons::MSource::TMomSource<FIMPL>;
 | 
			
		||||
template class Grid::Hadrons::MSource::TMomentum<FIMPL>;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#ifndef Hadrons_MomSource_hpp_
 | 
			
		||||
#define Hadrons_MomSource_hpp_
 | 
			
		||||
#ifndef Hadrons_Momentum_hpp_
 | 
			
		||||
#define Hadrons_Momentum_hpp_
 | 
			
		||||
 | 
			
		||||
#include <Hadrons/Global.hpp>
 | 
			
		||||
#include <Hadrons/Module.hpp>
 | 
			
		||||
@@ -14,29 +14,29 @@ src_x = e^i2pi/L * p *position
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
 *                                  TPlane                                     *
 | 
			
		||||
 *                          Plane Wave source                                 *
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
  BEGIN_MODULE_NAMESPACE(MSource)
 | 
			
		||||
BEGIN_MODULE_NAMESPACE(MSource)
 | 
			
		||||
 | 
			
		||||
  class MomSourcePar: Serializable
 | 
			
		||||
  {
 | 
			
		||||
  public:
 | 
			
		||||
class MomentumPar: Serializable
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
//What is meant by serializable in this context
 | 
			
		||||
GRID_SERIALIZABLE_CLASS_MEMBERS(MomSourcePar,
 | 
			
		||||
GRID_SERIALIZABLE_CLASS_MEMBERS(MomentumPar,
 | 
			
		||||
std::string, mom);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
template <typename FImpl>
 | 
			
		||||
class TMomSource: public Module<MomSourcePar>
 | 
			
		||||
class TMomentum: public Module<MomentumPar>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
FERM_TYPE_ALIASES(FImpl,);
 | 
			
		||||
public:
 | 
			
		||||
// constructor
 | 
			
		||||
TMomSource(const std::string name);
 | 
			
		||||
TMomentum(const std::string name);
 | 
			
		||||
// destructor
 | 
			
		||||
virtual ~TMomSource(void) = default;
 | 
			
		||||
virtual ~TMomentum(void) {};
 | 
			
		||||
// dependency relation
 | 
			
		||||
virtual std::vector<std::string> getInput(void);
 | 
			
		||||
virtual std::vector<std::string> getOutput(void);
 | 
			
		||||
@@ -46,28 +46,28 @@ virtual void setup(void);
 | 
			
		||||
virtual void execute(void);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
MODULE_REGISTER_TMP(MomSource, TMomSource<FIMPL>, MSource);
 | 
			
		||||
//MODULE_REGISTER_NS(MomSource, TMomSource, MSource);
 | 
			
		||||
MODULE_REGISTER_TMP(Momentum, TMomentum<FIMPL>, MSource);
 | 
			
		||||
//MODULE_REGISTER_NS(Momentum, TMomentum, MSource);
 | 
			
		||||
 | 
			
		||||
/******************************************************************************
 | 
			
		||||
*                       TMomSource template implementation                       *
 | 
			
		||||
*                       TMomentum template implementation                     *
 | 
			
		||||
******************************************************************************/
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename FImpl>
 | 
			
		||||
TMomSource<FImpl>::TMomSource(const std::string name)
 | 
			
		||||
: Module<MomSourcePar>(name)
 | 
			
		||||
TMomentum<FImpl>::TMomentum(const std::string name)
 | 
			
		||||
: Module<MomentumPar>(name)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
// dependencies/products ///////////////////////////////////////////////////////
 | 
			
		||||
template <typename FImpl>
 | 
			
		||||
std::vector<std::string> TMomSource<FImpl>::getInput(void)
 | 
			
		||||
std::vector<std::string> TMomentum<FImpl>::getInput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> in;
 | 
			
		||||
    return in;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename FImpl>
 | 
			
		||||
std::vector<std::string> TMomSource<FImpl>::getOutput(void)
 | 
			
		||||
std::vector<std::string> TMomentum<FImpl>::getOutput(void)
 | 
			
		||||
{
 | 
			
		||||
    std::vector<std::string> out = {getName()};
 | 
			
		||||
    return out;
 | 
			
		||||
@@ -76,7 +76,7 @@ std::vector<std::string> TMomSource<FImpl>::getOutput(void)
 | 
			
		||||
 | 
			
		||||
// setup ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename FImpl>
 | 
			
		||||
void TMomSource<FImpl>::setup(void)
 | 
			
		||||
void TMomentum<FImpl>::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    envCreateLat(PropagatorField, getName());
 | 
			
		||||
}
 | 
			
		||||
@@ -84,7 +84,7 @@ void TMomSource<FImpl>::setup(void)
 | 
			
		||||
 | 
			
		||||
//execution//////////////////////////////////////////////////////////////////
 | 
			
		||||
template <typename FImpl>
 | 
			
		||||
void TMomSource<FImpl>::execute(void)
 | 
			
		||||
void TMomentum<FImpl>::execute(void)
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Generating planewave momentum source with momentum " << par().mom << std::endl;
 | 
			
		||||
    //what does this env do?
 | 
			
		||||
@@ -118,4 +118,4 @@ END_MODULE_NAMESPACE
 | 
			
		||||
 | 
			
		||||
END_HADRONS_NAMESPACE
 | 
			
		||||
 | 
			
		||||
#endif // Hadrons_MomSource_hpp_
 | 
			
		||||
#endif // Hadrons_Momentum_hpp_
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user