Interface to allow object to consume Reporter values.
More...
#include <ReporterInterface.h>
Interface to allow object to consume Reporter values.
Definition at line 22 of file ReporterInterface.h.
◆ ReporterInterface() [1/2]
| ReporterInterface::ReporterInterface |
( |
const MooseObject * |
moose_object | ) |
|
Definition at line 20 of file ReporterInterface.C.
const InputParameters & parameters() const
Get the parameters of the object.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
const InputParameters & _ri_params
Parameters for the MooseObject inherting from this interface.
const ReporterData & _ri_reporter_data
The ReporterData.
FEProblemBase & _ri_fe_problem_base
Provides access to FEProblemBase::getReporterData.
◆ ReporterInterface() [2/2]
Special constructor used for Kokkos functor copy during parallel dispatch.
Definition at line 29 of file ReporterInterface.C.
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
const InputParameters & _ri_params
Parameters for the MooseObject inherting from this interface.
const ReporterData & _ri_reporter_data
The ReporterData.
FEProblemBase & _ri_fe_problem_base
Provides access to FEProblemBase::getReporterData.
◆ addReporterDependencyHelper()
| virtual void ReporterInterface::addReporterDependencyHelper |
( |
const ReporterName & |
| ) |
|
|
inlineprotectedvirtual |
◆ getReporterContextBaseByName()
Get the reporter context to allow non-typed operations with the data.
- Parameters
-
- Returns
- ReporterContextBase of the reporter value
Definition at line 60 of file ReporterInterface.C.
64 "Cannot call getReporterContextBaseByName() until all Reporters have been constructed.");
bool reportersAdded() const
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
const ReporterData & _ri_reporter_data
The ReporterData.
const ReporterContextBase & getReporterContextBase(const ReporterName &reporter_name) const
◆ getReporterName()
| const ReporterName & ReporterInterface::getReporterName |
( |
const std::string & |
param_name | ) |
const |
|
protected |
- Returns
- The ReporterName associated with the parametre
param_name.
Performs error checking to mak sure that the parameter is valid.
Definition at line 70 of file ReporterInterface.C.
Referenced by getReporterValue(), and hasReporterValue().
74 "When getting a Reporter, failed to get a parameter with the name \"",
77 "\n\nKnown parameters:\n",
87 "\" is not an expected type for getting a Reporter.\n\n",
88 "The expected type is \"ReporterName\".");
const InputParameters & parameters() const
Get the parameters of the object.
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
const InputParameters & _ri_params
Parameters for the MooseObject inherting from this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
The Reporter system is comprised of objects that can contain any number of data values.
◆ getReporterValue() [1/2]
template<typename T >
| const T & ReporterInterface::getReporterValue |
( |
const std::string & |
param_name, |
|
|
const std::size_t |
time_index = 0 |
|
) |
| |
|
protected |
doco-normal-methods-begin Returns read-only reference to a Reporter value that is provided by an input parameter.
- Template Parameters
-
| T | The C++ type of the Reporter value being consumed |
- Parameters
-
| param_name | The name of the parameter that gives the name of the Reporter, which must be a ReporterName parameter (i.e., getParam<ReporterName>(param_name)). |
| mode | The mode that the object will consume the Reporter value time_index (optional) If zero is provided the current value is returned. Use a positive index to return previous values (1 = older, 2 = older, etc.). The maximum number of old values is dictated by the ReporterData object. |
Definition at line 148 of file ReporterInterface.h.
const ReporterMode REPORTER_MODE_UNSET
◆ getReporterValue() [2/2]
template<typename T >
| const T & ReporterInterface::getReporterValue |
( |
const std::string & |
param_name, |
|
|
ReporterMode |
mode, |
|
|
const std::size_t |
time_index = 0 |
|
) |
| |
|
protected |
Definition at line 155 of file ReporterInterface.h.
161 possiblyCheckHasReporter<T>(reporter_name, param_name);
163 return getReporterValueByName<T>(reporter_name, mode, time_index);
const ReporterName & getReporterName(const std::string ¶m_name) const
◆ getReporterValueByName() [1/2]
template<typename T >
| const T & ReporterInterface::getReporterValueByName |
( |
const ReporterName & |
reporter_name, |
|
|
const std::size_t |
time_index = 0 |
|
) |
| |
|
protected |
Returns read-only reference to a Reporter value that is provided by name directly.
- Template Parameters
-
| T | The C++ type of the Reporter value being consumed |
- Parameters
-
| reporter_name | A ReporterName object that for the desired Reporter value. |
| mode | The mode that the object will consume the Reporter value time_index (optional) If zero is provided the current value is returned. Use a positive index to return previous values (1 = older, 2 = older, etc.). The maximum number of old values is dictated by the ReporterData object. |
Definition at line 168 of file ReporterInterface.h.
Referenced by ParsedVectorReporter::ParsedVectorReporter().
const ReporterMode REPORTER_MODE_UNSET
◆ getReporterValueByName() [2/2]
template<typename T >
| const T & ReporterInterface::getReporterValueByName |
( |
const ReporterName & |
reporter_name, |
|
|
ReporterMode |
mode, |
|
|
const std::size_t |
time_index = 0 |
|
) |
| |
|
protected |
Definition at line 176 of file ReporterInterface.h.
180 possiblyCheckHasReporter<T>(reporter_name);
virtual void addReporterDependencyHelper(const ReporterName &)
A method that can be overridden to update the UO dependencies.
const T & getReporterValue(const ReporterName &reporter_name, const MooseObject &consumer, const ReporterMode &mode, const std::size_t time_index=0) const
Method for returning read only references to Reporter values.
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
const ReporterData & _ri_reporter_data
The ReporterData.
◆ hasReporterValue() [1/2]
| bool ReporterInterface::hasReporterValue |
( |
const std::string & |
param_name | ) |
const |
|
protected |
Return True if the Reporter value exists.
- Template Parameters
-
| T | The C++ type of the Reporter value being consumed |
- Parameters
-
Definition at line 40 of file ReporterInterface.C.
44 "Cannot call hasReporterValue() until all Reporters have been constructed.");
const ReporterName & getReporterName(const std::string ¶m_name) const
bool reportersAdded() const
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
bool hasReporterValueByName(const ReporterName &reporter_name) const
◆ hasReporterValue() [2/2]
template<typename T >
| bool ReporterInterface::hasReporterValue |
( |
const std::string & |
param_name | ) |
const |
|
protected |
Definition at line 189 of file ReporterInterface.h.
193 "Cannot call hasReporterValue() until all Reporters have been constructed.");
const ReporterName & getReporterName(const std::string ¶m_name) const
bool reportersAdded() const
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
◆ hasReporterValueByName() [1/2]
| bool ReporterInterface::hasReporterValueByName |
( |
const ReporterName & |
reporter_name | ) |
const |
|
protected |
Definition at line 50 of file ReporterInterface.C.
Referenced by hasReporterValue(), and AdvancedOutput::initShowHideLists().
54 "Cannot call hasReporterValueByName() until all Reporters have been constructed.");
bool reportersAdded() const
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
const ReporterData & _ri_reporter_data
The ReporterData.
bool hasReporterValue(const ReporterName &reporter_name) const
Return True if a Reporter value with the given type and name have been created.
◆ hasReporterValueByName() [2/2]
template<typename T >
| bool ReporterInterface::hasReporterValueByName |
( |
const ReporterName & |
reporter_name | ) |
const |
|
protected |
Definition at line 200 of file ReporterInterface.h.
204 "Cannot call hasReporterValueByName() until all Reporters have been constructed.");
bool reportersAdded() const
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
const ReporterData & _ri_reporter_data
The ReporterData.
bool hasReporterValue(const ReporterName &reporter_name) const
Return True if a Reporter value with the given type and name have been created.
◆ possiblyCheckHasReporter()
template<typename T >
| void ReporterInterface::possiblyCheckHasReporter |
( |
const ReporterName & |
reporter_name, |
|
|
const std::string & |
param_name = "" |
|
) |
| const |
|
private |
Helpers for "possibly" checking if a Reporter value exists.
This is only able to check for existance after all Reporters have been added (after the task creating them has been called). If called before said task, this will do nothing, hence the "possibly". This allows us to have errors reported directly by the object requesting the Reporter instead of through a system with less context.
Definition at line 211 of file ReporterInterface.h.
214 if (
reportersAdded() && !hasReporterValueByName<T>(reporter_name))
216 std::stringstream oss;
217 oss <<
"A Reporter value with the name \"" << reporter_name <<
"\" and type \"" 218 << MooseUtils::prettyCppType<T>() <<
"\" was not found.";
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
bool reportersAdded() const
const MooseObject & _ri_moose_object
The MooseObject needing this interface.
const InputParameters & _ri_params
Parameters for the MooseObject inherting from this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
◆ reportersAdded()
| bool ReporterInterface::reportersAdded |
( |
| ) |
const |
|
private |
- Returns
- True if all Reporters have been added (the task associated with adding them is complete)
Definition at line 92 of file ReporterInterface.C.
Referenced by getReporterContextBaseByName(), hasReporterValue(), hasReporterValueByName(), and possiblyCheckHasReporter().
bool isTaskComplete(const std::string &task) const
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
FEProblemBase & _ri_fe_problem_base
Provides access to FEProblemBase::getReporterData.
◆ validParams()
◆ _ri_fe_problem_base
◆ _ri_moose_object
◆ _ri_params
◆ _ri_reporter_data
The documentation for this class was generated from the following files: