dune-mmesh (1.4)

rangegenerators.hh
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
6#include <dune/common/iteratorrange.hh>
7
8namespace Dune
9{
13 template<typename Entity>
14 inline auto incidentElements(const Entity& entity)
15#ifndef DOXYGEN_SHOULD_SKIP_THIS
16 -> IteratorRange<decltype(entity.impl().incidentBegin())>
17#endif /* DOXYGEN_SHOULD_SKIP_THIS */
18 {
19 static_assert(Entity::mydimension <= 1, "Incident element range iterator is only available for vertices and edges!");
20 return IteratorRange<decltype(entity.impl().incidentBegin())>(entity.impl().incidentBegin(), entity.impl().incidentEnd());
21 }
22
26 template<typename Vertex>
27 inline auto incidentFacets(const Vertex& vertex)
28#ifndef DOXYGEN_SHOULD_SKIP_THIS
29 -> IteratorRange<decltype(vertex.impl().incidentFacetsBegin())>
30#endif /* DOXYGEN_SHOULD_SKIP_THIS */
31 {
32 static_assert(Vertex::mydimension == 0, "Incident facet range iterator is only available for vertices!");
33 return IteratorRange<decltype(vertex.impl().incidentFacetsBegin())>(vertex.impl().incidentFacetsBegin(),vertex.impl().incidentFacetsEnd());
34 }
35
39 template<typename Vertex>
40 inline auto incidentVertices(const Vertex& vertex, bool includeInfinite = false)
41#ifndef DOXYGEN_SHOULD_SKIP_THIS
42 -> IteratorRange<decltype(vertex.impl().incidentVerticesBegin( includeInfinite ))>
43#endif /* DOXYGEN_SHOULD_SKIP_THIS */
44 {
45 static_assert(Vertex::mydimension == 0, "Incident vertices range iterator is only available for vertices!");
46 return IteratorRange<decltype(vertex.impl().incidentVerticesBegin( includeInfinite ))>(
47 vertex.impl().incidentVerticesBegin( includeInfinite ),
48 vertex.impl().incidentVerticesEnd( includeInfinite )
49 );
50 }
51
55 template<typename GridView, int codim = 1>
56 inline auto interfaceElements(const GridView& gv, bool includeBoundary = false)
57#ifndef DOXYGEN_SHOULD_SKIP_THIS
58 -> IteratorRange<decltype(gv.grid().template interfaceBegin<codim>( includeBoundary ))>
59#endif /* DOXYGEN_SHOULD_SKIP_THIS */
60 {
61 return IteratorRange<decltype(gv.grid().template interfaceBegin<codim>( includeBoundary ))>(
62 gv.grid().template interfaceBegin<codim>( includeBoundary ),
63 gv.grid().template interfaceEnd<codim>( includeBoundary )
64 );
65 }
66
70 template<typename GridView>
71 inline auto interfaceVertices(const GridView& gv, bool includeBoundary = false)
72#ifndef DOXYGEN_SHOULD_SKIP_THIS
73 -> IteratorRange<decltype(gv.grid().interfaceVerticesBegin( includeBoundary ))>
74#endif /* DOXYGEN_SHOULD_SKIP_THIS */
75 {
76 return IteratorRange<decltype(gv.grid().interfaceVerticesBegin( includeBoundary ))>(
77 gv.grid().interfaceVerticesBegin( includeBoundary ),
78 gv.grid().interfaceVerticesEnd( includeBoundary )
79 );
80 }
81
85 template<typename Vertex>
86 inline auto incidentInterfaceVertices(const Vertex& vertex)
87#ifndef DOXYGEN_SHOULD_SKIP_THIS
88 -> IteratorRange<decltype(vertex.impl().incidentInterfaceVerticesBegin())>
89#endif /* DOXYGEN_SHOULD_SKIP_THIS */
90 {
91 static_assert(Vertex::mydimension == 0, "Incident interface vertices range iterator is only available for interface vertices!");
92 return IteratorRange<decltype(vertex.impl().incidentInterfaceVerticesBegin())>(
93 vertex.impl().incidentInterfaceVerticesBegin(),
94 vertex.impl().incidentInterfaceVerticesEnd()
95 );
96 }
97
101 template<typename Entity>
102 inline auto incidentInterfaceElements(const Entity& entity)
103#ifndef DOXYGEN_SHOULD_SKIP_THIS
104 -> IteratorRange<decltype(entity.impl().incidentInterfaceElementsBegin())>
105#endif /* DOXYGEN_SHOULD_SKIP_THIS */
106 {
107 static_assert(Entity::mydimension <= 1, "Incident interface vertices range iterator is only available for interface vertices and edges!");
108 return IteratorRange<decltype(entity.impl().incidentInterfaceElementsBegin())>(
109 entity.impl().incidentInterfaceElementsBegin(),
110 entity.impl().incidentInterfaceElementsEnd()
111 );
112 }
113
114} // namespace Dune
115
116#endif // DUNE_MMESH_RANGEGENERATORS_HH
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Apr 6, 22:49, 2025)