LCOV - code coverage report
Current view: top level - src/postprocessors - VectorPostprocessorComponent.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 17 18 94.4 %
Date: 2025-07-17 01:28:37 Functions: 3 3 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 "VectorPostprocessorComponent.h"
      11             : #include "VectorPostprocessorInterface.h"
      12             : 
      13             : registerMooseObject("MooseApp", VectorPostprocessorComponent);
      14             : 
      15             : InputParameters
      16       14297 : VectorPostprocessorComponent::validParams()
      17             : {
      18       14297 :   InputParameters params = GeneralPostprocessor::validParams();
      19             : 
      20       14297 :   params.addRequiredParam<VectorPostprocessorName>(
      21             :       "vectorpostprocessor", "The vectorpostprocessor from which a value is extracted");
      22       14297 :   params.addRequiredParam<std::string>("vector_name",
      23             :                                        "Name of the vector for which to report a value");
      24       14297 :   params.addRequiredParam<unsigned int>(
      25             :       "index", "Index of the vectorpostprocessor for which to report a value");
      26       14297 :   params.addClassDescription(
      27             :       "Returns the value of the specified component of a VectorPostprocessor");
      28             : 
      29       14297 :   return params;
      30           0 : }
      31             : 
      32          16 : VectorPostprocessorComponent::VectorPostprocessorComponent(const InputParameters & parameters)
      33             :   : GeneralPostprocessor(parameters),
      34          16 :     _vpp_name(getParam<VectorPostprocessorName>("vectorpostprocessor")),
      35          16 :     _vector_name(getParam<std::string>("vector_name")),
      36          16 :     _vpp_values(getVectorPostprocessorValue("vectorpostprocessor", _vector_name)),
      37          32 :     _vpp_index(getParam<unsigned int>("index"))
      38             : {
      39          16 : }
      40             : 
      41             : Real
      42          26 : VectorPostprocessorComponent::getValue() const
      43             : {
      44          26 :   if (_vpp_index >= _vpp_values.size())
      45           4 :     mooseError("In VectorPostprocessorComponent index greater than size of vector");
      46          22 :   return _vpp_values[_vpp_index];
      47             : }

Generated by: LCOV version 1.14