https://mooseframework.inl.gov
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ReporterStatisticsContext< InType, OutType > Class Template Reference

ReporterContext that utilizes a Calculator object to compute its value and confidence levels. More...

#include <StatisticsReporter.h>

Inheritance diagram for ReporterStatisticsContext< InType, OutType >:
[legend]

Public Types

enum  AutoOperation
 

Public Member Functions

 ReporterStatisticsContext (const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< std::pair< OutType, std::vector< OutType >>> &state, const InType &data, const ReporterProducerEnum &mode, const MooseEnumItem &stat)
 
 ReporterStatisticsContext (const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< std::pair< OutType, std::vector< OutType >>> &state, const InType &data, const ReporterProducerEnum &mode, const MooseEnumItem &stat, const MooseEnum &ci_method, const std::vector< Real > &ci_levels, unsigned int ci_replicates, unsigned int ci_seed)
 
virtual void finalize () override
 
virtual void storeInfo (nlohmann::json &json) const override
 
virtual void declareClone (ReporterData &r_data, const ReporterName &r_name, const ReporterMode &mode, const MooseObject &producer) const override
 
virtual void declareVectorClone (ReporterData &r_data, const ReporterName &r_name, const ReporterMode &mode, const MooseObject &producer) const override
 
virtual void resize (dof_id_type local_size) final
 
virtual void clear () final
 
virtual void vectorSum () final
 
virtual std::string contextType () const override
 
const ReporterNamename () const override final
 
const ReporterState< std::pair< OutType, std::vector< OutType > > > & state () const
 
virtual std::string type () const override
 
virtual void transfer (ReporterData &r_data, const ReporterName &r_name, unsigned int time_index=0) const override
 
virtual void transferToVector (ReporterData &r_data, const ReporterName &r_name, dof_id_type index, unsigned int time_index=0) const override
 
virtual void transferFromVector (ReporterData &r_data, const ReporterName &r_name, dof_id_type index, unsigned int time_index=0) const override
 
void init (const ReporterMode &mode)
 
const MooseObjectgetProducer () const
 
const ReporterProducerEnumgetProducerModeEnum () const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Protected Member Functions

void broadcast ()
 
virtual void store (nlohmann::json &json) const override
 
virtual void copyValuesBack () override
 
virtual bool restoreState () override
 
void requiresConsumerModes (const ReporterStateBase &state, const std::set< ReporterMode > &modes) const
 

Protected Attributes

ReporterState< std::pair< OutType, std::vector< OutType > > > & _state
 
const MooseObject_producer
 
ReporterProducerEnum _producer_enum
 
const Parallel::Communicator & _communicator
 

Private Attributes

const InType & _data
 Data used for the statistic calculation. More...
 
const ReporterProducerEnum_data_mode
 Mode in which the above data was produced. More...
 
std::unique_ptr< StochasticTools::Calculator< InType, OutType > > _calc_ptr
 Storage for the Calculator object for the desired stat, this is created in constructor. More...
 
std::unique_ptr< StochasticTools::BootstrapCalculator< InType, OutType > > _ci_calc_ptr = nullptr
 Storage for the BootstrapCalculator for the desired confidence interval calculations (optional) More...
 

Detailed Description

template<typename InType, typename OutType>
class ReporterStatisticsContext< InType, OutType >

ReporterContext that utilizes a Calculator object to compute its value and confidence levels.

Definition at line 21 of file StatisticsReporter.h.

Constructor & Destructor Documentation

◆ ReporterStatisticsContext() [1/2]

template<typename InType , typename OutType >
ReporterStatisticsContext< InType, OutType >::ReporterStatisticsContext ( const libMesh::ParallelObject other,
const MooseObject producer,
ReporterState< std::pair< OutType, std::vector< OutType >>> &  state,
const InType &  data,
const ReporterProducerEnum mode,
const MooseEnumItem stat 
)

Definition at line 61 of file StatisticsReporter.h.

69  _data(data),
70  _data_mode(mode),
71  _calc_ptr(StochasticTools::makeCalculator<InType, OutType>(stat, other))
72 {
73 }
const ReporterProducerEnum & _data_mode
Mode in which the above data was produced.
const InType & _data
Data used for the statistic calculation.
const ReporterState< std::pair< OutType, std::vector< OutType > > > & state() const
std::unique_ptr< StochasticTools::Calculator< InType, OutType > > _calc_ptr
Storage for the Calculator object for the desired stat, this is created in constructor.

◆ ReporterStatisticsContext() [2/2]

