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 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 }

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  TIME_SECTION(_perf_cdf);
97  return boost::math::cdf(*_distribution_unique_ptr, x);
98 #else
99  return x; // unreachable
100 #endif
101 }

◆ median()

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

Definition at line 118 of file BoostDistribution.h.

119 {
120 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
121  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
122  TIME_SECTION(_perf_median);
123  return boost::math::median(*_distribution_unique_ptr);
124 #else
125  return 0; // unreachable
126 #endif
127 }

◆ pdf()

template<typename T >
Real BoostDistribution< T >::pdf ( const Real &  x) const
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  TIME_SECTION(_perf_pdf);
84  return boost::math::pdf(*_distribution_unique_ptr, x);
85 #else
86  return x; // unreachable
87 #endif
88 }

◆ quantile()

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

Definition at line 105 of file BoostDistribution.h.

106 {
107 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
108  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
109  TIME_SECTION(_perf_quantile);
110  return boost::math::quantile(*_distribution_unique_ptr, y);
111 #else
112  return y; // unreachable
113 #endif
114 }

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:
name
const std::string name
Definition: Setup.h:21
BoostDistribution::_distribution_unique_ptr
std::unique_ptr< T > _distribution_unique_ptr
This must be defined by the child class in the constructor.
Definition: BoostDistribution.h:60