www.mooseframework.org
TestDistributionDirectPostprocessor.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "NormalDistribution.h"
12 
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<GeneralPostprocessor>();
20  params.addRequiredParam<DistributionName>(
21  "distribution", "The normal distribution which supplies the postprocessor value.");
22  params.addRequiredParam<Real>(
23  "value", "A value to pass to the cdf, pdf, or quantile function of the given distribution.");
24  params.addParam<Real>("mean", 0, "Mean of normal distribution.");
25  params.addParam<Real>("standard_deviation", 1, "Standard deviation of normal distribution.");
26  MooseEnum method("cdf pdf quantile");
27  params.addParam<MooseEnum>("method", method, "The distribution method to call.");
28  return params;
29 }
30 
32  const InputParameters & parameters)
33  : GeneralPostprocessor(parameters),
34  _distribution(getDistribution<NormalDistribution>("distribution")),
35  _value(getParam<Real>("value")),
36  _mean(getParam<Real>("mean")),
37  _std_dev(getParam<Real>("standard_deviation")),
38  _distribution_method(getParam<MooseEnum>("method"))
39 {
40 }
41 
42 PostprocessorValue
44 {
45  if (_distribution_method == "pdf")
47  else if (_distribution_method == "cdf")
49  else if (_distribution_method == "quantile")
51  mooseError("This should be possible to reach, what did you do!");
52 }
Test object for testing distribution capabilities.
const Real & _std_dev
Value of standard deviation to test direct method.
virtual PostprocessorValue getValue() override
registerMooseObject("StochasticToolsTestApp", TestDistributionDirectPostprocessor)
virtual Real quantile(const Real &p) const override
const NormalDistribution & _distribution
Object of statistics distribution.
const Real & _mean
Value of mean to test direct method.
InputParameters validParams< TestDistributionDirectPostprocessor >()
TestDistributionDirectPostprocessor(const InputParameters &parameters)
A class used to generate a normal distribution.
virtual Real cdf(const Real &x) const override
const MooseEnum & _distribution_method
The distribution method to call.
const Real & _value
The value to supply to method.
virtual Real pdf(const Real &x) const override