opm-common
FIPRegionStatistics.hpp
1 /*
2  Copyright 2024 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 FIP_REGION_STATISTICS_HPP
21 #define FIP_REGION_STATISTICS_HPP
22 
23 #include <cstddef>
24 #include <functional>
25 #include <string>
26 #include <string_view>
27 #include <vector>
28 
31 
32 namespace Opm {
33  class FieldPropsManager;
34 } // namespace Opm
35 
36 namespace Opm {
37 
40  {
41  public:
43  FIPRegionStatistics() = default;
44 
64  explicit FIPRegionStatistics(const std::size_t declaredMaxRegID,
65  const FieldPropsManager& fldPropsMgr,
66  std::function<void(std::vector<int>&)> computeGlobalMax);
67 
72  bool operator==(const FIPRegionStatistics& that) const;
73 
76 
81  {
82  return this->minimumMaximumRegionID_;
83  }
84 
90  const std::vector<std::string>& regionSets() const
91  {
92  return this->regionSets_;
93  }
94 
103  int maximumRegionID(std::string_view regionSet) const;
104 
111  template <typename Serializer>
112  void serializeOp(Serializer& serializer)
113  {
114  serializer(this->minimumMaximumRegionID_);
115  serializer(this->regionSets_);
116  serializer(this->maxRegionID_);
117  }
118 
119  private:
121  int minimumMaximumRegionID_{};
122 
126  std::vector<std::string> regionSets_{};
127 
130  std::vector<int> maxRegionID_{};
131  };
132 } // namespace Opm
133 
134 #endif // FIP_REGION_STATISTICS_HPP
int maximumRegionID(std::string_view regionSet) const
Get global maximum region ID of a named region set.
Definition: FIPRegionStatistics.cpp:118
Definition: FieldPropsManager.hpp:42
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
static FIPRegionStatistics serializationTestObject()
Serialisation test object.
Definition: FIPRegionStatistics.cpp:104
Basic descriptive statistics about a model&#39;s fluid-in-place regions.
Definition: FIPRegionStatistics.hpp:39
int declaredMaximumRegionID() const
Retrieve model&#39;s declared maximum fluid-in-place region ID.
Definition: FIPRegionStatistics.hpp:80
FIPRegionStatistics()=default
Default constructor.
const std::vector< std::string > & regionSets() const
Get list of named region sets, without the initial &#39;FIP&#39; name prefix.
Definition: FIPRegionStatistics.hpp:90
bool operator==(const FIPRegionStatistics &that) const
Equality predicate.
Definition: FIPRegionStatistics.cpp:95
void serializeOp(Serializer &serializer)
Serialisation operator.
Definition: FIPRegionStatistics.hpp:112
Class for (de-)serializing.
Definition: Serializer.hpp:94