CHROMA
hex_fermstate_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*! @file
4  * @brief Hex field state for stout links and a creator
5  *
6  * Holds gauge fields at various smearing levels and caches some
7  * auxiliary things
8  */
9 
10 #ifndef _hex_fermstate_h
11 #define _hex_fermstate_h
12 
13 #include "state.h"
14 #include "create_state.h"
16 #include "util/gauge/stout_utils.h"
17 #include "meas/smear/hex_smear.h"
18 
19 #include <stdexcept>
20 
21 namespace Chroma
22 {
23  /*! @ingroup fermstates */
24  namespace CreateHexFermStateEnv
25  {
26  extern const std::string name;
27  bool registerAll();
28  }
29 
30 
31  //! Hex field state
32  /*! @ingroup fermstates
33  *
34  * Holds a hex smeared state
35  */
36 
37  template< typename T, typename P, typename Q>
38  class HexFermState : public FermState<T,P,Q>
39  {
40  public:
41  // Typedefs to save typing
42  //! Constructor only from a parameter structure
43  // Constructor only from a parameter structure
45  const HexFermStateParams& p_,
46  const Q& u_)
47  {
48  START_CODE();
49  create(fbc_, p_, u_);
50  END_CODE();
51  }
52 
53  //! Return the ferm BC object for this state
54  const FermBC<T,P,Q>& getBC() const {return *fbc;}
55 
56  //! Return the ferm BC object for this state
57  Handle< FermBC<T,P,Q> > getFermBC() const {return fbc;}
58 
59  //! Destructor is automagic
60  virtual ~HexFermState() {}
61 
62  //! Return FAT Linke
63  const Q& getLinks() const
64  {
65  // This has BC-s applied already in the construction
66  return fat_links_with_bc;
67  }
68 
69  const Q& getThinLinks() const
70  {
71  return thin_links;
72  }
73 
74  /* Only an inverter at the moment */
75  void fatForceToThin(const P& F_fat, P& F_thin) const
76  {
77  START_CODE();
78 
79  throw std::domain_error("HEX smearing is currently not supported in the Hybrid Monte Carlo algorithm.")
80 
81  END_CODE();
82  }
83 
84 
85  /* Not implemneted **/
86  virtual void deriv(P& F) const
87  {
88  START_CODE();
89 
90  throw std::domain_error("HEX smearing is currently not supported in the Hybrid Monte Carlo algorithm.")
91 
92  END_CODE();
93  }
94 
95 
96  private:
97 
98  // Hide default constructor
100 
101 
102  // create function
104  const HexFermStateParams& p_,
105  const Q& u_)
106  {
107  START_CODE();
108 
109  fbc = fbc_ ;
110  params = p_ ;
111 
112  // allocate some space
113  thin_links.resize(Nd);
114  smeared_links.resize(Nd);
115 
116  thin_links = u_;
117 
119 
120 
121  if( fbc->nontrivialP() ) {
122  fbc->modify( smeared_links );
123  }
124 
125  // ANTIPERIODIC BCs only -- modify only top level smeared thing
126  fat_links_with_bc.resize(Nd) ;
128  fbc->modify(fat_links_with_bc) ;
129 
130 
131  END_CODE();
132  }
133 
134 
135  private:
137 
141 
143 
144  }; // End class
145 
146 
147 
148  //! Create a hex ferm connection state
149  /*! @ingroup fermstates
150  *
151  * This is a factory class for producing a connection state
152  */
153  template<typename T, typename P, typename Q >
154  class CreateHexFermState : public CreateFermState<T, P, Q>
155  {
156  public:
157  // Typedefs to save typing
158 
159  //! Full constructor
161  const HexFermStateParams& p_) :
162  fbc(fbc_), params(p_) {}
163 
164  //! Destructor
166 
167  //! Construct a ConnectState
169  {
170  return new HexFermState<T,P,Q>(fbc, params, q);
171  }
172 
173  //! Return the ferm BC object for this state
174  const FermBC<T,P,Q>& getBC() const {return *fbc;}
175 
176  //! Return the ferm BC object for this state
177  Handle< FermBC<T,P,Q> > getFermBC() const {return fbc;}
178 
179  private:
180  CreateHexFermState() {} // hide default constructur
181  void operator=(const CreateHexFermState&) {} // hide =
182 
183  private:
186  };
187 
188 
189 }
190 #endif
Create a fermion connection state.
Definition: create_state.h:69
Create a hex ferm connection state.
CreateHexFermState(Handle< FermBC< T, P, Q > > fbc_, const HexFermStateParams &p_)
Full constructor.
void operator=(const CreateHexFermState &)
Handle< FermBC< T, P, Q > > fbc
HexFermState< T, P, Q > * operator()(const Q &q) const
Construct a ConnectState.
const FermBC< T, P, Q > & getBC() const
Return the ferm BC object for this state.
HexFermStateParams params
Handle< FermBC< T, P, Q > > getFermBC() const
Return the ferm BC object for this state.
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
Hex field state.
virtual void deriv(P &F) const
Handle< FermBC< T, P, Q > > getFermBC() const
Return the ferm BC object for this state.
const Q & getThinLinks() const
HexFermState(Handle< FermBC< T, P, Q > > fbc_, const HexFermStateParams &p_, const Q &u_)
Constructor only from a parameter structure.
void fatForceToThin(const P &F_fat, P &F_thin) const
HexFermStateParams params
void create(Handle< FermBC< T, P, Q > > fbc_, const HexFermStateParams &p_, const Q &u_)
Handle< FermBC< T, P, Q > > fbc
const FermBC< T, P, Q > & getBC() const
Return the ferm BC object for this state.
const Q & getLinks() const
Return FAT Linke.
virtual ~HexFermState()
Destructor is automagic.
Create a connection state.
void Hex_Smear(const multi1d< LatticeColorMatrix > &u, multi1d< LatticeColorMatrix > &u_hyp, const int nstep)
Construct nstep iterations of the "hex-smeared" links of Capitani et al.
Definition: hex_smear.cc:232
Hex smear a gauge field.
Nd
Definition: meslate.cc:74
Double q
Definition: mesq.cc:17
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::Q Q
START_CODE()
::std::string string
Definition: gtest.h:1979
Support class for fermion actions and linear operators.
Stout utilities.
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13
static INTERNAL_PRECISION F