opm-simulators
ConvergenceOutputConfiguration.hpp
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 
26 namespace Opm {
27 
46 {
47 public:
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 
86 private:
88  std::byte flag_{0};
89 };
90 
91 } // namespace Opm
92 
93 #endif // CONVERGENCE_OUTPUT_CONFIGURATION_HPP
bool any() const
Whether or not user wants any additional convergence output at all.
Definition: ConvergenceOutputConfiguration.hpp:73
ConvergenceOutputConfiguration(std::string_view options, std::string_view optionName="")
Constructor.
Definition: ConvergenceOutputConfiguration.cpp:112
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Parse comma separated option strings into a runtime configuration object for whether to output additi...
Definition: ConvergenceOutputConfiguration.hpp:45
Option
Option values.
Definition: ConvergenceOutputConfiguration.hpp:53
bool want(const Option opt) const
Whether or not user wants specific convergence output.
Definition: ConvergenceOutputConfiguration.hpp:81