https://mooseframework.inl.gov
ConstantPostprocessor.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 "ConstantPostprocessor.h"
11 
13 
16 {
18  params.addParam<Real>("value", 0, "The value");
19  params.declareControllable("value");
20 
21  params.addClassDescription("Postprocessor that holds a constant value");
22  return params;
23 }
24 
26  : GeneralPostprocessor(params), _value(getParam<Real>("value"))
27 {
28  const PostprocessorReporterName r_name(name());
29  auto & write_data = _fe_problem.getReporterData(ReporterData::WriteKey());
30 
31  // Initialize value
32  write_data.setReporterValue<PostprocessorValue>(r_name, _value);
33 }
34 
35 Real
37 {
38  return _value;
39 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
static InputParameters validParams()
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
Real PostprocessorValue
various MOOSE typedefs
Definition: MooseTypes.h:202
ConstantPostprocessor(const InputParameters &parameters)
registerMooseObject("MooseApp", ConstantPostprocessor)
void setReporterValue(const ReporterName &reporter_name, const T &value, const std::size_t time_index=0)
Method for setting Reporter values that already exist.
Definition: ReporterData.h:481
A ReporterName that represents a Postprocessor.
Definition: ReporterName.h:134
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Definition: UserObject.h:211
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...
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...
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
const Real & _value
value held by postprocessor
static InputParameters validParams()
A class for storing a constant value.