CHROMA
extfield_fermstate_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! @file
3  * @brief Fermion external field state and a creator
4  */
5 
6 #ifndef __extfield_fermstate_h__
7 #define __extfield_fermstate_h__
8 
9 #include "state.h"
10 #include "create_state.h"
11 #include "handle.h"
14 
15 
16 namespace Chroma
17 {
18 
19 
20  /*! @ingroup fermstates */
21  namespace CreateExtFieldFermStateEnv
22  {
23  extern const std::string name;
24  bool registerAll();
25  }
26 
27  //! External field state
28  /*! @ingroup fermstates
29  *
30  * Only needs to hold an original state and a modified state
31  */
32  template<typename T, typename P, typename Q>
33  class ExtFieldFermState : public FermState<T,P,Q>
34  {
35  public:
36  //! Full constructor
38  Handle< ExternalField > ext_field,
39  const Q& q_) :
40  fbc(fbc_)
41  {
42  // Original fields
43  fs = new SimpleFermState<T,P,Q>(fbc, q_);
44 
45  // Fold in U(1) fields
46  Q q_u1 = q_;
47  for(int mu=0; mu < q_u1.size(); ++mu)
48  q_u1[mu] *= (*ext_field)(mu);
49 
50  fs_u1 = new SimpleFermState<T,P,Q>(fbc, q_u1);
51  }
52 
53  //! Destructor
55 
56  //! Return the link fields needed in constructing linear operators
57  const Q& getLinks() const {return fs_u1->getLinks();}
58 
59  //! Return the original field state
60  const Handle< FermState<T,P,Q> > getOriginalState() const {return fs;}
61 
62  //! Return the U(1) modified field state
63  const Handle< FermState<T,P,Q> > getU1State() const {return fs_u1;}
64 
65  //! Return the ferm BC object for this state
66  const FermBC<T,P,Q>& getBC() const {return *fbc;}
67 
68  //! Return the ferm BC object for this state
69  Handle< FermBC<T,P,Q> > getFermBC() const {return fbc;}
70 
71  private:
72  ExtFieldFermState() {} // hide default constructur
73  void operator=(const ExtFieldFermState&) {} // hide =
74 
75  private:
79  };
80 
81 
82 
83  //! Create a simple ferm connection state
84  /*! @ingroup fermstates
85  *
86  * This is a factory class for producing a connection state
87  */
88  template<typename T, typename P, typename Q>
90  {
91  public:
92  //! Full constructor
94  Handle< ExternalField > ext_field_) :
95  fbc(fbc_), ext_field(ext_field_) {}
96 
97  //! Destructor
99 
100  //! Construct a ConnectState
102  {
103  return new ExtFieldFermState<T,P,Q>(fbc, ext_field, q);
104  }
105 
106  //! Return the ferm BC object for this state
107  const FermBC<T,P,Q>& getBC() const {return *fbc;}
108 
109  //! Return the ferm BC object for this state
110  Handle< FermBC<T,P,Q> > getFermBC() const {return fbc;}
111 
112  private:
113  CreateExtFieldFermState() {} // hide default constructur
114  void operator=(const CreateExtFieldFermState&) {} // hide =
115 
116  private:
119  };
120 
121 }
122 
123 
124 #endif
Create a simple ferm connection state.
ExtFieldFermState< T, P, Q > * operator()(const Q &q) const
Construct a ConnectState.
Handle< FermBC< T, P, Q > > fbc
CreateExtFieldFermState(Handle< FermBC< T, P, Q > > fbc_, Handle< ExternalField > ext_field_)
Full constructor.
const FermBC< T, P, Q > & getBC() const
Return the ferm BC object for this state.
Handle< FermBC< T, P, Q > > getFermBC() const
Return the ferm BC object for this state.
void operator=(const CreateExtFieldFermState &)
Create a fermion connection state.
Definition: create_state.h:69
Handle< FermState< T, P, Q > > fs_u1
const Q & getLinks() const
Return the link fields needed in constructing linear operators.
Handle< FermState< T, P, Q > > fs
Handle< FermBC< T, P, Q > > getFermBC() const
Return the ferm BC object for this state.
const Handle< FermState< T, P, Q > > getOriginalState() const
Return the original field state.
void operator=(const ExtFieldFermState &)
const Handle< FermState< T, P, Q > > getU1State() const
Return the U(1) modified field state.
Handle< FermBC< T, P, Q > > fbc
ExtFieldFermState(Handle< FermBC< T, P, Q > > fbc_, Handle< ExternalField > ext_field, const Q &q_)
Full constructor.
const FermBC< T, P, Q > & getBC() 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
Simple version of FermState.
int mu
Definition: cool.cc:24
Create a connection state.
External field.
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
Simple ferm state and a creator.
Support class for fermion actions and linear operators.