Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
director_Smear.cpp
Go to the documentation of this file.
1 
14 #include "director_Smear.h"
15 
16 const std::string Director_Smear::class_name = "Director_Smear";
17 
18 //====================================================================
20 {
21  const string str_vlevel = params.get_string("verbose_level");
22 
23  m_vl = vout.set_verbose_level(str_vlevel);
24 
25  //- fetch and check input parameters
26  int Nsmear;
27 
28  int err = 0;
29  err += params.fetch_int("number_of_smearing", Nsmear);
30 
31  if (err) {
32  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
33  exit(EXIT_FAILURE);
34  }
35 
36 
37  set_parameters(Nsmear);
38 }
39 
40 
41 //====================================================================
42 void Director_Smear::set_parameters(const int Nsmear)
43 {
44  const int Nvol = CommonParameters::Nvol();
45  const int Ndim = CommonParameters::Ndim();
46 
47  //- print input parameters
48  vout.general(m_vl, "%s:\n", class_name.c_str());
49  vout.general(m_vl, " Nsmear = %d\n", Nsmear);
50 
51  //- range check
52  // NB. Nsmear == 0 is allowed.
53 
54  //- store values
55  m_Nsmear = Nsmear;
56 
57  //- post-process
58  m_Usmear.resize(m_Nsmear);
59  if (m_Nsmear > 0) {
60  for (int i_smear = 0; i_smear < m_Nsmear; ++i_smear) {
61  m_Usmear[i_smear].reset(Nvol, Ndim);
62  }
63  vout.detailed(m_vl, " size of Usmear[i_smear] was set.\n");
64  }
65 }
66 
67 
68 //====================================================================
70 {
71  m_U = (Field_G *)U;
72 
73  if (m_status_linkv == 0) smear();
74 }
75 
76 
77 //====================================================================
79 {
80  set_config(U.get());
81 }
82 
83 
84 //====================================================================
86 {
87  assert(m_U != 0);
88 
89  if (i_smear == 0) {
90  return m_U;
91  } else {
92  return &m_Usmear[i_smear - 1];
93  }
94 }
95 
96 
97 //====================================================================
99 {
100  return m_Nsmear == 0 ? m_U : &m_Usmear[m_Nsmear - 1];
101 }
102 
103 
104 //====================================================================
106 {
107  if (i_smear == 0) return m_U;
108 
109  return &m_Usmear[i_smear - 1];
110 }
111 
112 
113 //====================================================================
115 {
116  if (m_Nsmear > 0) {
117  const int Nvol = m_U->nvol();
118  const int Nex = m_U->nex();
119 
120  for (int i_smear = 0; i_smear < m_Nsmear; ++i_smear) {
121  Field_G Uprev(Nvol, Nex);
122  if (i_smear == 0) {
123  Uprev = *m_U;
124  } else {
125  Uprev = m_Usmear[i_smear - 1];
126  }
127 
128  Field_G Usmear(Nvol, Nex);
129  m_smear->smear(Usmear, Uprev);
130  m_Usmear[i_smear] = (Field)Usmear;
131  }
132  }
133 
134  ++m_status_linkv;
135 }
136 
137 
138 //====================================================================
139 //============================================================END=====
void smear()
smearing is performed by calling a function of Smear object
BridgeIO vout
Definition: bridgeIO.cpp:503
void detailed(const char *format,...)
Definition: bridgeIO.cpp:216
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Container of Field-type object.
Definition: field.h:45
int nvol() const
Definition: field.h:127
Class for parameters.
Definition: parameters.h:46
SU(N) gauge field.
Definition: field_G.h:38
Smear * m_smear
smearing operator
int fetch_int(const string &key, int &value) const
Definition: parameters.cpp:346
Bridge::VerboseLevel m_vl
Definition: director.h:40
pointer get() const
int nex() const
Definition: field.h:128
virtual void smear(Field_G &, const Field_G &)=0
std::vector< Field_G > m_Usmear
smeared configs.
void set_config(Field *U)
set pointer to original thin link variable
int m_status_linkv
set to zero when link var. is updated
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
Field * getptr_smearedConfig(const int i_smear)
get pointer to i-th smeared config (0th is original thin link)
void set_parameters(const Parameters &params)
set parameters, must be called before set_config
static const std::string class_name
Field_G * get_config()
string get_string(const string &key) const
Definition: parameters.cpp:221
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
int m_Nsmear
number of smearing to be applied
Field_G * m_U
original thin link var.