mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Namespace, format improved
This commit is contained in:
parent
7747b95430
commit
bf629dddce
@ -1,4 +1,4 @@
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
@ -25,112 +25,109 @@ Author: Peter Boyle <peterboyle@Peters-MacBook-Pro-2.local>
|
|||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
See the full license in the file "LICENSE" in the top level distribution directory
|
See the full license in the file "LICENSE" in the top level distribution directory
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#ifndef GRID_QCD_FERMION_OPERATOR_H
|
#ifndef GRID_QCD_FERMION_OPERATOR_H
|
||||||
#define GRID_QCD_FERMION_OPERATOR_H
|
#define GRID_QCD_FERMION_OPERATOR_H
|
||||||
|
|
||||||
namespace Grid {
|
NAMESPACE_BEGIN(Grid);
|
||||||
|
|
||||||
namespace QCD {
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Allow to select between gauge representation rank bc's, flavours etc.
|
||||||
////////////////////////////////////////////////////////////////
|
// and single/double precision.
|
||||||
// Allow to select between gauge representation rank bc's, flavours etc.
|
////////////////////////////////////////////////////////////////
|
||||||
// and single/double precision.
|
|
||||||
////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
class FermionOperator : public CheckerBoardedSparseMatrixBase<typename Impl::FermionField>, public Impl
|
class FermionOperator : public CheckerBoardedSparseMatrixBase<typename Impl::FermionField>, public Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
INHERIT_IMPL_TYPES(Impl);
|
INHERIT_IMPL_TYPES(Impl);
|
||||||
|
|
||||||
FermionOperator(const ImplParams &p= ImplParams()) : Impl(p) {};
|
FermionOperator(const ImplParams &p= ImplParams()) : Impl(p) {};
|
||||||
virtual ~FermionOperator(void) = default;
|
virtual ~FermionOperator(void) = default;
|
||||||
|
|
||||||
virtual FermionField &tmp(void) = 0;
|
virtual FermionField &tmp(void) = 0;
|
||||||
|
|
||||||
GridBase * Grid(void) { return FermionGrid(); }; // this is all the linalg routines need to know
|
GridBase * Grid(void) { return FermionGrid(); }; // this is all the linalg routines need to know
|
||||||
GridBase * RedBlackGrid(void) { return FermionRedBlackGrid(); };
|
GridBase * RedBlackGrid(void) { return FermionRedBlackGrid(); };
|
||||||
|
|
||||||
virtual GridBase *FermionGrid(void) =0;
|
virtual GridBase *FermionGrid(void) =0;
|
||||||
virtual GridBase *FermionRedBlackGrid(void) =0;
|
virtual GridBase *FermionRedBlackGrid(void) =0;
|
||||||
virtual GridBase *GaugeGrid(void) =0;
|
virtual GridBase *GaugeGrid(void) =0;
|
||||||
virtual GridBase *GaugeRedBlackGrid(void) =0;
|
virtual GridBase *GaugeRedBlackGrid(void) =0;
|
||||||
|
|
||||||
// override multiply
|
// override multiply
|
||||||
virtual RealD M (const FermionField &in, FermionField &out)=0;
|
virtual RealD M (const FermionField &in, FermionField &out)=0;
|
||||||
virtual RealD Mdag (const FermionField &in, FermionField &out)=0;
|
virtual RealD Mdag (const FermionField &in, FermionField &out)=0;
|
||||||
|
|
||||||
// half checkerboard operaions
|
// half checkerboard operaions
|
||||||
virtual int ConstEE(void) { return 1; }; // clover returns zero as EE depends on gauge field
|
virtual int ConstEE(void) { return 1; }; // clover returns zero as EE depends on gauge field
|
||||||
|
|
||||||
virtual void Meooe (const FermionField &in, FermionField &out)=0;
|
virtual void Meooe (const FermionField &in, FermionField &out)=0;
|
||||||
virtual void MeooeDag (const FermionField &in, FermionField &out)=0;
|
virtual void MeooeDag (const FermionField &in, FermionField &out)=0;
|
||||||
virtual void Mooee (const FermionField &in, FermionField &out)=0;
|
virtual void Mooee (const FermionField &in, FermionField &out)=0;
|
||||||
virtual void MooeeDag (const FermionField &in, FermionField &out)=0;
|
virtual void MooeeDag (const FermionField &in, FermionField &out)=0;
|
||||||
virtual void MooeeInv (const FermionField &in, FermionField &out)=0;
|
virtual void MooeeInv (const FermionField &in, FermionField &out)=0;
|
||||||
virtual void MooeeInvDag (const FermionField &in, FermionField &out)=0;
|
virtual void MooeeInvDag (const FermionField &in, FermionField &out)=0;
|
||||||
|
|
||||||
// non-hermitian hopping term; half cb or both
|
// non-hermitian hopping term; half cb or both
|
||||||
virtual void Dhop (const FermionField &in, FermionField &out,int dag)=0;
|
virtual void Dhop (const FermionField &in, FermionField &out,int dag)=0;
|
||||||
virtual void DhopOE(const FermionField &in, FermionField &out,int dag)=0;
|
virtual void DhopOE(const FermionField &in, FermionField &out,int dag)=0;
|
||||||
virtual void DhopEO(const FermionField &in, FermionField &out,int dag)=0;
|
virtual void DhopEO(const FermionField &in, FermionField &out,int dag)=0;
|
||||||
virtual void DhopDir(const FermionField &in, FermionField &out,int dir,int disp)=0; // implemented by WilsonFermion and WilsonFermion5D
|
virtual void DhopDir(const FermionField &in, FermionField &out,int dir,int disp)=0; // implemented by WilsonFermion and WilsonFermion5D
|
||||||
|
|
||||||
// force terms; five routines; default to Dhop on diagonal
|
// force terms; five routines; default to Dhop on diagonal
|
||||||
virtual void MDeriv (GaugeField &mat,const FermionField &U,const FermionField &V,int dag){DhopDeriv(mat,U,V,dag);};
|
virtual void MDeriv (GaugeField &mat,const FermionField &U,const FermionField &V,int dag){DhopDeriv(mat,U,V,dag);};
|
||||||
virtual void MoeDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){DhopDerivOE(mat,U,V,dag);};
|
virtual void MoeDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){DhopDerivOE(mat,U,V,dag);};
|
||||||
virtual void MeoDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){DhopDerivEO(mat,U,V,dag);};
|
virtual void MeoDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){DhopDerivEO(mat,U,V,dag);};
|
||||||
virtual void MooDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){mat=zero;}; // Clover can override these
|
virtual void MooDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){mat=zero;}; // Clover can override these
|
||||||
virtual void MeeDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){mat=zero;};
|
virtual void MeeDeriv(GaugeField &mat,const FermionField &U,const FermionField &V,int dag){mat=zero;};
|
||||||
|
|
||||||
virtual void DhopDeriv (GaugeField &mat,const FermionField &U,const FermionField &V,int dag)=0;
|
virtual void DhopDeriv (GaugeField &mat,const FermionField &U,const FermionField &V,int dag)=0;
|
||||||
virtual void DhopDerivEO(GaugeField &mat,const FermionField &U,const FermionField &V,int dag)=0;
|
virtual void DhopDerivEO(GaugeField &mat,const FermionField &U,const FermionField &V,int dag)=0;
|
||||||
virtual void DhopDerivOE(GaugeField &mat,const FermionField &U,const FermionField &V,int dag)=0;
|
virtual void DhopDerivOE(GaugeField &mat,const FermionField &U,const FermionField &V,int dag)=0;
|
||||||
|
|
||||||
|
|
||||||
virtual void Mdiag (const FermionField &in, FermionField &out) { Mooee(in,out);}; // Same as Mooee applied to both CB's
|
virtual void Mdiag (const FermionField &in, FermionField &out) { Mooee(in,out);}; // Same as Mooee applied to both CB's
|
||||||
virtual void Mdir (const FermionField &in, FermionField &out,int dir,int disp)=0; // case by case Wilson, Clover, Cayley, ContFrac, PartFrac
|
virtual void Mdir (const FermionField &in, FermionField &out,int dir,int disp)=0; // case by case Wilson, Clover, Cayley, ContFrac, PartFrac
|
||||||
|
|
||||||
|
|
||||||
virtual void MomentumSpacePropagator(FermionField &out,const FermionField &in,RealD _m) { assert(0);};
|
virtual void MomentumSpacePropagator(FermionField &out,const FermionField &in,RealD _m) { assert(0);};
|
||||||
|
|
||||||
virtual void FreePropagator(const FermionField &in,FermionField &out,RealD mass) {
|
virtual void FreePropagator(const FermionField &in,FermionField &out,RealD mass) {
|
||||||
FFT theFFT((GridCartesian *) in._grid);
|
FFT theFFT((GridCartesian *) in._grid);
|
||||||
|
|
||||||
FermionField in_k(in._grid);
|
FermionField in_k(in._grid);
|
||||||
FermionField prop_k(in._grid);
|
FermionField prop_k(in._grid);
|
||||||
|
|
||||||
theFFT.FFT_all_dim(in_k,in,FFT::forward);
|
theFFT.FFT_all_dim(in_k,in,FFT::forward);
|
||||||
this->MomentumSpacePropagator(prop_k,in_k,mass);
|
this->MomentumSpacePropagator(prop_k,in_k,mass);
|
||||||
theFFT.FFT_all_dim(out,prop_k,FFT::backward);
|
theFFT.FFT_all_dim(out,prop_k,FFT::backward);
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Updates gauge field during HMC
|
// Updates gauge field during HMC
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
virtual void ImportGauge(const GaugeField & _U)=0;
|
virtual void ImportGauge(const GaugeField & _U)=0;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Conserved currents, either contract at sink or insert sequentially.
|
// Conserved currents, either contract at sink or insert sequentially.
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
virtual void ContractConservedCurrent(PropagatorField &q_in_1,
|
virtual void ContractConservedCurrent(PropagatorField &q_in_1,
|
||||||
PropagatorField &q_in_2,
|
PropagatorField &q_in_2,
|
||||||
PropagatorField &q_out,
|
PropagatorField &q_out,
|
||||||
Current curr_type,
|
Current curr_type,
|
||||||
unsigned int mu)=0;
|
unsigned int mu)=0;
|
||||||
virtual void SeqConservedCurrent(PropagatorField &q_in,
|
virtual void SeqConservedCurrent(PropagatorField &q_in,
|
||||||
PropagatorField &q_out,
|
PropagatorField &q_out,
|
||||||
Current curr_type,
|
Current curr_type,
|
||||||
unsigned int mu,
|
unsigned int mu,
|
||||||
std::vector<Real> mom,
|
std::vector<Real> mom,
|
||||||
unsigned int tmin,
|
unsigned int tmin,
|
||||||
unsigned int tmax)=0;
|
unsigned int tmax)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
NAMESPACE_END(Grid);
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user