MessageLimits.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 Statoil ASA.
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#ifndef OPM_MESSAGES_HPP
21#define OPM_MESSAGES_HPP
22
25
26namespace Opm {
27
28 class TimeMap;
29
30 struct MLimits {
43
45 {
46 MLimits result;
47 result.message_print_limit = 1;
48 result.comment_print_limit = 2;
49 result.warning_print_limit = 3;
50 result.problem_print_limit = 4;
51 result.error_print_limit = 5;
52 result.bug_print_limit = 6;
53 result.message_stop_limit = 7;
54 result.comment_stop_limit = 8;
55 result.warning_stop_limit = 9;
56 result.problem_stop_limit = 10;
57 result.error_stop_limit = 11;
58 result.bug_stop_limit = 12;
59
60 return result;
61 }
62
63 bool operator==(const MLimits& other) const {
64 return ((this->message_print_limit == other.message_print_limit) &&
65 (this->comment_print_limit == other.comment_print_limit) &&
66 (this->warning_print_limit == other.warning_print_limit) &&
67 (this->problem_print_limit == other.problem_print_limit) &&
68 (this->error_print_limit == other.error_print_limit ) &&
69 (this->bug_print_limit == other.bug_print_limit ) &&
70 (this->message_stop_limit == other.message_stop_limit ) &&
71 (this->comment_stop_limit == other.comment_stop_limit ) &&
72 (this->warning_stop_limit == other.warning_stop_limit ) &&
73 (this->problem_stop_limit == other.problem_stop_limit ) &&
74 (this->error_stop_limit == other.error_stop_limit ) &&
75 (this->bug_stop_limit == other.bug_stop_limit ));
76 }
77
78 bool operator!=(const MLimits& other) const {
79 return !(*this == other);
80 }
81
82 template<class Serializer>
83 void serializeOp(Serializer& serializer)
84 {
85 serializer(message_print_limit);
86 serializer(comment_print_limit);
87 serializer(warning_print_limit);
88 serializer(problem_print_limit);
89 serializer(error_print_limit);
90 serializer(bug_print_limit);
91 serializer(message_stop_limit);
92 serializer(comment_stop_limit);
93 serializer(warning_stop_limit);
94 serializer(problem_stop_limit);
95 serializer(error_stop_limit);
96 serializer(bug_stop_limit);
97 }
98 };
99
100
102 public:
103
104
105 MessageLimits() = default;
106 /*
107 This constructor will create a new Messages object which is
108 a copy of the input argument, and then all items explicitly
109 set in the record are modified.
110 */
111
112 explicit MessageLimits( const TimeMap& );
113
115
117 int getMessagePrintLimit(size_t timestep) const;
118 int getCommentPrintLimit(size_t timestep) const;
119 int getWarningPrintLimit(size_t timestep) const;
120 int getProblemPrintLimit(size_t timestep) const;
121 int getErrorPrintLimit(size_t timestep) const;
122 int getBugPrintLimit(size_t timestep) const;
123 void setMessagePrintLimit(size_t timestep, int value);
124 void setCommentPrintLimit(size_t timestep, int value);
125 void setWarningPrintLimit(size_t timestep, int value);
126 void setProblemPrintLimit(size_t timestep, int value);
127 void setErrorPrintLimit(size_t timestep, int value);
128 void setBugPrintLimit(size_t timestep, int value);
129
130 int getMessageStopLimit(size_t timestep) const;
131 int getCommentStopLimit(size_t timestep) const;
132 int getWarningStopLimit(size_t timestep) const;
133 int getProblemStopLimit(size_t timestep) const;
134 int getErrorStopLimit(size_t timestep) const;
135 int getBugStopLimit(size_t timestep) const;
136 void setMessageStopLimit(size_t timestep, int value);
137 void setCommentStopLimit(size_t timestep, int value);
138 void setWarningStopLimit(size_t timestep, int value);
139 void setProblemStopLimit(size_t timestep, int value);
140 void setErrorStopLimit(size_t timestep, int value);
141 void setBugStopLimit(size_t timestep, int value);
142
143 bool operator==(const MessageLimits& data) const;
144
145 template<class Serializer>
146 void serializeOp(Serializer& serializer)
147 {
148 limits.serializeOp(serializer);
149 }
150
151 private:
152 void update(size_t timestep, const MLimits& value);
153
155 };
156}
157
158#endif
Definition: DynamicState.hpp:58
Definition: MessageLimits.hpp:101
MessageLimits()=default
void setBugPrintLimit(size_t timestep, int value)
void serializeOp(Serializer &serializer)
Definition: MessageLimits.hpp:146
int getErrorPrintLimit(size_t timestep) const
void setWarningStopLimit(size_t timestep, int value)
int getCommentPrintLimit(size_t timestep) const
int getBugStopLimit(size_t timestep) const
void setCommentStopLimit(size_t timestep, int value)
int getWarningPrintLimit(size_t timestep) const
void setWarningPrintLimit(size_t timestep, int value)
void setErrorPrintLimit(size_t timestep, int value)
void setProblemPrintLimit(size_t timestep, int value)
static MessageLimits serializeObject()
int getProblemStopLimit(size_t timestep) const
void setMessagePrintLimit(size_t timestep, int value)
int getErrorStopLimit(size_t timestep) const
void setBugStopLimit(size_t timestep, int value)
int getMessagePrintLimit(size_t timestep) const
Get all the value from MESSAGES keyword.
int getProblemPrintLimit(size_t timestep) const
void setProblemStopLimit(size_t timestep, int value)
void setMessageStopLimit(size_t timestep, int value)
MessageLimits(const TimeMap &)
int getMessageStopLimit(size_t timestep) const
int getBugPrintLimit(size_t timestep) const
int getWarningStopLimit(size_t timestep) const
void setErrorStopLimit(size_t timestep, int value)
void setCommentPrintLimit(size_t timestep, int value)
int getCommentStopLimit(size_t timestep) const
bool operator==(const MessageLimits &data) const
static const int defaultValue
Definition: M.hpp:215
static const int defaultValue
Definition: M.hpp:251
static const int defaultValue
Definition: M.hpp:191
static const int defaultValue
Definition: M.hpp:227
static const int defaultValue
Definition: M.hpp:209
static const int defaultValue
Definition: M.hpp:245
static const int defaultValue
Definition: M.hpp:185
static const int defaultValue
Definition: M.hpp:221
static const int defaultValue
Definition: M.hpp:203
static const int defaultValue
Definition: M.hpp:239
static const int defaultValue
Definition: M.hpp:197
static const int defaultValue
Definition: M.hpp:233
Definition: Serializer.hpp:38
Definition: TimeMap.hpp:40
Definition: A.hpp:4
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955
static std::string data()
Definition: exprtk.hpp:40022
Definition: MessageLimits.hpp:30
int problem_print_limit
Definition: MessageLimits.hpp:34
bool operator==(const MLimits &other) const
Definition: MessageLimits.hpp:63
int warning_stop_limit
Definition: MessageLimits.hpp:39
int problem_stop_limit
Definition: MessageLimits.hpp:40
int error_print_limit
Definition: MessageLimits.hpp:35
int error_stop_limit
Definition: MessageLimits.hpp:41
static MLimits serializeObject()
Definition: MessageLimits.hpp:44
int message_print_limit
Definition: MessageLimits.hpp:31
bool operator!=(const MLimits &other) const
Definition: MessageLimits.hpp:78
int message_stop_limit
Definition: MessageLimits.hpp:37
int warning_print_limit
Definition: MessageLimits.hpp:33
int comment_print_limit
Definition: MessageLimits.hpp:32
int bug_print_limit
Definition: MessageLimits.hpp:36
int bug_stop_limit
Definition: MessageLimits.hpp:42
void serializeOp(Serializer &serializer)
Definition: MessageLimits.hpp:83
int comment_stop_limit
Definition: MessageLimits.hpp:38