www.mooseframework.org
RelativeDifferencePostprocessor.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
15 
16 template <>
19 {
21 
22  params.addRequiredParam<PostprocessorName>("value1", "First post-processor");
23  params.addRequiredParam<PostprocessorName>("value2",
24  "Second post-processor, base for relative difference");
25 
26  params.addClassDescription("Computes the absolute value of the relative "
27  "difference between 2 post-processor values.");
28 
29  return params;
30 }
31 
33  : GeneralPostprocessor(parameters),
34  _value1(getPostprocessorValue("value1")),
35  _value2(getPostprocessorValue("value2"))
36 {
37 }
38 
39 void
41 {
42 }
43 
44 void
46 {
47 }
48 
51 {
53  return std::abs(_value1 - _value2);
54  else
55  return std::abs((_value1 - _value2) / _value2);
56 }
RelativeDifferencePostprocessor(const InputParameters &parameters)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< GeneralPostprocessor >()
const PostprocessorValue & _value1
first post-processor value
const PostprocessorValue & _value2
second post-processor value, used as base in relative difference
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual PostprocessorValue getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
Real PostprocessorValue
MOOSE typedefs.
Definition: MooseTypes.h:73
virtual void execute() override
Execute method.
bool absoluteFuzzyEqual(const libMesh::Real &var1, const libMesh::Real &var2, const libMesh::Real &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
InputParameters validParams< RelativeDifferencePostprocessor >()