opm-grid
CpGridUtilities.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_CPGRIDUTILITIES_HEADER_INCLUDED
21 #define OPM_CPGRIDUTILITIES_HEADER_INCLUDED
22 
23 #include <opm/grid/CpGrid.hpp>
24 
25 namespace Opm
26 {
27 
38 std::pair<std::unordered_map<int, int>, std::vector<std::array<int, 3>>>
39 lgrIJK(const Dune::CpGrid& grid, const std::string& lgr_name);
40 
62 std::pair<std::vector<double>, std::vector<double>>
63 lgrCOORDandZCORN(const Dune::CpGrid& grid,
64  int level,
65  const std::unordered_map<int, int>& lgrCartesianIdxToCellIdx,
66  const std::vector<std::array<int, 3>>& lgrIJK);
67 
82 void setPillarCoordinates(int i, int j, int nx,
83  int topCorner, int bottomCorner,
84  int positionIdx,
85  const Dune::cpgrid::Entity<0>& topElem,
86  const Dune::cpgrid::Entity<0>& bottomElem,
87  std::vector<double>& lgrCOORD);
88 
89 
101 void processPillars(int i, int j, int nx,
102  const Dune::cpgrid::Entity<0>& topElem,
103  const Dune::cpgrid::Entity<0>& bottomElem,
104  std::vector<double>& lgrCOORD);
105 } // namespace Opm
106 
107 #endif // OPM_CPGRIDUTILITIES_HEADER_INCLUDED
[ provides Dune::Grid ]
Definition: CpGrid.hpp:201
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.cpp:71
void processPillars(int i, int j, int nx, const Dune::cpgrid::Entity< 0 > &topElem, const Dune::cpgrid::Entity< 0 > &bottomElem, std::vector< double > &lgrCOORD)
Processes and sets the coordinates for all four pillars of a given "(i,j) column of cells"...
Definition: CpGridUtilities.cpp:215
void setPillarCoordinates(int i, int j, int nx, int topCorner, int bottomCorner, int positionIdx, const Dune::cpgrid::Entity< 0 > &topElem, const Dune::cpgrid::Entity< 0 > &bottomElem, std::vector< double > &lgrCOORD)
Sets the coordinates for a pillar.
Definition: CpGridUtilities.cpp:184
std::pair< std::vector< double >, std::vector< double > > lgrCOORDandZCORN(const Dune::CpGrid &grid, int level, const std::unordered_map< int, int > &lgrCartesianIdxToCellIdx, const std::vector< std::array< int, 3 >> &lgrIJK)
Extracts the COORD and ZCORN values for the LGR (Local Grid Refinement) block.
Definition: CpGridUtilities.cpp:73
std::pair< std::unordered_map< int, int >, std::vector< std::array< int, 3 > > > lgrIJK(const Dune::CpGrid &grid, const std::string &lgr_name)
Retrieves Cartesian indices for a specified Local Grid Refinement (LGR) level in a Dune::CpGrid...
Definition: CpGridUtilities.cpp:39