Line data Source code
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 "ConstantVectorPostprocessor.h" 11 : 12 : registerMooseObject("MooseApp", ConstantVectorPostprocessor); 13 : 14 : InputParameters 15 16723 : ConstantVectorPostprocessor::validParams() 16 : { 17 16723 : InputParameters params = GeneralVectorPostprocessor::validParams(); 18 16723 : params.addClassDescription( 19 : "Populate constant VectorPostprocessorValue directly from input file."); 20 50169 : params.addParam<std::vector<std::string>>("vector_names", 21 33446 : std::vector<std::string>(1, "value"), 22 : "Names of the column vectors in this object"); 23 16723 : 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 16723 : return params; 29 0 : } 30 : 31 1203 : ConstantVectorPostprocessor::ConstantVectorPostprocessor(const InputParameters & parameters) 32 1203 : : GeneralVectorPostprocessor(parameters) 33 : { 34 1203 : std::vector<std::string> names = getParam<std::vector<std::string>>("vector_names"); 35 1203 : unsigned int nvec = names.size(); 36 : 37 1203 : _value.resize(nvec); 38 3502 : for (unsigned int j = 0; j < nvec; ++j) 39 2299 : _value[j] = &declareVector(names[j]); 40 : 41 1203 : std::vector<std::vector<Real>> v = getParam<std::vector<std::vector<Real>>>("value"); 42 1203 : if (v.size() != nvec) 43 0 : paramError("value", 44 : "Leading dimension must be equal to leading dimension of vector_names parameter."); 45 : 46 1203 : if (processor_id() == 0) 47 : { 48 2686 : for (unsigned int j = 0; j < nvec; ++j) 49 : { 50 1774 : unsigned int ne = v[j].size(); 51 1774 : _value[j]->resize(ne); 52 7104 : for (unsigned int l = 0; l < ne; ++l) 53 5330 : (*_value[j])[l] = v[j][l]; 54 : } 55 : } 56 1203 : } 57 : 58 : void 59 1171 : ConstantVectorPostprocessor::initialize() 60 : { 61 1171 : } 62 : 63 : void 64 1171 : ConstantVectorPostprocessor::execute() 65 : { 66 1171 : }