https://mooseframework.inl.gov
SolutionInvalidityRegistry.h
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 
10 #pragma once
11 
12 #include "GeneralRegistry.h"
13 #include "MooseTypes.h"
14 #include "MooseHashing.h"
15 
16 #include <mutex>
17 
18 // Forward Declarations
19 class SolutionInvalidity;
20 void dataStore(std::ostream &, SolutionInvalidity &, void *);
21 
22 namespace moose::internal
23 {
24 class SolutionInvalidityRegistry;
25 
29 SolutionInvalidityRegistry & getSolutionInvalidityRegistry();
30 
35 {
36 public:
37  SolutionInvalidityName(const std::string & object_type, const std::string & message)
39  {
40  }
41 
42  bool operator==(const SolutionInvalidityName & other) const
43  {
44  return object_type == other.object_type && message == other.message;
45  }
46 
48  std::string object_type;
50  std::string message;
51 };
52 
57 {
58  inline size_t operator()(const SolutionInvalidityName & name) const
59  {
60  size_t seed = 0;
61  Moose::hash_combine(seed, name.object_type, name.message);
62  return seed;
63  }
64 };
65 
66 std::ostream & operator<<(std::ostream & os, const SolutionInvalidityName & name);
67 
72 {
73 public:
74  SolutionInvalidityInfo(const std::string & object_type,
75  const std::string & message,
76  const InvalidSolutionID id,
77  const bool warning)
79  {
80  }
81 
85  bool warning;
86 };
87 
91 class SolutionInvalidityRegistry : public GeneralRegistry<SolutionInvalidityName,
92  SolutionInvalidityInfo,
93  SoltionInvalidityNameHash>
94 {
95 public:
104  InvalidSolutionID registerInvalidity(const std::string & object_type,
105  const std::string & message,
106  const bool warning);
107 
108 private:
110 
115 };
116 }
std::string name(const ElemQuality q)
SolutionInvalidityName(const std::string &object_type, const std::string &message)
unsigned int InvalidSolutionID
Definition: MooseTypes.h:213
bool warning
Whether or not this is a warning.
friend SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
So it can be constructed.
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:33
void hash_combine(std::size_t &)
Used for hash function specialization for Attribute objects.
Definition: MooseHashing.h:22
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.
SolutionInvalidityInfo(const std::string &object_type, const std::string &message, const InvalidSolutionID id, const bool warning)
std::string object_type
The type of the object.
std::ostream & operator<<(std::ostream &os, const SolutionInvalidityName &name)
Helper class that stores the name associated with an invalid solution.
The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidit...
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.
bool operator==(const SolutionInvalidityName &other) const
void dataStore(std::ostream &, SolutionInvalidity &, void *)
Helper class that hash the name associated with an invalid solution.
Helper class that stores the info associated with an invalid solution.
friend SolutionInvalidity
This is only here so that SolutionInvalidity can access readSectionInfo.
size_t operator()(const SolutionInvalidityName &name) const