My Project
Loading...
Searching...
No Matches
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 Carfin() = default;
59
60 explicit Carfin(const GridDims& gridDims,
61 IsActive isActive,
62 ActiveIdx activeIdx);
63
64 Carfin(const GridDims& gridDims,
65 IsActive isActive,
66 ActiveIdx activeIdx,
67 const std::string& name,
68 int i1, int i2,
69 int j1, int j2,
70 int k1, int k2,
71 int nx, int ny,
72 int nz);
73
74 void update(const DeckRecord& deckRecord);
75 void reset();
76
77 bool isGlobal() const;
78 std::size_t size() const;
79 std::size_t getDim(std::size_t idim) const;
80
81 const std::vector<cell_index>& index_list() const;
82 const std::vector<cell_index>& global_index_list() const;
83
84 bool operator==(const Carfin& other) const;
85 bool equal(const Carfin& other) const;
86
87 const std::string& NAME() const;
88 int I1() const;
89 int I2() const;
90 int J1() const;
91 int J2() const;
92 int K1() const;
93 int K2() const;
94 int NX() const;
95 int NY() const;
96 int NZ() const;
97
98 template<class Serializer>
99 void serializeOp(Serializer& serializer)
100 {
101 serializer(m_dims);
102 serializer(m_offset);
103 serializer(m_end_offset);
104 serializer(name_grid);
105 }
106
107 private:
108 GridDims m_globalGridDims_{};
109 IsActive m_globalIsActive_{};
110 ActiveIdx m_globalActiveIdx_{};
111
112 std::array<std::size_t, 3> m_dims{};
113 std::array<std::size_t, 3> m_offset{};
114 std::array<std::size_t, 3> m_end_offset{};
115 std::string name_grid;
116
117 std::vector<cell_index> m_active_index_list;
118 std::vector<cell_index> m_global_index_list;
119
120 void init(const std::string& name,
121 int i1, int i2,
122 int j1, int j2,
123 int k1, int k2,
124 int nx, int ny, int nz);
125 void initIndexList();
126 int lower(int dim) const;
127 int upper(int dim) const;
128 int dimension(int dim) const;
129 };
130}
131
132
133#endif
Definition Carfin.hpp:34
Definition DeckRecord.hpp:32
Definition GridDims.hpp:31
Class for (de-)serializing.
Definition Serializer.hpp:91
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition Carfin.hpp:40