FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
shape_convert_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 {
18 template<typename Shape_>
19 struct OtherShape;
20
21 template<>
22 struct OtherShape<Shape::Vertex>
23 {
24 typedef Shape::Vertex Type;
25 };
26
27 template<int dim_>
28 struct OtherShape<Shape::Simplex<dim_> >
29 {
30 typedef Shape::Hypercube<dim_> Type;
31 };
32
33 template<int dim_>
34 struct OtherShape<Shape::Hypercube<dim_> >
35 {
36 typedef Shape::Simplex<dim_> Type;
37 };
38
39 template<
40 typename Shape_,
41 int face_dim_>
42 struct ShapeConvertTraits;
43
49 template<int face_dim_>
50 struct ShapeConvertTraits<Shape::Vertex, face_dim_>
51 {
52 // validate dimensions
53 static_assert(face_dim_ == 0, "invalid face dimension");
54
56 typedef Shape::Vertex ShapeType;
57
59 static constexpr int cell_dim = ShapeType::dimension; // = 0
60
62 static constexpr int face_dim = face_dim_; // = 0
63
65 static constexpr int count = 1;
66
68 static inline String name()
69 {
70 return "ShapeConvertTraits<Vertex," + stringify(face_dim_) + ">";
71 }
72 }; // struct ShapeConvertTraits<...,Vertex,...>
73
79 template<>
80 struct ShapeConvertTraits<Shape::Hypercube<1>, 0>
81 {
83 typedef Shape::Hypercube<1> ShapeType;
85 typedef Shape::Vertex FaceType;
87 static constexpr int cell_dim = 1;
89 static constexpr int face_dim = 0;
90 // number of faces generated
91 static constexpr int count = 0;
92
94 static inline String name()
95 {
96 return "ShapeConvertTraits<Hypercube<1>,0>";
97 }
98 }; // struct ShapeConvertTraits<Hypercube<1>,0>
99
105 template<>
106 struct ShapeConvertTraits<Shape::Hypercube<1>, 1>
107 {
109 typedef Shape::Hypercube<1> ShapeType;
111 typedef Shape::Simplex<1> FaceType;
113 static constexpr int cell_dim = 1;
115 static constexpr int face_dim = 1;
116 // number of faces generated
117 static constexpr int count = 1;
118
120 static inline String name()
121 {
122 return "ShapeConvertTraits<Hypercube<1>,1>";
123 }
124 }; // struct ShapeConvertTraits<Hypercube<1>,1>
125
131 template<>
132 struct ShapeConvertTraits<Shape::Hypercube<2>, 0>
133 {
135 typedef Shape::Hypercube<2> ShapeType;
137 typedef Shape::Vertex FaceType;
139 static constexpr int cell_dim = 2;
141 static constexpr int face_dim = 0;
142 // number of faces generated
143 static constexpr int count = 1;
144
146 static inline String name()
147 {
148 return "ShapeConvertTraits<Hypercube<2>,0>";
149 }
150 }; // struct ShapeConvertTraits<Hypercube<2>,0>
151
157 template<>
158 struct ShapeConvertTraits<Shape::Hypercube<2>, 1>
159 {
161 typedef Shape::Hypercube<2> ShapeType;
163 typedef Shape::Simplex<1> FaceType;
165 static constexpr int cell_dim = 2;
167 static constexpr int face_dim = 1;
168 // number of faces generated
169 static constexpr int count = 4;
170
172 static inline String name()
173 {
174 return "ShapeConvertTraits<Hypercube<2>,1>";
175 }
176 }; // struct ShapeConvertTraits<Hypercube<2>,1>
177
183 template<>
184 struct ShapeConvertTraits<Shape::Hypercube<2>, 2>
185 {
187 typedef Shape::Hypercube<2> ShapeType;
189 typedef Shape::Simplex<2> FaceType;
191 static constexpr int cell_dim = 2;
193 static constexpr int face_dim = 2;
194 // number of faces generated
195 static constexpr int count = 4;
196
198 static inline String name()
199 {
200 return "ShapeConvertTraits<Hypercube<2>,2>";
201 }
202 }; // struct ShapeConvertTraits<Hypercube<2>,2>
203
209 template<>
210 struct ShapeConvertTraits<Shape::Hypercube<3>, 0>
211 {
213 typedef Shape::Hypercube<3> ShapeType;
215 typedef Shape::Vertex FaceType;
217 static constexpr int cell_dim = 3;
219 static constexpr int face_dim = 0;
220 // number of faces generated
221 static constexpr int count = 1;
222
224 static inline String name()
225 {
226 return "ShapeConvertTraits<Hypercube<3>,0>";
227 }
228 }; // struct ShapeConvertTraits<Hypercube<3>,0>
229
235 template<>
236 struct ShapeConvertTraits<Shape::Hypercube<3>, 1>
237 {
239 typedef Shape::Hypercube<3> ShapeType;
241 typedef Shape::Simplex<1> FaceType;
243 static constexpr int cell_dim = 3;
245 static constexpr int face_dim = 1;
246 // number of faces generated
247 static constexpr int count = 14;
248
250 static inline String name()
251 {
252 return "ShapeConvertTraits<Hypercube<3>,1>";
253 }
254 }; // struct ShapeConvertTraits<Hypercube<3>,1>
255
261 template<>
262 struct ShapeConvertTraits<Shape::Hypercube<3>, 2>
263 {
265 typedef Shape::Hypercube<3> ShapeType;
267 typedef Shape::Simplex<2> FaceType;
269 static constexpr int cell_dim = 3;
271 static constexpr int face_dim = 2;
272 // number of faces generated
273 static constexpr int count = 36;
274
276 static inline String name()
277 {
278 return "ShapeConvertTraits<Hypercube<3>,2>";
279 }
280 }; // struct ShapeConvertTraits<Hypercube<3>,2>
281
287 template<>
288 struct ShapeConvertTraits<Shape::Hypercube<3>, 3>
289 {
291 typedef Shape::Hypercube<3> ShapeType;
293 typedef Shape::Simplex<3> FaceType;
295 static constexpr int cell_dim = 3;
297 static constexpr int face_dim = 3;
298 // number of faces generated
299 static constexpr int count = 24;
300
302 static inline String name()
303 {
304 return "ShapeConvertTraits<Hypercube<3>,3>";
305 }
306 }; // struct ShapeConvertTraits<Hypercube<3>,3>
307
308 /* ******************************************************************** */
309 /* ******************************************************************** */
310 /* ******************************************************************** */
311
317 template<>
318 struct ShapeConvertTraits<Shape::Simplex<1>, 0>
319 {
321 typedef Shape::Simplex<1> ShapeType;
323 typedef Shape::Vertex FaceType;
325 static constexpr int cell_dim = 1;
327 static constexpr int face_dim = 0;
328 // number of faces generated
329 static constexpr int count = 1;
330
332 static inline String name()
333 {
334 return "ShapeConvertTraits<Simplex<1>,0>";
335 }
336 }; // struct ShapeConvertTraits<Simplex<1>,0>
337
343 template<>
344 struct ShapeConvertTraits<Shape::Simplex<1>, 1>
345 {
347 typedef Shape::Simplex<1> ShapeType;
349 typedef Shape::Hypercube<1> FaceType;
351 static constexpr int cell_dim = 1;
353 static constexpr int face_dim = 1;
354 // number of faces generated
355 static constexpr int count = 2;
356
358 static inline String name()
359 {
360 return "ShapeConvertTraits<Simplex<1>,1>";
361 }
362 }; // struct ShapeConvertTraits<Simplex<1>,1>
363
369 template<>
370 struct ShapeConvertTraits<Shape::Simplex<2>, 0>
371 {
373 typedef Shape::Simplex<2> ShapeType;
375 typedef Shape::Vertex FaceType;
377 static constexpr int cell_dim = 2;
379 static constexpr int face_dim = 0;
380 // number of faces generated
381 static constexpr int count = 1;
382
384 static inline String name()
385 {
386 return "ShapeConvertTraits<Simplex<2>,0>";
387 }
388 }; // struct ShapeConvertTraits<Simplex<2>,0>
389
395 template<>
396 struct ShapeConvertTraits<Shape::Simplex<2>, 1>
397 {
399 typedef Shape::Simplex<2> ShapeType;
401 typedef Shape::Hypercube<1> FaceType;
403 static constexpr int cell_dim = 2;
405 static constexpr int face_dim = 1;
406 // number of faces generated
407 static constexpr int count = 3;
408
410 static inline String name()
411 {
412 return "ShapeConvertTraits<Simplex<2>,1>";
413 }
414 }; // struct ShapeConvertTraits<Simplex<2>,1>
415
421 template<>
422 struct ShapeConvertTraits<Shape::Simplex<2>, 2>
423 {
425 typedef Shape::Simplex<2> ShapeType;
427 typedef Shape::Hypercube<2> FaceType;
429 static constexpr int cell_dim = 2;
431 static constexpr int face_dim = 2;
432 // number of faces generated
433 static constexpr int count = 3;
434
436 static inline String name()
437 {
438 return "ShapeConvertTraits<Simplex<2>,2>";
439 }
440 }; // struct ShapeConvertTraits<Simplex<2>,2>
441
447 template<>
448 struct ShapeConvertTraits<Shape::Simplex<3>, 0>
449 {
451 typedef Shape::Simplex<3> ShapeType;
453 typedef Shape::Vertex FaceType;
455 static constexpr int cell_dim = 3;
457 static constexpr int face_dim = 0;
458 // number of faces generated
459 static constexpr int count = 1;
460
462 static inline String name()
463 {
464 return "ShapeConvertTraits<Simplex<3>,0>";
465 }
466 }; // struct ShapeConvertTraits<Simplex<3>,0>
467
473 template<>
474 struct ShapeConvertTraits<Shape::Simplex<3>, 1>
475 {
477 typedef Shape::Simplex<3> ShapeType;
479 typedef Shape::Hypercube<1> FaceType;
481 static constexpr int cell_dim = 3;
483 static constexpr int face_dim = 1;
484 // number of faces generated
485 static constexpr int count = 4;
486
488 static inline String name()
489 {
490 return "ShapeConvertTraits<Simplex<3>,1>";
491 }
492 }; // struct ShapeConvertTraits<Simplex<3>,1>
493
499 template<>
500 struct ShapeConvertTraits<Shape::Simplex<3>, 2>
501 {
503 typedef Shape::Simplex<3> ShapeType;
505 typedef Shape::Hypercube<2> FaceType;
507 static constexpr int cell_dim = 3;
509 static constexpr int face_dim = 2;
510 // number of faces generated
511 static constexpr int count = 6;
512
514 static inline String name()
515 {
516 return "ShapeConvertTraits<Simplex<3>,2>";
517 }
518 }; // struct ShapeConvertTraits<Simplex<3>,2>
519
525 template<>
526 struct ShapeConvertTraits<Shape::Simplex<3>, 3>
527 {
529 typedef Shape::Simplex<3> ShapeType;
531 typedef Shape::Hypercube<3> FaceType;
533 static constexpr int cell_dim = 3;
535 static constexpr int face_dim = 3;
536 // number of faces generated
537 static constexpr int count = 4;
538
540 static inline String name()
541 {
542 return "ShapeConvertTraits<Simplex<3>,3>";
543 }
544 }; // struct ShapeConvertTraits<Simplex<3>,3>
545
546 } // namespace Intern
548 } // namespace Geometry
549} // namespace FEAT
Type
bitmask for zfp header
Definition: pack.hpp:81
FEAT namespace.
Definition: adjactor.hpp:12
String stringify(const T_ &item)
Converts an item into a String.
Definition: string.hpp:944