C++ main module for stochmagnet Package  1.0
SMS_STDNormalFunction.h
Go to the documentation of this file.
1 #ifndef SMS_STDNormalFunction_H
2 #define SMS_STDNormalFunction_H
3 
5 
6 //header for std::nomal law
7 #include <random>
8 
15 class SMS_STDNormalFunction : public SM_TemplatedStochasticFunction<SMS_STDNormalFunction> {
16  // ATTRIBUTES
17 
18 private:
19  static std::random_device mGenerator;
20  static std::mt19937 mRNGenerator;
21 
22 
23 
24  std::normal_distribution<tReal> *mRandomDistribution;
25 
26 
27 
28 public:
29  // METHODS
30 
31  // CONSTRUCTORS
32 
35 
36 
37 
38  // DESTRUCTORS
39 
40 
43  virtual ~SMS_STDNormalFunction(void) ;
44 
45 
46 
47 public:
48 
49 
56  }
57 
58  public:
59 
60  //MEMORY
74  virtual tMemSize getMemorySize() const {
75  return sizeof(*this)+getContentsMemorySize();
76  }
77 
86  virtual tMemSize getContentsMemorySize() const {
88  mem+=(mRandomDistribution==null)?0:sizeof(*mRandomDistribution);
89 
90  return mem;
91  }
92 
93 private:
96  inline static std::mt19937& getRNGenerator() {
97  return mRNGenerator;
98  };
99 
100 
101  // --------------------
102  // ATTRIBUTES setting
103  // --------------------
104 public:
109  virtual void setProperties(const tReal& mean,
110  const tReal& sd) override;
111 
112 
116  virtual void initializeSeed(const tULLInt& seed) override;
117 
121  virtual tReal random() const override {
122  return templatedRandom();
123  }
127  inline tReal templatedRandom() const {
128  return (*mRandomDistribution)(getRNGenerator());
129  }
130 
131 
132 
133 
134 
135 };
136 
137 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:94
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:259
This class implements a stochastic function with a normal law implemented from the boost library.
Definition: SMS_STDNormalFunction.h:15
static std::random_device mGenerator
Definition: SMS_STDNormalFunction.h:19
virtual void initializeSeed(const tULLInt &seed) override
initialize the seed
Definition: SMS_STDNormalFunction.cpp:35
static std::mt19937 & getRNGenerator()
get the generator
Definition: SMS_STDNormalFunction.h:96
static CORE_UniquePointer< SMS_STDNormalFunction > New()
build a new instance of the stochasticfunction
Definition: SMS_STDNormalFunction.h:53
virtual ~SMS_STDNormalFunction(void)
destroy an object.
Definition: SMS_STDNormalFunction.cpp:18
tReal templatedRandom() const
random return a random numbers in range
Definition: SMS_STDNormalFunction.h:127
virtual tReal random() const override
random return a random numbers in range
Definition: SMS_STDNormalFunction.h:121
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SMS_STDNormalFunction.h:86
virtual void setProperties(const tReal &mean, const tReal &sd) override
set the properties of the stochastic futcion
Definition: SMS_STDNormalFunction.cpp:24
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SMS_STDNormalFunction.h:74
static std::mt19937 mRNGenerator
Definition: SMS_STDNormalFunction.h:20
std::normal_distribution< tReal > * mRandomDistribution
Definition: SMS_STDNormalFunction.h:24
SMS_STDNormalFunction()
create an object
Definition: SMS_STDNormalFunction.cpp:9
This class describes a templated stochastic function to generate random numbers.
Definition: SM_TemplatedStochasticFunction.h:15
typename std::unique_ptr< T, CORE_Object::Delete > CORE_UniquePointer
Definition: sp.h:8
#define tULLInt
Definition: types.h:58
#define tMemSize
Definition: types.h:166
#define tReal
Definition: types.h:137