CHROMA
gaugeact.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*! @file
4  * @brief Class structure for gauge actions
5  */
6 
7 #ifndef __gaugeactt_h__
8 #define __gaugeactt_h__
9 
10 
11 #include "state.h"
12 #include "gaugebc.h"
13 #include "create_state.h"
14 
15 namespace Chroma
16 {
17 
18  //! Abstract base class for gauge actions
19  /*! @ingroup actions
20  *
21  * Supports creation and application for gauge actions
22  */
23  template<typename P, typename Q>
25  {
26  public:
27  //! Virtual destructor to help with cleanup;
28  virtual ~GaugeAction() {}
29 
30  //! Return the factory object that produces a state
31  /*!
32  * The user will supply the FermState in a derived class
33  *
34  * NOTE: this function is public since we have nested gaugeacts
35  * that forward this call to the member gaugeact
36  */
37  virtual const CreateGaugeState<P,Q>& getCreateState() const = 0;
38 
39  //! Given links, create the state
40  virtual GaugeState<P,Q>* createState(const Q& q) const
41  {
42  return getCreateState()(q);
43  }
44 
45  //! Return the gauge BC object for this action
46  virtual const GaugeBC<P,Q>& getGaugeBC() const
47  {
48  return getCreateState().getBC();
49  }
50 
51  //! Return the set on which the gauge action is defined
52  virtual const Set& getSet(void) const = 0;
53 
54  //! Compute dS/dU
55  /*! Default version. Derived class should override this if needed. */
56  virtual void deriv(P& result, const Handle< GaugeState<P,Q> >& state) const
57  {
58  QDPIO::cerr << "GaugeAction::deriv not implemented" << std::endl;
59  QDP_abort(1);
60  }
61 
62  //! Compute the action on a gauge configuration
63  virtual Double S(const Handle< GaugeState<P,Q> >& state) const = 0;
64 
65  };
66 
67 
68 
69  //! Base class for gauge actions with links appearing linearly in the action
70  /*! @ingroup actions
71  *
72  * Here, we are assuming that the "Q" must be a multi1d<LatticeColorMatrix>
73  * to be able to use heatbath. Namely, each gauge link must appear in the
74  * Lagrangian density only once.
75  *
76  * To fully support heatbath, this code needs more work so that 2-link actions
77  * can also be supported.
78  */
79  class LinearGaugeAction : public GaugeAction< multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> >
80  {
81  public:
82  typedef multi1d<LatticeColorMatrix> P;
83  typedef multi1d<LatticeColorMatrix> Q;
84 
85  //! Virtual destructor to help with cleanup;
86  virtual ~LinearGaugeAction() {}
87 
88  //! Compute staple
89  /*!
90  * Default version. Derived class should override this if needed.
91  */
92  virtual void staple(LatticeColorMatrix& result,
93  const Handle< GaugeState<P,Q> >& state,
94  int mu, int cb) const = 0;
95  };
96 
97 }
98 
99 
100 #endif
Create a gauge connection state.
Definition: create_state.h:47
Abstract base class for gauge actions.
Definition: gaugeact.h:25
virtual GaugeState< P, Q > * createState(const Q &q) const
Given links, create the state.
Definition: gaugeact.h:40
virtual const Set & getSet(void) const =0
Return the set on which the gauge action is defined.
virtual Double S(const Handle< GaugeState< P, Q > > &state) const =0
Compute the action on a gauge configuration.
virtual void deriv(P &result, const Handle< GaugeState< P, Q > > &state) const
Compute dS/dU.
Definition: gaugeact.h:56
virtual const GaugeBC< P, Q > & getGaugeBC() const
Return the gauge BC object for this action.
Definition: gaugeact.h:46
virtual ~GaugeAction()
Virtual destructor to help with cleanup;.
Definition: gaugeact.h:28
virtual const CreateGaugeState< P, Q > & getCreateState() const =0
Return the factory object that produces a state.
Base class for all gauge action boundary conditions.
Definition: gaugebc.h:30
Support class for fermion actions and linear operators.
Definition: state.h:74
Class for counted reference semantics.
Definition: handle.h:33
Base class for gauge actions with links appearing linearly in the action.
Definition: gaugeact.h:80
multi1d< LatticeColorMatrix > Q
Definition: gaugeact.h:83
multi1d< LatticeColorMatrix > P
Definition: gaugeact.h:82
virtual ~LinearGaugeAction()
Virtual destructor to help with cleanup;.
Definition: gaugeact.h:86
virtual void staple(LatticeColorMatrix &result, const Handle< GaugeState< P, Q > > &state, int mu, int cb) const =0
Compute staple.
int mu
Definition: cool.cc:24
Create a connection state.
Gauge boundary conditions.
Double q
Definition: mesq.cc:17
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::Q Q
int cb
Definition: invbicg.cc:120
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
FloatingPoint< double > Double
Definition: gtest.h:7351
Support class for fermion actions and linear operators.
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13