12#ifndef DUMUX_DISCRETIZATION_BASIC_GRID_GEOMETRY_HH 
   13#define DUMUX_DISCRETIZATION_BASIC_GRID_GEOMETRY_HH 
   19#include <dune/grid/common/mcmgmapper.hh> 
   35template<
class GV, 
class EM, 
class VM>
 
   42    static constexpr int dim = GV::dimension;
 
   43    static constexpr int dimWorld = GV::dimensionworld;
 
   46    using Element = 
typename GV::template Codim<0>::Entity;
 
   50    using Grid = 
typename GV::Grid;
 
   67    , elementMapper_(makeElementMapper_(
gridView))
 
   68    , vertexMapper_(makeVertexMapper_(
gridView))
 
   69    , bBoxMin_(std::numeric_limits<double>::max())
 
   70    , bBoxMax_(-std::numeric_limits<double>::max())
 
   72        computeGlobalBoundingBox_();
 
 
  104    { 
return vertexMapper_; }
 
 
  110    { 
return elementMapper_; }
 
 
  116    { 
return vertexMapper_; }
 
 
  122    { 
return elementMapper_; }
 
 
  128    { 
return *boundingBoxTree_; }
 
 
  134    { 
return *elementMap_; }
 
 
  161        if constexpr (std::is_constructible<ElementMapper, GridView, Dune::MCMGLayout>())
 
  170        if constexpr (std::is_constructible<VertexMapper, GridView, Dune::MCMGLayout>())
 
  177    void computeGlobalBoundingBox_()
 
  180        for (
const auto& vertex : vertices(gridView_))
 
  182            for (
int i=0; i<dimWorld; i++)
 
  186                bBoxMin_[i] = min(bBoxMin_[i], 
vertex.geometry().corner(0)[i]);
 
  187                bBoxMax_[i] = max(bBoxMax_[i], 
vertex.geometry().corner(0)[i]);
 
  192        if (gridView_.comm().size() > 1)
 
  194            for (
int i = 0; i < dimWorld; ++i)
 
  196                bBoxMin_[i] = gridView_.comm().min(bBoxMin_[i]);
 
  197                bBoxMax_[i] = gridView_.comm().max(bBoxMax_[i]);
 
  205        elementMapper_.update(gridView_);
 
  206        vertexMapper_.update(gridView_);
 
  209        computeGlobalBoundingBox_();
 
  215        elementMap_ = std::make_shared<ElementMap>(gridView_.grid(), elementMapper_);
 
  216        boundingBoxTree_ = std::make_unique<BoundingBoxTree>(
 
  217            std::make_shared<ElementSet>(gridView_, 
elementMapper(), elementMap_)
 
  229    std::unique_ptr<const BoundingBoxTree> boundingBoxTree_;
 
  232    std::shared_ptr<const ElementMap> elementMap_;
 
 
An axis-aligned bounding box volume hierarchy for dune grids.
const BoundingBoxTree & boundingBoxTree() const
Returns the bounding box tree of the grid.
Definition basicgridgeometry.hh:127
VM VertexMapper
export the vertex mapper type
Definition basicgridgeometry.hh:58
void update(GridView &&gridView)
Update internal state after grid changed.
Definition basicgridgeometry.hh:88
VertexMapper & vertexMapper()
Returns the mapper for vertices to indices for possibly adaptive grids.
Definition basicgridgeometry.hh:115
Element element(GridIndexType eIdx) const
Get an element from a global element index.
Definition basicgridgeometry.hh:139
const VertexMapper & vertexMapper() const
Returns the mapper for vertices to indices for constant grids.
Definition basicgridgeometry.hh:103
ElementMapper & elementMapper()
Returns the mapper for elements to indices for possibly adaptive grids.
Definition basicgridgeometry.hh:121
const ElementMap & elementMap() const
Returns the element index to element map.
Definition basicgridgeometry.hh:133
typename GV::Grid Grid
export the grid type
Definition basicgridgeometry.hh:50
void update(const GridView &gridView)
Update internal state after grid changed.
Definition basicgridgeometry.hh:79
const GlobalCoordinate & bBoxMax() const
The coordinate of the corner of the GridView's bounding box with the largest values.
Definition basicgridgeometry.hh:153
GV GridView
export the grid view type
Definition basicgridgeometry.hh:52
const GlobalCoordinate & bBoxMin() const
The coordinate of the corner of the GridView's bounding box with the smallest values.
Definition basicgridgeometry.hh:146
typename Element::Geometry::GlobalCoordinate GlobalCoordinate
export the global coordinate type
Definition basicgridgeometry.hh:54
const GridView & gridView() const
Return the gridView this grid geometry object lives on.
Definition basicgridgeometry.hh:97
EM ElementMapper
export the element mapper type
Definition basicgridgeometry.hh:56
const ElementMapper & elementMapper() const
Returns the mapper for elements to indices for constant grids.
Definition basicgridgeometry.hh:109
An axis-aligned bounding box volume tree implementation.
Definition boundingboxtree.hh:67
A map from indices to entities using grid entity seeds.
Definition entitymap.hh:27
An interface for a set of geometric entities based on a GridView.
Definition geometricentityset.hh:37
A map from indices to entities using grid entity seeds.
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:65
typename GridView::IndexSet::IndexType GridIndex
Definition indextraits.hh:27