LCOV - code coverage report
Current view: top level - src/reporters - ReporterInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 18 26 69.2 %
Date: 2025-07-17 01:28:37 Functions: 4 6 66.7 %
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 "ReporterInterface.h"
      11             : 
      12             : #include "FEProblemBase.h"
      13             : 
      14             : InputParameters
      15     9894173 : ReporterInterface::validParams()
      16             : {
      17     9894173 :   return emptyInputParameters();
      18             : }
      19             : 
      20      398553 : ReporterInterface::ReporterInterface(const MooseObject * moose_object)
      21      797106 :   : _ri_params(moose_object->parameters()),
      22      398553 :     _ri_fe_problem_base(*_ri_params.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
      23      398553 :     _ri_reporter_data(_ri_fe_problem_base.getReporterData()),
      24      398553 :     _ri_moose_object(*moose_object)
      25             : {
      26      398553 : }
      27             : 
      28             : bool
      29           0 : ReporterInterface::hasReporterValue(const std::string & param_name) const
      30             : {
      31           0 :   if (!reportersAdded())
      32           0 :     _ri_moose_object.mooseError(
      33             :         "Cannot call hasReporterValue() until all Reporters have been constructed.");
      34             : 
      35           0 :   return hasReporterValueByName(getReporterName(param_name));
      36             : }
      37             : 
      38             : bool
      39           0 : ReporterInterface::hasReporterValueByName(const ReporterName & reporter_name) const
      40             : {
      41           0 :   if (!reportersAdded())
      42           0 :     _ri_moose_object.mooseError(
      43             :         "Cannot call hasReporterValueByName() until all Reporters have been constructed.");
      44             : 
      45           0 :   return _ri_reporter_data.hasReporterValue(reporter_name);
      46             : }
      47             : 
      48             : const ReporterName &
      49        1048 : ReporterInterface::getReporterName(const std::string & param_name) const
      50             : {
      51        1048 :   if (!_ri_params.isParamValid(param_name))
      52           4 :     _ri_moose_object.mooseError(
      53             :         "When getting a Reporter, failed to get a parameter with the name \"",
      54             :         param_name,
      55             :         "\".",
      56             :         "\n\nKnown parameters:\n",
      57           4 :         _ri_moose_object.parameters());
      58             : 
      59        1044 :   if (_ri_params.isType<ReporterName>(param_name))
      60        1040 :     return _ri_params.get<ReporterName>(param_name);
      61             : 
      62           4 :   _ri_moose_object.mooseError("Supplied parameter with name \"",
      63             :                               param_name,
      64             :                               "\" of type \"",
      65           4 :                               _ri_params.type(param_name),
      66             :                               "\" is not an expected type for getting a Reporter.\n\n",
      67             :                               "The expected type is \"ReporterName\".");
      68             : }
      69             : 
      70             : bool
      71        3736 : ReporterInterface::reportersAdded() const
      72             : {
      73        3736 :   return _ri_fe_problem_base.getMooseApp().actionWarehouse().isTaskComplete("add_reporter");
      74             : }

Generated by: LCOV version 1.14