LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - ConstantVectorPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 27 29 93.1 %
Date: 2025-07-17 01:28:37 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       16509 : ConstantVectorPostprocessor::validParams()
      16             : {
      17       16509 :   InputParameters params = GeneralVectorPostprocessor::validParams();
      18       16509 :   params.addClassDescription(
      19             :       "Populate constant VectorPostprocessorValue directly from input file.");
      20       49527 :   params.addParam<std::vector<std::string>>("vector_names",
      21       33018 :                                             std::vector<std::string>(1, "value"),
      22             :                                             "Names of the column vectors in this object");
      23       16509 :   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       16509 :   return params;
      29           0 : }
      30             : 
      31        1096 : ConstantVectorPostprocessor::ConstantVectorPostprocessor(const InputParameters & parameters)
      32        1096 :   : GeneralVectorPostprocessor(parameters)
      33             : {
      34        1096 :   std::vector<std::string> names = getParam<std::vector<std::string>>("vector_names");
      35        1096 :   unsigned int nvec = names.size();
      36             : 
      37        1096 :   _value.resize(nvec);
      38        3190 :   for (unsigned int j = 0; j < nvec; ++j)
      39        2094 :     _value[j] = &declareVector(names[j]);
      40             : 
      41        1096 :   std::vector<std::vector<Real>> v = getParam<std::vector<std::vector<Real>>>("value");
      42        1096 :   if (v.size() != nvec)
      43           0 :     paramError("value",
      44             :                "Leading dimension must be equal to leading dimension of vector_names parameter.");
      45             : 
      46        1096 :   if (processor_id() == 0)
      47             :   {
      48        2440 :     for (unsigned int j = 0; j < nvec; ++j)
      49             :     {
      50        1611 :       unsigned int ne = v[j].size();
      51        1611 :       _value[j]->resize(ne);
      52        6447 :       for (unsigned int l = 0; l < ne; ++l)
      53        4836 :         (*_value[j])[l] = v[j][l];
      54             :     }
      55             :   }
      56        1096 : }
      57             : 
      58             : void
      59        1046 : ConstantVectorPostprocessor::initialize()
      60             : {
      61        1046 : }
      62             : 
      63             : void
      64        1046 : ConstantVectorPostprocessor::execute()
      65             : {
      66        1046 : }

Generated by: LCOV version 1.14