C++ mpi module for stochmagnet_main Package
RNDB_UniformRealDistribution.h
1 #ifndef RNDB_UniformRealDistribution_H
2 #define RNDB_UniformRealDistribution_H
3 
4 //inherited class
5 #include "RAND_RandomNumberDistribution.h"
6 
7 //boost header
8 #include <boost/random/uniform_real_distribution.hpp>
9 
15 class RNDB_UniformRealDistribution : public RAND_RandomNumberDistribution<tReal,boost::random::uniform_real_distribution<tReal>,RNDB_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  boost::random::uniform_real_distribution<T> dist;
35  initialize(dist);
36  }
37 
38 
39 
40  // DESTRUCTORS
41 
42 
46  }
47 
48 
49 
50 public:
51 
55  inline static CORE_UniquePointer<RNDB_UniformRealDistribution> New() {
56  return CORE_UniquePointer<RNDB_UniformRealDistribution>(new RNDB_UniformRealDistribution(),
58  }
59 
60 private:
61 
62  public:
63 
64  //MEMORY
78  virtual tMemSize getMemorySize() const {
79  return sizeof(*this)+getContentsMemorySize();
80  }
81 
90  virtual tMemSize getContentsMemorySize() const {
91  tMemSize mem= SuperSelf::getContentsMemorySize();
92  return mem;
93  }
94 
99  void setSupport(const T& a,const T& b) {
100  boost::random::uniform_real_distribution<T> dist(a,b);
101  initialize(dist);
102 
103  }
104 
116  inline void setProperties(const tReal& mean,
117  const tReal& sd) {
118  setSupport(mean-sqrt(3)*sd,mean+sqrt(3)*sd);
119  }
120 
121 
122 
123 
124 };
125 
126 #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(boost::random::uniform_real_distribution< tReal > &dist)
initiliaze generator
Definition: RAND_RandomNumberDistribution.h:103
This class implements a an uniform real law in [a,b[.
Definition: RNDB_UniformRealDistribution.h:15
void setProperties(const tReal &mean, const tReal &sd)
set the properties of the stochastic futcion
Definition: RNDB_UniformRealDistribution.h:116
RNDB_UniformRealDistribution()
create an object
Definition: RNDB_UniformRealDistribution.h:33
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: RNDB_UniformRealDistribution.h:90
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: RNDB_UniformRealDistribution.h:78
static CORE_UniquePointer< RNDB_UniformRealDistribution > New()
build a new instance of the stochasticfunction
Definition: RNDB_UniformRealDistribution.h:55
virtual ~RNDB_UniformRealDistribution(void)
destroy an object.
Definition: RNDB_UniformRealDistribution.h:45
void setSupport(const T &a, const T &b)
set the support of the random function
Definition: RNDB_UniformRealDistribution.h:99