1#ifndef DUNE_COPASI_GRID_BOUNDARY_ENTITY_MAPPER_HH
2#define DUNE_COPASI_GRID_BOUNDARY_ENTITY_MAPPER_HH
4#include <dune-copasi-config.hh>
6#include <dune/grid/common/mcmgmapper.hh>
7#include <dune/grid/common/rangegenerators.hh>
9#include <dune/grid/concepts/gridview.hh>
24template<Dune::Concept::Gr
idView Gr
idView>
29 :
_mapper{ grid_view, [](GeometryType gt, int griddim) {
return gt.dim() !=
static_cast<unsigned int>(griddim); } }
30 , _boundary(_mapper.size(),
false)
32 for (
const auto& entity : elements(grid_view)) {
33 for (
const auto& intersection : intersections(grid_view, entity)) {
34 if (intersection.boundary()) {
35 auto face = intersection.indexInInside();
36 const auto& refelem = referenceElement(entity.geometry());
37 for (std::size_t codim = 1; codim != (GridView::dimension+1); ++codim) {
38 unsigned int sz = refelem.size(face, 1, codim);
39 for (
unsigned int sub_entity = 0; sub_entity != sz; ++sub_entity) {
40 unsigned int local_idx = refelem.subEntity(face, 1, sub_entity, codim);
41 unsigned int idx = _mapper.subIndex(entity, local_idx, codim);
42 _boundary[idx] =
true;
51 bool isBoundary(
const auto& entity,
auto local_index,
auto codim)
const
53 return _boundary[_mapper.subIndex(entity, local_index, codim)];
56 MultipleCodimMultipleGeomTypeMapper<GridView>
_mapper;
Mapper of boundary entities.
Definition: boundary_entity_mapper.hh:26
std::vector< bool > _boundary
Definition: boundary_entity_mapper.hh:57
MultipleCodimMultipleGeomTypeMapper< GridView > _mapper
Definition: boundary_entity_mapper.hh:56
BoundaryEntityMapper(GridView grid_view)
Definition: boundary_entity_mapper.hh:28
bool isBoundary(const auto &entity, auto local_index, auto codim) const
Whether a sub-entity is in the boundary of the grid view.
Definition: boundary_entity_mapper.hh:51
Definition: axis_names.hh:7