35 explicit EGrid(
const std::string& filename,
const std::string& grid_name =
"global");
37 int global_index(
int i,
int j,
int k)
const;
38 int active_index(
int i,
int j,
int k)
const;
40 const std::array<int, 3>& dimension()
const {
return nijk; }
42 std::array<int, 3> ijk_from_active_index(
int actInd)
const;
43 std::array<int, 3> ijk_from_global_index(
int globInd)
const;
45 void getCellCorners(
int globindex, std::array<double, 8>& X, std::array<double, 8>& Y, std::array<double, 8>& Z);
46 void getCellCorners(
const std::array<int, 3>& ijk, std::array<double, 8>& X, std::array<double, 8>& Y, std::array<double, 8>& Z);
48 std::vector<std::array<float, 3>> getXYZ_layer(
int layer,
bool bottom=
false);
49 std::vector<std::array<float, 3>> getXYZ_layer(
int layer,
const std::array<int, 4>& box,
bool bottom=
false);
51 int activeCells()
const {
return nactive; }
52 int totalNumberOfCells()
const {
return nijk[0] * nijk[1] * nijk[2]; }
54 void load_grid_data();
56 bool with_mapaxes()
const {
return m_mapaxes_loaded; }
57 void mapaxes_transform(
double& x,
double& y)
const;
58 bool is_radial()
const {
return m_radial; }
60 const std::vector<int>& hostCellsGlobalIndex()
const {
return host_cells; }
61 std::vector<std::array<int, 3>> hostCellsIJK();
64 using NNCentry = std::tuple<int, int, int, int, int, int, float>;
65 std::vector<NNCentry> get_nnc_ijk();
67 const std::vector<std::string>& list_of_lgrs()
const {
return lgr_names; }
69 const std::array<double, 6>& get_mapaxes()
const {
return m_mapaxes; }
70 const std::string& get_mapunits()
const {
return m_mapunits; }
71 const std::vector<float>& get_coord()
const {
return coord_array; }
72 const std::vector<float>& get_zcorn()
const {
return zcorn_array; }
78 std::filesystem::path inputFileName, initFileName;
79 std::string m_grid_name;
82 std::array<double, 6> m_mapaxes;
83 std::string m_mapunits;
84 bool m_mapaxes_loaded;
85 std::array<double, 4> origin;
86 std::array<double, 2> unit_x;
87 std::array<double, 2> unit_y;
89 std::array<int, 3> nijk;
90 std::array<int, 3> host_nijk;
93 mutable bool m_nncs_loaded;
95 std::vector<int> act_index;
96 std::vector<int> glob_index;
98 std::vector<float> coord_array;
99 std::vector<float> zcorn_array;
101 std::vector<int> nnc1_array;
102 std::vector<int> nnc2_array;
103 std::vector<float> transnnc_array;
104 std::vector<int> host_cells;
105 std::map<int,int> res;
107 std::vector<std::string> lgr_names;
111 int zcorn_array_index;
112 int coord_array_index;
113 int coordsys_array_index;
114 int actnum_array_index;
115 int nnc1_array_index;
116 int nnc2_array_index;
118 std::vector<float> get_zcorn_from_disk(
int layer,
bool bottom);
120 void getCellCorners(
const std::array<int, 3>& ijk,
const std::vector<float>& zcorn_layer,
121 std::array<double, 4>& X, std::array<double, 4>& Y, std::array<double, 4>& Z);