www.mooseframework.org
VectorOfPostprocessors.C
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 #include "VectorOfPostprocessors.h"
11 #include "PostprocessorInterface.h"
12 
14 
17 {
19 
20  params.addRequiredParam<std::vector<PostprocessorName>>(
21  "postprocessors", "The postprocessors whose values are to be reported");
22  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  params.set<bool>("_auto_broadcast") = false;
28 
29  return params;
30 }
31 
33  : GeneralVectorPostprocessor(parameters),
34  _pp_vec(declareVector(MooseUtils::shortName(parameters.get<std::string>("_object_name"))))
35 {
36  std::vector<PostprocessorName> pps_names(
37  getParam<std::vector<PostprocessorName>>("postprocessors"));
38  _pp_vec.resize(pps_names.size());
39  for (const auto & pps_name : pps_names)
41 }
42 
43 void
45 {
46  _pp_vec.clear();
47 }
48 
49 void
51 {
52  for (const auto & ppv : _postprocessor_values)
53  _pp_vec.push_back(*ppv);
54 }
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1147
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void initialize() override
Initialize, clears the postprocessor vector.
VectorPostprocessorValue & _pp_vec
The VectorPostprocessorValue object where the results are stored.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
std::string shortName(const std::string &name)
Function for stripping name after the file / in parser block.
Definition: MooseUtils.C:595
VectorOfPostprocessors is a type of VectorPostprocessor that outputs the values of an arbitrary user-...
static InputParameters validParams()
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
std::vector< const PostprocessorValue * > _postprocessor_values
The vector of PostprocessorValue objects that are used to get the values of the postprocessors.
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
VectorOfPostprocessors(const InputParameters &parameters)
Class constructor.
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
virtual void execute() override
Populates the postprocessor vector of values with the supplied postprocessors.
registerMooseObject("MooseApp", VectorOfPostprocessors)