https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Uniform Class Reference

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

#include <Uniform.h>

Inheritance diagram for Uniform:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 Uniform (const InputParameters &parameters)
 
virtual Real pdf (const Real &x) const override
 
virtual Real cdf (const Real &x) const override
 
virtual Real quantile (const Real &y) const override
 
virtual Real median () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraphperfGraph ()
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static Real pdf (const Real &x, const Real &lower_bound, const Real &upper_bound)
 
static Real cdf (const Real &x, const Real &lower_bound, const Real &upper_bound)
 
static Real quantile (const Real &y, const Real &lower_bound, const Real &upper_bound)
 

Public Attributes

const ConsoleStream _console
 

Protected Member Functions

PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 

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...
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const Parallel::Communicator & _communicator
 

Detailed Description

A class used to generate uniform distribution.

Definition at line 17 of file Uniform.h.

Constructor & Destructor Documentation

◆ Uniform()

Uniform::Uniform ( const InputParameters parameters)

Definition at line 24 of file Uniform.C.

26  _lower_bound(getParam<Real>("lower_bound")),
27  _upper_bound(getParam<Real>("upper_bound"))
28 {
30  mooseError("The lower bound is larger than the upper bound!");
31 }
Distribution(const InputParameters &parameters)
const Real & _lower_bound
The lower bound for the uniform distribution.
Definition: Uniform.h:34
void mooseError(Args &&... args) const
const InputParameters & parameters() const
const Real & _upper_bound
The upper bound for the uniform distribution.
Definition: Uniform.h:37

Member Function Documentation

◆ cdf() [1/2]

Real Uniform::cdf ( const Real x,
const Real lower_bound,
const Real upper_bound 
)
static

Definition at line 43 of file Uniform.C.

Referenced by cdf(), and KernelDensity1D::cdf().

44 {
45  if (x < lower_bound)
46  return 0.0;
47  else if (x > upper_bound)
48  return 1.0;
49  else
50  return (x - lower_bound) / (upper_bound - lower_bound);
51 }
const std::vector< double > x

◆ cdf() [2/2]

Real Uniform::cdf ( const Real x) const
overridevirtual

Implements Distribution.

Definition at line 69 of file Uniform.C.

70 {
71  return cdf(x, _lower_bound, _upper_bound);
72 }
const std::vector< double > x
static Real cdf(const Real &x, const Real &lower_bound, const Real &upper_bound)
Definition: Uniform.C:43
const Real & _lower_bound
The lower bound for the uniform distribution.
Definition: Uniform.h:34
const Real & _upper_bound
The upper bound for the uniform distribution.
Definition: Uniform.h:37

◆ pdf() [1/2]

Real Uniform::pdf ( const Real x,
const Real lower_bound,
const Real upper_bound 
)
static

Definition at line 34 of file Uniform.C.

Referenced by KernelDensity1D::pdf(), and pdf().

35 {
36  if (x < lower_bound || x > upper_bound)
37  return 0.0;
38  else
39  return 1.0 / (upper_bound - lower_bound);
40 }

◆ pdf() [2/2]

Real Uniform::pdf ( const Real x) const
overridevirtual

Implements Distribution.

Definition at line 63 of file Uniform.C.

64 {
65  return pdf(x, _lower_bound, _upper_bound);
66 }
static Real pdf(const Real &x, const Real &lower_bound, const Real &upper_bound)
Definition: Uniform.C:34
const std::vector< double > x
const Real & _lower_bound
The lower bound for the uniform distribution.
Definition: Uniform.h:34
const Real & _upper_bound
The upper bound for the uniform distribution.
Definition: Uniform.h:37

◆ quantile() [1/2]

Real Uniform::quantile ( const Real y,
const Real lower_bound,
const Real upper_bound 
)
static

Definition at line 54 of file Uniform.C.

Referenced by quantile(), and KernelDensity1D::quantile().

55 {
56  if (y < 0 || y > 1)
57  ::mooseError("The cdf_value provided is out of range 0 to 1.");
58  else
59  return y * (upper_bound - lower_bound) + lower_bound;
60 }
const std::vector< double > y
void mooseError(Args &&... args) const

◆ quantile() [2/2]

Real Uniform::quantile ( const Real y) const
overridevirtual

Implements Distribution.

Definition at line 75 of file Uniform.C.

76 {
78 }
const std::vector< double > y
static Real quantile(const Real &y, const Real &lower_bound, const Real &upper_bound)
Definition: Uniform.C:54
const Real & _lower_bound
The lower bound for the uniform distribution.
Definition: Uniform.h:34
const Real & _upper_bound
The upper bound for the uniform distribution.
Definition: Uniform.h:37

◆ validParams()

InputParameters Uniform::validParams ( )
static

Definition at line 15 of file Uniform.C.

Referenced by UniformDistribution::validParams().

16 {
18  params.addClassDescription("Continuous uniform distribution.");
19  params.addParam<Real>("lower_bound", 0.0, "Distribution lower bound");
20  params.addParam<Real>("upper_bound", 1.0, "Distribution upper bound");
21  return params;
22 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _lower_bound

const Real& Uniform::_lower_bound
protected

The lower bound for the uniform distribution.

Definition at line 34 of file Uniform.h.

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

◆ _upper_bound

const Real& Uniform::_upper_bound
protected

The upper bound for the uniform distribution.

Definition at line 37 of file Uniform.h.

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


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