Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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:
43  std::vector<int> m_source_position;
44  std::vector<int> m_source_momentum;
45  std::string m_str_noise_type;
46  bool m_in_node;
47 
48  public:
50  : Source(), m_rand(RandomNumberManager::getInstance())
51  {
52  }
53 
54  /* Source_Random(RandomNumbers *rand) */
55  /* : Source(), m_rand(rand) */
56  /* {} */
57 
58  /* Source_Random(unique_ptr<RandomNumbers>& rand) */
59  /* : Source(), m_rand(rand.get()) */
60  /* {} */
61 
62  void set_parameters(const Parameters& params);
63  void set_parameters(const std::vector<int>& source_position,
64  const std::vector<int>& source_momentum,
65  const std::string noise_type);
66 
67  void set(Field& src, const int idx);
68  void set(Field& src, const int i_color, const int i_spin);
69  void set_all_color(Field& src, const int i_spin);
70  void set_all_color_spin(Field& src);
71 
73  void set_all_space_time(Field& src, const int ic);
74 
76  void set_all_space_time(Field& src, const int ic, const int is);
77 
78 #ifdef USE_FACTORY
79  private:
80  static Source *create_object()
81  {
82  return new Source_Random();
83  }
84 
85  // static Source *create_object_with_arg(RandomNumbers *rand)
86  // {
87  // return new Source_Random(rand);
88  // }
89 
90  public:
91  static bool register_factory()
92  {
93  bool init1 = Source::Factory::Register("Random", create_object);
94 
95  // bool init2 = Source::Factory_rand::Register("Random", create_object_with_arg);
96  return init1;
97  // return init1 && init2;
98  }
99 #endif
100 };
101 #endif
static const std::string class_name
Definition: source_Random.h:38
Random noise source in the space at a given timeslice.
Definition: source_Random.h:35
Container of Field-type object.
Definition: field.h:45
void set_all_color_spin(Field &src)
Class for parameters.
Definition: parameters.h:46
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". The same random number is set for all the spin indices at one site.
std::vector< int > m_source_position
Definition: source_Random.h:43
std::string m_str_noise_type
Definition: source_Random.h:45
void set_all_color(Field &src, const int i_spin)
RandomNumbers * m_rand
Definition: source_Random.h:41
Lexical site index.
Definition: index_lex.h:34
Manager class for RandomNumbers.
Base class of random number generators.
Definition: randomNumbers.h:43
Index_lex m_index
Definition: source_Random.h:42
std::vector< int > m_source_momentum
Definition: source_Random.h:44
void set(Field &src, const int idx)
void set_parameters(const Parameters &params)
Base class of source for a linear solver.
Definition: source.h:37