opm-common
UDQDims.hpp
1 /*
2  Copyright (c) 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_UDQDIMS_HPP
21 #define OPM_UDQDIMS_HPP
22 
23 #include <cstddef>
24 #include <functional>
25 #include <optional>
26 #include <vector>
27 
28 namespace Opm {
29 
30 class UDQConfig;
31 
32 } // namespace Opm
33 
34 namespace Opm {
35 
39 class UDQDims
40 {
41 public:
48  explicit UDQDims(const UDQConfig& config,
49  const std::vector<int>& intehead);
50 
52  static std::size_t entriesPerIUDQ() { return 3; }
53 
55  static std::size_t entriesPerIUAD() { return 5; }
56 
58  static std::size_t entriesPerZUDN() { return 2; }
59 
61  static std::size_t entriesPerZUDL() { return 16; }
62 
64  std::size_t totalNumUDQs() const;
65 
67  std::size_t numIUAD() const;
68 
72  std::size_t numIGPH() const;
73 
75  std::size_t numIUAP() const;
76 
78  std::size_t numFieldUDQs() const;
79 
81  std::size_t maxNumGroups() const;
82 
84  std::size_t numGroupUDQs() const;
85 
87  std::size_t maxNumMsWells() const;
88 
90  std::size_t maxNumSegments() const;
91 
93  std::size_t numSegmentUDQs() const;
94 
96  std::size_t maxNumWells() const;
97 
99  std::size_t numWellUDQs() const;
100 
105  [[deprecated("The data vector is not aware of categories other than field, group, or well. Use named accessors instead.")]]
106  const std::vector<int>& data() const
107  {
108  if (! this->dimensionData_.has_value()) {
109  this->collectDimensions();
110  }
111 
112  return *this->dimensionData_;
113  }
114 
115 private:
117  std::size_t totalNumUDQs_{};
118 
121  std::reference_wrapper<const std::vector<int>> intehead_;
122 
124  mutable std::optional<std::vector<int>> dimensionData_;
125 
127  void collectDimensions() const;
128 
135  std::size_t intehead(const std::vector<int>::size_type i) const;
136 };
137 
138 } // namespace Opm
139 
140 #endif // OPM_UDQDIMS_HPP
std::size_t maxNumWells() const
Run&#39;s maximum number of wells, multi-segmented or otherwise.
Definition: UDQDims.cpp:106
Collection of all user-defined quantities in the current simulation run.
Definition: UDQConfig.hpp:68
std::size_t numFieldUDQs() const
Number of field level UDQs.
Definition: UDQDims.cpp:67
std::size_t maxNumMsWells() const
Run&#39;s maximum number of multi-segmented wells.
Definition: UDQDims.cpp:88
std::size_t maxNumSegments() const
Run&#39;s maximum number of segments per multi-segmented well.
Definition: UDQDims.cpp:93
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
std::size_t maxNumGroups() const
Maximum number of groups in run, including FIELD.
Definition: UDQDims.cpp:75
std::size_t numIUAP() const
Number of well/group IDs involved in UDAs.
Definition: UDQDims.cpp:59
std::size_t numGroupUDQs() const
Number of group level UDQs.
Definition: UDQDims.cpp:80
std::size_t numIUAD() const
Total number of UDAs in run.
Definition: UDQDims.cpp:47
std::size_t numWellUDQs() const
Number of well level UDQs.
Definition: UDQDims.cpp:111
std::size_t numSegmentUDQs() const
Number of segment level UDQs.
Definition: UDQDims.cpp:98
std::size_t totalNumUDQs() const
Total number of UDQs in run of all types/categories.
Definition: UDQDims.cpp:39
const std::vector< int > & data() const
Linear sequence of some array sizes.
Definition: UDQDims.hpp:106
std::size_t numIGPH() const
Number of potential group level injection phase UDAs.
Definition: UDQDims.cpp:52
Collection of UDQ and UDA related dimension queries.
Definition: UDQDims.hpp:39
UDQDims(const UDQConfig &config, const std::vector< int > &intehead)
Constructor.
Definition: UDQDims.cpp:33
static std::size_t entriesPerIUDQ()
Number of IUDQ elements per UDQ.
Definition: UDQDims.hpp:52
static std::size_t entriesPerZUDN()
Number of ZUDN elments per UDQ.
Definition: UDQDims.hpp:58
static std::size_t entriesPerIUAD()
Number of IUAD elements per UDA.
Definition: UDQDims.hpp:55
static std::size_t entriesPerZUDL()
Number of ZUDL elments per UDQ.
Definition: UDQDims.hpp:61