opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
DeferredLogger.hpp
1
/*
2
Copyright 2018 SINTEF Digital, Mathematics and Cybernetics.
3
4
This file is part of the Open Porous Media project (OPM).
5
6
OPM is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
OPM is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
21
#ifndef OPM_DEFERREDLOGGER_HEADER_INCLUDED
22
#define OPM_DEFERREDLOGGER_HEADER_INCLUDED
23
24
#include <opm/simulators/utils/ParallelCommunication.hpp>
25
26
#include <string>
27
#include <vector>
28
29
namespace
Opm
30
{
35
36
namespace
ExceptionType
37
{
38
39
40
/*
41
If an exception has been raised on more than processor simultaneously the
42
highest number type will be thrown in the subsequent global rethrow.
43
*/
44
45
enum
ExcEnum {
46
NONE = 0,
47
RUNTIME_ERROR = 1,
48
INVALID_ARGUMENT = 2,
49
LOGIC_ERROR = 3,
50
DEFAULT = 4,
// will throw std::logic_error()
51
NUMERICAL_ISSUE = 5
52
};
53
}
54
55
56
class
DeferredLogger
57
{
58
public
:
59
60
struct
Message
61
{
62
int64_t flag;
63
std::string tag;
64
std::string text;
65
};
66
67
void
info(
const
std::string& tag,
const
std::string& message);
68
void
warning(
const
std::string& tag,
const
std::string& message);
69
void
error(
const
std::string& tag,
const
std::string& message);
70
void
problem(
const
std::string& tag,
const
std::string& message);
71
void
bug(
const
std::string& tag,
const
std::string& message);
72
void
debug(
const
std::string& tag,
const
std::string& message);
73
void
note(
const
std::string& tag,
const
std::string& message);
74
75
void
info(
const
std::string& message);
76
void
warning(
const
std::string& message);
77
void
error(
const
std::string& message);
78
void
problem(
const
std::string& message);
79
void
bug(
const
std::string& message);
80
void
debug(
const
std::string& message);
81
void
debug(
const
std::string& message,
const
int
verbosity_level);
82
void
note(
const
std::string& message);
83
86
void
logMessages
();
87
89
void
clearMessages
();
90
91
private
:
92
std::vector<Message> messages_;
93
friend
DeferredLogger
gatherDeferredLogger
(
const
DeferredLogger
& local_deferredlogger,
94
Parallel::Communication mpi_communicator);
95
};
96
97
}
// namespace Opm
98
99
#endif
// OPM_DEFERREDLOGGER_HEADER_INCLUDED
Opm::DeferredLogger
Definition
DeferredLogger.hpp:57
Opm::DeferredLogger::logMessages
void logMessages()
Log all messages to the OpmLog backends, and clear the message container.
Definition
DeferredLogger.cpp:92
Opm::DeferredLogger::clearMessages
void clearMessages()
Clear the message container without logging them.
Definition
DeferredLogger.cpp:100
Opm::DeferredLogger::gatherDeferredLogger
friend DeferredLogger gatherDeferredLogger(const DeferredLogger &local_deferredlogger, Parallel::Communication mpi_communicator)
Create a global log combining local logs.
Definition
gatherDeferredLogger.cpp:168
Opm::ExceptionType
This class implements a deferred logger: 1) messages can be pushed back to a vector 2) a call to logM...
Definition
DeferredLogger.hpp:37
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition
blackoilbioeffectsmodules.hh:43
Opm::DeferredLogger::Message
Definition
DeferredLogger.hpp:61
opm
simulators
utils
DeferredLogger.hpp
Generated by
1.17.0