www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
BoostDistribution< T > Class Template Reference

A class used to as a base for distributions defined by Boost. More...

#include <BoostDistribution.h>

Inheritance diagram for BoostDistribution< T >:
[legend]

Public Member Functions

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

Protected Attributes

std::unique_ptr< T > _distribution_unique_ptr
 This must be defined by the child class in the constructor. More...
 

Detailed Description

template<typename T = Real>
class BoostDistribution< T >

A class used to as a base for distributions defined by Boost.

The default type is set to Real to allow for derived classes to compile without Boost and trigger the mooseError in the constructor.

Definition at line 48 of file BoostDistribution.h.

Constructor & Destructor Documentation

◆ BoostDistribution()

template<typename T >
BoostDistribution< T >::BoostDistribution ( const InputParameters &  parameters)

Definition at line 64 of file BoostDistribution.h.

65  : Distribution(parameters)
66 {
67 #ifndef LIBMESH_HAVE_EXTERNAL_BOOST
68  mooseError("The ",
69  getParam<std::string>("type"),
70  " distribution named '",
71  name(),
72  "' requires that libMesh be compiled with an external Boost library, this may be done "
73  "using the --with-boost configure option.");
74 #endif
75 }
const std::string name
Definition: Setup.h:22

Member Function Documentation

◆ cdf()

template<typename T >
Real BoostDistribution< T >::cdf ( const Real &  x)
overridevirtual

Definition at line 91 of file BoostDistribution.h.

92 {
93 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
94  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
95  return boost::math::cdf(*_distribution_unique_ptr, x);
96 #else
97  return x; // unreachable
98 #endif
99 }
std::unique_ptr< T > _distribution_unique_ptr
This must be defined by the child class in the constructor.

◆ median()

template<typename T >
Real BoostDistribution< T >::median ( )
overridevirtual

Definition at line 115 of file BoostDistribution.h.

116 {
117 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
118  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
119  return boost::math::median(*_distribution_unique_ptr);
120 #else
121  return 0; // unreachable
122 #endif
123 }
std::unique_ptr< T > _distribution_unique_ptr
This must be defined by the child class in the constructor.

◆ pdf()

template<typename T >
Real BoostDistribution< T >::pdf ( const Real &  x)
overridevirtual

Definition at line 79 of file BoostDistribution.h.

80 {
81 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
82  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
83  return boost::math::pdf(*_distribution_unique_ptr, x);
84 #else
85  return x; // unreachable
86 #endif
87 }
std::unique_ptr< T > _distribution_unique_ptr
This must be defined by the child class in the constructor.

◆ quantile()

template<typename T >
Real BoostDistribution< T >::quantile ( const Real &  y)
overridevirtual

Definition at line 103 of file BoostDistribution.h.

104 {
105 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
106  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
107  return boost::math::quantile(*_distribution_unique_ptr, y);
108 #else
109  return y; // unreachable
110 #endif
111 }
std::unique_ptr< T > _distribution_unique_ptr
This must be defined by the child class in the constructor.

Member Data Documentation

◆ _distribution_unique_ptr

template<typename T = Real>
std::unique_ptr<T> BoostDistribution< T >::_distribution_unique_ptr
protected

This must be defined by the child class in the constructor.

Definition at line 60 of file BoostDistribution.h.


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