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

PCStatisticsContext is almost identical to ReporterStatisticsContext with InType == Outype. More...

#include <PolynomialChaosReporter.h>

Inheritance diagram for PCStatisticsContext< OutType >:
[legend]

Public Types

enum  AutoOperation
 

Public Member Functions

 PCStatisticsContext (const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< std::pair< OutType, std::vector< OutType >>> &state, const PolynomialChaos &pc, const MooseEnumItem &stat)
 
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 PolynomialChaos_pc
 Polynomial chaos surrogate object. More...
 
const MooseEnumItem _stat
 The stat to compute. More...
 

Detailed Description

template<typename OutType>
class PCStatisticsContext< OutType >

PCStatisticsContext is almost identical to ReporterStatisticsContext with InType == Outype.

Unfortunately, we cannot derive from ReporterStatisticsContext since that class relies on the construction of a Calculator object, something that is unnecessary for calculating statistics with polynomial chaos.

Definition at line 56 of file PolynomialChaosReporter.h.

Constructor & Destructor Documentation

◆ PCStatisticsContext()

template<typename OutType >
PCStatisticsContext< OutType >::PCStatisticsContext ( const libMesh::ParallelObject other,
const MooseObject producer,
ReporterState< std::pair< OutType, std::vector< OutType >>> &  state,
const PolynomialChaos pc,
const MooseEnumItem stat 
)

Definition at line 156 of file PolynomialChaosReporter.C.

163  _pc(pc),
164  _stat(stat)
165 {
166 }
const ReporterState< std::pair< OutType, std::vector< OutType > > > & state() const
const PolynomialChaos & _pc
Polynomial chaos surrogate object.
const MooseEnumItem _stat
The stat to compute.

Member Function Documentation

◆ finalize()

template<typename OutType >
void PCStatisticsContext< OutType >::finalize ( )
overridevirtual

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

Definition at line 170 of file PolynomialChaosReporter.C.

171 {
172  // Compute standard deviation
173  OutType sig = OutType();
174  if (_stat == "stddev" || _stat == "skewness" || _stat == "kurtosis")
176 
177  OutType & val = this->_state.value().first;
178  val = OutType();
179  // Mean
180  if (_stat == "mean" && this->processor_id() == 0)
181  val = _pc.computeMean();
182  // Standard Deviation
183  else if (_stat == "stddev" && this->processor_id() == 0)
184  val = sig;
185  // Skewness
186  else if (_stat == "skewness")
187  val = _pc.powerExpectation(3) / (sig * sig * sig);
188  // Kurtosis
189  else if (_stat == "kurtosis")
190  val = _pc.powerExpectation(4) / (sig * sig * sig * sig);
191  this->_communicator.sum(val);
192 
194 }
virtual Real computeMean() const
Evaluate mean: = E[u].
ReporterState< std::pair< OutType, std::vector< OutType > > > & _state
const Parallel::Communicator & _communicator
const PolynomialChaos & _pc
Polynomial chaos surrogate object.
virtual void finalize() override
Real powerExpectation(const unsigned int n) const
Compute expectation of a certain power of the QoI: E[(u-)^n].
const MooseEnumItem _stat
The stat to compute.
T & value(const std::size_t time_index=0)
processor_id_type processor_id() const
virtual Real computeStandardDeviation() const
Evaluate standard deviation: = sqrt(E[(u-)^2])

◆ storeInfo()

template<typename OutType >
void PCStatisticsContext< OutType >::storeInfo ( nlohmann::json &  json) const
overridevirtual

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

Definition at line 198 of file PolynomialChaosReporter.C.

199 {
201  json["stat"] = _stat.name();
202 }
const std::string & name() const
const MooseEnumItem _stat
The stat to compute.
virtual void storeInfo(nlohmann::json &json) const override

Member Data Documentation

◆ _pc

template<typename OutType >
const PolynomialChaos& PCStatisticsContext< OutType >::_pc
private

Polynomial chaos surrogate object.

Definition at line 70 of file PolynomialChaosReporter.h.

◆ _stat

template<typename OutType >
const MooseEnumItem PCStatisticsContext< OutType >::_stat
private

The stat to compute.

Definition at line 72 of file PolynomialChaosReporter.h.


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