opm-grid
NestedRefinementUtilities.hpp
1 /*
2  Copyright 2025 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_NESTEDREFINEMENTUTILITIES_HEADER_INCLUDED
21 #define OPM_NESTEDREFINEMENTUTILITIES_HEADER_INCLUDED
22 
23 #include <array>
24 #include <string>
25 #include <vector>
26 
27 namespace Opm
28 {
29 
37 bool isNameInTheList(const std::vector<std::string>& lgr_parent_grid_names,
38  const std::string& grid_name);
39 
48 std::vector<int>
49 getLgrDataIndicesByParentGrid(const std::vector<std::string>& lgr_parent_grid_names,
50  const std::string& parent_grid_name);
51 
73 std::tuple<std::vector<std::array<int,3>>,
74  std::vector<std::array<int,3>>,
75  std::vector<std::array<int,3>>,
76  std::vector<std::string>>
77 filterLgrDataPerParentGridName(const std::vector<std::array<int,3>>& cells_per_dim_vec,
78  const std::vector<std::array<int,3>>& startIJK_vec,
79  const std::vector<std::array<int,3>>& endIJK_vec,
80  const std::vector<std::string>& lgr_name_vec,
81  const std::vector<std::string>& lgr_parent_grid_name_vec,
82  const std::string& parent_grid_name);
83 
93 bool areParentGridsAvailableBeforeTheirLgrs(const std::map<std::string,int>& existing_grid_names,
94  const std::vector<std::string>& new_lgr_names,
95  const std::vector<std::string>& new_lgrs_parent_grid_names);
96 
97 } // namespace Opm
98 
99 #endif // OPM_NESTEDREFINEMENTUTILITIES_HEADER_INCLUDED
std::tuple< std::vector< std::array< int, 3 > >, std::vector< std::array< int, 3 > >, std::vector< std::array< int, 3 > >, std::vector< std::string > > filterLgrDataPerParentGridName(const std::vector< std::array< int, 3 >> &cells_per_dim_vec, const std::vector< std::array< int, 3 >> &startIJK_vec, const std::vector< std::array< int, 3 >> &endIJK_vec, const std::vector< std::string > &lgr_name_vec, const std::vector< std::string > &lgr_parent_grid_name_vec, const std::string &parent_grid_name)
Retrieve LGR data associated with a specific parent grid.
Definition: NestedRefinementUtilities.cpp:63
bool isNameInTheList(const std::vector< std::string > &lgr_parent_grid_names, const std::string &grid_name)
Check whether a grid name exists in a list of parent grid names.
Definition: NestedRefinementUtilities.cpp:36
std::vector< int > getLgrDataIndicesByParentGrid(const std::vector< std::string > &lgr_parent_grid_names, const std::string &parent_grid_name)
Group LGRs by their parent grid, identified through indices.
Definition: NestedRefinementUtilities.cpp:42
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.cpp:71
bool areParentGridsAvailableBeforeTheirLgrs(const std::map< std::string, int > &existing_grid_names, const std::vector< std::string > &new_lgr_names, const std::vector< std::string > &new_lgrs_parent_grid_names)
Check whether each parent grid exists before its child LGRs.
Definition: NestedRefinementUtilities.cpp:92