GridStateWriter.hpp
Go to the documentation of this file.
1/*
2 Copyright 2026 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#ifndef OPM_GRID_REFINEMENT_GRIDSTATEWRITER_HEADER_INCLUDED
20#define OPM_GRID_REFINEMENT_GRIDSTATEWRITER_HEADER_INCLUDED
21
24
25#include <memory>
26
28
29#include <array>
30#include <tuple>
31#include <vector>
32
33namespace Opm
34{
35namespace Refinement
36{
37
44{
46
48 static void setLevel(Data& grid, int level);
49
51 static void setCellsPerDim(Data& grid, const std::array<int,3>& cellsPerDim);
52
57 static void setSubdivision(Data& grid,
58 const std::array<Opm::Refinement::AxisSubdivision,3>& subdivision);
59
64 static void setParentRelations(Data& grid,
65 std::vector<std::array<int,2>> childToParent,
66 std::vector<int> cartesianIndexInParentCell);
67
70 static void setParentToChildren(Data& grid,
71 std::vector<std::tuple<int, std::vector<int>>> parentToChildren);
72
74 static void setLeafToLevel(Data& grid, std::vector<std::array<int,2>> leafToLevel);
75
78 static void setLevelToLeaf(Data& grid, std::vector<int> levelToLeaf);
79
81 static void setAquiferCells(Data& grid, std::vector<int> cells);
82
85 static void setCornerOrigin(Data& grid, std::vector<std::array<int,2>> cornerOrigin);
86
87 static void setLogicalCartesianSize(Data& grid, const std::array<int,3>& size);
88 static void setGlobalCell(Data& grid, std::vector<int> globalCell);
89 static void setIndexSet(Data& grid, std::size_t numCells, std::size_t numPoints);
90 static void setRefinementMaxLevel(Data& grid, int maxLevel);
91
99 static void setCommunicator(Data& grid, const Data::Communication& comm);
100
104 static std::vector<std::array<int,8>>& mutableCellToPoint(Data& grid);
109 static Opm::SparseTable<int>& mutableFaceToPoint(Data& grid);
110 static const Opm::SparseTable<int>& faceToPoint(const Data& grid);
117 static const std::vector<std::array<int,2>>& childToParent(const Data& grid);
118 static const std::vector<int>& cartesianIndexInParentCell(const Data& grid);
119
123 std::shared_ptr<const RetainedCornerPointInput> input);
124 static std::shared_ptr<const RetainedCornerPointInput> retainedCornerPointInput(const Data& grid);
125
130 static const std::vector<char>& cellPartitionTypes(const Data& grid);
131 static void setCellPartitionTypes(Data& grid, std::vector<char> types);
132
135 static void setGlobalIdMapping(Data& grid,
136 std::vector<int> cellIds,
137 std::vector<int> faceIds,
138 std::vector<int> pointIds);
139};
140
141} // namespace Refinement
142} // namespace Opm
143
144#endif // OPM_GRID_REFINEMENT_GRIDSTATEWRITER_HEADER_INCLUDED
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:144
CpGridDataTraits::Communication Communication
The type of the collective communication.
Definition: CpGridData.hpp:696
Definition: DefaultGeometryPolicy.hpp:56
A class design to hold a variable with a value for each entity of the given codimension,...
Definition: EntityRep.hpp:316
int numCells(const Dune::CpGrid &grid)
Get the number of cells of a grid.
const int * globalCell(const Dune::CpGrid &)
Get the local to global index mapping.
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.hpp:26
Definition: GridStateWriter.hpp:44
static const Dune::cpgrid::EntityVariable< enum face_tag, 1 > & faceTag(const Data &grid)
static void setParentToChildren(Data &grid, std::vector< std::tuple< int, std::vector< int > > > parentToChildren)
static const std::vector< std::array< int, 2 > > & childToParent(const Data &grid)
static void setCellsPerDim(Data &grid, const std::array< int, 3 > &cellsPerDim)
Set the per-parent subdivision factors of a refined level grid.
static void setLeafToLevel(Data &grid, std::vector< std::array< int, 2 > > leafToLevel)
Set leaf-to-level mapping on the leaf: entry = {level, level index}.
static void setCornerOrigin(Data &grid, std::vector< std::array< int, 2 > > cornerOrigin)
static Opm::SparseTable< int > & mutableFaceToPoint(Data &grid)
static void setAquiferCells(Data &grid, std::vector< int > cells)
Set the sorted cell indices of numerical aquifer cells.
static void setIndexSet(Data &grid, std::size_t numCells, std::size_t numPoints)
static const std::vector< char > & cellPartitionTypes(const Data &grid)
static Dune::cpgrid::OrientedEntityTable< 0, 1 > & mutableCellToFace(Data &grid)
static void setLevelToLeaf(Data &grid, std::vector< int > levelToLeaf)
static void setLevel(Data &grid, int level)
Set the level index a grid occupies in the hierarchy.
static void setCellPartitionTypes(Data &grid, std::vector< char > types)
static void setCommunicator(Data &grid, const Data::Communication &comm)
static Dune::cpgrid::SignedEntityVariable< Dune::FieldVector< double, 3 >, 1 > & mutableFaceNormals(Data &grid)
static const Dune::cpgrid::DefaultGeometryPolicy & geometry(const Data &grid)
static void setGlobalCell(Data &grid, std::vector< int > globalCell)
static void setLogicalCartesianSize(Data &grid, const std::array< int, 3 > &size)
static const Dune::cpgrid::OrientedEntityTable< 0, 1 > & cellToFace(const Data &grid)
static const Dune::cpgrid::OrientedEntityTable< 1, 0 > & faceToCell(const Data &grid)
static std::vector< std::array< int, 8 > > & mutableCellToPoint(Data &grid)
static const Dune::cpgrid::SignedEntityVariable< Dune::FieldVector< double, 3 >, 1 > & faceNormals(const Data &grid)
static void setRefinementMaxLevel(Data &grid, int maxLevel)
static Dune::cpgrid::DefaultGeometryPolicy & mutableGeometry(Data &grid)
static Dune::cpgrid::EntityVariable< enum face_tag, 1 > & mutableFaceTag(Data &grid)
static void setSubdivision(Data &grid, const std::array< Opm::Refinement::AxisSubdivision, 3 > &subdivision)
static std::shared_ptr< const RetainedCornerPointInput > retainedCornerPointInput(const Data &grid)
static void setRetainedCornerPointInput(Data &grid, std::shared_ptr< const RetainedCornerPointInput > input)
static void setParentRelations(Data &grid, std::vector< std::array< int, 2 > > childToParent, std::vector< int > cartesianIndexInParentCell)
static Dune::cpgrid::OrientedEntityTable< 1, 0 > & mutableFaceToCell(Data &grid)
static void setGlobalIdMapping(Data &grid, std::vector< int > cellIds, std::vector< int > faceIds, std::vector< int > pointIds)
static const Opm::SparseTable< int > & faceToPoint(const Data &grid)
static const std::vector< int > & cartesianIndexInParentCell(const Data &grid)