CHROMA
simple_fermstate.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*! @file
4  * @brief Simple ferm state and a creator
5  */
6 
7 #ifndef __simple_fermstate_h__
8 #define __simple_fermstate_h__
9 
10 #include "state.h"
11 #include "create_state.h"
12 #include "handle.h"
14 
15 namespace Chroma
16 {
17  //! Simple version of FermState
18  /*! @ingroup fermstates
19  *
20  * Only needs to hold a ferm field and ferm bc
21  */
22  template<typename T, typename P, typename Q>
23  class SimpleFermState : public FermState<T,P,Q>
24  {
25  public:
26  //! Use only a SimpleFermBC with a boundary flag and a Q
27  SimpleFermState(const multi1d<int>& boundary, const Q& q_) :
28  fbc(new SimpleFermBC<T,P,Q>(boundary)), q(q_)
29  {
30  // Apply the BC
31  fbc->modify(q);
32  }
33 
34  //! Full constructor
35  SimpleFermState(Handle< FermBC<T,P,Q> > fbc_, const Q& q_) :
36  fbc(fbc_), q(q_)
37  {
38  // Apply the BC
39  fbc->modify(q);
40  }
41 
42  //! Destructor
44 
45  //! Return the link fields needed in constructing linear operators
46  const Q& getLinks() const {return q;}
47 
48  //! Return the ferm BC object for this state
49  const FermBC<T,P,Q>& getBC() const {return *fbc;}
50 
51  //! Return the ferm BC object for this state
52  Handle< FermBC<T,P,Q> > getFermBC() const {return fbc;}
53 
54  private:
55  SimpleFermState() {} // hide default constructur
56  void operator=(const SimpleFermState&) {} // hide =
57 
58  private:
60  Q q;
61  };
62 
63 
64 
65  //! Create a simple ferm connection state
66  /*! @ingroup fermstates
67  *
68  * This is a factory class for producing a connection state
69  */
70  template<typename T, typename P, typename Q>
71  class CreateSimpleFermState : public CreateFermState<T,P,Q>
72  {
73  public:
74  //! Use only a SimpleFermBC with a boundary flag
75  CreateSimpleFermState(const multi1d<int>& boundary) :
76  fbc(new SimpleFermBC<T,P,Q>(boundary)) {}
77 
78  //! Full constructor
80 
81  //! Destructor
83 
84  //! Construct a ConnectState
86  {
87  return new SimpleFermState<T,P,Q>(fbc, q);
88  }
89 
90  //! Return the ferm BC object for this state
91  const FermBC<T,P,Q>& getBC() const {return *fbc;}
92 
93  //! Return the ferm BC object for this state
94  Handle< FermBC<T,P,Q> > getFermBC() const {return fbc;}
95 
96  private:
97  CreateSimpleFermState() {} // hide default constructur
98  void operator=(const CreateSimpleFermState&) {} // hide =
99 
100  private:
102  };
103 
104 }
105 
106 
107 #endif
Create a fermion connection state.
Definition: create_state.h:69
Create a simple ferm connection state.
CreateSimpleFermState(const multi1d< int > &boundary)
Use only a SimpleFermBC with a boundary flag.
void operator=(const CreateSimpleFermState &)
Handle< FermBC< T, P, Q > > fbc
Handle< FermBC< T, P, Q > > getFermBC() const
Return the ferm BC object for this state.
const FermBC< T, P, Q > & getBC() const
Return the ferm BC object for this state.
CreateSimpleFermState(Handle< FermBC< T, P, Q > > fbc_)
Full constructor.
SimpleFermState< T, P, Q > * operator()(const Q &q) const
Construct a ConnectState.
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
Concrete class for all gauge actions with simple boundary conditions.
Definition: simple_fermbc.h:42
Simple version of FermState.
Handle< FermBC< T, P, Q > > getFermBC() const
Return the ferm BC object for this state.
SimpleFermState(Handle< FermBC< T, P, Q > > fbc_, const Q &q_)
Full constructor.
Handle< FermBC< T, P, Q > > fbc
SimpleFermState(const multi1d< int > &boundary, const Q &q_)
Use only a SimpleFermBC with a boundary flag and a Q.
void operator=(const SimpleFermState &)
const Q & getLinks() const
Return the link fields needed in constructing linear operators.
const FermBC< T, P, Q > & getBC() const
Return the ferm BC object for this state.
Create a connection state.
Class for counted reference semantics.
Double q
Definition: mesq.cc:17
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LinOpSysSolverMGProtoClover::Q Q
LinOpSysSolverMGProtoClover::T T
Simple fermionic BC.
Support class for fermion actions and linear operators.
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13