https://mooseframework.inl.gov
SolutionInvalidityRegistry.C
Go to the documentation of this file.
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 
11 
12 #include "DataIO.h"
13 
14 namespace moose::internal
15 {
16 
17 SolutionInvalidityRegistry &
19 {
20  // In C++11 this is even thread safe! (Lookup "Static Initializers")
21  static SolutionInvalidityRegistry solution_invalid_registry_singleton;
22 
23  return solution_invalid_registry_singleton;
24 }
25 
28  "SolutionInvalidityRegistry")
29 {
30 }
31 
33 SolutionInvalidityRegistry::registerInvalidity(const std::string & object_type,
34  const std::string & message,
35  const bool warning)
36 {
37  const SolutionInvalidityName name(object_type, message);
38  if (keyExists(name))
39  mooseAssert(item(id(name)).warning == warning, "Inconsistent registration for a warning");
40  const auto create_item = [&object_type, &message, &warning](const std::size_t id)
41  { return SolutionInvalidityInfo(object_type, message, id, warning); };
42  return registerItem(name, create_item);
43 }
44 
45 std::ostream &
46 operator<<(std::ostream & os, const SolutionInvalidityName & name)
47 {
48  os << name.object_type << ": " << name.message;
49  return os;
50 }
51 }
std::string name(const ElemQuality q)
unsigned int InvalidSolutionID
Definition: MooseTypes.h:213
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:33
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
The place where all sections with solution invalid warnings will be stored.
std::ostream & operator<<(std::ostream &os, const SolutionInvalidityName &name)
Helper class that stores the name associated with an invalid solution.
std::size_t registerItem(const SolutionInvalidityName &key, CreateItem &create_item)
Registers an item with key key if said key does not exist.
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.
Helper class that hash the name associated with an invalid solution.
Helper class that stores the info associated with an invalid solution.