CHROMA
state.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*! @file
4  * @brief Support class for fermion actions and linear operators
5  *
6  * Holds things like color link fields and other info needed for linear
7  * operators
8  */
9 
10 #ifndef __state_h__
11 #define __state_h__
12 
13 #include "chromabase.h"
14 #include "gaugebc.h"
15 #include "fermbc.h"
16 #include "handle.h"
17 
18 namespace Chroma
19 {
20  //! Support class for fermion actions and linear operators
21  /*! @ingroup state
22  *
23  * Holds things like color link fields and other info needed for linear
24  * operators.
25  */
26  template<typename P, typename Q>
28  {
29  public:
30  //! Virtual destructor to help with cleanup;
31  virtual ~ConnectState() {}
32 
33  //! Return the coordinates (link fields) needed in constructing linear operators
34  virtual const Q& getLinks() const = 0;
35 
36  /*! A virtual function to get the derivative of the state.
37  * This is useful for things like fat link states, where
38  * the derivative of the state with respect to the thin
39  * links is complicated.
40  * The default implementation just multiplies the accumulated
41  * force by the (thin) links, which works because
42  * \f$\dot{U} = \pi U\f$
43  * and the pi momenta get factored out
44  * this function modifies the force term
45  */
46  virtual void deriv(P& F) const
47  {
48  if( F.size() != Nd ) {
49  throw "F has wrong size";
50  }
51 
52  P F_tmp = F;
53 
54  for(int mu=0; mu < Nd; mu++) {
55  F[mu] = getLinks()[mu]*F_tmp[mu];
56  }
57  }
58 
59  //! Return the amorphous BC object for this state
60  /*! The user will supply the BC in a derived class */
61  virtual const BoundCond<P,Q>& getBC() const = 0;
62  };
63 
64 
65 
66  //! Support class for fermion actions and linear operators
67  /*! @ingroup state
68  *
69  * Holds things like color link fields and other info needed for linear
70  * operators.
71  */
72  template<typename P, typename Q>
73  class GaugeState : public ConnectState<P,Q>
74  {
75  public:
76  //! Virtual destructor to help with cleanup;
77  virtual ~GaugeState() {}
78 
79  //! Return the gauge BC object for this state
80  /*! The user will supply the BC in a derived class */
81  virtual const GaugeBC<P,Q>& getBC() const = 0;
82  };
83 
84 
85 
86  //! Support class for fermion actions and linear operators
87  /*! @ingroup state
88  *
89  * Holds things like color link fields and other info needed for linear
90  * operators.
91  */
92  template<typename T, typename P, typename Q>
93  class FermState : public ConnectState<P,Q>
94  {
95  public:
96  //! Virtual destructor to help with cleanup;
97  virtual ~FermState() {}
98 
99  //! Return the ferm BC object for this state
100  /*! The user will supply the BC in a derived class */
101  virtual const FermBC<T,P,Q>& getBC() const = 0;
102 
103  //! Return the ferm BC object for this state
104  /*! This is to help the optimized linops */
105  virtual Handle< FermBC<T,P,Q> > getFermBC() const = 0;
106 
107  };
108 
109 }
110 
111 
112 #endif
Primary include file for CHROMA library code.
Base class for all boundary conditions.
Definition: boundcond.h:19
Support class for fermion actions and linear operators.
Definition: state.h:28
virtual const Q & getLinks() const =0
Return the coordinates (link fields) needed in constructing linear operators.
virtual const BoundCond< P, Q > & getBC() const =0
Return the amorphous BC object for this state.
virtual void deriv(P &F) const
Definition: state.h:46
virtual ~ConnectState()
Virtual destructor to help with cleanup;.
Definition: state.h:31
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Support class for fermion actions and linear operators.
Definition: state.h:94
virtual const FermBC< T, P, Q > & getBC() const =0
Return the ferm BC object for this state.
virtual Handle< FermBC< T, P, Q > > getFermBC() const =0
Return the ferm BC object for this state.
virtual ~FermState()
Virtual destructor to help with cleanup;.
Definition: state.h:97
Base class for all gauge action boundary conditions.
Definition: gaugebc.h:30
Support class for fermion actions and linear operators.
Definition: state.h:74
virtual ~GaugeState()
Virtual destructor to help with cleanup;.
Definition: state.h:77
virtual const GaugeBC< P, Q > & getBC() const =0
Return the gauge BC object for this state.
Class for counted reference semantics.
Definition: handle.h:33
int mu
Definition: cool.cc:24
Fermion action boundary conditions.
Gauge boundary conditions.
Class for counted reference semantics.
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::Q Q
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13
static INTERNAL_PRECISION F