24#ifndef DUMUX_DISCRETIZATION_BASIC_GRID_GEOMETRY_HH
25#define DUMUX_DISCRETIZATION_BASIC_GRID_GEOMETRY_HH
31#include <dune/grid/common/mcmgmapper.hh>
47template<
class GV,
class EM,
class VM>
54 static constexpr int dim = GV::dimension;
55 static constexpr int dimWorld = GV::dimensionworld;
58 using Element =
typename GV::template Codim<0>::Entity;
62 using Grid =
typename GV::Grid;
79 , elementMapper_(makeElementMapper_(
gridView))
80 , vertexMapper_(makeVertexMapper_(
gridView))
81 , bBoxMin_(std::numeric_limits<double>::max())
82 , bBoxMax_(-std::numeric_limits<double>::max())
84 computeGlobalBoundingBox_();
110 {
return gridView_; }
116 {
return vertexMapper_; }
122 {
return elementMapper_; }
128 {
return vertexMapper_; }
134 {
return elementMapper_; }
140 {
return *boundingBoxTree_; }
146 {
return *elementMap_; }
173 if constexpr (std::is_constructible<ElementMapper, GridView, Dune::MCMGLayout>())
182 if constexpr (std::is_constructible<VertexMapper, GridView, Dune::MCMGLayout>())
189 void computeGlobalBoundingBox_()
192 for (
const auto& vertex : vertices(gridView_))
194 for (
int i=0; i<dimWorld; i++)
198 bBoxMin_[i] = min(bBoxMin_[i],
vertex.geometry().corner(0)[i]);
199 bBoxMax_[i] = max(bBoxMax_[i],
vertex.geometry().corner(0)[i]);
204 if (gridView_.comm().size() > 1)
206 for (
int i = 0; i < dimWorld; ++i)
208 bBoxMin_[i] = gridView_.comm().min(bBoxMin_[i]);
209 bBoxMax_[i] = gridView_.comm().max(bBoxMax_[i]);
217 elementMapper_.update(gridView_);
218 vertexMapper_.update(gridView_);
221 computeGlobalBoundingBox_();
227 elementMap_ = std::make_shared<ElementMap>(gridView_.grid(), elementMapper_);
228 boundingBoxTree_ = std::make_unique<BoundingBoxTree>(
229 std::make_shared<ElementSet>(gridView_,
elementMapper(), elementMap_)
241 std::unique_ptr<const BoundingBoxTree> boundingBoxTree_;
244 std::shared_ptr<const ElementMap> elementMap_;
A map from indices to entities using grid entity seeds.
Defines the index types used for grid and local indices.
An axis-aligned bounding box volume hierarchy for dune grids.
An interface for a set of geometric entities.
BasicGridGeometry(const GridView &gridView)
Constructor computes the bounding box of the entire domain, for e.g. setting boundary conditions.
Definition: basicgridgeometry.hh:77
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
A map from indices to entities using grid entity seeds.
Definition: entitymap.hh:39
Structure to define the index types used for grid and local indices.
Definition: indextraits.hh:38
An implementation of a grid geometry with some basic features.
Definition: basicgridgeometry.hh:49
const BoundingBoxTree & boundingBoxTree() const
Returns the bounding box tree of the grid.
Definition: basicgridgeometry.hh:139
VM VertexMapper
export the vertex mapper type
Definition: basicgridgeometry.hh:70
void update(GridView &&gridView)
Update internal state after grid changed.
Definition: basicgridgeometry.hh:100
VertexMapper & vertexMapper()
Returns the mapper for vertices to indices for possibly adaptive grids.
Definition: basicgridgeometry.hh:127
Element element(GridIndexType eIdx) const
Get an element from a global element index.
Definition: basicgridgeometry.hh:151
const VertexMapper & vertexMapper() const
Returns the mapper for vertices to indices for constant grids.
Definition: basicgridgeometry.hh:115
ElementMapper & elementMapper()
Returns the mapper for elements to indices for possibly adaptive grids.
Definition: basicgridgeometry.hh:133
const ElementMap & elementMap() const
Returns the element index to element map.
Definition: basicgridgeometry.hh:145
typename GV::Grid Grid
export the grid type
Definition: basicgridgeometry.hh:62
void update(const GridView &gridView)
Update internal state after grid changed.
Definition: basicgridgeometry.hh:91
const GlobalCoordinate & bBoxMax() const
The coordinate of the corner of the GridView's bounding box with the largest values.
Definition: basicgridgeometry.hh:165
GV GridView
export the grid view type
Definition: basicgridgeometry.hh:64
const GlobalCoordinate & bBoxMin() const
The coordinate of the corner of the GridView's bounding box with the smallest values.
Definition: basicgridgeometry.hh:158
typename Element::Geometry::GlobalCoordinate GlobalCoordinate
export the global coordinate type
Definition: basicgridgeometry.hh:66
const GridView & gridView() const
Return the gridView this grid geometry object lives on.
Definition: basicgridgeometry.hh:109
EM ElementMapper
export the element mapper type
Definition: basicgridgeometry.hh:68
const ElementMapper & elementMapper() const
Returns the mapper for elements to indices for constant grids.
Definition: basicgridgeometry.hh:121
An axis-aligned bounding box volume tree implementation.
Definition: boundingboxtree.hh:68
An interface for a set of geometric entities based on a GridView.
Definition: geometricentityset.hh:44