Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
randomNumbers.h
Go to the documentation of this file.
1 
14 #ifndef RANDOMNUMBERS_INCLUDED
15 #define RANDOMNUMBERS_INCLUDED
16 
17 #include "Field/field.h"
18 
19 #include "IO/bridgeIO.h"
20 using Bridge::vout;
21 
23 
37 {
38  public:
39  static const std::string class_name;
40 
41  protected:
43 
44  public:
45 
47  : m_vl(CommonParameters::Vlevel()) {}
48 
49  virtual ~RandomNumbers() {}
50 
51  private:
52  // non-copyable
55 
56  public:
57 
59 
60  virtual double get() = 0;
61 
62  void gauss(double& rand1, double& rand2);
63 
64 
66  virtual void gauss_lex_global(Field&);
67 
69  virtual void gauss_eo_global(Field&);
70 
72  virtual void uniform_lex_global(Field&);
73 
75  virtual void read_file(const std::string&) = 0;
76  virtual void write_file(const std::string&) = 0;
77 
79  virtual void reset(unsigned long seed) = 0;
80 
81 
82  protected:
83 
85  {
86  public:
88  : m_rand_gauss(rand_gauss), m_ptr(f.ptr(0)), m_block(f.nin()) {}
89  void operator()(const bool do_fill);
90  size_t block_size() const;
91 
92  private:
94  double *m_ptr;
95  size_t m_block;
96  };
97 
99  {
100  public:
102  : m_rand_gauss(rand_gauss), m_ptr(f.ptr(0)), m_block(f.nin()) {}
103  void operator()(const bool do_fill);
104  size_t block_size() const;
105 
106  private:
108  double *m_ptr;
109  size_t m_block;
110  };
111 
113  {
114  public:
116  : m_rand_gauss(rand_gauss), m_ptr(f.ptr(0)), m_block(f.nin()) {}
117  void operator()(const bool do_fill);
118  size_t block_size() const;
119 
120  private:
122  double *m_ptr;
123  size_t m_block;
124  };
125 
126  private:
127  template<typename InnerGenerator>
128  void generate_global(Field& f);
129 };
130 #endif
BridgeIO vout
Definition: bridgeIO.cpp:495
void set_parameter_verboselevel(const Bridge::VerboseLevel vl)
Definition: randomNumbers.h:58
virtual void uniform_lex_global(Field &)
uniform random number defined on global lattice.
Container of Field-type object.
Definition: field.h:39
RandomNumbers & operator=(const RandomNumbers &)
virtual void write_file(const std::string &)=0
static const std::string class_name
Definition: randomNumbers.h:39
virtual ~RandomNumbers()
Definition: randomNumbers.h:49
virtual void gauss_lex_global(Field &)
gaussian random number defined on global lattice.
RandomNumbers * m_rand_gauss
Bridge::VerboseLevel m_vl
Definition: randomNumbers.h:42
void operator()(const bool do_fill)
virtual void gauss_eo_global(Field &)
gaussian noise for even-odd perconditioned field (S.UEDA)
rand_gauss_even(Field &f, RandomNumbers *rand_gauss)
Definition: randomNumbers.h:87
Common parameter class: provides parameters as singleton.
virtual void reset(unsigned long seed)=0
reset state with new seed.
void operator()(const bool do_fill)
virtual void read_file(const std::string &)=0
save and load random number status.
void operator()(const bool do_fill)
Base class of random number generators.
Definition: randomNumbers.h:36
Bridge::VerboseLevel vl
Definition: checker.cpp:18
VerboseLevel
Definition: bridgeIO.h:42
void generate_global(Field &f)
rand_gauss_odd(Field &f, RandomNumbers *rand_gauss)
rand_uniform(Field &f, RandomNumbers *rand_gauss)
void gauss(double &rand1, double &rand2)