ConvergenceOutputConfiguration.hpp
Go to the documentation of this file.
1/*
2 Copyright 2022 Equinor 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 CONVERGENCE_OUTPUT_CONFIGURATION_HPP
21#define CONVERGENCE_OUTPUT_CONFIGURATION_HPP
22
23#include <cstddef>
24#include <string_view>
25
26namespace Opm {
27
49{
50public:
56 enum class Option : unsigned char {
57 None = 0,
58 Steps = 1 << 1,
59 Iterations = 1 << 2,
60 Performance = 1 << 3,
61 };
62
73 explicit ConvergenceOutputConfiguration(std::string_view options,
74 std::string_view optionName = "");
75
77 bool any() const
78 {
79 return this->flag_ != std::byte{0};
80 }
81
85 bool want(const Option opt) const
86 {
87 return std::to_integer<int>(this->flag_ & static_cast<std::byte>(opt)) != 0;
88 }
89
90private:
92 std::byte flag_{0};
93};
94
95} // namespace Opm
96
97#endif // CONVERGENCE_OUTPUT_CONFIGURATION_HPP
Definition: ConvergenceOutputConfiguration.hpp:49
Option
Definition: ConvergenceOutputConfiguration.hpp:56
bool any() const
Whether or not user wants any additional convergence output at all.
Definition: ConvergenceOutputConfiguration.hpp:77
bool want(const Option opt) const
Definition: ConvergenceOutputConfiguration.hpp:85
ConvergenceOutputConfiguration(std::string_view options, std::string_view optionName="")
Definition: blackoilbioeffectsmodules.hh:45