opm-simulators
ALQState.hpp
1 /*
2  Copyright 2021 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 OPM_ALQ_STATE_HEADER_INCLUDED
21 #define OPM_ALQ_STATE_HEADER_INCLUDED
22 
23 #include <map>
24 #include <optional>
25 #include <string>
26 
27 
28 namespace Opm {
29 
30 template<class Scalar>
31 class ALQState
32 {
33 public:
34  static ALQState serializationTestObject();
35 
36  Scalar get() const;
37  void update_default(Scalar value);
38  void set(Scalar value);
39  bool oscillation() const;
40  void update_count(bool increase);
41  void reset_count();
42  int get_increment_count() const;
43  int get_decrement_count() const;
44 
45  template<class Serializer>
46  void serializeOp(Serializer& serializer)
47  {
48  serializer(current_alq_);
49  serializer(default_alq_);
50  serializer(alq_increase_count_);
51  serializer(alq_decrease_count_);
52  }
53 
54  bool operator==(const ALQState&) const;
55 
56 private:
57  std::optional<Scalar> current_alq_;
58  Scalar default_alq_{0.0};
59  int alq_increase_count_{0};
60  int alq_decrease_count_{0};
61 };
62 
63 }
64 
65 #endif
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: ALQState.hpp:31