Bridge++  Ver. 2.0.2
integrator_UpdateP.cpp
Go to the documentation of this file.
1 
14 #include "integrator_UpdateP.h"
15 
16 const std::string Integrator_UpdateP::class_name = "Integrator_UpdateP";
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 err = 0;
28 
29  if (err) {
30  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
31  exit(EXIT_FAILURE);
32  }
33 }
34 
35 
36 //====================================================================
38 {
39  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
40 }
41 
42 
43 //====================================================================
44 void Integrator_UpdateP::evolve(const double step_size, Field_G& iP, Field_G& U)
45 {
46  if (not is_cache_valid()) { // recalc force
47  m_force.set(0.0);
48 
49  Field force_tmp(iP.nin(), iP.nvol(), iP.nex());
50  for (unsigned int i = 0, n = m_action.size(); i < n; ++i) {
51  m_action[i]->force(force_tmp);
52  vout.detailed(m_vl, "updated p by action %d finished.\n", i);
53  axpy(m_force, 1.0, force_tmp);
54  }
55 
57 
58  vout.detailed(m_vl, "%s: force updated.\n", class_name.c_str());
59  } else {
60  vout.general(m_vl, "%s: returns previous force.\n", class_name.c_str());
61  }
62 
63  axpy(iP, step_size, m_force);
64 }
65 
66 
67 //====================================================================
68 //============================================================END=====
Integrator_UpdateP::m_action
std::vector< Action * > m_action
Definition: integrator_UpdateP.h:43
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Integrator_UpdateP::m_force
Field_G m_force
Definition: integrator_UpdateP.h:49
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
Bridge::BridgeIO::detailed
void detailed(const char *format,...)
Definition: bridgeIO.cpp:219
Field::nex
int nex() const
Definition: field.h:128
Integrator_UpdateP::is_cache_valid
bool is_cache_valid() const
Definition: integrator_UpdateP.h:76
integrator_UpdateP.h
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Integrator_UpdateP::class_name
static const std::string class_name
Definition: integrator_UpdateP.h:40
Field::nin
int nin() const
Definition: field.h:126
Integrator_UpdateP::get_parameters
void get_parameters(Parameters &params) const
Definition: integrator_UpdateP.cpp:37
Integrator_UpdateP::cache_validated
void cache_validated()
Definition: integrator_UpdateP.h:77
Field::nvol
int nvol() const
Definition: field.h:127
Integrator_UpdateP::set_parameters
void set_parameters()
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Integrator_UpdateP::evolve
void evolve(const double step_size, Field_G &iP, Field_G &U)
Definition: integrator_UpdateP.cpp:44
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Integrator::m_vl
Bridge::VerboseLevel m_vl
Definition: integrator.h:60
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