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

A class used to generate a Johnson SB distribution. More...

#include <JohnsonSB.h>

Inheritance diagram for JohnsonSB:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 JohnsonSB (const InputParameters &parameters)
 
virtual Real pdf (const Real &x) const override
 
virtual Real cdf (const Real &x) const override
 
virtual Real quantile (const Real &p) 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 &a, const Real &b, const Real &alpha_1, const Real &alpha_2)
 
static Real cdf (const Real &x, const Real &a, const Real &b, const Real &alpha_1, const Real &alpha_2)
 
static Real quantile (const Real &p, const Real &a, const Real &b, const Real &alpha_1, const Real &alpha_2)
 
static Real pdf (const Real &x, const Real &mean, const Real &std_dev)
 
static Real cdf (const Real &x, const Real &mean, const Real &std_dev)
 
static Real quantile (const Real &p, const Real &mean, const Real &std_dev)
 

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
 The lower location parameter, a. More...
 
const Real_upper
 The upper location parameter, b. More...
 
const Real_alpha_1
 The first shape parameter, alpha_1. More...
 
const Real_alpha_2
 The second shape parameter, alpha_2. More...
 
const Real_mean
 The mean (or expectation) of the distribution (mu) More...
 
const Real_standard_deviation
 The standard deviation of the distribution (sigma) 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
 

Static Protected Attributes

static const std::array< Real, 6 > _a
 
static const std::array< Real, 6 > _b
 

Detailed Description

A class used to generate a Johnson SB distribution.

Definition at line 17 of file JohnsonSB.h.

Constructor & Destructor Documentation

◆ JohnsonSB()

JohnsonSB::JohnsonSB ( const InputParameters parameters)

Definition at line 35 of file JohnsonSB.C.

36  : Normal(parameters),
37  _lower(getParam<Real>("a")),
38  _upper(getParam<Real>("b")),
39  _alpha_1(getParam<Real>("alpha_1")),
40  _alpha_2(getParam<Real>("alpha_2"))
41 {
42 }
Normal(const InputParameters &parameters)
Definition: Normal.C:33
const Real & _alpha_2
The second shape parameter, alpha_2.
Definition: JohnsonSB.h:46
const Real & _alpha_1
The first shape parameter, alpha_1.
Definition: JohnsonSB.h:43
const InputParameters & parameters() const
const Real & _lower
The lower location parameter, a.
Definition: JohnsonSB.h:37
const Real & _upper
The upper location parameter, b.
Definition: JohnsonSB.h:40

Member Function Documentation

◆ cdf() [1/3]

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

Reimplemented from Normal.

Definition at line 88 of file JohnsonSB.C.

89 {
90  return cdf(x, _lower, _upper, _alpha_1, _alpha_2);
91 }
const std::vector< double > x
const Real & _alpha_2
The second shape parameter, alpha_2.
Definition: JohnsonSB.h:46
const Real & _alpha_1
The first shape parameter, alpha_1.
Definition: JohnsonSB.h:43
const Real & _lower
The lower location parameter, a.
Definition: JohnsonSB.h:37
virtual Real cdf(const Real &x) const override
Definition: JohnsonSB.C:88
const Real & _upper
The upper location parameter, b.
Definition: JohnsonSB.h:40

◆ cdf() [2/3]

Real Normal::cdf ( const Real x,
const Real mean,
const Real std_dev 
)
staticinherited

Definition at line 48 of file Normal.C.

49 {
50  return 0.5 * (1.0 + std::erf((x - mean) / (std_dev * std::sqrt(2.0))));
51 }
const std::vector< double > x

◆ cdf() [3/3]

Real JohnsonSB::cdf ( const Real x,
const Real a,
const Real b,
const Real alpha_1,
const Real alpha_2 
)
static

Definition at line 60 of file JohnsonSB.C.

62 {
63  if (x <= a)
64  return 0.0;
65  else if (x < b)
66  {
67  return Normal::cdf(alpha_1 + alpha_2 * std::log((x - a) / (b - x)), 0.0, 1.0);
68  }
69  else
70  return 0.0;
71 }
virtual Real cdf(const Real &x) const override
Definition: Normal.C:74
const std::vector< double > x

◆ pdf() [1/3]

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

Reimplemented from Normal.

Definition at line 82 of file JohnsonSB.C.

83 {
84  return pdf(x, _lower, _upper, _alpha_1, _alpha_2);
85 }
const std::vector< double > x
const Real & _alpha_2
The second shape parameter, alpha_2.
Definition: JohnsonSB.h:46
virtual Real pdf(const Real &x) const override
Definition: JohnsonSB.C:82
const Real & _alpha_1
The first shape parameter, alpha_1.
Definition: JohnsonSB.h:43
const Real & _lower
The lower location parameter, a.
Definition: JohnsonSB.h:37
const Real & _upper
The upper location parameter, b.
Definition: JohnsonSB.h:40

◆ pdf() [2/3]

Real Normal::pdf ( const Real x,
const Real mean,
const Real std_dev 
)
staticinherited

Definition at line 41 of file Normal.C.

42 {
43  return 1.0 / (std_dev * std::sqrt(2.0 * M_PI)) *
44  std::exp(-0.5 * Utility::pow<2>((x - mean) / std_dev));
45 }
const std::vector< double > x

◆ pdf() [3/3]

Real JohnsonSB::pdf ( const Real x,
const Real a,
const Real b,
const Real alpha_1,
const Real alpha_2 
)
static

Definition at line 45 of file JohnsonSB.C.

47 {
48  if (x <= a)
49  return 0.0;
50  else if (x < b)
51  {
52  return (alpha_2 * (b - a)) / ((x - a) * (b - x) * std::sqrt(2.0 * M_PI)) *
53  std::exp(-0.5 * Utility::pow<2>(alpha_1 + alpha_2 * std::log((x - a) / (b - x))));
54  }
55  else
56  return 0.0;
57 }
const std::vector< double > x

