LCOV - code coverage report
Current view: top level - src/utils - SolutionInvalidityRegistry.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 13 16 81.2 %
Date: 2025-07-17 01:28:37 Functions: 4 5 80.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 "SolutionInvalidityRegistry.h"
      11             : 
      12             : #include "DataIO.h"
      13             : 
      14             : namespace moose::internal
      15             : {
      16             : 
      17             : SolutionInvalidityRegistry &
      18       63180 : getSolutionInvalidityRegistry()
      19             : {
      20             :   // In C++11 this is even thread safe! (Lookup "Static Initializers")
      21       63180 :   static SolutionInvalidityRegistry solution_invalid_registry_singleton;
      22             : 
      23       63180 :   return solution_invalid_registry_singleton;
      24             : }
      25             : 
      26       51173 : SolutionInvalidityRegistry::SolutionInvalidityRegistry()
      27             :   : GeneralRegistry<SolutionInvalidityName, SolutionInvalidityInfo, SoltionInvalidityNameHash>(
      28       51173 :         "SolutionInvalidityRegistry")
      29             : {
      30       51173 : }
      31             : 
      32             : InvalidSolutionID
      33         326 : SolutionInvalidityRegistry::registerInvalidity(const std::string & object_type,
      34             :                                                const std::string & message,
      35             :                                                const bool warning)
      36             : {
      37         326 :   const SolutionInvalidityName name(object_type, message);
      38         326 :   if (keyExists(name))
      39             :     mooseAssert(item(id(name)).warning == warning, "Inconsistent registration for a warning");
      40         312 :   const auto create_item = [&object_type, &message, &warning](const std::size_t id)
      41         312 :   { return SolutionInvalidityInfo(object_type, message, id, warning); };
      42         652 :   return registerItem(name, create_item);
      43         326 : }
      44             : 
      45             : std::ostream &
      46           0 : operator<<(std::ostream & os, const SolutionInvalidityName & name)
      47             : {
      48           0 :   os << name.object_type << ": " << name.message;
      49           0 :   return os;
      50             : }
      51             : }

Generated by: LCOV version 1.14