My Project
ActiveIndexByColumns.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_ACTIVE_INDEX_BY_COLUMNS_HPP
21 #define OPM_ACTIVE_INDEX_BY_COLUMNS_HPP
22 
23 #include <array>
24 #include <cassert>
25 #include <cstddef>
26 #include <functional>
27 #include <vector>
28 
29 namespace Opm {
30  class EclipseGrid;
31 }
32 
33 namespace Opm {
34 
39 {
40 public:
41  bool operator==(const ActiveIndexByColumns& rhs) const;
42 
49  explicit ActiveIndexByColumns(const std::size_t numActive,
50  const std::array<int, 3>& cartDims,
51  const std::function<std::array<int, 3>(const std::size_t)>& getIJK);
52 
57  int getColumnarActiveIndex(const std::size_t naturalActiveIndex) const
58  {
59  assert ((naturalActiveIndex < this->natural2columnar_.size())
60  && "Natural active cell index out of bounds");
61 
62  return this->natural2columnar_[naturalActiveIndex];
63  }
64 
65 private:
66  std::vector<int> natural2columnar_;
67 };
68 
71 
72 } // namespace Opm
73 
74 
75 #endif // OPM_ACTIVE_INDEX_BY_COLUMNS_HPP
Special purpose mapping facility to handle the output code's need to enumerate the active cells by co...
Definition: ActiveIndexByColumns.hpp:39
ActiveIndexByColumns(const std::size_t numActive, const std::array< int, 3 > &cartDims, const std::function< std::array< int, 3 >(const std::size_t)> &getIJK)
Create natural->columnar active cell index mapping.
int getColumnarActiveIndex(const std::size_t naturalActiveIndex) const
Map active index in natural order to active index in columnar order.
Definition: ActiveIndexByColumns.hpp:57
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:54
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
ActiveIndexByColumns buildColumnarActiveIndexMappingTables(const EclipseGrid &grid)
Build natural->columnar active cell index mapping from an EclipseGrid instance.