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 : #include "VectorOfPostprocessors.h" 11 : #include "PostprocessorInterface.h" 12 : 13 : registerMooseObject("MooseApp", VectorOfPostprocessors); 14 : 15 : InputParameters 16 14313 : VectorOfPostprocessors::validParams() 17 : { 18 14313 : InputParameters params = GeneralVectorPostprocessor::validParams(); 19 : 20 14313 : params.addRequiredParam<std::vector<PostprocessorName>>( 21 : "postprocessors", "The postprocessors whose values are to be reported"); 22 14313 : params.addClassDescription("Outputs the values of an arbitrary user-specified set of " 23 : "postprocessors as a vector in the order specified by the user"); 24 : 25 : // The value from this VPP is naturally already on every processor 26 : // TODO: Make this not the case! See #11415 27 14313 : params.set<bool>("_auto_broadcast") = false; 28 : 29 14313 : return params; 30 0 : } 31 : 32 24 : VectorOfPostprocessors::VectorOfPostprocessors(const InputParameters & parameters) 33 : : GeneralVectorPostprocessor(parameters), 34 24 : _pp_vec(declareVector(MooseUtils::shortName(parameters.get<std::string>("_object_name")))) 35 : { 36 : std::vector<PostprocessorName> pps_names( 37 24 : getParam<std::vector<PostprocessorName>>("postprocessors")); 38 24 : _pp_vec.resize(pps_names.size()); 39 72 : for (const auto & pps_name : pps_names) 40 48 : _postprocessor_values.push_back(&getPostprocessorValueByName(pps_name)); 41 24 : } 42 : 43 : void 44 77 : VectorOfPostprocessors::initialize() 45 : { 46 77 : _pp_vec.clear(); 47 77 : } 48 : 49 : void 50 77 : VectorOfPostprocessors::execute() 51 : { 52 231 : for (const auto & ppv : _postprocessor_values) 53 154 : _pp_vec.push_back(*ppv); 54 77 : }