https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Receiver.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
10#include "Receiver.h"
11
13
16{
18 params.addParam<Real>("default", 0, "The default value");
19 params.addParam<bool>(
20 "initialize_old", true, "Initialize the old postprocessor value with the default value");
21
22 params.addClassDescription("Reports the value stored in this processor, which is usually filled "
23 "in by another object. The Receiver does not compute its own value.");
24 return params;
25}
26
28 : GeneralPostprocessor(params),
29 _initialize_old(getParam<bool>("initialize_old")),
30 _my_value(getPostprocessorValueByName(name()))
31{
32 const PostprocessorReporterName r_name(name());
34
35 // Request that we need the old and older time values for this Receiver
36 write_data.needReporterTimeIndex<PostprocessorValue>(r_name, 2);
37
38 // Initialize values
39 const Real & value = getParam<Real>("default");
40 write_data.setReporterValue<PostprocessorValue>(r_name, value, 0);
42 {
43 write_data.setReporterValue<PostprocessorValue>(r_name, value, 1);
44 write_data.setReporterValue<PostprocessorValue>(r_name, value, 2);
45 }
46}
47
48Real
50{
51 // Return the stored value (references stored value in getPostprocessorData)
52 return _my_value;
53}
Real PostprocessorValue
various MOOSE typedefs
Definition MooseTypes.h:230
registerMooseObject("MooseApp", Receiver)
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
A ReporterName that represents a Postprocessor.
A class for storing data, it allows the user to change the value of the postprocessor by altering the...
Definition Receiver.h:19
virtual Real getValue() const override
Returns the value stored in _my_value.
Definition Receiver.C:49
const PostprocessorValue & _my_value
Reference to the value being stored in the associated PostprocessorData class.
Definition Receiver.h:48
Receiver(const InputParameters &parameters)
Class constructor.
Definition Receiver.C:27
static InputParameters validParams()
Definition Receiver.C:15
bool _initialize_old
Flag for initializing the old value.
Definition Receiver.h:45
void needReporterTimeIndex(const ReporterName &reporter_name, const std::size_t time_index)
Method for setting that a specific time index is requested for a Reporter value.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.