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) const override
 
virtual Real cdf (const Real &x) const override
 
virtual Real quantile (const Real &y) const override
 
virtual Real median () const 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 49 of file BoostDistribution.h.

Constructor & Destructor Documentation

◆ BoostDistribution()

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

Definition at line 65 of file BoostDistribution.h.

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

Member Function Documentation

◆ cdf()

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

Definition at line 92 of file BoostDistribution.h.

93 {
94 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
95  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
96  return boost::math::cdf(*_distribution_unique_ptr, x);
97 #else
98  return x; // unreachable
99 #endif
100 }
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 ( ) const
overridevirtual

Definition at line 116 of file BoostDistribution.h.

117 {
118 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
119  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
120  return boost::math::median(*_distribution_unique_ptr);
121 #else
122  return 0; // unreachable
123 #endif
124 }
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) const
overridevirtual

Definition at line 80 of file BoostDistribution.h.

81 {
82 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
83  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
84  return boost::math::pdf(*_distribution_unique_ptr, x);
85 #else
86  return x; // unreachable
87 #endif
88 }
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) const
overridevirtual

Definition at line 104 of file BoostDistribution.h.

105 {
106 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
107  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
108  return boost::math::quantile(*_distribution_unique_ptr, y);
109 #else
110  return y; // unreachable
111 #endif
112 }
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 61 of file BoostDistribution.h.


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