CHROMA
simple_gaugebc.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Simple gauge boundary conditions
4  */
5 
6 #ifndef __simple_gaugebc_h__
7 #define __simple_gaugebc_h__
8 
9 #include "gaugebc.h"
10 
11 namespace Chroma
12 {
13 
14  /*! @ingroup gaugebcs */
15  namespace SimpleGaugeBCEnv
16  {
17  extern const std::string name;
18  bool registerAll();
19  }
20 
21  /*! @ingroup gaugebcs */
23  {
25  SimpleGaugeBCParams(XMLReader& xml, const std::string& path);
26  multi1d<Complex> boundary;
27  };
28 
29  /*! @ingroup gaugebcs */
30  void read(XMLReader& xml, const std::string& path, SimpleGaugeBCParams& p);
31 
32  /*! @ingroup gaugebcs */
33  void write(XMLWriter& xml, const std::string& path, const SimpleGaugeBCParams& p);
34 
35 
36  //! Concrete class for gauge actions with simple boundary conditions
37  /*! @ingroup gaugebcs
38  *
39  * Simple BC, where boundary array is multiplied on the links on the
40  * edge of the lattice
41  */
42  template<typename P, typename Q>
43  class SimpleGaugeBC : public GaugeBC<P,Q>
44  {
45  public:
46  // Typedefs to save typing
47  //! Only full constructor
48  /*!
49  * \param boundary multiply links on edge of lattice by boundary
50  *
51  * NOTE: the type of boundary can be generalized
52  */
53  SimpleGaugeBC(const multi1d<Complex>& boundary_) : boundary(boundary_) {}
54 
55  //! From param struct
57 
58  //! Destructor is automatic
60 
61  //! Modify U fields in place
62  void modify(Q& u) const
63  {
64  // phases for all the directions
65  for(int m = 0; m < Nd; ++m)
66  {
67  /* u[m] *= (coord(m) == nrow(m)-1 ) ? boundary[m] : 1 */
68  u[m] *= where(Layout::latticeCoordinate(m) == Layout::lattSize()[m]-1,
69  boundary[m], Complex(1));
70  }
71  }
72 
73  //! Zero the U fields in place on the masked links
74  void zero(P& u) const {}
75 
76  //! Says if there are non-trivial BC links
77  /*!
78  * This is a simple implementation - always do the work.
79  * Could be improved by checking boundary
80  */
81  bool nontrivialP() const {return false;}
82 
83  private:
84  // Hide empty constructor
86 
87  //! Hide assignment
88  void operator=(const SimpleGaugeBC<P,Q>& a) {}
89 
90  private:
91  multi1d<Complex> boundary;
92  };
93 
94 }
95 
96 
97 #endif
Base class for all gauge action boundary conditions.
Definition: gaugebc.h:30
Concrete class for gauge actions with simple boundary conditions.
multi1d< Complex > boundary
void operator=(const SimpleGaugeBC< P, Q > &a)
Hide assignment.
SimpleGaugeBC(const SimpleGaugeBCParams &p)
From param struct.
SimpleGaugeBC(const multi1d< Complex > &boundary_)
Only full constructor.
~SimpleGaugeBC()
Destructor is automatic.
void zero(P &u) const
Zero the U fields in place on the masked links.
bool nontrivialP() const
Says if there are non-trivial BC links.
void modify(Q &u) const
Modify U fields in place.
Gauge 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.
static int m[4]
Definition: make_seeds.cc:16
Nd
Definition: meslate.cc:74
const std::string name
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::Q Q
Complex a
Definition: invbicg.cc:95
::std::string string
Definition: gtest.h:1979
multi1d< Complex > boundary
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13