https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
33void
37
38void
42
45{
46 Real sum = 0;
47 for (auto & v : _values)
48 sum += *v;
49 return sum;
50}
Real PostprocessorValue
various MOOSE typedefs
Definition MooseTypes.h:230
registerMooseObject("MooseApp", SumPostprocessor)
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
Computes a sum of postprocessor values.
virtual PostprocessorValue getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
std::vector< const PostprocessorValue * > _values
Postprocessors to add up.
virtual void execute() override
Execute method.
static InputParameters validParams()
SumPostprocessor(const InputParameters &parameters)