LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - ConstantVectorPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 26 28 92.9 %
Date: 2026-05-29 20:35:17 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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        5441 : ConstantVectorPostprocessor::validParams()
      16             : {
      17        5441 :   InputParameters params = GeneralVectorPostprocessor::validParams();
      18       10882 :   params.addClassDescription(
      19             :       "Populate constant VectorPostprocessorValue directly from input file.");
      20       16323 :   params.addParam<std::vector<std::string>>("vector_names",
      21       16323 :                                             std::vector<std::string>(1, "value"),
      22             :                                             "Names of the column vectors in this object");
      23       16323 :   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        5441 :   return params;
      29           0 : }
      30             : 
      31        1169 : ConstantVectorPostprocessor::ConstantVectorPostprocessor(const InputParameters & parameters)
      32        1169 :   : GeneralVectorPostprocessor(parameters)
      33             : {
      34        2338 :   std::vector<std::string> names = getParam<std::vector<std::string>>("vector_names");
      35        1169 :   unsigned int nvec = names.size();
      36             : 
      37        1169 :   _value.resize(nvec);
      38        3358 :   for (unsigned int j = 0; j < nvec; ++j)
      39        2189 :     _value[j] = &declareVector(names[j]);
      40             : 
      41        2338 :   std::vector<std::vector<Real>> v = getParam<std::vector<std::vector<Real>>>("value");
      42        1169 :   if (v.size() != nvec)
      43           0 :     paramError("value",
      44             :                "Leading dimension must be equal to leading dimension of vector_names parameter.");
      45             : 
      46        3358 :   for (unsigned int j = 0; j < nvec; ++j)
      47             :   {
      48        2189 :     unsigned int ne = v[j].size();
      49        2189 :     _value[j]->resize(ne);
      50        8710 :     for (unsigned int l = 0; l < ne; ++l)
      51        6521 :       (*_value[j])[l] = v[j][l];
      52             :   }
      53        1169 : }
      54             : 
      55             : void
      56        1131 : ConstantVectorPostprocessor::initialize()
      57             : {
      58        1131 : }
      59             : 
      60             : void
      61        1131 : ConstantVectorPostprocessor::execute()
      62             : {
      63        1131 : }

Generated by: LCOV version 1.14