https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VectorPostprocessorComponent.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
12
14
17{
19
20 params.addRequiredParam<VectorPostprocessorName>(
21 "vectorpostprocessor", "The vectorpostprocessor from which a value is extracted");
22 params.addRequiredParam<std::string>("vector_name",
23 "Name of the vector for which to report a value");
24 params.addRequiredParam<unsigned int>(
25 "index", "Index of the vectorpostprocessor for which to report a value");
27 "Returns the value of the specified component of a VectorPostprocessor");
28
29 return params;
30}
31
33 : GeneralPostprocessor(parameters),
34 _vpp_name(getParam<VectorPostprocessorName>("vectorpostprocessor")),
35 _vector_name(getParam<std::string>("vector_name")),
36 _vpp_values(getVectorPostprocessorValue("vectorpostprocessor", _vector_name)),
37 _vpp_index(getParam<unsigned int>("index"))
38{
39}
40
41Real
43{
44 if (_vpp_index >= _vpp_values.size())
45 mooseError("In VectorPostprocessorComponent index greater than size of vector");
46 return _vpp_values[_vpp_index];
47}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", VectorPostprocessorComponent)
void ErrorVector unsigned int
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.
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
const VectorPostprocessorValue & _vpp_values
VectorPostprocessorValue object to read a specified component from.
VectorPostprocessorComponent(const InputParameters &parameters)
const unsigned int _vpp_index
Index of the component in the vector to read a value from.