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
 

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 44 of file BoostDistribution.h.

Constructor & Destructor Documentation

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

Definition at line 59 of file BoostDistribution.h.

60  : Distribution(parameters)
61 {
62 #ifndef LIBMESH_HAVE_EXTERNAL_BOOST
63  mooseError("The ",
64  getParam<std::string>("type"),
65  " distribution named '",
66  name(),
67  "' requires that libMesh be compiled with an external Boost library, this may be done "
68  "using the --with-boost configure option.");
69 #endif
70 }

Member Function Documentation

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

Definition at line 86 of file BoostDistribution.h.

87 {
88 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
89  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
90  return boost::math::cdf(*_distribution_unique_ptr, x);
91 #else
92  return x; // unreachable
93 #endif
94 }
std::unique_ptr< T > _distribution_unique_ptr
This must be defined by the child class in the constructor.
template<typename T >
Real BoostDistribution< T >::pdf ( const Real &  x)
overridevirtual

Definition at line 74 of file BoostDistribution.h.

75 {
76 #ifdef LIBMESH_HAVE_EXTERNAL_BOOST
77  mooseAssert(_distribution_unique_ptr, "Boost distribution pointer not defined.");
78  return boost::math::pdf(*_distribution_unique_ptr, x);
79 #else
80  return x; // unreachable
81 #endif
82 }
std::unique_ptr< T > _distribution_unique_ptr
This must be defined by the child class in the constructor.
template<typename T >
Real BoostDistribution< T >::quantile ( const Real &  y)
overridevirtual

Definition at line 98 of file BoostDistribution.h.

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

Member Data Documentation

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 55 of file BoostDistribution.h.

Referenced by BoostDistribution< T >::cdf(), BoostDistribution< T >::pdf(), and BoostDistribution< T >::quantile().


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