C++ mpi module for stochmagnet_main Package
RNDSTD_UniformRealDistribution.h
1 #ifndef RNDSTD_UniformRealDistribution_H
2 #define RNDSTD_UniformRealDistribution_H
3 
4 #include "RAND_RandomNumberDistribution.h"
5 
6 //header for standart random laws
7 #include <random>
8 
15 class RNDSTD_UniformRealDistribution : public RAND_RandomNumberDistribution<tReal,std::uniform_real_distribution<tReal>,RNDSTD_UniformRealDistribution> {
16  // ATTRIBUTES
17 
18 private:
19 
20  //type of the return value of the distribution
21  typedef tReal T;
22  //self class
24  //super class
26 
27 public:
28  // METHODS
29 
30  // CONSTRUCTORS
31 
34  std::uniform_real_distribution<T> dist;
35  initialize(dist);
36  }
37 
38 
39 
40  // DESTRUCTORS
41 
42 
46  }
47 
48 
49 
50 public:
51 
52 
56  inline static CORE_UniquePointer<RNDSTD_UniformRealDistribution> New() {
57  return CORE_UniquePointer<RNDSTD_UniformRealDistribution>(new RNDSTD_UniformRealDistribution(),
59  }
60 
61  public:
62 
63  //MEMORY
77  virtual tMemSize getMemorySize() const {
78  return sizeof(*this)+getContentsMemorySize();
79  }
80 
89  virtual tMemSize getContentsMemorySize() const {
90  tMemSize mem= SuperSelf::getContentsMemorySize();
91  return mem;
92  }
93 
94 
95 private:
96 
97 
98  // --------------------
99  // ATTRIBUTES setting
100  // --------------------
101 public:
102 
107  void setSupport(const T& a,const T& b) {
108 
109  std::uniform_real_distribution<T> dist(a,b);
110  initialize(dist);
111  }
112 
124  inline void setProperties(const tReal& mean,
125  const tReal& sd) {
126  setSupport(mean-sqrt(3)*sd,mean+sqrt(3)*sd);
127  }
128 
129 
130 
131 
132 
133 
134 };
135 
136 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class generates a distribution implemented in class G with internal implementation class I with ...
Definition: RAND_RandomNumberDistribution.h:17
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: RAND_RandomNumberDistribution.h:88
void initialize(std::uniform_real_distribution< tReal > &dist)
initiliaze generator
Definition: RAND_RandomNumberDistribution.h:103
This class implements a stochastic function with a real uniform law in [0,1[ implemented from the boo...
Definition: RNDSTD_UniformRealDistribution.h:15
static CORE_UniquePointer< RNDSTD_UniformRealDistribution > New()
build a new instance of the stochasticfunction
Definition: RNDSTD_UniformRealDistribution.h:56
void setSupport(const T &a, const T &b)
set the support of the random function
Definition: RNDSTD_UniformRealDistribution.h:107
virtual ~RNDSTD_UniformRealDistribution(void)
destroy an object.
Definition: RNDSTD_UniformRealDistribution.h:45
RNDSTD_UniformRealDistribution()
create an object
Definition: RNDSTD_UniformRealDistribution.h:33
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: RNDSTD_UniformRealDistribution.h:89
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: RNDSTD_UniformRealDistribution.h:77
void setProperties(const tReal &mean, const tReal &sd)
set the properties of the stochastic futcion
Definition: RNDSTD_UniformRealDistribution.h:124