https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
20void dataStore(std::ostream &, SolutionInvalidity &, void *);
21
22namespace moose::internal
23{
24class SolutionInvalidityRegistry;
25
29SolutionInvalidityRegistry & getSolutionInvalidityRegistry();
30
35{
36public:
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
66std::ostream & operator<<(std::ostream & os, const SolutionInvalidityName & name);
67
72{
73public:
75 const std::string & message,
76 const InvalidSolutionID id,
77 const bool warning)
79 {
80 }
81
85 bool warning;
86};
87
91class SolutionInvalidityRegistry : public GeneralRegistry<SolutionInvalidityName,
92 SolutionInvalidityInfo,
93 SoltionInvalidityNameHash>
94{
95public:
104 InvalidSolutionID registerInvalidity(const std::string & object_type,
105 const std::string & message,
106 const bool warning);
107
108private:
110
115};
116}
unsigned int InvalidSolutionID
Definition MooseTypes.h:241
void dataStore(std::ostream &, SolutionInvalidity &, void *)
The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidit...
Helper class that stores the info associated with an invalid solution.
bool warning
Whether or not this is a warning.
SolutionInvalidityInfo(const std::string &object_type, const std::string &message, const InvalidSolutionID id, const bool warning)
Helper class that stores the name associated with an invalid solution.
SolutionInvalidityName(const std::string &object_type, const std::string &message)
std::string object_type
The type of the object.
bool operator==(const SolutionInvalidityName &other) const
The place where all sections with solution invalid warnings will be stored.
friend SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
So it can be constructed.
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
friend SolutionInvalidity
This is only here so that SolutionInvalidity can access readSectionInfo.
void hash_combine(std::size_t &)
Used for hash function specialization for Attribute objects.
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.
std::ostream & operator<<(std::ostream &os, const SolutionInvalidityName &name)
Helper class that hash the name associated with an invalid solution.
size_t operator()(const SolutionInvalidityName &name) const