BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
32 : generator_(static_cast<TRandom*>(other.generator_->Clone())) {}
104 generator_->Circle(ret_double[0], ret_double[1],
static_cast<double>(r));
105 return {
static_cast<real_t>(ret_double[0]),
106 static_cast<real_t>(ret_double[1])};
112 generator_->Sphere(ret[0], ret[1], ret[2], r);
113 return {
static_cast<real_t>(ret[0]),
static_cast<real_t>(ret[1]),
114 static_cast<real_t>(ret[2])};
132 template <
typename TSample>
135 return SampleImpl(rng);
141 template <
typename TSample>
144 return Sample2Impl(rng);
150 template <
typename TSample>
158 template <
typename TSample>
161 return Sample3Impl(rng);
167 template <
typename TSample>
170 {SampleImpl(rng), SampleImpl(rng), SampleImpl(rng)});
222 : mean_(mean), gamma_(gamma) {}
234 : function_(function), option_(option) {}
250 double (*f)(
const double*,
const double*),
252 const char* option) {
257 tf1 =
new TF1(
"", f, min, max, params.
size());
259 tf1->SetParameters(params[0], params[1], params[2], params[3], params[4],
260 params[5], params[6], params[7], params[8], params[9]);
269 : function_(function), option_(option) {}
283 return {
static_cast<real_t>(ret[0]),
static_cast<real_t>(ret[1])};
289 double (*f)(
const double*,
const double*),
296 tf2 =
new TF2(
"", f, xmin, xmax, ymin, ymax, params.
size());
298 tf2->SetParameters(params[0], params[1], params[2], params[3], params[4],
299 params[5], params[6], params[7], params[8], params[9]);
308 : function_(function), option_(option) {}
322 return {
static_cast<real_t>(ret[0]),
static_cast<real_t>(ret[1])};
326 function_->GetRandom3(ret[0], ret[1], ret[2]);
327 return {
static_cast<real_t>(ret[0]),
static_cast<real_t>(ret[1]),
328 static_cast<real_t>(ret[2])};
334 double (*f)(
const double*,
const double*),
341 tf3 =
new TF3(
"", f, xmin, xmax, ymin, ymax, zmin, zmax, params.
size());
343 tf3->SetParameters(params[0], params[1], params[2], params[3], params[4],
344 params[5], params[6], params[7], params[8], params[9]);
real_t SampleImpl(TRandom *rng) override
real_t Gaus(real_t mean=0.0, real_t sigma=1.0)
MathArray< real_t, 3 > Sphere(real_t radius)
int SampleImpl(TRandom *rng) override
~UserDefinedDistRng3D() override
GausRng GetGausRng(real_t mean=0, real_t sigma=1) const
real_t PoissonD(real_t mean)
~UserDefinedDistRng2D() override
UserDefinedDistRng1D(TRootIOCtor *ioctor)
BinomialRng(int ntot, real_t prob)
UserDefinedDistRng3D GetUserDefinedDistRng3D(double(*f)(const double *, const double *), const FixedSizeVector< real_t, 10 > ¶ms, real_t xmin, real_t xmax, real_t ymin, real_t ymax, real_t zmin, real_t zmax, const char *option=nullptr)
MathArray< TSample, 3 > Sample3()
MathArray< real_t, 2 > Circle(real_t radius)
BreitWignerRng GetBreitWignerRng(real_t mean=0, real_t gamma=1) const
ExpRng GetExpRng(real_t tau) const
real_t BreitWigner(real_t mean=0, real_t gamma=1)
Random & operator=(const Random &other)
PoissonDRng GetPoissonDRng(real_t mean) const
~UserDefinedDistRng1D() override
Random * GetRandom()
Returns a thread local random number generator.
std::unordered_map< UserDefinedDist, TF1 * > udd_tf1_map_
real_t Uniform(real_t max=1.0)
BinomialRng GetBinomialRng(int ntot, real_t prob) const
UserDefinedDistRng3D(TRootIOCtor *ioctor)
virtual MathArray< TSample, 2 > Sample2Impl(TRandom *rng)
BreitWignerRng(real_t mean, real_t gamma)
real_t SampleImpl(TRandom *rng) override
unsigned Integer(int max)
void Draw(const char *option="")
int Binomial(int ntot, real_t prob)
void SetGenerator(TRandom *new_rng)
real_t SampleImpl(TRandom *rng) override
virtual MathArray< TSample, 3 > Sample3Impl(TRandom *rng)
void Draw(const char *option="")
real_t SampleImpl(TRandom *rng) override
real_t Landau(real_t mean=0, real_t sigma=1)
real_t SampleImpl(TRandom *rng) override
void Draw(const char *option="")
UserDefinedDistRng2D GetUserDefinedDistRng2D(double(*f)(const double *, const double *), const FixedSizeVector< real_t, 10 > ¶ms, real_t xmin, real_t xmax, real_t ymin, real_t ymax, const char *option=nullptr)
~BreitWignerRng() override
std::unordered_map< UserDefinedDist, TF2 * > udd_tf2_map_
UserDefinedDistRng1D GetUserDefinedDistRng1D(double(*f)(const double *, const double *), const FixedSizeVector< real_t, 10 > ¶ms, real_t min, real_t max, const char *option=nullptr)
UniformRng GetUniformRng(real_t min=0, real_t max=1) const
real_t SampleImpl(TRandom *rng) override
MathArray< real_t, 2 > Sample2Impl(TRandom *rng) override
TSample Sample()
Draws a sample from the distribution.
MathArray< real_t, 3 > Sample3Impl(TRandom *rng) override
PoissonRng GetPoissonRng(real_t mean) const
UserDefinedDistRng2D(TRootIOCtor *ioctor)
LandauRng GetLandauRng(real_t mean=0, real_t sigma=1) const
GausRng(real_t mean, real_t sigma)
LandauRng(real_t mean, real_t sigma)
int SampleImpl(TRandom *rng) override
real_t SampleImpl(TRandom *rng) override
static Simulation * GetActive()
This function returns the currently active Simulation simulation.
virtual ~GausRng() override
real_t SampleImpl(TRandom *rng) override
void SetSeed(uint64_t seed)
std::unordered_map< UserDefinedDist, TF3 * > udd_tf3_map_
MathArray< real_t, 2 > Sample2Impl(TRandom *rng) override
MathArray< TSample, 2 > Sample2()