www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
StochasticResults Class Reference

A tool for output Sampler data. More...

#include <StochasticResults.h>

Inheritance diagram for StochasticResults:
[legend]

Public Member Functions

 StochasticResults (const InputParameters &parameters)
 
virtual void initialize () override
 
virtual void finalize () override
 
virtual void execute () override
 
void init (Sampler &_sampler)
 Initialize storage based on the Sampler returned by the SamplerMultiApp. More...
 
VectorPostprocessorValue & getVectorPostprocessorValueByGroup (unsigned int group)
 Return the VectorPostprocessorValue for a given Sampler group index. More...
 
const std::vector< VectorPostprocessorValue * > & getSampleVectors () const
 Get the sample vectors. More...
 

Protected Attributes

std::vector< VectorPostprocessorValue * > _sample_vectors
 Storage for declared vectors. More...
 
Sampler * _sampler = nullptr
 The sampler to extract data. More...
 

Detailed Description

A tool for output Sampler data.

Definition at line 23 of file StochasticResults.h.

Constructor & Destructor Documentation

StochasticResults::StochasticResults ( const InputParameters &  parameters)

Definition at line 25 of file StochasticResults.C.

26  : GeneralVectorPostprocessor(parameters), SamplerInterface(this)
27 {
28 }

Member Function Documentation

virtual void StochasticResults::execute ( )
inlineoverridevirtual

Definition at line 29 of file StochasticResults.h.

29 {}
virtual void StochasticResults::finalize ( )
inlineoverridevirtual

Definition at line 28 of file StochasticResults.h.

28 {}
const std::vector<VectorPostprocessorValue *>& StochasticResults::getSampleVectors ( ) const
inline

Get the sample vectors.

Returns
A const pointer to the vector of sample vectors

Definition at line 50 of file StochasticResults.h.

51  {
52  return _sample_vectors;
53  }
std::vector< VectorPostprocessorValue * > _sample_vectors
Storage for declared vectors.
VectorPostprocessorValue & StochasticResults::getVectorPostprocessorValueByGroup ( unsigned int  group)

Return the VectorPostprocessorValue for a given Sampler group index.

Parameters
groupIndex related to the index of the DenseMatrix returned by Sampler::getSamples()
Returns
A reference to the storage location for the PP data from the sub-applications.

Definition at line 43 of file StochasticResults.C.

Referenced by execute(), and SamplerPostprocessorTransfer::execute().

44 {
45  if (group >= _sample_vectors.size())
46  mooseError("The supplied sample index ", group, " does not exist.");
47  return *_sample_vectors[group];
48 }
std::vector< VectorPostprocessorValue * > _sample_vectors
Storage for declared vectors.
void StochasticResults::init ( Sampler &  _sampler)

Initialize storage based on the Sampler returned by the SamplerMultiApp.

Parameters
samplerThe Sampler associated with the MultiApp that this VPP is working with.

This method is called by the SamplerPostprocessorTransfer.

Definition at line 51 of file StochasticResults.C.

Referenced by execute(), and SamplerPostprocessorTransfer::initialSetup().

52 {
53  _sampler = &sampler;
54  const std::vector<std::string> & names = _sampler->getSampleNames();
55  _sample_vectors.resize(names.size());
56  for (auto i = beginIndex(names); i < names.size(); ++i)
57  _sample_vectors[i] = &declareVector(names[i]);
58 }
Sampler * _sampler
The sampler to extract data.
std::vector< VectorPostprocessorValue * > _sample_vectors
Storage for declared vectors.
void StochasticResults::initialize ( )
overridevirtual

Definition at line 31 of file StochasticResults.C.

32 {
33  mooseAssert(_sampler, "The _sampler pointer must be initialized via the init() method.");
34 
35  // Resize and zero vectors to the correct size, this allows the SamplerPostprocessorTransfer
36  // to set values in the vector directly.
37  std::vector<DenseMatrix<Real>> data = _sampler->getSamples();
38  for (auto i = beginIndex(data); i < data.size(); ++i)
39  _sample_vectors[i]->resize(data[i].m(), 0);
40 }
Sampler * _sampler
The sampler to extract data.
std::vector< VectorPostprocessorValue * > _sample_vectors
Storage for declared vectors.

Member Data Documentation

std::vector<VectorPostprocessorValue *> StochasticResults::_sample_vectors
protected

Storage for declared vectors.

Definition at line 57 of file StochasticResults.h.

Referenced by getSampleVectors(), getVectorPostprocessorValueByGroup(), init(), and initialize().

Sampler* StochasticResults::_sampler = nullptr
protected

The sampler to extract data.

Definition at line 60 of file StochasticResults.h.

Referenced by execute(), init(), and initialize().


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