This is a helper class to aid with parallel communication of compute Reporter values as well as provides a link to the stored Reporter value state object. More...
#include <ReporterContext.h>
Public Member Functions | |
ReporterContextBase (const libMesh::ParallelObject &other, const MooseObject &producer) | |
virtual | ~ReporterContextBase ()=default |
virtual const ReporterName & | name () const =0 |
Return the ReporterName that the context is associated. More... | |
virtual std::string | type () const =0 |
Return the type of the data stored. More... | |
virtual std::string | contextType () const =0 |
virtual void | copyValuesBack ()=0 |
Called by FEProblemBase::advanceState via ReporterData. More... | |
virtual bool | restoreState ()=0 |
Called by FEProblemBase::restoreSolutions via ReporterData. More... | |
virtual void | storeInfo (nlohmann::json &json) const =0 |
Called by JSONOutput::outputReporters to output meta data independent of calculated values. More... | |
virtual void | store (nlohmann::json &json) const =0 |
Called by JSONOutput::outputReporters to invoke storage of values for output. More... | |
virtual void | finalize ()=0 |
Called by FEProblemBase::joinAndFinalize via ReporterData. More... | |
void | init (const ReporterMode &mode) |
Initialize the producer mode. More... | |
const MooseObject & | getProducer () const |
Return the MooseObject that produces this Reporter. More... | |
const ReporterProducerEnum & | getProducerModeEnum () const |
Return the Reporter value produced mode. More... | |
virtual void | transfer (ReporterData &r_data, const ReporterName &r_name, unsigned int time_index=0) const =0 |
Helper for enabling generic transfer of Reporter values. More... | |
virtual void | transferToVector (ReporterData &r_data, const ReporterName &r_name, dof_id_type index, unsigned int time_index=0) const =0 |
Helper for enabling generic transfer of Reporter values to a vector. More... | |
virtual void | transferFromVector (ReporterData &r_data, const ReporterName &r_name, dof_id_type index, unsigned int time_index=0) const =0 |
Helper for enabling generic transfer of a vector Reporter of values to a single value. More... | |
virtual void | declareClone (ReporterData &r_data, const ReporterName &r_name, const ReporterMode &mode, const MooseObject &producer) const =0 |
Helper for declaring new reporter values based on this context. More... | |
virtual void | declareVectorClone (ReporterData &r_data, const ReporterName &r_name, const ReporterMode &mode, const MooseObject &producer) const =0 |
Helper for declaring new vector reporter values based on this context. More... | |
virtual void | resize (dof_id_type local_size)=0 |
Helper for resizing vector data. More... | |
virtual void | clear ()=0 |
Helper for clearing vector data. More... | |
virtual void | vectorSum ()=0 |
Helper for summing reporter value. More... | |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
Protected Member Functions | |
void | requiresConsumerModes (const ReporterStateBase &state, const std::set< ReporterMode > &modes) const |
Helper for checking whether or not the state state has only the modes modes . More... | |
Protected Attributes | |
const MooseObject & | _producer |
The MooseObject that is producing this Reporter. More... | |
ReporterProducerEnum | _producer_enum |
Defines how the Reporter value can be produced and how it is being produced. More... | |
const Parallel::Communicator & | _communicator |
This is a helper class to aid with parallel communication of compute Reporter values as well as provides a link to the stored Reporter value state object.
This file contains several reporter context types with specific polymorphism:
ReporterContextBase—>ReporterContext<T> | | | ReporterGeneralContext<T> | | | | | | | ReporterGatherContext<T> | | ReporterScatterContext<T> | ReporterBroadcastContext<T> | ReporterVectorContext<std::vector<T>>
When creating a new context, it is generally advisable to derive from ReporterGeneralContext (
Definition at line 57 of file ReporterContext.h.
ReporterContextBase::ReporterContextBase | ( | const libMesh::ParallelObject & | other, |
const MooseObject & | producer | ||
) |
Definition at line 14 of file ReporterContext.C.
|
virtualdefault |
|
pure virtual |
Helper for clearing vector data.
Implemented in ReporterVectorContext< T >, and ReporterGeneralContext< T >.
Referenced by ReporterTransferInterface::clearVectorReporter().
|
pure virtual |
This must be overridden in every class.
Implemented in ReporterVectorContext< T >, ReporterGatherContext< T >, ReporterScatterContext< T >, ReporterBroadcastContext< T >, ReporterGeneralContext< T >, ReporterContext< T >, and ReporterContext< std::vector< T > >.
Referenced by ReporterData::getReporterInfo().
|
pure virtual |
Called by FEProblemBase::advanceState via ReporterData.
Implemented in ReporterContext< T >, ReporterContext< std::vector< T > >, and VectorPostprocessorContext< T >.
|
pure virtual |
Helper for declaring new reporter values based on this context.
r_data | The ReporterData on the app that this value is being declared |
r_name | The name of the Reporter value being declared |
mode | Reporter mode to declare with |
Implemented in ReporterVectorContext< T >, and ReporterGeneralContext< T >.
Referenced by ReporterTransferInterface::declareClone().
|
pure virtual |
Helper for declaring new vector reporter values based on this context.
r_data | The ReporterData on the app that this value is being declared |
r_name | The name of the Reporter value being declared |
mode | Reporter mode to declare with |
Implemented in ReporterVectorContext< T >, and ReporterGeneralContext< T >.
Referenced by ReporterTransferInterface::declareVectorClone().
|
pure virtual |
|
inline |
Return the MooseObject that produces this Reporter.
Definition at line 118 of file ReporterContext.h.
Referenced by ReporterData::getReporterInfo().
const ReporterProducerEnum & ReporterContextBase::getProducerModeEnum | ( | ) | const |
Return the Reporter value produced mode.
Definition at line 28 of file ReporterContext.C.
Referenced by ReporterData::getReporterMode().
void ReporterContextBase::init | ( | const ReporterMode & | mode | ) |
Initialize the producer mode.
This done after construction to allow the constructor to define the available values in the ReporterProducerEnum.
Definition at line 21 of file ReporterContext.C.
|
pure virtual |
Return the ReporterName that the context is associated.
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
Referenced by requiresConsumerModes().
|
protected |
Helper for checking whether or not the state state
has only the modes modes
.
Definition at line 34 of file ReporterContext.C.
|
pure virtual |
Helper for resizing vector data.
local_size | Number of elements to resize vector to |
Implemented in ReporterVectorContext< T >, and ReporterGeneralContext< T >.
Referenced by ReporterTransferInterface::resizeReporter().
|
pure virtual |
Called by FEProblemBase::restoreSolutions via ReporterData.
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
|
pure virtual |
Called by JSONOutput::outputReporters to invoke storage of values for output.
This method exists and is distinct from the RestartableData::store method for JSON output via the JSONOutput object. The RestartableData::store/load methods are designed for restart and include all the data including the old values.
This method only outputs the current value within the JSONOutput object. NOTE: nlohmann qualification is needed for argument json because the std::vector overload is not in the std namespace, it's in the nlohmann namespace, and will come up in argument dependent lookup (ADL) only because of this qualification.
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
|
pure virtual |
Called by JSONOutput::outputReporters to output meta data independent of calculated values.
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
|
pure virtual |
Helper for enabling generic transfer of Reporter values.
r_data | The ReporterData on the app that this data is being transferred to |
r_name | The name of the Report being transferred to |
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
Referenced by ReporterTransferInterface::transferReporter().
|
pure virtual |
Helper for enabling generic transfer of a vector Reporter of values to a single value.
r_data | The ReporterData on the app that this data is being transferred to |
r_name | The name of the Reporter being transferred to |
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
Referenced by ReporterTransferInterface::transferFromVectorReporter().
|
pure virtual |
Helper for enabling generic transfer of Reporter values to a vector.
r_data | The ReporterData on the app that this data is being transferred to |
r_name | The name of the Report being transfered to |
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
Referenced by ReporterTransferInterface::transferToVectorReporter().
|
pure virtual |
Return the type of the data stored.
Implemented in ReporterContext< T >, and ReporterContext< std::vector< T > >.
Referenced by AccumulateReporter::declareLateValues().
|
pure virtual |
Helper for summing reporter value.
Implemented in ReporterVectorContext< T >, and ReporterGeneralContext< T >.
Referenced by ReporterTransferInterface::sumVectorReporter().
|
protected |
The MooseObject that is producing this Reporter.
Definition at line 214 of file ReporterContext.h.
Referenced by getProducer().
|
protected |
Defines how the Reporter value can be produced and how it is being produced.
Definition at line 217 of file ReporterContext.h.
Referenced by getProducerModeEnum(), init(), ReporterBroadcastContext< T >::ReporterBroadcastContext(), ReporterContext< std::vector< T > >::ReporterContext(), ReporterGatherContext< T >::ReporterGatherContext(), ReporterScatterContext< T >::ReporterScatterContext(), and requiresConsumerModes().