https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ConstantVectorPostprocessor.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
11
13
16{
19 "Populate constant VectorPostprocessorValue directly from input file.");
20 params.addParam<std::vector<std::string>>("vector_names",
21 std::vector<std::string>(1, "value"),
22 "Names of the column vectors in this object");
23 params.addRequiredParam<std::vector<std::vector<Real>>>(
24 "value",
25 "Vector values this object will have. Leading dimension must be equal to leading dimension "
26 "of vector_names parameter.");
27
28 return params;
29}
30
32 : GeneralVectorPostprocessor(parameters)
33{
34 std::vector<std::string> names = getParam<std::vector<std::string>>("vector_names");
35 unsigned int nvec = names.size();
36
37 _value.resize(nvec);
38 for (unsigned int j = 0; j < nvec; ++j)
39 _value[j] = &declareVector(names[j]);
40
41 std::vector<std::vector<Real>> v = getParam<std::vector<std::vector<Real>>>("value");
42 if (v.size() != nvec)
43 paramError("value",
44 "Leading dimension must be equal to leading dimension of vector_names parameter.");
45
46 for (unsigned int j = 0; j < nvec; ++j)
47 {
48 unsigned int ne = v[j].size();
49 _value[j]->resize(ne);
50 for (unsigned int l = 0; l < ne; ++l)
51 (*_value[j])[l] = v[j][l];
52 }
53}
54
55void
59
60void
registerMooseObject("MooseApp", ConstantVectorPostprocessor)
ConstantVectorPostprocessor(const InputParameters &parameters)
std::vector< VectorPostprocessorValue * > _value
virtual void execute() override
Execute method.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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.
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
VectorPostprocessorValue & declareVector(const std::string &vector_name)
Register a new vector to fill up.