◆ quantile() [1/3]

Real JohnsonSB::quantile ( const Real p) const
overridevirtual

Reimplemented from Normal.

Definition at line 94 of file JohnsonSB.C.

95 {
96  return quantile(p, _lower, _upper, _alpha_1, _alpha_2);
97 }
const Real & _alpha_2
The second shape parameter, alpha_2.
Definition: JohnsonSB.h:46
const Real & _alpha_1
The first shape parameter, alpha_1.
Definition: JohnsonSB.h:43
const Real & _lower
The lower location parameter, a.
Definition: JohnsonSB.h:37
virtual Real quantile(const Real &p) const override
Definition: JohnsonSB.C:94
const Real & _upper
The upper location parameter, b.
Definition: JohnsonSB.h:40

◆ quantile() [2/3]

Real Normal::quantile ( const Real p,
const Real mean,
const Real std_dev 
)
staticinherited

Definition at line 54 of file Normal.C.

55 {
56  const Real x = (p < 0.5 ? p : 1.0 - p);
57  const Real y = std::sqrt(-2.0 * std::log(x));
58  const Real y2 = y * y;
59  const Real y3 = y2 * y;
60  const Real y4 = y3 * y;
61  const Real sgn = (p - 0.5 < 0.0 ? -1.0 : 1.0);
62  const Real Zp = sgn * (y + (_a[0] + _a[1] * y + _a[2] * y2 + _a[3] * y3 + _a[4] * y4) /
63  (_b[0] + _b[1] * y + _b[2] * y2 + _b[3] * y3 + _b[4] * y4));
64  return Zp * std_dev + mean;
65 }
int sgn(T val)
The sign function.
Definition: Numerics.h:41
const std::vector< double > y
const std::vector< double > x
static const std::array< Real, 6 > _a
Definition: Normal.h:35
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::array< Real, 6 > _b
Definition: Normal.h:36

◆ quantile() [3/3]

Real JohnsonSB::quantile ( const Real p,
const Real a,
const Real b,
const Real alpha_1,
const Real alpha_2 
)
static

Definition at line 74 of file JohnsonSB.C.

76 {
77  const Real Z = Normal::quantile(p, 0.0, 1.0);
78  return (a + b * std::exp((Z - alpha_1) / alpha_2)) / (1.0 + std::exp((Z - alpha_1) / alpha_2));
79 }
static const std::string Z
Definition: NS.h:169
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real quantile(const Real &p) const override
Definition: Normal.C:80

◆ validParams()

InputParameters JohnsonSB::validParams ( )
static

Definition at line 17 of file JohnsonSB.C.

Referenced by JohnsonSBDistribution::validParams().

18 {
20  params.addClassDescription("Johnson Special Bounded (SB) distribution.");
21 
22  params.set<Real>("mean") = 0.0;
23  params.set<Real>("standard_deviation") = 1.0;
24  params.suppressParameter<Real>("mean");
25  params.suppressParameter<Real>("standard_deviation");
26 
27  params.addRequiredParam<Real>("a", "Lower location parameter");
28  params.addRequiredParam<Real>("b", "Upper location parameter");
29  params.addRequiredParam<Real>("alpha_1", "Shape parameter (sometimes called a)");
30  params.addRequiredParam<Real>("alpha_2", "Shape parameter (sometimes called b)");
31 
32  return params;
33 }
T & set(const std::string &name, bool quiet_mode=false)
static InputParameters validParams()
Definition: Normal.C:23
void addRequiredParam(const std::string &name, const std::string &doc_string)
void suppressParameter(const std::string &name)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _a

const std::array< Real, 6 > Normal::_a
staticprotectedinherited
Initial value:
= {
{-0.322232431088, -1.0, -0.342242088547, -0.0204231210245, -0.0000453642210148}}

Coefficients for the rational function used to approximate the quantile

Definition at line 35 of file Normal.h.

Referenced by Normal::quantile().

◆ _alpha_1

const Real& JohnsonSB::_alpha_1
protected

The first shape parameter, alpha_1.

Definition at line 43 of file JohnsonSB.h.

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

◆ _alpha_2

const Real& JohnsonSB::_alpha_2
protected

The second shape parameter, alpha_2.

Definition at line 46 of file JohnsonSB.h.

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

◆ _b

const std::array< Real, 6 > Normal::_b
staticprotectedinherited
Initial value:
= {
{0.099348462606, 0.588581570495, 0.531103462366, 0.10353775285, 0.0038560700634}}

Definition at line 36 of file Normal.h.

Referenced by Normal::quantile().

◆ _lower

const Real& JohnsonSB::_lower
protected

The lower location parameter, a.

Definition at line 37 of file JohnsonSB.h.

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

◆ _mean

const Real& Normal::_mean
protectedinherited

The mean (or expectation) of the distribution (mu)

Definition at line 40 of file Normal.h.

Referenced by Normal::cdf(), TruncatedNormal::cdf(), Normal::pdf(), TruncatedNormal::pdf(), Normal::quantile(), and TruncatedNormal::quantile().

◆ _standard_deviation

const Real& Normal::_standard_deviation
protectedinherited

The standard deviation of the distribution (sigma)

Definition at line 43 of file Normal.h.

Referenced by Normal::cdf(), TruncatedNormal::cdf(), Normal::pdf(), TruncatedNormal::pdf(), Normal::quantile(), and TruncatedNormal::quantile().

◆ _upper

const Real& JohnsonSB::_upper
protected

The upper location parameter, b.

Definition at line 40 of file JohnsonSB.h.

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


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