mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-03 21:44:33 +00:00 
			
		
		
		
	Consolidating HMC interface
Uniformed interface for standard action in fundamental rep and Hirep
This commit is contained in:
		@@ -45,27 +45,6 @@ class Action {
 | 
			
		||||
  virtual ~Action(){};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Could derive PseudoFermion action with a PF field, FermionField, and a Grid;
 | 
			
		||||
// implement refresh
 | 
			
		||||
/*
 | 
			
		||||
template<class GaugeField, class FermionField>
 | 
			
		||||
class PseudoFermionAction : public Action<GaugeField> {
 | 
			
		||||
 public:
 | 
			
		||||
  FermionField Phi;
 | 
			
		||||
  GridParallelRNG &pRNG;
 | 
			
		||||
  GridBase &Grid;
 | 
			
		||||
 | 
			
		||||
  PseudoFermionAction(GridBase &_Grid,GridParallelRNG &_pRNG) : Grid(_Grid),
 | 
			
		||||
Phi(&_Grid), pRNG(_pRNG) {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  virtual void refresh(const GaugeField &gauge) {
 | 
			
		||||
    gaussian(Phi,pRNG);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
// Indexing of tuple types
 | 
			
		||||
template <class T, class Tuple>
 | 
			
		||||
struct Index;
 | 
			
		||||
@@ -80,6 +59,7 @@ struct Index<T, std::tuple<U, Types...>> {
 | 
			
		||||
  static const std::size_t value = 1 + Index<T, std::tuple<Types...>>::value;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
template <class GaugeField>
 | 
			
		||||
struct ActionLevel {
 | 
			
		||||
 public:
 | 
			
		||||
@@ -99,10 +79,10 @@ struct ActionLevel {
 | 
			
		||||
 | 
			
		||||
  void push_back(ActPtr ptr) { actions.push_back(ptr); }
 | 
			
		||||
};
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
template <class GaugeField, class Repr>
 | 
			
		||||
struct ActionLevelHirep {
 | 
			
		||||
template <class GaugeField, class Repr = NoHirep >
 | 
			
		||||
struct ActionLevel {
 | 
			
		||||
 public:
 | 
			
		||||
  unsigned int multiplier; 
 | 
			
		||||
 | 
			
		||||
@@ -118,9 +98,9 @@ struct ActionLevelHirep {
 | 
			
		||||
  std::vector<ActPtr>& actions;
 | 
			
		||||
 | 
			
		||||
  // Temporary conversion between ActionLevel and ActionLevelHirep
 | 
			
		||||
  ActionLevelHirep(ActionLevel<GaugeField>& AL ):actions(AL.actions), multiplier(AL.multiplier){}
 | 
			
		||||
  //ActionLevelHirep(ActionLevel<GaugeField>& AL ):actions(AL.actions), multiplier(AL.multiplier){}
 | 
			
		||||
 | 
			
		||||
  ActionLevelHirep(unsigned int mul = 1) : actions(std::get<0>(actions_hirep)), multiplier(mul) {
 | 
			
		||||
  ActionLevel(unsigned int mul = 1) : actions(std::get<0>(actions_hirep)), multiplier(mul) {
 | 
			
		||||
    // initialize the hirep vectors to zero.
 | 
			
		||||
    //apply(this->resize, actions_hirep, 0); //need a working resize
 | 
			
		||||
    assert(mul >= 1);
 | 
			
		||||
@@ -162,11 +142,11 @@ struct ActionLevelHirep {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
template <class GaugeField>
 | 
			
		||||
using ActionSet = std::vector<ActionLevel<GaugeField> >;
 | 
			
		||||
//template <class GaugeField>
 | 
			
		||||
//using ActionSet = std::vector<ActionLevel<GaugeField> >;
 | 
			
		||||
 | 
			
		||||
template <class GaugeField, class R>
 | 
			
		||||
using ActionSetHirep = std::vector<ActionLevelHirep<GaugeField, R> >;
 | 
			
		||||
using ActionSet = std::vector<ActionLevel<GaugeField, R> >;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ class NerscHmcRunnerTemplate {
 | 
			
		||||
 | 
			
		||||
  enum StartType_t { ColdStart, HotStart, TepidStart, CheckpointStart };
 | 
			
		||||
 | 
			
		||||
  ActionSetHirep<GaugeField, RepresentationsPolicy> TheAction;
 | 
			
		||||
  ActionSet<GaugeField, RepresentationsPolicy> TheAction;
 | 
			
		||||
 | 
			
		||||
  GridCartesian *UGrid;
 | 
			
		||||
  GridCartesian *FGrid;
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ class Integrator {
 | 
			
		||||
 | 
			
		||||
  IntegratorParameters Params;
 | 
			
		||||
 | 
			
		||||
  const ActionSetHirep<GaugeField, RepresentationPolicy> as;
 | 
			
		||||
  const ActionSet<GaugeField, RepresentationPolicy> as;
 | 
			
		||||
 | 
			
		||||
  int levels;  //
 | 
			
		||||
  double t_U;  // Track time passing on each level and for U and for P
 | 
			
		||||
@@ -180,7 +180,7 @@ class Integrator {
 | 
			
		||||
 | 
			
		||||
 public:
 | 
			
		||||
  Integrator(GridBase* grid, IntegratorParameters Par,
 | 
			
		||||
             ActionSetHirep<GaugeField, RepresentationPolicy>& Aset,
 | 
			
		||||
             ActionSet<GaugeField, RepresentationPolicy>& Aset,
 | 
			
		||||
             SmearingPolicy& Sm)
 | 
			
		||||
      : Params(Par),
 | 
			
		||||
        as(Aset),
 | 
			
		||||
 
 | 
			
		||||
@@ -101,7 +101,7 @@ namespace Grid{
 | 
			
		||||
 | 
			
		||||
      LeapFrog(GridBase* grid, 
 | 
			
		||||
	       IntegratorParameters Par,
 | 
			
		||||
	       ActionSet<GaugeField> & Aset,
 | 
			
		||||
	       ActionSet<GaugeField, RepresentationPolicy> & Aset,
 | 
			
		||||
	       SmearingPolicy & Sm):
 | 
			
		||||
	Integrator<GaugeField, SmearingPolicy, RepresentationPolicy>(grid,Par,Aset,Sm) {};
 | 
			
		||||
 | 
			
		||||
@@ -151,7 +151,7 @@ namespace Grid{
 | 
			
		||||
 | 
			
		||||
      MinimumNorm2(GridBase* grid, 
 | 
			
		||||
		   IntegratorParameters Par,
 | 
			
		||||
		   ActionSetHirep<GaugeField, RepresentationPolicy> & Aset,
 | 
			
		||||
		   ActionSet<GaugeField, RepresentationPolicy> & Aset,
 | 
			
		||||
		   SmearingPolicy& Sm):
 | 
			
		||||
	Integrator<GaugeField, SmearingPolicy, RepresentationPolicy>(grid,Par,Aset,Sm) {};
 | 
			
		||||
 | 
			
		||||
@@ -215,7 +215,7 @@ namespace Grid{
 | 
			
		||||
      // Looks like dH scales as dt^4. tested wilson/wilson 2 level.
 | 
			
		||||
    ForceGradient(GridBase* grid, 
 | 
			
		||||
		  IntegratorParameters Par,
 | 
			
		||||
		  ActionSet<GaugeField> & Aset,
 | 
			
		||||
		  ActionSet<GaugeField, RepresentationPolicy> & Aset,
 | 
			
		||||
		  SmearingPolicy &Sm):
 | 
			
		||||
      Integrator<GaugeField, SmearingPolicy, RepresentationPolicy>(grid,Par,Aset, Sm) {};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user