#include <BootstrapCalculators.h>
Public Member Functions | |
Calculator (const libMesh::ParallelObject &other, const std::string &name) | |
virtual | ~Calculator ()=default |
OutType | compute (const InType &, bool) |
Evaluate the calculator on the full vector of data. More... | |
void | initializeCalculator () |
Public function that must be called before updateCalculator and finalizeCalculator. More... | |
void | updateCalculator (const typename InType::value_type &) |
Public function to update calculator with a piece of data. More... | |
void | finalizeCalculator (bool) |
Public function to finalize the resulting calculator value. More... | |
OutType | getValue () const |
Public function to return the calculated value _state must be FINALIZED. More... | |
const std::string & | name () const |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
Protected Member Functions | |
virtual void | initialize ()=0 |
This function is used to reset the calculator to its initial state and prepare it for another evaluation. More... | |
virtual void | update (const typename InType::value_type &)=0 |
Updating the calculator with a piece of data. More... | |
virtual void | finalize (bool)=0 |
This is used to compute the resulting calculator value by performing necessary arithmetic and parallel communication. More... | |
virtual OutType | get () const =0 |
Returns the resulting calculator value. More... | |
Protected Attributes | |
const Parallel::Communicator & | _communicator |
Private Types | |
enum | CalculatorState { NONE, INITIALIZED, FINALIZED } |
Private Attributes | |
const std::string | _name |
CalculatorState | _state |
Definition at line 35 of file BootstrapCalculators.h.
|
private |
|
inline |
Definition at line 65 of file Calculators.h.
|
virtualdefault |
OutType StochasticTools::Calculator< InType, OutType >::compute | ( | const InType & | data, |
bool | is_distributed | ||
) |
Evaluate the calculator on the full vector of data.
This is basically a convenient wrapper around initializeCalculator, updateCalculator, finalizeCalculator, and getvalue.
Definition at line 288 of file Calculators.h.
|
protectedpure virtual |
This is used to compute the resulting calculator value by performing necessary arithmetic and parallel communication.
This only called once after all the input data is entered through update.
Implemented in StochasticTools::Median< InType, OutType >, StochasticTools::L2Norm< InType, OutType >, StochasticTools::StdErr< InType, OutType >, StochasticTools::StdDev< InType, OutType >, StochasticTools::Sum< InType, OutType >, StochasticTools::Ratio< InType, OutType >, StochasticTools::Mean< InType, OutType >, StochasticTools::SobolCalculator< std::vector< InType >, std::vector< OutType > >, StochasticTools::SobolCalculator< InType, OutType >, and StochasticTools::VectorCalculator< InType, OutType, CalcType >.
void StochasticTools::Calculator< InType, OutType >::finalizeCalculator | ( | bool | is_distributed | ) |
Public function to finalize the resulting calculator value.
_state must be INITLIALIZED Sets _state to FINALIZED
Definition at line 315 of file Calculators.h.
|
protectedpure virtual |
Returns the resulting calculator value.
It is important to not modify member data here so the calculator can retain its state.
Implemented in StochasticTools::Median< InType, OutType >, StochasticTools::L2Norm< InType, OutType >, StochasticTools::StdDev< InType, OutType >, StochasticTools::Max< InType, OutType >, StochasticTools::Min< InType, OutType >, StochasticTools::Ratio< InType, OutType >, StochasticTools::Mean< InType, OutType >, StochasticTools::SobolCalculator< std::vector< InType >, std::vector< OutType > >, StochasticTools::SobolCalculator< InType, OutType >, and StochasticTools::VectorCalculator< InType, OutType, CalcType >.
OutType StochasticTools::Calculator< InType, OutType >::getValue | ( | ) | const |
Public function to return the calculated value _state must be FINALIZED.
Definition at line 325 of file Calculators.h.
|
protectedpure virtual |
This function is used to reset the calculator to its initial state and prepare it for another evaluation.
This usually involves clearing class members.
Implemented in StochasticTools::Median< InType, OutType >, StochasticTools::L2Norm< InType, OutType >, StochasticTools::StdDev< InType, OutType >, StochasticTools::Ratio< InType, OutType >, StochasticTools::Mean< InType, OutType >, StochasticTools::SobolCalculator< std::vector< InType >, std::vector< OutType > >, StochasticTools::SobolCalculator< InType, OutType >, and StochasticTools::VectorCalculator< InType, OutType, CalcType >.
void StochasticTools::Calculator< InType, OutType >::initializeCalculator | ( | ) |
Public function that must be called before updateCalculator and finalizeCalculator.
Sets _state to INITIALIZED
Definition at line 299 of file Calculators.h.
Referenced by StochasticTools::SobolCalculator< std::vector< InType >, std::vector< OutType > >::finalize(), and StochasticTools::SobolCalculator< std::vector< InType >, std::vector< OutType > >::update().
|
inline |
Definition at line 99 of file Calculators.h.
|
protectedpure virtual |
Updating the calculator with a piece of data.
Sometimes some clever arithmetic is required to avoid storing data.
Implemented in StochasticTools::Median< InType, OutType >, StochasticTools::L2Norm< InType, OutType >, StochasticTools::StdDev< InType, OutType >, StochasticTools::Ratio< InType, OutType >, StochasticTools::MeanAbsoluteValue< InType, OutType >, and StochasticTools::Mean< InType, OutType >.
void StochasticTools::Calculator< InType, OutType >::updateCalculator | ( | const typename InType::value_type & | val | ) |
Public function to update calculator with a piece of data.
_state mush be INITIALIZED
Definition at line 307 of file Calculators.h.
|
private |
Definition at line 132 of file Calculators.h.
Referenced by StochasticTools::Calculator< std::vector< std::vector< InType > >, std::vector< std::vector< OutType > > >::name().
|
private |
Definition at line 133 of file Calculators.h.