FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
face_index_mapping.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
9#include <kernel/shape.hpp>
10
11namespace FEAT
12{
13 namespace Geometry
14 {
16 namespace Intern
17 {
25 template<
26 typename Shape_,
27 int cell_dim_,
28 int face_dim_>
29#ifndef DOXYGEN
30 class FaceIndexMapping;
31#else
32 class FaceIndexMapping
33 {
34 public:
35 static int map(int cell, int face);
36 };
37#endif // DOXYGEN
38
39 template<>
40 class FaceIndexMapping<Shape::Simplex<2>, 1, 0>
41 {
42 public:
43 static int map(int cell, int face)
44 {
45 ASSERTM((0 <= cell) && (cell < 3), "invalid cell index");
46 ASSERTM((0 <= face) && (face < 2), "invalid face index");
47 static const int indices[3][2] =
48 {
49 {1, 2},
50 {2, 0},
51 {0, 1}
52 };
53 return indices[cell][face];
54 }
55 }; // FaceIndexMapping<Simplex<2>, 1, 0>
56
57 template<>
58 class FaceIndexMapping<Shape::Simplex<3>, 1, 0>
59 {
60 public:
61 static int map(int cell, int face)
62 {
63 ASSERTM((0 <= cell) && (cell < 6), "invalid cell index");
64 ASSERTM((0 <= face) && (face < 2), "invalid face index");
65 static const int indices[6][2] =
66 {
67 {0, 1},
68 {0, 2},
69 {0, 3},
70 {1, 2},
71 {1, 3},
72 {2, 3}
73 };
74 return indices[cell][face];
75 }
76 }; // FaceIndexMapping<Simplex<3>, 1, 0>
77
78 template<>
79 class FaceIndexMapping<Shape::Simplex<3>, 2, 0>
80 {
81 public:
82 static int map(int cell, int face)
83 {
84 ASSERTM((0 <= cell) && (cell < 4), "invalid cell index");
85 ASSERTM((0 <= face) && (face < 3), "invalid face index");
86 static const int indices[4][3] =
87 {
88 {1, 2, 3},
89 {0, 2, 3},
90 {0, 1, 3},
91 {0, 1, 2}
92 };
93 return indices[cell][face];
94 }
95 }; // FaceIndexMapping<Simplex<3>, 2, 0>
96
97 template<>
98 class FaceIndexMapping<Shape::Simplex<3>, 2, 1>
99 {
100 public:
101 static int map(int cell, int face)
102 {
103 ASSERTM((0 <= cell) && (cell < 4), "invalid cell index");
104 ASSERTM((0 <= face) && (face < 3), "invalid face index");
105 static const int indices[4][3] =
106 {
107 {5, 4, 3},
108 {5, 2, 1},
109 {4, 2, 0},
110 {3, 1, 0}
111 };
112 return indices[cell][face];
113 }
114 }; // FaceIndexMapping<Simplex<3>, 2, 0>
115
116 template<>
117 class FaceIndexMapping<Shape::Hypercube<2>, 1, 0>
118 {
119 public:
120 static int map(int cell, int face)
121 {
122 ASSERTM((0 <= cell) && (cell < 4), "invalid cell index");
123 ASSERTM((0 <= face) && (face < 2), "invalid face index");
124 static const int indices[4][2] =
125 {
126 {0, 1},
127 {2, 3},
128 {0, 2},
129 {1, 3}
130 };
131 return indices[cell][face];
132 }
133 }; // FaceIndexMapping<Hypercube<2>, 1, 0>
134
135 template<>
136 class FaceIndexMapping<Shape::Hypercube<3>, 1, 0>
137 {
138 public:
139 static int map(int cell, int face)
140 {
141 ASSERTM((0 <= cell) && (cell < 12), "invalid cell index");
142 ASSERTM((0 <= face) && (face < 2), "invalid face index");
143 static const int indices[12][2] =
144 {
145 {0, 1},
146 {2, 3},
147 {4, 5},
148 {6, 7},
149 {0, 2},
150 {1, 3},
151 {4, 6},
152 {5, 7},
153 {0, 4},
154 {1, 5},
155 {2, 6},
156 {3, 7}
157 };
158 return indices[cell][face];
159 }
160 }; // FaceIndexMapping<Shape::Hypercube<3>, 1, 0>
161
162 template<>
163 class FaceIndexMapping<Shape::Hypercube<3>, 2, 0>
164 {
165 public:
166 static int map(int cell, int face)
167 {
168 ASSERTM((0 <= cell) && (cell < 6), "invalid cell index");
169 ASSERTM((0 <= face) && (face < 4), "invalid face index");
170 static const int indices[6][4] =
171 {
172 {0, 1, 2, 3},
173 {4, 5, 6, 7},
174 {0, 1, 4, 5},
175 {2, 3, 6, 7},
176 {0, 2, 4, 6},
177 {1, 3, 5, 7}
178 };
179 return indices[cell][face];
180 }
181 }; // FaceIndexMapping<Shape::Hypercube<3>, 2, 0>
182
183 template<>
184 class FaceIndexMapping<Shape::Hypercube<3>, 2, 1>
185 {
186 public:
187 static int map(int cell, int face)
188 {
189 ASSERTM((0 <= cell) && (cell < 6), "invalid cell index");
190 ASSERTM((0 <= face) && (face < 4), "invalid face index");
191 static const int indices[6][4] =
192 {
193 {0, 1, 4, 5},
194 {2, 3, 6, 7},
195 {0, 2, 8, 9},
196 {1, 3, 10, 11},
197 {4, 6, 8, 10},
198 {5, 7, 9, 11}
199 };
200 return indices[cell][face];
201 }
202 }; // FaceIndexMapping<Shape::Hypercube<3>, 2, 1>
203 } // namespace Intern
205 } // namespace Geometry
206} // namespace FEAT
#define ASSERTM(expr, msg)
Debug-Assertion macro definition with custom message.
Definition: assertion.hpp:230
FEAT namespace.
Definition: adjactor.hpp:12