LCOV - code coverage report
Current view: top level - src/ics - ScalarComponentIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 11 14 78.6 %
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 "ScalarComponentIC.h"
      11             : #include "MooseVariableScalar.h"
      12             : 
      13             : registerMooseObject("MooseApp", ScalarComponentIC);
      14             : 
      15             : InputParameters
      16       14955 : ScalarComponentIC::validParams()
      17             : {
      18       14955 :   InputParameters params = ScalarInitialCondition::validParams();
      19       14955 :   params.addClassDescription(
      20             :       "Initial condition to set different values on each component of scalar variable.");
      21       14955 :   params.addRequiredParam<std::vector<Real>>("values",
      22             :                                              "Initial values to initialize the scalar variable.");
      23       14955 :   return params;
      24           0 : }
      25             : 
      26         345 : ScalarComponentIC::ScalarComponentIC(const InputParameters & parameters)
      27         345 :   : ScalarInitialCondition(parameters), _initial_values(getParam<std::vector<Real>>("values"))
      28             : {
      29         345 :   if (_initial_values.size() < _var.order())
      30           0 :     mooseError("The initial vector values size given to the scalar variable '",
      31           0 :                name(),
      32             :                "' has wrong size.");
      33         345 : }
      34             : 
      35             : Real
      36         528 : ScalarComponentIC::value()
      37             : {
      38         528 :   return _initial_values[_i];
      39             : }

Generated by: LCOV version 1.14