www.mooseframework.org
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
DistributionInterface Class Reference

Interface for objects that need to use distributions. More...

#include <DistributionInterface.h>

Inheritance diagram for DistributionInterface:
[legend]

Public Member Functions

 DistributionInterface (const MooseObject *moose_object)
 
const DistributiongetDistribution (const std::string &name) const
 Get a distribution with a given name. More...
 
template<typename T >
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 Get a distribution with a given name. More...
 
template<typename T >
const T & getDistributionByName (const std::string &name) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Private Attributes

const InputParameters_dni_params
 Parameters of the object with this interface. More...
 
FEProblemBase_dni_feproblem
 Reference to FEProblemBase instance. More...
 
const MooseObject *const _dni_moose_object_ptr
 Pointer to the MooseObject. More...
 

Detailed Description

Interface for objects that need to use distributions.

Inherit from this class at a very low level to make the getDistribution method available.

Definition at line 25 of file DistributionInterface.h.

Constructor & Destructor Documentation

◆ DistributionInterface()

DistributionInterface::DistributionInterface ( const MooseObject moose_object)

Definition at line 23 of file DistributionInterface.C.

24  : _dni_params(moose_object->parameters()),
26  _dni_moose_object_ptr(moose_object)
27 {
28 }
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
FEProblemBase & _dni_feproblem
Reference to FEProblemBase instance.
const InputParameters & parameters() const
Get the parameters of the object.
const InputParameters & _dni_params
Parameters of the object with this interface.
const MooseObject *const _dni_moose_object_ptr
Pointer to the MooseObject.

Member Function Documentation

◆ getDistribution() [1/2]

const Distribution & DistributionInterface::getDistribution ( const std::string &  name) const

Get a distribution with a given name.

Parameters
nameThe name of the parameter key of the distribution to retrieve
Returns
The distribution with name associated with the parameter 'name'

Definition at line 31 of file DistributionInterface.C.

Referenced by getDistribution(), and getDistributionByName().

32 {
33  DistributionName dist_name = _dni_params.get<DistributionName>(name);
34  return _dni_feproblem.getDistribution(dist_name);
35 }
std::string name(const ElemQuality q)
virtual Distribution & getDistribution(const std::string &name)
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
FEProblemBase & _dni_feproblem
Reference to FEProblemBase instance.
const InputParameters & _dni_params
Parameters of the object with this interface.

◆ getDistribution() [2/2]

template<typename T >
const T & DistributionInterface::getDistribution ( const std::string &  name) const

Definition at line 69 of file DistributionInterface.h.

70 {
71  try
72  {
73  const T & dist = dynamic_cast<const T &>(getDistribution(name));
74  return dist;
75  }
76  catch (std::bad_cast & exception)
77  {
78  DistributionName dist_name = _dni_params.get<DistributionName>(name);
79  mooseError("The '",
81  "' object failed to retrieve '",
82  dist_name,
83  "' distribution with the desired type.");
84  }
85 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
const Distribution & getDistribution(const std::string &name) const
Get a distribution with a given name.
const InputParameters & _dni_params
Parameters of the object with this interface.
const MooseObject *const _dni_moose_object_ptr
Pointer to the MooseObject.

◆ getDistributionByName() [1/2]

const Distribution & DistributionInterface::getDistributionByName ( const DistributionName &  name) const

Get a distribution with a given name.

Parameters
nameThe name of the distribution to retrieve
Returns
The distribution with name 'name'

Definition at line 38 of file DistributionInterface.C.

Referenced by RandomIC::RandomIC().

39 {
40  return _dni_feproblem.getDistribution(name);
41 }
virtual Distribution & getDistribution(const std::string &name)
FEProblemBase & _dni_feproblem
Reference to FEProblemBase instance.

◆ getDistributionByName() [2/2]

template<typename T >
const T & DistributionInterface::getDistributionByName ( const std::string &  name) const

Definition at line 89 of file DistributionInterface.h.

90 {
91  try
92  {
93  const T & dist = dynamic_cast<const T &>(getDistribution(name));
94  return dist;
95  }
96  catch (std::bad_cast & exception)
97  {
98  mooseError("The '",
100  "' object failed to retrieve '",
101  name,
102  "' distribution with the desired type.");
103  }
104 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
const Distribution & getDistribution(const std::string &name) const
Get a distribution with a given name.
const MooseObject *const _dni_moose_object_ptr
Pointer to the MooseObject.

◆ validParams()

InputParameters DistributionInterface::validParams ( )
static

Definition at line 17 of file DistributionInterface.C.

Referenced by RandomIC::validParams(), Sampler::validParams(), and FVInterfaceKernel::validParams().

18 {
20  return params;
21 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()

Member Data Documentation

◆ _dni_feproblem

FEProblemBase& DistributionInterface::_dni_feproblem
private

Reference to FEProblemBase instance.

Definition at line 61 of file DistributionInterface.h.

Referenced by getDistribution(), and getDistributionByName().

◆ _dni_moose_object_ptr

const MooseObject* const DistributionInterface::_dni_moose_object_ptr
private

Pointer to the MooseObject.

Definition at line 64 of file DistributionInterface.h.

Referenced by getDistribution(), and getDistributionByName().

◆ _dni_params

const InputParameters& DistributionInterface::_dni_params
private

Parameters of the object with this interface.

Definition at line 58 of file DistributionInterface.h.

Referenced by getDistribution().


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