Bridge++  Ver. 2.0.2
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  std::string vlevel;
22  if (!params.fetch_string("verbose_level", vlevel)) {
23  m_vl = vout.set_verbose_level(vlevel);
24  }
25 
26  //- fetch and check input parameters
27  int Nsmear;
28 
29  int err = 0;
30  err += params.fetch_int("number_of_smearing", Nsmear);
31 
32  if (err) {
33  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
34  exit(EXIT_FAILURE);
35  }
36 
37 
38  set_parameters(Nsmear);
39 }
40 
41 
42 //====================================================================
44 {
45  params.set_int("number_of_smearing", m_Nsmear);
46 
47  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
48 }
49 
50 
51 //====================================================================
52 void Director_Smear::set_parameters(const int Nsmear)
53 {
54  const int Nvol = CommonParameters::Nvol();
55  const int Ndim = CommonParameters::Ndim();
56 
57  //- print input parameters
58  vout.general(m_vl, "%s:\n", class_name.c_str());
59  vout.general(m_vl, " Nsmear = %d\n", Nsmear);
60 
61  //- range check
62  // NB. Nsmear == 0 is allowed.
63 
64  //- store values
65  m_Nsmear = Nsmear;
66 
67  //- post-process
68  m_Usmear.resize(m_Nsmear);
69  if (m_Nsmear > 0) {
70  for (int i_smear = 0; i_smear < m_Nsmear; ++i_smear) {
71  m_Usmear[i_smear].reset(Nvol, Ndim);
72  }
73  vout.detailed(m_vl, " size of Usmear[i_smear] was set.\n");
74  }
75 }
76 
77 
78 //====================================================================
80 {
81  m_U = (Field_G *)U;
82 
83  if (m_status_linkv == 0) smear();
84 }
85 
86 
87 //====================================================================
89 {
90  assert(m_U != 0);
91 
92  if (i_smear == 0) {
93  return m_U;
94  } else {
95  return &m_Usmear[i_smear - 1];
96  }
97 }
98 
99 
100 //====================================================================
102 {
103  return m_Nsmear == 0 ? m_U : &m_Usmear[m_Nsmear - 1];
104 }
105 
106 
107 //====================================================================
109 {
110  if (i_smear == 0) return m_U;
111 
112  return &m_Usmear[i_smear - 1];
113 }
114 
115 
116 //====================================================================
118 {
119  if (m_Nsmear > 0) {
120  const int Nvol = m_U->nvol();
121  const int Nex = m_U->nex();
122 
123  for (int i_smear = 0; i_smear < m_Nsmear; ++i_smear) {
124  Field_G Uprev(Nvol, Nex);
125  if (i_smear == 0) {
126  Uprev = *m_U;
127  } else {
128  Uprev = m_Usmear[i_smear - 1];
129  }
130 
131  Field_G Usmear(Nvol, Nex);
132  m_smear->smear(Usmear, Uprev);
133  m_Usmear[i_smear] = (Field)Usmear;
134  }
135  }
136 
137  ++m_status_linkv;
138 }
139 
140 
141 //====================================================================
142 //============================================================END=====
director_Smear.h
Director_Smear::m_U
Field_G * m_U
original thin link var.
Definition: director_Smear.h:49
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Parameters
Class for parameters.
Definition: parameters.h:46
Director_Smear::m_Usmear
std::vector< Field_G > m_Usmear
smeared configs.
Definition: director_Smear.h:50
Director_Smear::m_status_linkv
int m_status_linkv
set to zero when link var. is updated
Definition: director_Smear.h:51
Bridge::BridgeIO::detailed
void detailed(const char *format,...)
Definition: bridgeIO.cpp:219
Field::nex
int nex() const
Definition: field.h:128
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Director_Smear::getptr_smearedConfig
Field * getptr_smearedConfig(const int i_smear)
get pointer to i-th smeared config (0th is original thin link)
Definition: director_Smear.cpp:88
Director_Smear::set_parameters
void set_parameters(const Parameters &params)
set parameters, must be called before set_config
Definition: director_Smear.cpp:19
Smear::smear
virtual void smear(Field_G &, const Field_G &)=0
Director_Smear::smear
void smear()
smearing is performed by calling a function of Smear object
Definition: director_Smear.cpp:117
Director_Smear::class_name
static const std::string class_name
Definition: director_Smear.h:42
Field::nvol
int nvol() const
Definition: field.h:127
Director_Smear::get_parameters
void get_parameters(Parameters &params) const
get parameters
Definition: director_Smear.cpp:43
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Parameters::set_int
void set_int(const string &key, const int value)
Definition: parameters.cpp:36
Director_Smear::get_config
Field_G * get_config()
Definition: director_Smear.cpp:101
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Director_Smear::m_vl
Bridge::VerboseLevel m_vl
Definition: director_Smear.h:45
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Director_Smear::m_Nsmear
int m_Nsmear
number of smearing to be applied
Definition: director_Smear.h:47
Director_Smear::set_config
void set_config(Field *U)
set pointer to original thin link variable
Definition: director_Smear.cpp:79
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Parameters::fetch_int
int fetch_int(const string &key, int &value) const
Definition: parameters.cpp:346
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Director_Smear::m_smear
Smear * m_smear
smearing operator
Definition: director_Smear.h:48
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154