www.mooseframework.org
Receiver.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 /****************************************************************/
14 
15 #include "Receiver.h"
16 
17 template <>
20 {
22  params.addParam<Real>("default", "The default value");
23  params.addParam<bool>(
24  "initialize_old", true, "Initialize the old postprocessor value with the default value");
25  return params;
26 }
27 
29  : GeneralPostprocessor(params),
30  _initialize_old(getParam<bool>("initialize_old")),
31  _my_value(getPostprocessorValueByName(name()))
32 {
33 }
34 
35 Real
37 {
38  // Return the stored value (references stored value in getPostprocessorData)
39  return _my_value;
40 }
41 
42 void
44 {
45  if (isParamValid("default"))
46  {
47  Real value = getParam<Real>("default");
49  if (_initialize_old)
50  {
53  }
54  }
55 }
virtual void initialSetup() override
Initial setup function for applying the default value.
Definition: Receiver.C:43
bool _initialize_old
Flag for initializing the old value.
Definition: Receiver.h:60
const PostprocessorValue & _my_value
Reference to the value being stored in the associated PostprocessorData class.
Definition: Receiver.h:63
PostprocessorValue & getPostprocessorValueOld(const std::string &name)
Get the reference to the old value of a post-processor.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< GeneralPostprocessor >()
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
PostprocessorValue & getPostprocessorValueOlder(const std::string &name)
Get the reference to the older value of a post-processor.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition: MooseObject.h:67
Receiver(const InputParameters &parameters)
Class constructor.
Definition: Receiver.C:28
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Definition: UserObject.h:149
std::string _pp_name
Definition: Postprocessor.h:51
InputParameters validParams< Receiver >()
Definition: Receiver.C:19
virtual Real getValue() override
Returns the value stored in _my_value.
Definition: Receiver.C:36
PostprocessorValue & getPostprocessorValue(const PostprocessorName &name)
Get a reference to the value associated with the postprocessor.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...