https://mooseframework.inl.gov
SumPostprocessor.C
Go to the documentation of this file.
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 "SumPostprocessor.h"
11 
13 
16 {
18  params.addClassDescription("Sums the values of several postprocessors");
19  params.addRequiredParam<std::vector<PostprocessorName>>("values",
20  "List of postprocessors to add");
21  return params;
22 }
23 
25  : GeneralPostprocessor(parameters)
26 {
27  const std::vector<PostprocessorName> & pps_names =
28  getParam<std::vector<PostprocessorName>>("values");
29  for (auto & name : pps_names)
31 }
32 
33 void
35 {
36 }
37 
38 void
40 {
41 }
42 
45 {
46  Real sum = 0;
47  for (auto & v : _values)
48  sum += *v;
49  return sum;
50 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
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...
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
registerMooseObject("MooseApp", SumPostprocessor)
Real PostprocessorValue
various MOOSE typedefs
Definition: MooseTypes.h:230
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
SumPostprocessor(const InputParameters &parameters)
virtual void execute() override
Execute method.
static InputParameters validParams()
virtual PostprocessorValue getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
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...
Computes a sum of postprocessor values.
std::vector< const PostprocessorValue * > _values
Postprocessors to add up.