www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
UniformDistribution Class Reference

A class used to generate uniform distribution. More...

#include <UniformDistribution.h>

Inheritance diagram for UniformDistribution:
[legend]

Public Member Functions

 UniformDistribution (const InputParameters &parameters)
 
virtual Real pdf (const Real &x) override
 
virtual Real cdf (const Real &x) override
 
virtual Real quantile (const Real &y) override
 

Protected Attributes

const Real & _lower_bound
 The lower bound for the uniform distribution. More...
 
const Real & _upper_bound
 The upper bound for the uniform distribution. More...
 

Detailed Description

A class used to generate uniform distribution.

Definition at line 20 of file UniformDistribution.h.

Constructor & Destructor Documentation

UniformDistribution::UniformDistribution ( const InputParameters &  parameters)

Definition at line 21 of file UniformDistribution.C.

22  : Distribution(parameters),
23  _lower_bound(getParam<Real>("lower_bound")),
24  _upper_bound(getParam<Real>("upper_bound"))
25 {
27  mooseError("The lower bound is larger than the upper bound!");
28 }
const Real & _upper_bound
The upper bound for the uniform distribution.
const Real & _lower_bound
The lower bound for the uniform distribution.

Member Function Documentation

Real UniformDistribution::cdf ( const Real &  x)
overridevirtual

Definition at line 40 of file UniformDistribution.C.

41 {
42  if (x < _lower_bound)
43  return 0.0;
44  else if (x > _upper_bound)
45  return 1.0;
46  else
47  return (x - _lower_bound) / (_upper_bound - _lower_bound);
48 }
const Real & _upper_bound
The upper bound for the uniform distribution.
const Real & _lower_bound
The lower bound for the uniform distribution.
Real UniformDistribution::pdf ( const Real &  x)
overridevirtual

Definition at line 31 of file UniformDistribution.C.

32 {
33  if (x < _lower_bound || x > _upper_bound)
34  return 0.0;
35  else
36  return 1.0 / (_upper_bound - _lower_bound);
37 }
const Real & _upper_bound
The upper bound for the uniform distribution.
const Real & _lower_bound
The lower bound for the uniform distribution.
Real UniformDistribution::quantile ( const Real &  y)
overridevirtual

Definition at line 51 of file UniformDistribution.C.

52 {
53  if (y < 0 || y > 1)
54  mooseError("The cdf_value provided is out of range 0 to 1.");
55  else
56  return y * (_upper_bound - _lower_bound) + _lower_bound;
57 }
const Real & _upper_bound
The upper bound for the uniform distribution.
const Real & _lower_bound
The lower bound for the uniform distribution.

Member Data Documentation

const Real& UniformDistribution::_lower_bound
protected

The lower bound for the uniform distribution.

Definition at line 31 of file UniformDistribution.h.

Referenced by cdf(), pdf(), quantile(), and UniformDistribution().

const Real& UniformDistribution::_upper_bound
protected

The upper bound for the uniform distribution.

Definition at line 34 of file UniformDistribution.h.

Referenced by cdf(), pdf(), quantile(), and UniformDistribution().


The documentation for this class was generated from the following files: