FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
standard_refinement_traits.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 {
32 template<
33 typename Shape_,
34 int face_dim_>
35 #ifndef DOXYGEN
36 struct StandardRefinementTraits;
37 #else
38 struct StandardRefinementTraits
39 {
41 typedef Shape_ ShapeType;
42
44 static constexpr int cell_dim = ShapeType::dimension;
45
47 static constexpr int face_dim = face_dim_;
48
50 static constexpr int count = ...;
51 };
52 #endif // DOXYGEN
53
59 template<int face_dim_>
60 struct StandardRefinementTraits<Shape::Vertex, face_dim_>
61 {
62 // validate dimensions
63 static_assert(face_dim_ == 0, "invalid face dimension");
64
66 typedef Shape::Vertex ShapeType;
67
69 static constexpr int cell_dim = ShapeType::dimension; // = 0
70
72 static constexpr int face_dim = face_dim_; // = 0
73
75 static constexpr int count = 1;
76
78 static inline String name()
79 {
80 return "StandardRefinementTraits<Vertex," + stringify(face_dim_) + ">";
81 }
82 }; // struct StandardRefinementTraits<...,Vertex,...>
83
89 template<
90 int cell_dim_,
91 int face_dim_>
92 struct StandardRefinementTraits<Shape::Hypercube<cell_dim_>, face_dim_>
93 {
94 // validate dimensions
95 static_assert(face_dim_ >= 0, "invalid face dimension");
96 static_assert(cell_dim_ >= face_dim_, "invalid cell dimension");
97
99 typedef Shape::Hypercube<cell_dim_> ShapeType;
100
102 typedef typename Shape::FaceTraits<ShapeType, face_dim_>::ShapeType FaceType;
103
105 static constexpr int cell_dim = cell_dim_;
106
108 static constexpr int face_dim = face_dim_;
109
116 static constexpr int count = Shape::FaceTraits<ShapeType, cell_dim - face_dim>::count;
117
119 static inline String name()
120 {
121 return "StandardRefinementTraits<" + ShapeType::name() + "," + stringify(face_dim_) + ">";
122 }
123 }; // struct StandardRefinementTraits<Hypercube<...>,...>
124
130 template<
131 int face_dim_>
132 struct StandardRefinementTraits<Shape::Simplex<1>, face_dim_>
133 {
134 // validate dimensions
135 static_assert(face_dim_ >= 0, "invalid face dimension");
136 static_assert(1 >= face_dim_, "invalid cell dimension");
137
139 typedef Shape::Simplex<1> ShapeType;
140
142 typedef typename Shape::FaceTraits<ShapeType, face_dim_>::ShapeType FaceType;
143
145 static constexpr int cell_dim = 1;
146
148 static constexpr int face_dim = face_dim_;
149
151 static constexpr int count = Shape::FaceTraits<ShapeType, cell_dim - face_dim>::count;
152
154 static inline String name()
155 {
156 return "StandardRefinementTraits<" + ShapeType::name() + "," + stringify(face_dim_) + ">";
157 }
158 }; // struct StandardRefinementTraits<Simplex<1>,...>
159
165 template<>
166 struct StandardRefinementTraits<Shape::Simplex<2>, 0>
167 {
169 typedef Shape::Simplex<2> ShapeType;
170
172 static constexpr int cell_dim = 2;
173
175 static constexpr int face_dim = 0;
176
178 static constexpr int count = 0;
179
181 static inline String name()
182 {
183 return "StandardRefinementTraits<" + ShapeType::name() + ",0>";
184 }
185 }; // struct StandardRefinementTraits<Simplex<2>,0>
186
192 template<>
193 struct StandardRefinementTraits<Shape::Simplex<2>, 1>
194 {
196 typedef Shape::Simplex<2> ShapeType;
197
199 static constexpr int cell_dim = 2;
200
202 static constexpr int face_dim = 1;
203
205 static constexpr int count = 3;
206
208 static inline String name()
209 {
210 return "StandardRefinementTraits<" + ShapeType::name() + ",1>";
211 }
212 }; // struct StandardRefinementTraits<Simplex<2>,1>
213
219 template<>
220 struct StandardRefinementTraits<Shape::Simplex<2>, 2>
221 {
223 typedef Shape::Simplex<2> ShapeType;
224
226 static constexpr int cell_dim = 2;
227
229 static constexpr int face_dim = 2;
230
232 static constexpr int count = 4;
233
235 static inline String name()
236 {
237 return "StandardRefinementTraits<" + ShapeType::name() + ",2>";
238 }
239 }; // struct StandardRefinementTraits<Simplex<2>,2>
240
246 template<>
247 struct StandardRefinementTraits<Shape::Simplex<3>, 0>
248 {
250 typedef Shape::Simplex<3> ShapeType;
251
253 static constexpr int cell_dim = 3;
254
256 static constexpr int face_dim = 0;
257
259 static constexpr int count = 1;
260
262 static inline String name()
263 {
264 return "StandardRefinementTraits<" + ShapeType::name() + ",0>";
265 }
266 }; // struct StandardRefinementTraits<Simplex<3>,0>
267
273 template<>
274 struct StandardRefinementTraits<Shape::Simplex<3>, 1>
275 {
277 typedef Shape::Simplex<3> ShapeType;
278
280 static constexpr int cell_dim = 3;
281
283 static constexpr int face_dim = 1;
284
286 static constexpr int count = 6;
287
289 static inline String name()
290 {
291 return "StandardRefinementTraits<" + ShapeType::name() + ",1>";
292 }
293 }; // struct StandardRefinementTraits<Simplex<3>,1>
294
300 template<>
301 struct StandardRefinementTraits<Shape::Simplex<3>, 2>
302 {
304 typedef Shape::Simplex<3> ShapeType;
305
307 static constexpr int cell_dim = 3;
308
310 static constexpr int face_dim = 2;
311
313 static constexpr int count = 16;
314
316 static inline String name()
317 {
318 return "StandardRefinementTraits<" + ShapeType::name() + ",2>";
319 }
320 }; // struct StandardRefinementTraits<Simplex<3>,2>
321
327 template<>
328 struct StandardRefinementTraits<Shape::Simplex<3>, 3>
329 {
331 typedef Shape::Simplex<3> ShapeType;
332
334 static constexpr int cell_dim = 3;
335
337 static constexpr int face_dim = 3;
338
340 static constexpr int count = 12;
341
343 static inline String name()
344 {
345 return "StandardRefinementTraits<" + ShapeType::name() + ",3>";
346 }
347 }; // struct StandardRefinementTraits<Simplex<3>,3>
348 } // namespace Intern
350 } // namespace Geometry
351} // namespace FEAT
FEAT namespace.
Definition: adjactor.hpp:12
String stringify(const T_ &item)
Converts an item into a String.
Definition: string.hpp:944