General context that is called by all Reporter values to manage the old values. More...
#include <ReporterContext.h>
Public Types | |
enum | AutoOperation { AutoOperation::NONE, AutoOperation::BROADCAST } |
Options for automatic parallel operations to perform by the default context. More... | |
Public Member Functions | |
ReporterContext (const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< T > &state) | |
ReporterContext (const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< T > &state, const T &default_value) | |
const ReporterName & | name () const override final |
Return the name of the Reporter value. More... | |
const ReporterState< T > & | state () const |
Return a reference to the ReporterState object that is storing the Reporter value. More... | |
virtual std::string | type () const override |
Return the type being stored by the associated ReporterState object. More... | |
virtual void | finalize () override |
Perform automatic parallel communication based on the producer/consumer modes. More... | |
virtual void | transfer (ReporterData &r_data, const ReporterName &r_name, unsigned int time_index=0) const override |
Perform type specific transfer. More... | |
virtual void | transferToVector (ReporterData &r_data, const ReporterName &r_name, dof_id_type index, unsigned int time_index=0) const override |
Perform type specific transfer to a vector. More... | |
virtual void | transferFromVector (ReporterData &r_data, const ReporterName &r_name, dof_id_type index, unsigned int time_index=0) const override |
Perform type specific transfer from a vector. 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 | 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 | broadcast () |
virtual void | storeInfo (nlohmann::json &json) const override |
Output meta data to JSON, see JSONOutput. More... | |
virtual void | store (nlohmann::json &json) const override |
Output data to JSON, see JSONOutput. More... | |
virtual std::string | contextType () const override=0 |
virtual void | copyValuesBack () override |
Called by FEProblemBase::advanceState via ReporterData. More... | |
virtual bool | restoreState () override |
Restore state to its old values. More... | |
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 | |
ReporterState< T > & | _state |
The state on which this context object operates. More... | |
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 |
General context that is called by all Reporter values to manage the old values.
This is the default context object, the communication aspect includes inspecting the produced mode against the consumed mode to be sure that the data is compatible or if automatic communication can be done to make them compatible.
Definition at line 228 of file ReporterContext.h.
|
strong |
Options for automatic parallel operations to perform by the default context.
Enumerator | |
---|---|
NONE | |
BROADCAST |
Definition at line 234 of file ReporterContext.h.
ReporterContext< T >::ReporterContext | ( | const libMesh::ParallelObject & | other, |
const MooseObject & | producer, | ||
ReporterState< T > & | state | ||
) |
Definition at line 330 of file ReporterContext.h.
ReporterContext< T >::ReporterContext | ( | const libMesh::ParallelObject & | other, |
const MooseObject & | producer, | ||
ReporterState< T > & | state, | ||
const T & | default_value | ||
) |
Definition at line 339 of file ReporterContext.h.
|
inlineprotected |
Definition at line 303 of file ReporterContext.h.
|
pure virtualinherited |
Helper for clearing vector data.
Implemented in ReporterVectorContext< T >, and ReporterGeneralContext< T >.
Referenced by ReporterTransferInterface::clearVectorReporter().
|
overrideprotectedpure virtual |
This must be overridden in every class.
Implements ReporterContextBase.
Implemented in ReporterVectorContext< T >, ReporterGatherContext< T >, ReporterScatterContext< T >, ReporterBroadcastContext< T >, and ReporterGeneralContext< T >.
|
overrideprotectedvirtual |
Called by FEProblemBase::advanceState via ReporterData.
Implements ReporterContextBase.
Reimplemented in VectorPostprocessorContext< T >.
Definition at line 408 of file ReporterContext.h.
Referenced by VectorPostprocessorContext< T >::copyValuesBack().
|
pure virtualinherited |
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 virtualinherited |
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().
|
overridevirtual |
Perform automatic parallel communication based on the producer/consumer modes.
Implements ReporterContextBase.
Reimplemented in ReporterGatherContext< T >, ReporterScatterContext< T >, ReporterBroadcastContext< T >, and VectorPostprocessorContext< T >.
Definition at line 350 of file ReporterContext.h.
Referenced by VectorPostprocessorContext< T >::finalize().
|
inlineinherited |
Return the MooseObject that produces this Reporter.
Definition at line 118 of file ReporterContext.h.
Referenced by ReporterData::getReporterInfo().
|
inherited |
Return the Reporter value produced mode.
Definition at line 28 of file ReporterContext.C.
Referenced by ReporterData::getReporterMode().
|
inherited |
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.
|
inlinefinaloverridevirtual |
Return the name of the Reporter value.
Implements ReporterContextBase.
Definition at line 251 of file ReporterContext.h.
|
protectedinherited |
Helper for checking whether or not the state state
has only the modes modes
.
Definition at line 34 of file ReporterContext.C.
|
pure virtualinherited |
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().
|
inlineoverrideprotectedvirtual |
Restore state to its old values.
Implements ReporterContextBase.
Definition at line 323 of file ReporterContext.h.
|
inline |
Return a reference to the ReporterState object that is storing the Reporter value.
Definition at line 256 of file ReporterContext.h.
|
overrideprotectedvirtual |
Output data to JSON, see JSONOutput.
Implements ReporterContextBase.
Definition at line 422 of file ReporterContext.h.
|
overrideprotectedvirtual |
Output meta data to JSON, see JSONOutput.
Implements ReporterContextBase.
Definition at line 415 of file ReporterContext.h.
|
overridevirtual |
Perform type specific transfer.
NOTE: This is defined in ReporterData.h to avoid cyclic includes that would arise. I don't know of a better solution, if you have one please implement it.
Implements ReporterContextBase.
Definition at line 502 of file ReporterData.h.
|
overridevirtual |
Perform type specific transfer from a vector.
NOTE: This is defined in ReporterData.h to avoid cyclic includes that would arise. I don't know of a better solution, if you have one please implement it.
Implements ReporterContextBase.
Definition at line 529 of file ReporterData.h.
|
overridevirtual |
Perform type specific transfer to a vector.
NOTE: This is defined in ReporterData.h to avoid cyclic includes that would arise. I don't know of a better solution, if you have one please implement it.
Implements ReporterContextBase.
Definition at line 512 of file ReporterData.h.
|
inlineoverridevirtual |
Return the type being stored by the associated ReporterState object.
Implements ReporterContextBase.
Definition at line 263 of file ReporterContext.h.
|
pure virtualinherited |
Helper for summing reporter value.
Implemented in ReporterVectorContext< T >, and ReporterGeneralContext< T >.
Referenced by ReporterTransferInterface::sumVectorReporter().
|
protectedinherited |
The MooseObject that is producing this Reporter.
Definition at line 214 of file ReporterContext.h.
Referenced by ReporterContextBase::getProducer().
|
protectedinherited |
Defines how the Reporter value can be produced and how it is being produced.
Definition at line 217 of file ReporterContext.h.
Referenced by ReporterContextBase::getProducerModeEnum(), ReporterContextBase::init(), ReporterBroadcastContext< T >::ReporterBroadcastContext(), ReporterContext< std::vector< T > >::ReporterContext(), ReporterGatherContext< T >::ReporterGatherContext(), ReporterScatterContext< T >::ReporterScatterContext(), and ReporterContextBase::requiresConsumerModes().
|
protected |
The state on which this context object operates.
Definition at line 326 of file ReporterContext.h.
Referenced by ReporterContext< std::vector< T > >::broadcast(), ReporterContext< std::vector< T > >::name(), ReporterContext< std::vector< T > >::ReporterContext(), ReporterContext< std::vector< T > >::restoreState(), and ReporterContext< std::vector< T > >::state().