www.mooseframework.org
TestDistributionPostprocessor.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 #include "Distribution.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<GeneralPostprocessor>();
15  params.addRequiredParam<DistributionName>(
16  "distribution", "The distribution which supplies the postprocessor value.");
17  params.addRequiredParam<Real>(
18  "value", "A value to pass to the cdf, pdf, or quantile function of the given distribution.");
19 
20  MooseEnum method("cdf pdf quantile");
21  params.addParam<MooseEnum>("method", method, "The distribution method to call.");
22  return params;
23 }
24 
26  : GeneralPostprocessor(parameters),
27  _distribution(getDistribution("distribution")),
28  _value(getParam<Real>("value")),
29  _distribution_method(getParam<MooseEnum>("method"))
30 {
31 }
32 
33 PostprocessorValue
35 {
36  if (_distribution_method == "pdf")
37  return _distribution.pdf(_value);
38  else if (_distribution_method == "cdf")
39  return _distribution.cdf(_value);
40  else if (_distribution_method == "quantile")
41  return _distribution.quantile(_value);
42  mooseError("This should be possible to reach, what did you do!");
43 }
InputParameters validParams< TestDistributionPostprocessor >()
const Real & _value
The value to supply to method.
virtual PostprocessorValue getValue() override
const MooseEnum & _distribution_method
The distribution method to call.
TestDistributionPostprocessor(const InputParameters &parameters)
Distribution & _distribution
Object of statistics distribution.