My Project
Carfin.hpp
1/*
2 Copyright 2022 Equinor
3 This file is part of the Open Porous Media project (OPM).
4 OPM is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8 OPM is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with OPM. If not, see <http://www.gnu.org/licenses/>.
14*/
15
16#ifndef CARFIN_HPP_
17#define CARFIN_HPP_
18
19#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
20
21#include <array>
22#include <cstddef>
23#include <functional>
24#include <vector>
25#include <string>
26
27namespace Opm {
28 class DeckRecord;
29}
30
31namespace Opm
32{
33 class Carfin
34 {
35 public:
36 using IsActive = std::function<bool(const std::size_t globalIdx)>;
37 using ActiveIdx = std::function<std::size_t(const std::size_t globalIdx)>;
38
40 {
41 std::size_t global_index;
42 std::size_t active_index;
43 std::size_t data_index;
44
45 cell_index(std::size_t g,std::size_t a, std::size_t d)
46 : global_index(g)
47 , active_index(a)
48 , data_index(d)
49 {}
50
51 cell_index(std::size_t g, std::size_t d)
52 : global_index(g)
53 , active_index(g)
54 , data_index(d)
55 {}
56 };
57
58
59 explicit Carfin(const GridDims& gridDims,
60 IsActive isActive,
61 ActiveIdx activeIdx);
62
63 Carfin(const GridDims& gridDims,
64 IsActive isActive,
65 ActiveIdx activeIdx,
66 std::string name, int i1, int i2,
67 int j1, int j2,
68 int k1, int k2,
69 int nx, int ny,
70 int nz);
71
72 void update(const DeckRecord& deckRecord);
73 void reset();
74
75 bool isGlobal() const;
76 std::size_t size() const;
77 std::size_t getDim(std::size_t idim) const;
78
79 const std::vector<cell_index>& index_list() const;
80 const std::vector<cell_index>& global_index_list() const;
81
82 bool operator==(const Carfin& other) const;
83 bool equal(const Carfin& other) const;
84
85 std::string NAME() const;
86 int I1() const;
87 int I2() const;
88 int J1() const;
89 int J2() const;
90 int K1() const;
91 int K2() const;
92 int NX() const;
93 int NY() const;
94 int NZ() const;
95
96 private:
97 GridDims m_globalGridDims_{};
98 IsActive m_globalIsActive_{};
99 ActiveIdx m_globalActiveIdx_{};
100
101 std::array<std::size_t, 3> m_dims{};
102 std::array<std::size_t, 3> m_offset{};
103 std::array<std::size_t, 3> m_end_offset{};
104 std::string name_grid;
105
106 std::vector<cell_index> m_active_index_list;
107 std::vector<cell_index> m_global_index_list;
108
109 void init(std::string name, int i1, int i2, int j1, int j2, int k1, int k2, int nx , int ny , int nz);
110 void initIndexList();
111 int lower(int dim) const;
112 int upper(int dim) const;
113 int dimension(int dim) const;
114 };
115}
116
117
118#endif
Definition: Carfin.hpp:34
Definition: DeckRecord.hpp:32
Definition: GridDims.hpp:31
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: Carfin.hpp:40