Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 "StochasticResultsAction.h" 15 : 16 : /** 17 : * Storage helper for managing data being assigned to this VPP by a Transfer object. 18 : */ 19 1608 : struct StochasticResultsData 20 : { 21 : StochasticResultsData(const VectorPostprocessorName & name, VectorPostprocessorValue *); 22 : VectorPostprocessorName name; 23 : VectorPostprocessorValue * vector; 24 : VectorPostprocessorValue current; 25 : }; 26 : 27 : /** 28 : * A tool for output Sampler data. 29 : */ 30 : class StochasticResults : public GeneralVectorPostprocessor 31 : { 32 : public: 33 : static InputParameters validParams(); 34 : 35 : StochasticResults(const InputParameters & parameters); 36 : virtual void initialize() override; 37 : virtual void finalize() override; 38 2688 : virtual void execute() override {} 39 : 40 : // This method is used by the Transfers for populating data within the vectors for this VPP; this 41 : // is required to allow for the "contains_complete_history = true" to operate correctly with the 42 : // different modes of parallel operation, without the Transfer objects needing knowledge of the 43 : // modes. 44 : // 45 : // In practice, the Transfer objects are responsible for populating the vector that contains the 46 : // current data from sub-application for this local process. This object then handles the 47 : // communication and updating of the actual VPP data being mindfull of the 48 : // "contains_complete_history". An r-value reference is used by this object to take ownership of 49 : // the data to avoid unnecessary copying, because the supplied data can be very large. 50 : // 51 : // For an example use, please refer to SamplerPostprocessorTransfer. 52 : // 53 : // @param vector_name: name of the vector to populated, should be the name of the sampler. 54 : // @paran current: current local VPP data from sub-applications (see SamplerPostprocessorTranfer) 55 : void setCurrentLocalVectorPostprocessorValue(const std::string & vector_name, 56 : const VectorPostprocessorValue && current); 57 : 58 : protected: 59 : /// Storage for declared vectors 60 : std::vector<StochasticResultsData> _sample_vectors; 61 : 62 : /** 63 : * Create a VPP vector for results data for a given Sampler, see StochasticResultsAction for 64 : * more details to why this is necessary. 65 : */ 66 : void initVector(const std::string & vector_name); 67 : friend void StochasticResultsAction::act(); 68 : };