dune-mmesh 1.4.1-git
Loading...
Searching...
No Matches
rangegenerators.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_MMESH_RANGEGENERATORS_HH
4#define DUNE_MMESH_RANGEGENERATORS_HH
5
7
8namespace Dune {
12template <typename Entity>
13inline auto incidentElements(const Entity& entity)
14#ifndef DOXYGEN_SHOULD_SKIP_THIS
15 -> IteratorRange<decltype(entity.impl().incidentBegin())>
16#endif /* DOXYGEN_SHOULD_SKIP_THIS */
17{
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());
23}
24
28template <typename Vertex>
29inline auto incidentFacets(const Vertex& vertex)
30#ifndef DOXYGEN_SHOULD_SKIP_THIS
31 -> IteratorRange<decltype(vertex.impl().incidentFacetsBegin())>
32#endif /* DOXYGEN_SHOULD_SKIP_THIS */
33{
34 static_assert(
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());
39}
40
44template <typename Vertex>
45inline auto incidentVertices(const Vertex& vertex, bool includeInfinite = false)
46#ifndef DOXYGEN_SHOULD_SKIP_THIS
48 decltype(vertex.impl().incidentVerticesBegin(includeInfinite))>
49#endif /* DOXYGEN_SHOULD_SKIP_THIS */
50{
51 static_assert(
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));
57}
58
62template <typename GridView, 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))>
67#endif /* DOXYGEN_SHOULD_SKIP_THIS */
68{
69 return IteratorRange<decltype(gv.grid().template interfaceBegin<codim>(
70 includeBoundary))>(
71 gv.grid().template interfaceBegin<codim>(includeBoundary),
72 gv.grid().template interfaceEnd<codim>(includeBoundary));
73}
74
78template <typename GridView>
79inline auto interfaceVertices(const GridView& gv, bool includeBoundary = false)
80#ifndef DOXYGEN_SHOULD_SKIP_THIS
82 decltype(gv.grid().interfaceVerticesBegin(includeBoundary))>
83#endif /* DOXYGEN_SHOULD_SKIP_THIS */
84{
85 return IteratorRange<decltype(gv.grid().interfaceVerticesBegin(
86 includeBoundary))>(gv.grid().interfaceVerticesBegin(includeBoundary),
87 gv.grid().interfaceVerticesEnd(includeBoundary));
88}
89
93template <typename Vertex>
94inline auto incidentInterfaceVertices(const Vertex& vertex)
95#ifndef DOXYGEN_SHOULD_SKIP_THIS
96 -> IteratorRange<decltype(vertex.impl().incidentInterfaceVerticesBegin())>
97#endif /* DOXYGEN_SHOULD_SKIP_THIS */
98{
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());
106}
107
111template <typename Entity>
113#ifndef DOXYGEN_SHOULD_SKIP_THIS
114 -> IteratorRange<decltype(entity.impl().incidentInterfaceElementsBegin())>
115#endif /* DOXYGEN_SHOULD_SKIP_THIS */
116{
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());
124}
125
126} // namespace Dune
127
128#endif // DUNE_MMESH_RANGEGENERATORS_HH
auto incidentInterfaceVertices(const Vertex &vertex)
Incident interface vertices.
Definition rangegenerators.hh:94
auto interfaceVertices(const GridView &gv, bool includeBoundary=false)
All interface vertices.
Definition rangegenerators.hh:79
@ Vertex
Definition curvatureoperator.hh:22
auto incidentFacets(const Vertex &vertex)
Facets incident to a given vertex.
Definition rangegenerators.hh:29
auto incidentVertices(const Vertex &vertex, bool includeInfinite=false)
Vertices incident to a given vertex.
Definition rangegenerators.hh:45
auto incidentElements(const Entity &entity)
Elements incident to a given entity.
Definition rangegenerators.hh:13
auto interfaceElements(const GridView &gv, bool includeBoundary=false)
All interface elements.
Definition rangegenerators.hh:63
auto incidentInterfaceElements(const Entity &entity)
Incident interface elements.
Definition rangegenerators.hh:112
const Grid & grid() const
const EntityType & entity() const