LCOV - code coverage report
Current view: top level - src/reporters - ReporterContext.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 14 24 58.3 %
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 "ReporterContext.h"
      11             : 
      12             : #include "ReporterData.h"
      13             : 
      14       77625 : ReporterContextBase::ReporterContextBase(const libMesh::ParallelObject & other,
      15       77625 :                                          const MooseObject & producer)
      16       77625 :   : libMesh::ParallelObject(other), _producer(producer)
      17             : {
      18       77625 : }
      19             : 
      20             : void
      21       77625 : ReporterContextBase::init(const ReporterMode & mode)
      22             : {
      23       77625 :   if (mode != REPORTER_MODE_UNSET)
      24       23028 :     _producer_enum.assign(mode);
      25       77625 : }
      26             : 
      27             : const ReporterProducerEnum &
      28       57459 : ReporterContextBase::getProducerModeEnum() const
      29             : {
      30       57459 :   return _producer_enum;
      31             : }
      32             : 
      33             : void
      34         788 : ReporterContextBase::requiresConsumerModes(const ReporterStateBase & state,
      35             :                                            const std::set<ReporterMode> & modes) const
      36             : {
      37        1112 :   for (const auto & mode_object_pair : state.getConsumers())
      38         324 :     if (!modes.count(mode_object_pair.first))
      39             :     {
      40           0 :       std::stringstream oss;
      41           0 :       std::copy(modes.begin(), modes.end(), std::ostream_iterator<ReporterMode>(oss, " "));
      42             : 
      43           0 :       mooseError("The Reporter value '",
      44           0 :                  name(),
      45             :                  "' is being produced in ",
      46           0 :                  _producer_enum,
      47             :                  " mode, but ",
      48           0 :                  mode_object_pair.second->typeAndName(),
      49             :                  " is requesting to consume it in ",
      50           0 :                  mode_object_pair.first,
      51             :                  " mode, which is not supported.\n\nThe mode must be { ",
      52           0 :                  oss.str(),
      53             :                  " }.\n\n",
      54           0 :                  ReporterData::getReporterInfo(state, this));
      55           0 :     }
      56         788 : }

Generated by: LCOV version 1.14