template<typename InType , typename OutType >
ReporterStatisticsContext< InType, OutType >::ReporterStatisticsContext ( const libMesh::ParallelObject other,
const MooseObject producer,
ReporterState< std::pair< OutType, std::vector< OutType >>> &  state,
const InType &  data,
const ReporterProducerEnum mode,
const MooseEnumItem stat,
const MooseEnum ci_method,
const std::vector< Real > &  ci_levels,
unsigned int  ci_replicates,
unsigned int  ci_seed 
)

Definition at line 76 of file StatisticsReporter.h.

87  : ReporterStatisticsContext<InType, OutType>(other, producer, state, data, mode, stat)
88 {
89  _ci_calc_ptr = StochasticTools::makeBootstrapCalculator<InType, OutType>(
90  ci_method, other, ci_levels, ci_replicates, ci_seed, *_calc_ptr);
91 }
const ReporterState< std::pair< OutType, std::vector< OutType > > > & state() const
ReporterContext that utilizes a Calculator object to compute its value and confidence levels...
std::unique_ptr< StochasticTools::BootstrapCalculator< InType, OutType > > _ci_calc_ptr
Storage for the BootstrapCalculator for the desired confidence interval calculations (optional) ...
std::unique_ptr< StochasticTools::Calculator< InType, OutType > > _calc_ptr
Storage for the Calculator object for the desired stat, this is created in constructor.

Member Function Documentation

◆ finalize()

template<typename InType , typename OutType >
void ReporterStatisticsContext< InType, OutType >::finalize ( )
overridevirtual

Reimplemented from ReporterGeneralContext< std::pair< OutType, std::vector< OutType > > >.

Definition at line 95 of file StatisticsReporter.h.

96 {
97  if (_data_mode == REPORTER_MODE_DISTRIBUTED || this->processor_id() == 0)
98  {
99  this->_state.value().first = _calc_ptr->compute(_data, _data_mode == REPORTER_MODE_DISTRIBUTED);
100 
101  if (_ci_calc_ptr)
102  this->_state.value().second =
103  _ci_calc_ptr->compute(_data, _data_mode == REPORTER_MODE_DISTRIBUTED);
104  }
105 
107 }
const ReporterProducerEnum & _data_mode
Mode in which the above data was produced.
const InType & _data
Data used for the statistic calculation.
ReporterState< std::pair< OutType, std::vector< OutType > > > & _state
std::unique_ptr< StochasticTools::BootstrapCalculator< InType, OutType > > _ci_calc_ptr
Storage for the BootstrapCalculator for the desired confidence interval calculations (optional) ...
virtual void finalize() override
std::unique_ptr< StochasticTools::Calculator< InType, OutType > > _calc_ptr
Storage for the Calculator object for the desired stat, this is created in constructor.
T & value(const std::size_t time_index=0)
processor_id_type processor_id() const

◆ storeInfo()

template<typename InType , typename OutType >
void ReporterStatisticsContext< InType, OutType >::storeInfo ( nlohmann::json &  json) const
overridevirtual

Reimplemented from ReporterGeneralContext< std::pair< OutType, std::vector< OutType > > >.

Definition at line 111 of file StatisticsReporter.h.

112 {
114  json["stat"] = _calc_ptr->name();
115 }
virtual void storeInfo(nlohmann::json &json) const override
std::unique_ptr< StochasticTools::Calculator< InType, OutType > > _calc_ptr
Storage for the Calculator object for the desired stat, this is created in constructor.

Member Data Documentation

◆ _calc_ptr

template<typename InType, typename OutType>
std::unique_ptr<StochasticTools::Calculator<InType, OutType> > ReporterStatisticsContext< InType, OutType >::_calc_ptr
private

Storage for the Calculator object for the desired stat, this is created in constructor.

Definition at line 54 of file StatisticsReporter.h.

Referenced by ReporterStatisticsContext< InType, OutType >::ReporterStatisticsContext().

◆ _ci_calc_ptr

template<typename InType, typename OutType>
std::unique_ptr<StochasticTools::BootstrapCalculator<InType, OutType> > ReporterStatisticsContext< InType, OutType >::_ci_calc_ptr = nullptr
private

Storage for the BootstrapCalculator for the desired confidence interval calculations (optional)

Definition at line 57 of file StatisticsReporter.h.

Referenced by ReporterStatisticsContext< InType, OutType >::ReporterStatisticsContext().

◆ _data

template<typename InType, typename OutType>
const InType& ReporterStatisticsContext< InType, OutType >::_data
private

Data used for the statistic calculation.

Definition at line 48 of file StatisticsReporter.h.

◆ _data_mode

template<typename InType, typename OutType>
const ReporterProducerEnum& ReporterStatisticsContext< InType, OutType >::_data_mode
private

Mode in which the above data was produced.

Definition at line 51 of file StatisticsReporter.h.


The documentation for this class was generated from the following file: