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
46{
47public:
53 enum class Option : unsigned char {
54 None = 0,
55 Steps = 1 << 1,
56 Iterations = 1 << 2,
57 };
58
69 explicit ConvergenceOutputConfiguration(std::string_view options,
70 std::string_view optionName = "");
71
73 bool any() const
74 {
75 return this->flag_ != std::byte{0};
76 }
77
81 bool want(const Option opt) const
82 {
83 return std::to_integer<int>(this->flag_ & static_cast<std::byte>(opt)) != 0;
84 }
85
86private:
88 std::byte flag_{0};
89};
90
91} // namespace Opm
92
93#endif // CONVERGENCE_OUTPUT_CONFIGURATION_HPP
Definition: ConvergenceOutputConfiguration.hpp:46
Option
Definition: ConvergenceOutputConfiguration.hpp:53
bool any() const
Whether or not user wants any additional convergence output at all.
Definition: ConvergenceOutputConfiguration.hpp:73
bool want(const Option opt) const
Definition: ConvergenceOutputConfiguration.hpp:81
ConvergenceOutputConfiguration(std::string_view options, std::string_view optionName="")
Definition: BlackoilPhases.hpp:27