CHROMA
simple_fermbc.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Simple fermionic BC
4  */
5 
6 #ifndef __simple_fermbc_h__
7 #define __simple_fermbc_h__
8 
9 #include "fermbc.h"
10 #include "handle.h"
13 
14 namespace Chroma
15 {
16 
17  //! Params for simple fermbc
18  /*! \ingroup fermbcs */
20  {
22  SimpleFermBCParams(XMLReader& in, const std::string& path);
23 
24  multi1d<int> boundary;
25  };
26 
27  // Reader/writers
28  /*! \ingroup fermbcs */
29  void read(XMLReader& xml, const std::string& path, SimpleFermBCParams& param);
30  /*! \ingroup fermbcs */
31  void write(XMLWriter& xml, const std::string& path, const SimpleFermBCParams& param);
32 
33 
34  //! Concrete class for all gauge actions with simple boundary conditions
35  /*! @ingroup fermbcs
36  *
37  * Simple BC, where boundary array is multiplied on the links on the
38  * edge of the lattice
39  */
40  template<class T, typename P, typename Q>
41  class SimpleFermBC : public FermBC<T,P,Q>
42  {
43  public:
44  //! Only full constructor
45  /*!
46  * \param boundary multiply links on edge of lattice by boundary
47  *
48  * NOTE: there is no real reason this is of type int, could be more general
49  * like Complex
50  */
53  {init();}
54 
55  //! Only full constructor
56  /*!
57  * \param boundary multiply links on edge of lattice by boundary
58  *
59  * NOTE: there is no real reason this is of type int, could be more general
60  * like Complex
61  */
62  SimpleFermBC(const multi1d<int>& boundary_) :
63  gbc(new PeriodicGaugeBC<P,Q>()), boundary(boundary_)
64  {init();}
65 
66  //! Use both a Gauge BC and a boundary field
67  /*!
68  * \param gbc A generic gaugebc
69  * \param boundary multiply links on edge of lattice by boundary
70  */
71  SimpleFermBC(const Handle< GaugeBC<P,Q> >& gbc_, const multi1d<int>& boundary_) :
72  gbc(gbc_), boundary(boundary_)
73  {init();}
74 
75  //! Copy constructor
78 
79  //! Destructor is automatic
81 
82  //! Assignment
84  {gbc = a.gbc; boundary = a.boundary; nontriv = a.nontriv; return *this;}
85 
86  //! Modify U fields in place
87  void modify(Q& u) const
88  {
89  START_CODE();
90 
91  gbc->modify(u); // first modify the U fields
92 
93  // phases for all the directions
94  for(int m = 0; m < Nd; ++m)
95  {
96  if( boundary[m] != 1 ) {
97  /* u[m] *= (coord(m) == nrow(m)-1 ) ? boundary[m] : 1 */
98  u[m] *= where(Layout::latticeCoordinate(m) == (Layout::lattSize()[m]-1),
99  Integer(boundary[m]), Integer(1));
100  }
101  }
102 
103  END_CODE();
104  }
105 
106  //! Modify fermion fields in place
107  /*! NOP */
108  void modifyF(T& psi) const {}
109 
110  //! Modify fermion fields in place under a subset
111  /*! NOP */
112  void modifyF(T& psi, const Subset& s) const {}
113 
114  //! Modify fermion fields in place
115  /*! NOP */
116  void modifyF(multi1d<T>& psi) const {}
117 
118  //! Modify fermion fields in place under a subset
119  /*! NOP */
120  void modifyF(multi1d<T>& psi, const Subset& s) const {}
121 
122  //! Zero some gauge-like field in place on the masked links
123  void zero(P& ds_u) const {}
124 
125  //! Says if there are non-trivial BC links
126  bool nontrivialP() const {return false;}
127 
128  protected:
129  void init() {}
130 
131  private:
132  // No empty constructor
134 
135  private:
137  multi1d<int> boundary;
138  bool nontriv;
139  };
140 
141 }
142 
143 #endif
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
Base class for all gauge action boundary conditions.
Definition: gaugebc.h:30
Class for counted reference semantics.
Definition: handle.h:33
Concrete class for all gauge actions with simple boundary conditions.
Definition: simple_fermbc.h:42
~SimpleFermBC()
Destructor is automatic.
Definition: simple_fermbc.h:80
void modifyF(multi1d< T > &psi) const
Modify fermion fields in place.
void modifyF(T &psi, const Subset &s) const
Modify fermion fields in place under a subset.
void modifyF(multi1d< T > &psi, const Subset &s) const
Modify fermion fields in place under a subset.
SimpleFermBC(const Handle< GaugeBC< P, Q > > &gbc_, const multi1d< int > &boundary_)
Use both a Gauge BC and a boundary field.
Definition: simple_fermbc.h:71
SimpleFermBC(const SimpleFermBC &a)
Copy constructor.
Definition: simple_fermbc.h:76
Handle< GaugeBC< P, Q > > gbc
void modifyF(T &psi) const
Modify fermion fields in place.
void modify(Q &u) const
Modify U fields in place.
Definition: simple_fermbc.h:87
multi1d< int > boundary
SimpleFermBC(const SimpleFermBCParams &p)
Only full constructor.
Definition: simple_fermbc.h:51
bool nontrivialP() const
Says if there are non-trivial BC links.
SimpleFermBC & operator=(const SimpleFermBC &a)
Assignment.
Definition: simple_fermbc.h:83
SimpleFermBC(const multi1d< int > &boundary_)
Only full constructor.
Definition: simple_fermbc.h:62
void zero(P &ds_u) const
Zero some gauge-like field in place on the masked links.
Fermion action boundary conditions.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
Class for counted reference semantics.
static int m[4]
Definition: make_seeds.cc:16
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
LinOpSysSolverMGProtoClover::T T
Complex a
Definition: invbicg.cc:95
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
static QDP_ColorVector * in
multi1d< LatticeFermion > s(Ncb)
::std::string string
Definition: gtest.h:1979
Periodic gauge boundary conditions.
Simple gauge boundary conditions.
Params for simple fermbc.
Definition: simple_fermbc.h:20
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13