CHROMA
simple_gaugestate.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*! @file
4  * @brief Simple gauge state and a creator
5  */
6 
7 #ifndef __simple_gaugestate_h__
8 #define __simple_gaugestate_h__
9 
10 #include "state.h"
11 #include "create_state.h"
12 #include "handle.h"
13 
14 namespace Chroma
15 {
16 
17 
18  /*! @ingroup gaugestates */
19  namespace CreateSimpleGaugeStateEnv
20  {
21  extern const std::string name;
22  bool registerAll();
23  }
24 
25 
26  //! Simple version of GaugeState
27  /*! @ingroup gaugestates
28  *
29  * Only needs to hold a gauge field and gauge bc
30  */
31  template<typename P, typename Q>
32  class SimpleGaugeState : public GaugeState<P,Q>
33  {
34  public:
35  //! Full constructor
36  SimpleGaugeState(Handle< GaugeBC<P,Q> > gbc_, const Q& q_) :
37  gbc(gbc_), q(q_)
38  {
39  // Apply the BC
40  gbc->modify(q);
41  }
42 
43  //! Destructor
45 
46  //! Return the link fields needed in constructing linear operators
47  const Q& getLinks() const {return q;}
48 
49  //! Return the gauge BC object for this state
50  const GaugeBC<P,Q>& getBC() const {return *gbc;}
51 
52  private:
53  SimpleGaugeState() {} // hide default constructur
54  void operator=(const SimpleGaugeState&) {} // hide =
55 
56  private:
58  Q q;
59  };
60 
61 
62 
63  //! Create a simple gauge connection state
64  /*! @ingroup gaugestates
65  *
66  * This is a factory class for producing a connection state
67  */
68  template<typename P, typename Q>
70  {
71  public:
72  //! Full constructor
74 
75  //! Destructor
77 
78  //! Construct a ConnectState
80  {
81  return new SimpleGaugeState<P,Q>(gbc, q);
82  }
83 
84  //! Return the gauge BC object for this state
85  const GaugeBC<P,Q>& getBC() const {return *gbc;}
86 
87  private:
88  CreateSimpleGaugeState() {} // hide default constructur
89  void operator=(const CreateSimpleGaugeState&) {} // hide =
90 
91  private:
93  };
94 
95 
96 
97 }
98 
99 
100 #endif
Create a gauge connection state.
Definition: create_state.h:47
Create a simple gauge connection state.
SimpleGaugeState< P, Q > * operator()(const Q &q) const
Construct a ConnectState.
CreateSimpleGaugeState(Handle< GaugeBC< P, Q > > gbc_)
Full constructor.
void operator=(const CreateSimpleGaugeState &)
const GaugeBC< P, Q > & getBC() const
Return the gauge BC object for this state.
Handle< GaugeBC< P, Q > > gbc
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
Simple version of GaugeState.
const GaugeBC< P, Q > & getBC() const
Return the gauge BC object for this state.
Handle< GaugeBC< P, Q > > gbc
SimpleGaugeState(Handle< GaugeBC< P, Q > > gbc_, const Q &q_)
Full constructor.
void operator=(const SimpleGaugeState &)
const Q & getLinks() const
Return the link fields needed in constructing linear operators.
Create a connection state.
Class for counted reference semantics.
Double q
Definition: mesq.cc:17
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::Q Q
::std::string string
Definition: gtest.h:1979
Support class for fermion actions and linear operators.