C++ main module for stochmagnet Package  1.0
SMS_BoostUniformFunction.h
Go to the documentation of this file.
1 #ifndef SMS_BoostUniformFunction_H
2 #define SMS_BoostUniformFunction_H
3 
6 
7 
8 #include <boost/math/distributions/uniform.hpp>
9 #include <boost/random/uniform_real.hpp>
10 #include <boost/random/variate_generator.hpp>
11 
12 
13 // boost::mt19937
14 // boost::ecuyer1988
15 // boost::minstd_rand
16 // boost::rand48
17 typedef boost::mt19937 RNGUType;
18 
26  // ATTRIBUTES
27 
28 private:
29 
30 
31  // ASSOCIATIONS
32  boost::math::uniform_distribution<tReal> *mDistribution;
33  boost::uniform_real<tReal> *mRandomDistribution;
34  boost::random::variate_generator<RNGType&,
35  boost::uniform_real<tReal> > *mGenerator;
36 
37 
38 
39 public:
40  // METHODS
41 
42  // CONSTRUCTORS
43 
46 
47 
48 
49  // DESTRUCTORS
50 
51 
54  virtual ~SMS_BoostUniformFunction(void);
55 
56 
57 
58 public:
59 
66  }
67 
68 private:
69 
70  public:
71 
72  //MEMORY
86  virtual tMemSize getMemorySize() const {
87  return sizeof(*this)+getContentsMemorySize();
88  }
89 
98  virtual tMemSize getContentsMemorySize() const {
101  mem+=(mRandomDistribution==null)?0:sizeof(*mRandomDistribution);
102  mem+=(mGenerator==null)?0:sizeof(*mGenerator);
103  mem+=(mDistribution==null)?0:sizeof(*mDistribution);
104 
105  return mem;
106  }
107 
108 
109  // --------------------
110  // ATTRIBUTES setting
111  // --------------------
112 public:
113 
114 
118  virtual void initializeSeed(const tULLInt& seed) override {
119  initSeed(seed);
120  }
121 
126  void setSupport(const tReal& a,
127  const tReal& b);
128 
129  /* \brief set the properties of the stochastic fntion
130  * @param[in] mean : mean of the random function
131  * @param[in] sd : strandt deviation of the random function
132  */
133  virtual void setProperties(const tReal& mean,
134  const tReal& sd) override;
135 
139  virtual tReal random() const override {
140  return templatedRandom();
141  }
142 
146  inline tReal templatedRandom() const {
147  return (*mGenerator)();
148  }
149 
150 
151 
152 };
153 
154 #endif
boost::mt19937 RNGType
Definition: SMS_BoostRandomFunction.h:21
boost::mt19937 RNGUType
Definition: SMS_BoostUniformFunction.h:17
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 is the class to describes general distribution.
Definition: SMS_BoostRandomFunction.h:23
static void initSeed()
init the seed
Definition: SMS_BoostRandomFunction.cpp:22
This class implements a stochastic function with a normal law implemented from the boost library.
Definition: SMS_BoostUniformFunction.h:25
SMS_BoostUniformFunction()
create an object
Definition: SMS_BoostUniformFunction.cpp:4
virtual void initializeSeed(const tULLInt &seed) override
initialize the seed
Definition: SMS_BoostUniformFunction.h:118
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SMS_BoostUniformFunction.h:86
boost::math::uniform_distribution< tReal > * mDistribution
Definition: SMS_BoostUniformFunction.h:32
virtual ~SMS_BoostUniformFunction(void)
destroy an object.
Definition: SMS_BoostUniformFunction.cpp:14
tReal templatedRandom() const
random return a random numbers in range
Definition: SMS_BoostUniformFunction.h:146
virtual tReal random() const override
random return a random numbers in range
Definition: SMS_BoostUniformFunction.h:139
static CORE_UniquePointer< SMS_BoostUniformFunction > New()
build a new instance of the stochasticfunction
Definition: SMS_BoostUniformFunction.h:63
virtual void setProperties(const tReal &mean, const tReal &sd) override
set the properties of the stochastic function
Definition: SMS_BoostUniformFunction.cpp:28
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SMS_BoostUniformFunction.h:98
void setSupport(const tReal &a, const tReal &b)
set the support
Definition: SMS_BoostUniformFunction.cpp:46
boost::random::variate_generator< RNGType &, boost::uniform_real< tReal > > * mGenerator
Definition: SMS_BoostUniformFunction.h:35
boost::uniform_real< tReal > * mRandomDistribution
Definition: SMS_BoostUniformFunction.h:33
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