Dune Core Modules (2.4.1)

topology.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_ALU3DGRIDTOPOLOGY_HH
4#define DUNE_ALU3DGRIDTOPOLOGY_HH
5
6//- system includes
7#include <cassert>
8
9namespace Dune {
10
11 // types of the elementes,
12 // i.e . tetra or hexa, mixed is not implemeneted
13 enum ALU3dGridElementType { tetra = 4, hexa = 7, mixed, error };
14
15 template <ALU3dGridElementType type>
16 struct EntityCount {};
17
18 template <>
19 struct EntityCount<tetra> {
20 enum {numFaces = 4};
21 enum {numVertices = 4};
22 enum {numEdges = 6};
23 enum {numVerticesPerFace = 3};
24 enum {numEdgesPerFace = 3};
25 };
26
27 template <>
28 struct EntityCount<hexa> {
29 enum {numFaces = 6};
30 enum {numVertices = 8};
31 enum {numEdges = 12};
32 enum {numVerticesPerFace = 4};
33 enum {numEdgesPerFace = 4};
34 };
35
36
39 template <ALU3dGridElementType type>
41 {
42 public:
43 enum { numFaces = EntityCount<type>::numFaces };
44 enum { numVertices = EntityCount<type>::numVertices };
45 enum { numEdges = EntityCount<type>::numEdges };
46 enum { numVerticesPerFace = EntityCount<type>::numVerticesPerFace };
47
49 static int dune2aluFace(int index);
51 static int alu2duneFace(int index);
52
54 static int dune2aluEdge(int index);
56 static int alu2duneEdge(int index);
57
59 static int dune2aluVertex(int index);
61 static int alu2duneVertex(int index);
62
63 static int generic2aluFace ( const int index );
64 static int alu2genericFace ( const int index );
65
66 static int generic2aluVertex ( const int index );
67 static int alu2genericVertex ( const int index );
68
73 static int faceOrientation(int index);
74
81 static int dune2aluFaceVertex(int face, int localVertex);
88 static int alu2duneFaceVertex(int face, int localVertex);
89
97 static int faceVertex ( int face, int local );
98
99 private:
100 const static int dune2aluFace_[numFaces];
101 const static int alu2duneFace_[numFaces];
102
103 const static int dune2aluEdge_[numEdges];
104 const static int alu2duneEdge_[numEdges];
105
106 const static int dune2aluVertex_[numVertices];
107 const static int alu2duneVertex_[numVertices];
108
109 static const int generic2aluFace_[ numFaces ];
110 static const int alu2genericFace_[ numFaces ];
111
112 static const int generic2aluVertex_[ numVertices ];
113 static const int alu2genericVertex_[ numVertices ];
114
115 const static int faceOrientation_[numFaces];
116
117 const static int dune2aluFaceVertex_[numFaces][numVerticesPerFace];
118 const static int alu2duneFaceVertex_[numFaces][numVerticesPerFace];
119
120 static const int faceVertex_[ numFaces ][ numVerticesPerFace ];
121 };
122
125 template <ALU3dGridElementType type>
127 public:
129 static int dune2aluVertex(int index);
137 static int dune2aluVertex(int index, int twist);
139 static int alu2duneVertex(int index);
148 static int alu2duneVertex(int index, int twist);
150 static int dune2aluEdge(int index);
152 static int alu2duneEdge(int index);
153 // private:
154 static int twist(int index, int faceTwist);
155 static int invTwist(int index, int faceTwist);
156
157 static int twistedDuneIndex( const int idx, const int twist );
158
159 // for each aluTwist apply additional mapping
160 static int aluTwistMap(const int aluTwist);
161 private:
162 const static int dune2aluVertex_[EntityCount<type>::numVerticesPerFace];
163 const static int alu2duneVertex_[EntityCount<type>::numVerticesPerFace];
164
165 const static int dune2aluEdge_[EntityCount<type>::numEdgesPerFace];
166 const static int alu2duneEdge_[EntityCount<type>::numEdgesPerFace];
167
168 const static int alu2duneTwist_[ 2 * EntityCount<type>::numVerticesPerFace ];
169 const static int aluTwistMap_[ 2 * EntityCount<type>::numVerticesPerFace ];
170 };
171
172 //- IMPLEMENTATION
173 //- class ElementTopologyMapping
174 template <ALU3dGridElementType type>
176 assert(index >= 0 && index < numFaces);
177 return dune2aluFace_[index];
178 }
179
180 template <ALU3dGridElementType type>
182 assert(index >= 0 && index < numFaces);
183 return alu2duneFace_[index];
184 }
185
186 template <ALU3dGridElementType type>
188 assert(index >= 0 && index < numEdges);
189 return dune2aluEdge_[index];
190 }
191
192 template <ALU3dGridElementType type>
194 assert(index >= 0 && index < numEdges);
195 return alu2duneEdge_[index];
196 }
197
198 template <ALU3dGridElementType type>
200 {
201 assert(index >= 0 && index < numVertices);
202 return dune2aluVertex_[index];
203 }
204
205 template <ALU3dGridElementType type>
207 assert(index >= 0 && index < numVertices);
208 return alu2duneVertex_[index];
209 }
210
211 template< ALU3dGridElementType type >
212 inline int ElementTopologyMapping< type >::generic2aluFace ( const int index )
213 {
214 assert( (index >= 0) && (index < numFaces) );
215 return generic2aluFace_[ index ];
216 }
217
218 template< ALU3dGridElementType type >
219 inline int ElementTopologyMapping< type >::alu2genericFace ( const int index )
220 {
221 assert( (index >= 0) && (index < numFaces) );
222 return alu2genericFace_[ index ];
223 }
224
225 template< ALU3dGridElementType type >
226 inline int ElementTopologyMapping< type >::generic2aluVertex ( const int index )
227 {
228 assert( (index >= 0) && (index < numVertices) );
229 return generic2aluVertex_[ index ];
230 }
231
232 template< ALU3dGridElementType type >
233 inline int ElementTopologyMapping< type >::alu2genericVertex ( const int index )
234 {
235 assert( (index >= 0) && (index < numVertices) );
236 return alu2genericVertex_[ index ];
237 }
238
239 template <ALU3dGridElementType type>
241 assert(index >= 0 && index < numVertices);
242 return faceOrientation_[index];
243 }
244
245 template <ALU3dGridElementType type>
247 dune2aluFaceVertex(int face, int localVertex) {
248 assert(face >= 0 && face < numFaces);
249 assert(localVertex >= 0 && localVertex < numVerticesPerFace);
250 return dune2aluFaceVertex_[face][localVertex];
251 }
252
253 template <ALU3dGridElementType type>
255 alu2duneFaceVertex(int face, int localVertex) {
256 assert(face >= 0 && face < numFaces);
257 assert(localVertex >= 0 && localVertex < numVerticesPerFace);
258 return alu2duneFaceVertex_[face][localVertex];
259 }
260
261 template< ALU3dGridElementType type >
262 inline int ElementTopologyMapping< type >::faceVertex ( int face, int local )
263 {
264 assert( (face >= 0) && (face < numFaces) );
265 assert( (local >= 0) && (local < numVerticesPerFace) );
266 return faceVertex_[ face ][ local ];
267 }
268
269 //- class FaceTopologyMapping
270 template <ALU3dGridElementType type>
272 assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
273 return dune2aluVertex_[index];
274 }
275
276 template <ALU3dGridElementType type>
277 inline int FaceTopologyMapping<type>::dune2aluVertex(int index, int twist) {
278 assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
279 return invTwist(dune2aluVertex_[index], twist);
280 }
281
282 template <ALU3dGridElementType type>
284 assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
285 return alu2duneVertex_[index];
286 }
287
288 template <ALU3dGridElementType type>
289 inline int FaceTopologyMapping<type>::alu2duneVertex(int index, int twist)
290 {
291 assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
292 return alu2duneVertex_[invTwist(index, twist)];
293 }
294
295 template <ALU3dGridElementType type>
297 assert(index >= 0 && index < EntityCount<type>::numEdgesPerFace);
298 return alu2duneEdge_[index];
299 }
300
301 template <ALU3dGridElementType type>
303 aluTwistMap(const int aluTwist)
304 {
305 // this map has been calculated by grid/test/checktwists.cc
306 // and the dune-fem twist calculator
307 // this should be revised after the release 2.1
308 return aluTwistMap_[ aluTwist + ((type == tetra) ? 3 : 4) ];
309 }
310
311 template <ALU3dGridElementType type>
312 inline int FaceTopologyMapping<type>::
313 twistedDuneIndex(const int duneIdx, const int aluTwist)
314 {
315 if( type == tetra )
316 {
317 // apply alu2dune twist mapping (only for tetra)
318 const int twist = alu2duneTwist_[ aluTwist + 3 ];
319 return alu2duneVertex( dune2aluVertex(duneIdx) , twist );
320 }
321 else
322 return alu2duneVertex( dune2aluVertex(duneIdx) , aluTwist );
323 }
324
325 template <ALU3dGridElementType type>
327 assert(index >= 0 && index < EntityCount<type>::numEdgesPerFace);
328 return dune2aluEdge_[index];
329 }
330
331} // end namespace Dune
332#endif
Definition: topology.hh:41
static int alu2duneVertex(int index)
Maps vertex index from ALU3dGrid onto Dune reference element.
Definition: topology.hh:206
static int dune2aluEdge(int index)
Maps edge index from Dune onto ALU3dGrid reference element.
Definition: topology.hh:187
static int alu2duneFace(int index)
Maps face index from ALU3dGrid onto Dune reference element.
Definition: topology.hh:181
static int alu2duneFaceVertex(int face, int localVertex)
Definition: topology.hh:255
static int faceOrientation(int index)
Definition: topology.hh:240
static int alu2duneEdge(int index)
Maps edge index from ALU3dGrid onto Dune reference element.
Definition: topology.hh:193
static int dune2aluFaceVertex(int face, int localVertex)
Definition: topology.hh:247
static int faceVertex(int face, int local)
Maps a local vertex on a face onto a global vertex.
Definition: topology.hh:262
static int dune2aluVertex(int index)
Maps vertex index from Dune onto ALU3dGrid reference element.
Definition: topology.hh:199
static int dune2aluFace(int index)
Maps face index from Dune onto ALU3dGrid reference element.
Definition: topology.hh:175
Definition: topology.hh:126
static int alu2duneEdge(int index)
Maps edge index from ALU3dGrid onto Dune reference face.
Definition: topology.hh:296
static int dune2aluEdge(int index)
Maps edge index from Dune onto ALU3dGrid reference face.
Definition: topology.hh:326
static int alu2duneVertex(int index)
Maps vertex index from ALU3dGrid onto Dune reference face.
Definition: topology.hh:283
static int dune2aluVertex(int index)
Maps vertex index from Dune onto ALU3dGrid reference face.
Definition: topology.hh:271
Dune namespace.
Definition: alignment.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)