www.mooseframework.org
StochasticResults.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // MOOSE includes
13 #include "GeneralVectorPostprocessor.h"
14 #include "SamplerInterface.h"
15 
16 class StochasticResults;
17 
18 template <>
19 InputParameters validParams<StochasticResults>();
20 
25 {
26  StochasticResultsData(const VectorPostprocessorName & name, VectorPostprocessorValue *);
27  VectorPostprocessorName name;
28  VectorPostprocessorValue * vector;
29  VectorPostprocessorValue current;
30 };
31 
35 class StochasticResults : public GeneralVectorPostprocessor, SamplerInterface
36 {
37 public:
38  static InputParameters validParams();
39 
40  StochasticResults(const InputParameters & parameters);
41  void virtual initialize() override;
42  void virtual finalize() override;
43  void virtual execute() override {}
44 
45  // This method is used by the Transfers for populating data within the vectors for this VPP; this
46  // is required to allow for the "contains_complete_history = true" to operate correctly with the
47  // different modes of parallel operation, without the Transfer objects needing knowledge of the
48  // modes.
49  //
50  // In practice, the Trasnfer objects are responsible for populating the vector that contains the
51  // current data from sub-application for this local process. This object then handles the
52  // communication and updating of the actual VPP data being mindfull of the
53  // "contains_complete_history". An r-value reference is used by this object to take ownership of
54  // the data to avoid uncesssary copying, because the supplied data can be very large.
55  //
56  // For an example use, please refer to SamplerPostprocessorTransfer.
57  //
58  // @param vector_name: name of the vector to populated, should be the name of the sampler.
59  // @paran current: current local VPP data from sub-applications (see SamplerPostprocessorTranfer)
60  void setCurrentLocalVectorPostprocessorValue(const std::string & vector_name,
61  const VectorPostprocessorValue && current);
62 
72  void init(Sampler & _sampler);
73 
74 protected:
76  std::vector<StochasticResultsData> _sample_vectors;
77 
79  const MooseEnum _parallel_type;
80 
82  const processor_id_type _output_distributed_rank;
83 };
StochasticResults::StochasticResults
StochasticResults(const InputParameters &parameters)
Definition: StochasticResults.C:54
StochasticResults::_sample_vectors
std::vector< StochasticResultsData > _sample_vectors
Storage for declared vectors.
Definition: StochasticResults.h:76
StochasticResultsData::vector
VectorPostprocessorValue * vector
Definition: StochasticResults.h:28
validParams< StochasticResults >
InputParameters validParams< StochasticResults >()
StochasticResults::finalize
virtual void finalize() override
Definition: StochasticResults.C:100
StochasticResultsData
Storage helper for managing data being assigned to this VPP by a Transfer object.
Definition: StochasticResults.h:24
StochasticResults
A tool for output Sampler data.
Definition: StochasticResults.h:35
StochasticResultsData::StochasticResultsData
StochasticResultsData(const VectorPostprocessorName &name, VectorPostprocessorValue *)
Definition: StochasticResults.C:20
StochasticResults::initialize
virtual void initialize() override
Definition: StochasticResults.C:91
StochasticResults::execute
virtual void execute() override
Definition: StochasticResults.h:43
StochasticResults::setCurrentLocalVectorPostprocessorValue
void setCurrentLocalVectorPostprocessorValue(const std::string &vector_name, const VectorPostprocessorValue &&current)
Definition: StochasticResults.C:127
StochasticResultsData::name
VectorPostprocessorName name
Definition: StochasticResults.h:27
StochasticResultsData::current
VectorPostprocessorValue current
Definition: StochasticResults.h:29
StochasticResults::init
void init(Sampler &_sampler)
DEPRECATED Initialize storage based on the Sampler returned by the SamplerTransientMultiApp or Sample...
Definition: StochasticResults.C:141
StochasticResults::_parallel_type
const MooseEnum _parallel_type
Parallel operation mode.
Definition: StochasticResults.h:79
StochasticResults::validParams
static InputParameters validParams()
Definition: StochasticResults.C:27
StochasticResults::_output_distributed_rank
const processor_id_type _output_distributed_rank
The rank data to output if parallel type is distributed.
Definition: StochasticResults.h:82