/usr/include/dune/grid/alugrid/3d/topology.hh is in libdune-grid-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_ALU3DGRIDTOPOLOGY_HH
#define DUNE_ALU3DGRIDTOPOLOGY_HH
//- system includes
#include <cassert>
namespace Dune {
// types of the elementes,
// i.e . tetra or hexa, mixed is not implemeneted
enum ALU3dGridElementType { tetra = 4, hexa = 7, mixed, error };
template <ALU3dGridElementType type>
struct EntityCount {};
template <>
struct EntityCount<tetra> {
enum {numFaces = 4};
enum {numVertices = 4};
enum {numEdges = 6};
enum {numVerticesPerFace = 3};
enum {numEdgesPerFace = 3};
};
template <>
struct EntityCount<hexa> {
enum {numFaces = 6};
enum {numVertices = 8};
enum {numEdges = 12};
enum {numVerticesPerFace = 4};
enum {numEdgesPerFace = 4};
};
//! Maps indices of the Dune reference element onto the indices of the
//! ALU3dGrid reference element and vice-versa.
template <ALU3dGridElementType type>
class ElementTopologyMapping
{
public:
enum { numFaces = EntityCount<type>::numFaces };
enum { numVertices = EntityCount<type>::numVertices };
enum { numEdges = EntityCount<type>::numEdges };
enum { numVerticesPerFace = EntityCount<type>::numVerticesPerFace };
//! Maps face index from Dune onto ALU3dGrid reference element
static int dune2aluFace(int index);
//! Maps face index from ALU3dGrid onto Dune reference element
static int alu2duneFace(int index);
//! Maps edge index from Dune onto ALU3dGrid reference element
static int dune2aluEdge(int index);
//! Maps edge index from ALU3dGrid onto Dune reference element
static int alu2duneEdge(int index);
//! Maps vertex index from Dune onto ALU3dGrid reference element
static int dune2aluVertex(int index);
//! Maps vertex index from ALU3dGrid onto Dune reference element
static int alu2duneVertex(int index);
static int generic2aluFace ( const int index );
static int alu2genericFace ( const int index );
static int generic2aluVertex ( const int index );
static int alu2genericVertex ( const int index );
//! Return 1 if faces in ALU3dGrid and Dune reference element
//! have the same orientation (edge 0->1 is taken as reference as
//! they are the same in both reference elements), -1 otherwise.
//! The index is a Dune face index
static int faceOrientation(int index);
//! Maps local vertex index of a face onto a global vertex index
//! (Dune->ALU3dGrid)
//! \param face Face index (Dune reference element)
//! \param localVertex Local vertex index on face <i>face</i> (Dune reference
//! element)
//! \return global vertex index in ALU3dGrid reference element
static int dune2aluFaceVertex(int face, int localVertex);
//! Maps local vertex index of a face onto a global vertex index
//! (ALU3dGrid->Dune)
//! \param face Face index (ALU3dGrid reference element)
//! \param localVertex Local vertex index on face <i>face</i>
//! (ALU3dGrid reference element)
//! \return global vertex index in Dune reference element
static int alu2duneFaceVertex(int face, int localVertex);
/** \brief Maps a local vertex on a face onto a global vertex
*
* \param[in] face index of the face (with respect to ALU reference
* element)
* \param[in] local local index of vertex on the face
* \returns global index of vertex in ALU reference element
*/
static int faceVertex ( int face, int local );
private:
const static int dune2aluFace_[numFaces];
const static int alu2duneFace_[numFaces];
const static int dune2aluEdge_[numEdges];
const static int alu2duneEdge_[numEdges];
const static int dune2aluVertex_[numVertices];
const static int alu2duneVertex_[numVertices];
static const int generic2aluFace_[ numFaces ];
static const int alu2genericFace_[ numFaces ];
static const int generic2aluVertex_[ numVertices ];
static const int alu2genericVertex_[ numVertices ];
const static int faceOrientation_[numFaces];
const static int dune2aluFaceVertex_[numFaces][numVerticesPerFace];
const static int alu2duneFaceVertex_[numFaces][numVerticesPerFace];
static const int faceVertex_[ numFaces ][ numVerticesPerFace ];
};
//! Maps indices of the Dune reference face onto the indices of the
//! ALU3dGrid reference face and vice-versa.
template <ALU3dGridElementType type>
class FaceTopologyMapping {
public:
//! Maps vertex index from Dune onto ALU3dGrid reference face
static int dune2aluVertex(int index);
//! Maps vertex index from Dune onto ALU3dGrid reference face, where the
//! face in the ALU3dGrid has the twist <i>twist</i> compared to the orientation
//! of the respective face in the reference element
//! \param index local Dune vertex index on the particular face (i.e. the
//! face which has a twist <i>twist</i> compared to the reference element's face
//! \param twist twist of the face in consideration
//! \return local ALU3dGrid vertex index on reference element face
static int dune2aluVertex(int index, int twist);
//! Maps vertex index from ALU3dGrid onto Dune reference face
static int alu2duneVertex(int index);
//! Maps vertex index from ALU3dGrid onto Dune reference face, where the
//! face in the ALU3dGrid has the twist <i>twist</i> compared to the orientation
//! of the respective face in the reference element
//! \param index local ALU3dGrid vertex index on the particular face (i.e.
//! the face which has a twist <i>twist</i> compared to the reference element's
//! face
//! \param twist twist of the face in consideration
//! \return local Dune vertex index on reference element face
static int alu2duneVertex(int index, int twist);
//! Maps edge index from Dune onto ALU3dGrid reference face
static int dune2aluEdge(int index);
//! Maps edge index from ALU3dGrid onto Dune reference face
static int alu2duneEdge(int index);
// private:
static int twist(int index, int faceTwist);
static int invTwist(int index, int faceTwist);
static int twistedDuneIndex( const int idx, const int twist );
// for each aluTwist apply additional mapping
static int aluTwistMap(const int aluTwist);
private:
const static int dune2aluVertex_[EntityCount<type>::numVerticesPerFace];
const static int alu2duneVertex_[EntityCount<type>::numVerticesPerFace];
const static int dune2aluEdge_[EntityCount<type>::numEdgesPerFace];
const static int alu2duneEdge_[EntityCount<type>::numEdgesPerFace];
const static int alu2duneTwist_[ 2 * EntityCount<type>::numVerticesPerFace ];
const static int aluTwistMap_[ 2 * EntityCount<type>::numVerticesPerFace ];
};
//- IMPLEMENTATION
//- class ElementTopologyMapping
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::dune2aluFace(int index) {
assert(index >= 0 && index < numFaces);
return dune2aluFace_[index];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::alu2duneFace(int index) {
assert(index >= 0 && index < numFaces);
return alu2duneFace_[index];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::dune2aluEdge(int index) {
assert(index >= 0 && index < numEdges);
return dune2aluEdge_[index];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::alu2duneEdge(int index) {
assert(index >= 0 && index < numEdges);
return alu2duneEdge_[index];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::dune2aluVertex(int index)
{
assert(index >= 0 && index < numVertices);
return dune2aluVertex_[index];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::alu2duneVertex(int index) {
assert(index >= 0 && index < numVertices);
return alu2duneVertex_[index];
}
template< ALU3dGridElementType type >
inline int ElementTopologyMapping< type >::generic2aluFace ( const int index )
{
assert( (index >= 0) && (index < numFaces) );
return generic2aluFace_[ index ];
}
template< ALU3dGridElementType type >
inline int ElementTopologyMapping< type >::alu2genericFace ( const int index )
{
assert( (index >= 0) && (index < numFaces) );
return alu2genericFace_[ index ];
}
template< ALU3dGridElementType type >
inline int ElementTopologyMapping< type >::generic2aluVertex ( const int index )
{
assert( (index >= 0) && (index < numVertices) );
return generic2aluVertex_[ index ];
}
template< ALU3dGridElementType type >
inline int ElementTopologyMapping< type >::alu2genericVertex ( const int index )
{
assert( (index >= 0) && (index < numVertices) );
return alu2genericVertex_[ index ];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::faceOrientation(int index) {
assert(index >= 0 && index < numVertices);
return faceOrientation_[index];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::
dune2aluFaceVertex(int face, int localVertex) {
assert(face >= 0 && face < numFaces);
assert(localVertex >= 0 && localVertex < numVerticesPerFace);
return dune2aluFaceVertex_[face][localVertex];
}
template <ALU3dGridElementType type>
inline int ElementTopologyMapping<type>::
alu2duneFaceVertex(int face, int localVertex) {
assert(face >= 0 && face < numFaces);
assert(localVertex >= 0 && localVertex < numVerticesPerFace);
return alu2duneFaceVertex_[face][localVertex];
}
template< ALU3dGridElementType type >
inline int ElementTopologyMapping< type >::faceVertex ( int face, int local )
{
assert( (face >= 0) && (face < numFaces) );
assert( (local >= 0) && (local < numVerticesPerFace) );
return faceVertex_[ face ][ local ];
}
//- class FaceTopologyMapping
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::dune2aluVertex(int index) {
assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
return dune2aluVertex_[index];
}
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::dune2aluVertex(int index, int twist) {
assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
return invTwist(dune2aluVertex_[index], twist);
}
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::alu2duneVertex(int index) {
assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
return alu2duneVertex_[index];
}
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::alu2duneVertex(int index, int twist)
{
assert(index >= 0 && index < EntityCount<type>::numVerticesPerFace);
return alu2duneVertex_[invTwist(index, twist)];
}
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::alu2duneEdge(int index) {
assert(index >= 0 && index < EntityCount<type>::numEdgesPerFace);
return alu2duneEdge_[index];
}
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::
aluTwistMap(const int aluTwist)
{
// this map has been calculated by grid/test/checktwists.cc
// and the dune-fem twist calculator
// this should be revised after the release 2.1
return aluTwistMap_[ aluTwist + ((type == tetra) ? 3 : 4) ];
}
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::
twistedDuneIndex(const int duneIdx, const int aluTwist)
{
if( type == tetra )
{
// apply alu2dune twist mapping (only for tetra)
const int twist = alu2duneTwist_[ aluTwist + 3 ];
return alu2duneVertex( dune2aluVertex(duneIdx) , twist );
}
else
return alu2duneVertex( dune2aluVertex(duneIdx) , aluTwist );
}
template <ALU3dGridElementType type>
inline int FaceTopologyMapping<type>::dune2aluEdge(int index) {
assert(index >= 0 && index < EntityCount<type>::numEdgesPerFace);
return dune2aluEdge_[index];
}
} // end namespace Dune
#endif
|