Bridge++  Ver. 2.0.2
source_Random.h
Go to the documentation of this file.
1 
14 #ifndef SOURCE_RANDOM_INCLUDED
15 #define SOURCE_RANDOM_INCLUDED
16 
17 #include "source.h"
18 
19 #include "Field/index_lex.h"
21 
23 
35 class Source_Random : public Source
36 {
37  public:
38  static const std::string class_name;
39 
40  private:
42 
45  std::vector<int> m_source_position;
46  std::vector<int> m_source_momentum;
47  std::string m_str_noise_type;
48  bool m_in_node;
49 
50  public:
52  : m_vl(CommonParameters::Vlevel()),
53  m_rand(RandomNumberManager::getInstance())
54  {
55  }
56 
57  Source_Random(const Parameters& params)
58  : m_vl(CommonParameters::Vlevel()),
59  m_rand(RandomNumberManager::getInstance())
60  {
61  set_parameters(params);
62  }
63 
64  /* Source_Random(RandomNumbers *rand) */
65  /* : Source(), m_rand(rand) */
66  /* {} */
67 
68  void set_parameters(const Parameters& params);
69  void set_parameters(const std::vector<int>& source_position,
70  const std::vector<int>& source_momentum,
71  const std::string noise_type);
72 
73  void get_parameters(Parameters& params) const;
74 
75  void set(Field& src, const int idx);
76  void set(Field& src, const int i_color, const int i_spin);
77  void set_all_color(Field& src, const int i_spin);
78  void set_all_color_spin(Field& src);
79 
81  void set_all_space_time(Field& src, const int ic);
82 
84  void set_all_space_time(Field& src, const int ic, const int is);
85 
86 #ifdef USE_FACTORY
87  private:
88  static Source *create_object()
89  {
90  return new Source_Random();
91  }
92 
93  // static Source *create_object_with_arg(RandomNumbers *rand)
94  // {
95  // return new Source_Random(rand);
96  // }
97 
98  static Source *create_object_with_params(const Parameters& params)
99  {
100  return new Source_Random(params);
101  }
102 
103  public:
104  static bool register_factory()
105  {
106  bool init = true;
107  init &= Source::Factory::Register("Random", create_object);
108  // init &= Source::Factory_rand::Register("Random", create_object_with_arg);
109  init &= Source::Factory_params::Register("Random", create_object_with_params);
110  return init;
111  }
112 #endif
113 };
114 #endif
Source_Random::set_all_space_time
void set_all_space_time(Field &src, const int ic)
Setting a noise vector. Filling all the sites and spin indices for color index "ic"....
Definition: source_Random.cpp:405
Source_Random::set
void set(Field &src, const int idx)
Definition: source_Random.cpp:135
CommonParameters
Common parameter class: provides parameters as singleton.
Definition: commonParameters.h:42
Index_lex
Lexical site index.
Definition: index_lex.h:34
Source_Random::get_parameters
void get_parameters(Parameters &params) const
Definition: source_Random.cpp:53
Parameters
Class for parameters.
Definition: parameters.h:46
Source_Random::set_parameters
void set_parameters(const Parameters &params)
Definition: source_Random.cpp:25
RandomNumbers
Base class of random number generators.
Definition: randomNumbers.h:43
Source_Random::Source_Random
Source_Random()
Definition: source_Random.h:51
Source_Random::m_source_position
std::vector< int > m_source_position
Definition: source_Random.h:45
Source_Random::Source_Random
Source_Random(const Parameters &params)
Definition: source_Random.h:57
source.h
Source
Base class of source for a linear solver.
Definition: source.h:37
RandomNumberManager
Manager class for RandomNumbers.
Definition: randomNumberManager.h:53
AIndex_eo_qxs::idx
int idx(const int in, const int Nin, const int ist, const int Nx2, const int Ny, const int leo, const int Nvol2, const int ex)
Definition: aindex_eo.h:27
Source_Random::m_index
Index_lex m_index
Definition: source_Random.h:44
Source_Random::set_all_color_spin
void set_all_color_spin(Field &src)
Definition: source_Random.cpp:316
Source_Random::m_rand
RandomNumbers * m_rand
Definition: source_Random.h:43
Source_Random::m_in_node
bool m_in_node
Definition: source_Random.h:48
index_lex.h
Source_Random::m_vl
Bridge::VerboseLevel m_vl
Definition: source_Random.h:41
Source_Random
Random noise source in the space at a given timeslice.
Definition: source_Random.h:35
Source_Random::m_str_noise_type
std::string m_str_noise_type
Definition: source_Random.h:47
randomNumberManager.h
Source_Random::class_name
static const std::string class_name
Definition: source_Random.h:38
Field
Container of Field-type object.
Definition: field.h:46
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
Source_Random::m_source_momentum
std::vector< int > m_source_momentum
Definition: source_Random.h:46
Source_Random::set_all_color
void set_all_color(Field &src, const int i_spin)
Definition: source_Random.cpp:225