3#ifndef DUNE_MMESH_RANGEGENERATORS_HH
4#define DUNE_MMESH_RANGEGENERATORS_HH
6#include <dune/common/iteratorrange.hh>
12template <
typename Entity>
13inline auto incidentElements(
const Entity& entity)
14#ifndef DOXYGEN_SHOULD_SKIP_THIS
15 -> IteratorRange<
decltype(entity.impl().incidentBegin())>
18 static_assert(Entity::mydimension <= 1,
19 "Incident element range iterator is only available for "
20 "vertices and edges!");
21 return IteratorRange<
decltype(entity.impl().incidentBegin())>(
22 entity.impl().incidentBegin(), entity.impl().incidentEnd());
28template <
typename Vertex>
29inline auto incidentFacets(
const Vertex& vertex)
30#ifndef DOXYGEN_SHOULD_SKIP_THIS
31 -> IteratorRange<
decltype(vertex.impl().incidentFacetsBegin())>
35 Vertex::mydimension == 0,
36 "Incident facet range iterator is only available for vertices!");
37 return IteratorRange<
decltype(vertex.impl().incidentFacetsBegin())>(
38 vertex.impl().incidentFacetsBegin(), vertex.impl().incidentFacetsEnd());
44template <
typename Vertex>
45inline auto incidentVertices(
const Vertex& vertex,
bool includeInfinite =
false)
46#ifndef DOXYGEN_SHOULD_SKIP_THIS
48 decltype(vertex.impl().incidentVerticesBegin(includeInfinite))>
52 Vertex::mydimension == 0,
53 "Incident vertices range iterator is only available for vertices!");
54 return IteratorRange<
decltype(vertex.impl().incidentVerticesBegin(
55 includeInfinite))>(vertex.impl().incidentVerticesBegin(includeInfinite),
56 vertex.impl().incidentVerticesEnd(includeInfinite));
62template <
typename Gr
idView,
int codim = 1>
63inline auto interfaceElements(
const GridView& gv,
bool includeBoundary =
false)
64#ifndef DOXYGEN_SHOULD_SKIP_THIS
66 decltype(gv.grid().template interfaceBegin<codim>(includeBoundary))>
69 return IteratorRange<
decltype(gv.grid().template interfaceBegin<codim>(
71 gv.grid().template interfaceBegin<codim>(includeBoundary),
72 gv.grid().template interfaceEnd<codim>(includeBoundary));
78template <
typename Gr
idView>
79inline auto interfaceVertices(
const GridView& gv,
bool includeBoundary =
false)
80#ifndef DOXYGEN_SHOULD_SKIP_THIS
82 decltype(gv.grid().interfaceVerticesBegin(includeBoundary))>
85 return IteratorRange<
decltype(gv.grid().interfaceVerticesBegin(
86 includeBoundary))>(gv.grid().interfaceVerticesBegin(includeBoundary),
87 gv.grid().interfaceVerticesEnd(includeBoundary));
93template <
typename Vertex>
94inline auto incidentInterfaceVertices(
const Vertex& vertex)
95#ifndef DOXYGEN_SHOULD_SKIP_THIS
96 -> IteratorRange<
decltype(vertex.impl().incidentInterfaceVerticesBegin())>
99 static_assert(Vertex::mydimension == 0,
100 "Incident interface vertices range iterator is only available "
101 "for interface vertices!");
102 return IteratorRange<
103 decltype(vertex.impl().incidentInterfaceVerticesBegin())>(
104 vertex.impl().incidentInterfaceVerticesBegin(),
105 vertex.impl().incidentInterfaceVerticesEnd());
111template <
typename Entity>
112inline auto incidentInterfaceElements(
const Entity& entity)
113#ifndef DOXYGEN_SHOULD_SKIP_THIS
114 -> IteratorRange<
decltype(entity.impl().incidentInterfaceElementsBegin())>
117 static_assert(Entity::mydimension <= 1,
118 "Incident interface vertices range iterator is only available "
119 "for interface vertices and edges!");
120 return IteratorRange<
121 decltype(entity.impl().incidentInterfaceElementsBegin())>(
122 entity.impl().incidentInterfaceElementsBegin(),
123 entity.impl().incidentInterfaceElementsEnd());