8#include <kernel/geometry/raw_refinement_templates.hpp>
9#include <kernel/geometry/refinement_types.hpp>
10#include <kernel/shape.hpp>
13#include <unordered_map>
35 template<
typename Shape__>
65 template<
typename Shape_>
68 return std::is_same_v<Shape_, Shape::Quadrilateral> || std::is_same_v<Shape_, Shape::Hexahedron>;
81 template<
int template_dim_,
int child_dim_>
84 static_assert(template_dim_ <= 3);
85 static_assert(child_dim_ <= 3);
86 const constexpr std::array<std::array<int, 4>, 4> children = {{
92 return children[template_dim_][child_dim_];
103 if constexpr(dim_ == 1)
107 if constexpr(dim_ == 2)
111 if constexpr(dim_ == 3)
115 XABORTM(
"SchneidersData supplied no templates of dimension " +
stringify(dim_));
123 using V =
typename RawEdgeTemplate::VertexType;
135 RawEdgeTemplate().add_entity(V{0.0}, V{1.0 / 2.0}).add_entity(V{1.0 / 2.0}, V{1.0})});
139 RawEdgeTemplate().add_entity(V{0.0}, V{1.0 / 2.0}).add_entity(V{1.0 / 2.0}, V{1.0})});
145 .add_entity(V{0.0}, V{1.0 / 3.0})
146 .add_entity(V{1.0 / 3.0}, V{2.0 / 3.0})
147 .add_entity(V{2.0 / 3.0}, V{1.0})});
158 using V =
typename RawFaceTemplate::VertexType;
169 .add_entity(V{0.0, 0.0}, V{1.0 / 2.0, 0.0}, V{0.0, 1.0 / 2.0}, V{1.0 / 2.0, 1.0 / 2.0})
170 .add_entity(V{1.0 / 2.0, 0.0}, V{1.0, 0.0}, V{1.0 / 2.0, 1.0 / 2.0}, V{1.0, 1.0})
171 .add_entity(V{0.0, 1.0 / 2.0}, V{1.0 / 2.0, 1.0 / 2.0}, V{0.0, 1.0}, V{1.0, 1.0})});
178 RawFaceTemplate().add_entity(V{0.0, 0.0}, V{1.0, 0.0}, V{0.0, 1.0}, V{1.0, 1.0})});
181 RawFaceTemplate().add_entity(V{0.0, 0.0}, V{1.0, 0.0}, V{0.0, 1.0}, V{1.0, 1.0})});
184 RawFaceTemplate().add_entity(V{0.0, 0.0}, V{1.0, 0.0}, V{0.0, 1.0}, V{1.0, 1.0})});
187 RawFaceTemplate().add_entity(V{0.0, 0.0}, V{1.0, 0.0}, V{0.0, 1.0}, V{1.0, 1.0})});
193 .add_entity(V{0.0, 0.0}, V{1.0 / 3.0, 0.0}, V{0.0, 1.0}, V{1.0 / 3.0, 1.0 / 2.0})
194 .add_entity(V{1.0 / 3.0, 0.0}, V{2.0 / 3.0, 0.0}, V{1.0 / 3.0, 1.0 / 2.0}, V{2.0 / 3.0, 1.0 / 2.0})
195 .add_entity(V{2.0 / 3.0, 0.0}, V{1.0, 0.0}, V{2.0 / 3.0, 1.0 / 2.0}, V{1.0, 1.0})
196 .add_entity(V{1.0 / 3.0, 1.0 / 2.0}, V{2.0 / 3.0, 1.0 / 2.0}, V{0.0, 1.0}, V{1.0, 1.0})});
204 .add_entity(V{0.4, 0.4}, V{0.6, 0.4}, V{0.4, 0.6}, V{0.6, 0.6})
205 .add_entity(V{0.4, 0.6}, V{0.6, 0.6}, V{0.0, 1.0}, V{1.0, 1.0})
206 .add_entity(V{0.6, 0.6}, V{0.6, 0.4}, V{1.0, 1.0}, V{1.0, 0.0})
207 .add_entity(V{0.6, 0.4}, V{0.4, 0.4}, V{1.0, 0.0}, V{0.0, 0.0})
208 .add_entity(V{0.4, 0.4}, V{0.4, 0.6}, V{0.0, 0.0}, V{0.0, 1.0})
218 RawFaceTemplate().add_entity(V{0.0, 0.0}, V{1.0, 0.0}, V{0.0, 1.0}, V{1.0, 1.0})});
221 RawFaceTemplate().add_entity(V{0.0, 0.0}, V{1.0, 0.0}, V{0.0, 1.0}, V{1.0, 1.0})});
235 using V =
typename RawCellTemplate::VertexType;
250 V{0.0, 1.0 / 2.0, 0.0},
251 V{1.0 / 2.0, 1.0 / 2.0, 0.0},
254 V{0.0, 1.0 / 2.0, 1.0 / 2.0},
255 V{1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0})
257 V{1.0 / 2.0, 1.0 / 2.0, 0.0},
259 V{1.0 / 2.0, 1.0, 0.0},
261 V{1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0},
263 V{1.0 / 2.0, 1.0, 1.0 / 2.0},
266 V{0.0, 1.0 / 2.0, 1.0 / 2.0},
267 V{1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0},
268 V{0.0, 1.0, 1.0 / 2.0},
269 V{1.0 / 2.0, 1.0, 1.0 / 2.0},
274 .axis_aligned(V{0.0, 1.0 / 2.0, 0.0}, V{1.0 / 2.0, 1.0, 1.0 / 2.0})});
276 XASSERT(create_3dtemplate_rotations(result, isolated_base_type) == 8);
281 {non_isolated_point_base_type,
RawCellTemplate().axis_aligned(V{0.0, 0.0, 0.0}, V{1.0, 1.0, 1.0})});
283 XASSERT(create_3dtemplate_rotations(result, non_isolated_point_base_type) == 8);
288 {edge_refinement_base_type,
293 V{0.0, 1.0 / 3.0, 0.0},
294 V{1.0 / 2.0, 1.0 / 3.0, 0.0},
297 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
298 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.0})
300 V{1.0 / 2.0, 1.0 / 3.0, 0.0},
302 V{1.0 / 2.0, 2.0 / 3.0, 0.0},
304 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.0},
306 V{1.0 / 2.0, 2.0 / 3.0, 1.0 / 2.0},
309 V{0.0, 2.0 / 3.0, 0.0},
310 V{1.0 / 2.0, 2.0 / 3.0, 0.0},
313 V{0.0, 2.0 / 3.0, 1.0 / 2.0},
314 V{1.0 / 2.0, 2.0 / 3.0, 1.0 / 2.0},
318 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
319 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.0},
320 V{0.0, 2.0 / 3.0, 1.0 / 2.0},
321 V{1.0 / 2.0, 2.0 / 3.0, 1.0 / 2.0},
327 V{0.0, 1.0 / 3.0, 0.0},
328 V{1.0 / 2.0, 1.0 / 3.0, 0.0},
329 V{0.0, 2.0 / 3.0, 0.0},
330 V{1.0 / 2.0, 2.0 / 3.0, 0.0},
331 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
332 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.0},
333 V{0.0, 2.0 / 3.0, 1.0 / 2.0},
334 V{1.0 / 2.0, 2.0 / 3.0, 1.0 / 2.0})});
336 XASSERT(create_3dtemplate_rotations(result, edge_refinement_base_type) == 12);
341 {face_base_refinement,
345 V{1.0 / 3.0, 0.0, 0.0},
346 V{0.0, 1.0 / 3.0, 0.0},
347 V{1.0 / 3.0, 1.0 / 3.0, 0.0},
349 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
350 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
351 V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0})
353 V{1.0 / 3.0, 0.0, 0.0},
354 V{2.0 / 3.0, 0.0, 0.0},
355 V{1.0 / 3.0, 1.0 / 3.0, 0.0},
356 V{2.0 / 3.0, 1.0 / 3.0, 0.0},
357 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
358 V{2.0 / 3.0, 0.0, 1.0 / 2.0},
359 V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
360 V{2.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0})
362 V{2.0 / 3.0, 0.0, 0.0},
364 V{2.0 / 3.0, 1.0 / 3.0, 0.0},
365 V{1.0, 1.0 / 3.0, 0.0},
366 V{2.0 / 3.0, 0.0, 1.0 / 2.0},
368 V{2.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
369 V{1.0, 1.0 / 3.0, 1.0 / 2.0})
371 V{0.0, 1.0 / 3.0, 0.0},
372 V{1.0 / 3.0, 1.0 / 3.0, 0.0},
373 V{0.0, 2.0 / 3.0, 0.0},
374 V{1.0 / 3.0, 2.0 / 3.0, 0.0},
375 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
376 V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
377 V{0.0, 2.0 / 3.0, 1.0 /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V{1.0, 2.0 / 3.0, 0.0},
418 V{2.0 / 3.0, 1.0, 0.0},
420 V{2.0 / 3.0, 2.0 / 3.0, 1.0 / 3.0},
421 V{1.0, 2.0 / 3.0, 1.0 / 2.0},
422 V{2.0 / 3.0, 1.0, 1.0 / 2.0},
425 V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
426 V{2.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
427 V{1.0 / 3.0, 2.0 / 3.0, 1.0 / 3.0},
428 V{2.0 / 3.0, 2.0 / 3.0, 1.0 / 3.0},
429 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
430 V{2.0 / 3.0, 0.0, 1.0 / 2.0},
431 V{1.0 / 3.0, 1.0, 1.0 / 2.0},
432 V{2.0 / 3.0, 1.0, 1.0 / 2.0})
434 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
435 V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
436 V{0.0, 2.0 / 3.0, 1.0 / 2.0},
437 V{1.0 / 3.0, 2.0 / 3.0, 1.0 / 3.0},
439 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
441 V{1.0 / 3.0, 1.0, 1.0 / 2.0})
443 V{2.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
444 V{1.0, 1.0 / 3.0, 1.0 / 2.0},
445 V{2.0 / 3.0, 2.0 / 3.0, 1.0 / 3.0},
446 V{1.0, 2.0 / 3.0, 1.0 / 2.0},
447 V{2.0 / 3.0, 0.0, 1.0 / 2.0},
449 V{2.0 / 3.0, 1.0, 1.0 / 2.0},
452 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
453 V{2.0 / 3.0, 0.0, 1.0 / 2.0},
454 V{1.0 / 3.0, 1.0, 1.0 / 2.0},
455 V{2.0 / 3.0, 1.0, 1.0 / 2.0},
461 XASSERT(create_3dtemplate_rotations(result, face_base_refinement) == 6);
466 {two_edge_base_refinement,
470 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
472 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
474 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
476 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0})
478 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
479 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
482 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
483 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
487 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
489 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
491 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
493 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
498 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
499 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
502 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
503 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0})
505 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
506 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
507 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
508 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
514 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
515 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
516 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
517 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
518 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
519 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
520 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
521 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0})
527 XASSERT(create_3dtemplate_rotations(result, two_edge_base_refinement) == 24);
532 {two_face_base_refinement,
536 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
538 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
540 V{2.0 / 5.0, 2.0 / 5.0, 1.0},
542 V{2.0 / 5.0, 3.0 / 5.0, 1.0})
544 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
545 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
548 V{2.0 / 5.0, 3.0 / 5.0, 1.0},
549 V{3.0 / 5.0, 3.0 / 5.0, 1.0},
553 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
555 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
557 V{3.0 / 5.0, 2.0 / 5.0, 1.0},
559 V{3.0 / 5.0, 3.0 / 5.0, 1.0},
564 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
565 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
568 V{2.0 / 5.0, 2.0 / 5.0, 1.0},
569 V{3.0 / 5.0, 2.0 / 5.0, 1.0})
570 .axis_aligned(V{2.0 / 5.0, 2.0 / 5.0, 0.0}, V{3.0 / 5.0, 3.0 / 5.0, 1.0})
576 XASSERT(create_3dtemplate_rotations(result, two_face_base_refinement) == 12);
581 RawCellTemplate().grid({3, 3, 3}, V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0})});
#define XABORTM(msg)
Abortion macro definition with custom message.
#define XASSERT(expr)
Assertion macro definition.
static FaceMap & raw_faces()
Returns the raw templates for faces of this template set.
static constexpr bool is_shape_compatible()
Shape compatability test.
static constexpr int max_children()
Constexpr function for retrieving maximum number of children for any template of this template set.
static CellMap & raw_cells()
Returns the raw templates for cells of this template set.
TemplateMapByDim< 1 > EdgeMap
Type of map from edge refinement types to raw templates.
RawTemplate< Shape::Hypercube< 1 > > RawEdgeTemplate
Raw edge template type.
TemplateMapByDim< 3 > CellMap
Type of map from cell refinement types to raw templates.
TemplateMapByDim< 2 > FaceMap
Type of map from face refinement types to raw templates.
static TemplateMapByDim< dim_ > & raw_templates()
Accessor for raw template maps.
RawTemplate< Shape::Hypercube< 2 > > RawFaceTemplate
Raw face template type.
RawTemplate< Shape::Hypercube< 3 > > RawCellTemplate
Raw cell template type.
std::unordered_map< RefinementTypeByDim< dim_ >, RawTemplate< Shape::Hypercube< dim_ > > > TemplateMapByDim
Type of map from refinement type to raw templates.
static EdgeMap & raw_edges()
Returns the raw templates for edges of this template set.
String stringify(const T_ &item)
Converts an item into a String.
Hypercube shape tag struct template.