8#include <kernel/geometry/raw_refinement_templates.hpp>
9#include <kernel/geometry/refinement_types.hpp>
10#include <kernel/shape.hpp>
12#include <unordered_map>
34 template<
typename Shape__>
64 template<
typename Shape_>
67 return std::is_same_v<Shape_, Shape::Quadrilateral> || std::is_same_v<Shape_, Shape::Hexahedron>;
80 template<
int template_dim_,
int child_dim_>
83 static_assert(template_dim_ <= 3);
84 static_assert(child_dim_ <= 3);
85 const constexpr std::array<std::array<int, 4>, 4> children = {{
91 return children[template_dim_][child_dim_];
102 if constexpr(dim_ == 1)
106 if constexpr(dim_ == 2)
110 if constexpr(dim_ == 3)
114 XABORTM(
"SchneidersData supplied no templates of dimension " +
stringify(dim_));
122 using V =
typename RawEdgeTemplate::VertexType;
134 RawEdgeTemplate().add_entity(V{0.0}, V{1.0 / 2.0}).add_entity(V{1.0 / 2.0}, V{1.0})});
138 RawEdgeTemplate().add_entity(V{0.0}, V{1.0 / 2.0}).add_entity(V{1.0 / 2.0}, V{1.0})});
144 .add_entity(V{0.0}, V{1.0 / 3.0})
145 .add_entity(V{1.0 / 3.0}, V{2.0 / 3.0})
146 .add_entity(V{2.0 / 3.0}, V{1.0})});
157 using V =
typename RawFaceTemplate::VertexType;
168 .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})
169 .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})
170 .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})});
188 .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})
189 .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})
190 .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})
191 .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})});
199 .add_entity(V{0.4, 0.4}, V{0.6, 0.4}, V{0.4, 0.6}, V{0.6, 0.6})
200 .add_entity(V{0.4, 0.6}, V{0.6, 0.6}, V{0.0, 1.0}, V{1.0, 1.0})
201 .add_entity(V{0.6, 0.6}, V{0.6, 0.4}, V{1.0, 1.0}, V{1.0, 0.0})
202 .add_entity(V{0.6, 0.4}, V{0.4, 0.4}, V{1.0, 0.0}, V{0.0, 0.0})
203 .add_entity(V{0.4, 0.4}, V{0.4, 0.6}, V{0.0, 0.0}, V{0.0, 1.0})
228 using V =
typename RawCellTemplate::VertexType;
243 V{0.0, 1.0 / 2.0, 0.0},
244 V{1.0 / 2.0, 1.0 / 2.0, 0.0},
247 V{0.0, 1.0 / 2.0, 1.0 / 2.0},
248 V{1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0})
250 V{1.0 / 2.0, 1.0 / 2.0, 0.0},
252 V{1.0 / 2.0, 1.0, 0.0},
254 V{1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0},
256 V{1.0 / 2.0, 1.0, 1.0 / 2.0},
259 V{0.0, 1.0 / 2.0, 1.0 / 2.0},
260 V{1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0},
261 V{0.0, 1.0, 1.0 / 2.0},
262 V{1.0 / 2.0, 1.0, 1.0 / 2.0},
267 .axis_aligned(V{0.0, 1.0 / 2.0, 0.0}, V{1.0 / 2.0, 1.0, 1.0 / 2.0})});
269 XASSERT(create_3dtemplate_rotations(result, isolated_base_type) == 8);
274 {non_isolated_point_base_type,
RawCellTemplate().axis_aligned(V{0.0, 0.0, 0.0}, V{1.0, 1.0, 1.0})});
276 XASSERT(create_3dtemplate_rotations(result, non_isolated_point_base_type) == 8);
281 {edge_refinement_base_type,
286 V{0.0, 1.0 / 3.0, 0.0},
287 V{1.0 / 2.0, 1.0 / 3.0, 0.0},
290 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
291 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.0})
293 V{1.0 / 2.0, 1.0 / 3.0, 0.0},
295 V{1.0 / 2.0, 2.0 / 3.0, 0.0},
297 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.0},
299 V{1.0 / 2.0, 2.0 / 3.0, 1.0 / 2.0},
302 V{0.0, 2.0 / 3.0, 0.0},
303 V{1.0 / 2.0, 2.0 / 3.0, 0.0},
306 V{0.0, 2.0 / 3.0, 1.0 / 2.0},
307 V{1.0 / 2.0, 2.0 / 3.0, 1.0 / 2.0},
311 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
312 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.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},
320 V{0.0, 1.0 / 3.0, 0.0},
321 V{1.0 / 2.0, 1.0 / 3.0, 0.0},
322 V{0.0, 2.0 / 3.0, 0.0},
323 V{1.0 / 2.0, 2.0 / 3.0, 0.0},
324 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
325 V{1.0 / 2.0, 1.0 / 3.0, 1.0 / 2.0},
326 V{0.0, 2.0 / 3.0, 1.0 / 2.0},
327 V{1.0 / 2.0, 2.0 / 3.0, 1.0 / 2.0})});
329 XASSERT(create_3dtemplate_rotations(result, edge_refinement_base_type) == 12);
334 {face_base_refinement,
338 V{1.0 / 3.0, 0.0, 0.0},
339 V{0.0, 1.0 / 3.0, 0.0},
340 V{1.0 / 3.0, 1.0 / 3.0, 0.0},
342 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
343 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
344 V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0})
346 V{1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/ 3.0, 1.0, 1.0 / 2.0})
427 V{0.0, 1.0 / 3.0, 1.0 / 2.0},
428 V{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
429 V{0.0, 2.0 / 3.0, 1.0 / 2.0},
430 V{1.0 / 3.0, 2.0 / 3.0, 1.0 / 3.0},
432 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
434 V{1.0 / 3.0, 1.0, 1.0 / 2.0})
436 V{2.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
437 V{1.0, 1.0 / 3.0, 1.0 / 2.0},
438 V{2.0 / 3.0, 2.0 / 3.0, 1.0 / 3.0},
439 V{1.0, 2.0 / 3.0, 1.0 / 2.0},
440 V{2.0 / 3.0, 0.0, 1.0 / 2.0},
442 V{2.0 / 3.0, 1.0, 1.0 / 2.0},
445 V{1.0 / 3.0, 0.0, 1.0 / 2.0},
446 V{2.0 / 3.0, 0.0, 1.0 / 2.0},
447 V{1.0 / 3.0, 1.0, 1.0 / 2.0},
448 V{2.0 / 3.0, 1.0, 1.0 / 2.0},
454 XASSERT(create_3dtemplate_rotations(result, face_base_refinement) == 6);
459 {two_edge_base_refinement,
463 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
465 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
467 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
469 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0})
471 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
472 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
475 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
476 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
480 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
482 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
484 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
486 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
491 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
492 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
495 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
496 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0})
498 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
499 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
500 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
501 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
507 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
508 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
509 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
510 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
511 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
512 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 3.0},
513 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0},
514 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 3.0})
520 XASSERT(create_3dtemplate_rotations(result, two_edge_base_refinement) == 24);
525 {two_face_base_refinement,
529 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
531 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
533 V{2.0 / 5.0, 2.0 / 5.0, 1.0},
535 V{2.0 / 5.0, 3.0 / 5.0, 1.0})
537 V{2.0 / 5.0, 3.0 / 5.0, 0.0},
538 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
541 V{2.0 / 5.0, 3.0 / 5.0, 1.0},
542 V{3.0 / 5.0, 3.0 / 5.0, 1.0},
546 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
548 V{3.0 / 5.0, 3.0 / 5.0, 0.0},
550 V{3.0 / 5.0, 2.0 / 5.0, 1.0},
552 V{3.0 / 5.0, 3.0 / 5.0, 1.0},
557 V{2.0 / 5.0, 2.0 / 5.0, 0.0},
558 V{3.0 / 5.0, 2.0 / 5.0, 0.0},
561 V{2.0 / 5.0, 2.0 / 5.0, 1.0},
562 V{3.0 / 5.0, 2.0 / 5.0, 1.0})
563 .axis_aligned(V{2.0 / 5.0, 2.0 / 5.0, 0.0}, V{3.0 / 5.0, 3.0 / 5.0, 1.0})
569 XASSERT(create_3dtemplate_rotations(result, two_face_base_refinement) == 12);
572 {three_face_base_refinement,
576 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 5.0},
578 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 5.0},
580 V{2.0 / 5.0, 2.0 / 5.0, 3.0 / 5.0},
582 V{2.0 / 5.0, 3.0 / 5.0, 3.0 / 5.0})
584 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 5.0},
585 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 5.0},
588 V{2.0 / 5.0, 3.0 / 5.0, 3.0 / 5.0},
589 V{3.0 / 5.0, 3.0 / 5.0, 3.0 / 5.0},
593 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 5.0},
595 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 5.0},
597 V{3.0 / 5.0, 2.0 / 5.0, 3.0 / 5.0},
599 V{3.0 / 5.0, 3.0 / 5.0, 3.0 / 5.0},
604 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 5.0},
605 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 5.0},
608 V{2.0 / 5.0, 2.0 / 5.0, 3.0 / 5.0},
609 V{3.0 / 5.0, 2.0 / 5.0, 3.0 / 5.0})
615 V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 5.0},
616 V{3.0 / 5.0, 2.0 / 5.0, 2.0 / 5.0},
617 V{2.0 / 5.0, 3.0 / 5.0, 2.0 / 5.0},
618 V{3.0 / 5.0, 3.0 / 5.0, 2.0 / 5.0})
620 V{2.0 / 5.0, 2.0 / 5.0, 3.0 / 5.0},
621 V{3.0 / 5.0, 2.0 / 5.0, 3.0 / 5.0},
622 V{2.0 / 5.0, 3.0 / 5.0, 3.0 / 5.0},
623 V{3.0 / 5.0, 3.0 / 5.0, 3.0 / 5.0},
628 .axis_aligned(V{2.0 / 5.0, 2.0 / 5.0, 2.0 / 5.0}, V{3.0 / 5.0, 3.0 / 5.0, 3.0 / 5.0})
636 XASSERT(create_3dtemplate_rotations(result, three_face_base_refinement) == 8);
640 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 EdgeMap & raw_edges()
Returns the raw templates for edges of this template set.
std::unordered_map< RefinementTypeByDim< dim_ >, RawTemplate< Shape::Hypercube< dim_ > > > TemplateMapByDim
Type of map from refinement type to raw templates.
RawTemplate< Shape::Hypercube< 2 > > RawFaceTemplate
Raw face template type.
TemplateMapByDim< 1 > EdgeMap
Type of map from edge refinement types to raw templates.
static TemplateMapByDim< dim_ > & raw_templates()
Accessor for raw template maps.
static constexpr bool is_shape_compatible()
Shape compatability test.
RawTemplate< Shape::Hypercube< 1 > > RawEdgeTemplate
Raw edge template type.
TemplateMapByDim< 3 > CellMap
Type of map from cell refinement types to raw templates.
static CellMap & raw_cells()
Returns the raw templates for cells of this template set.
static FaceMap & raw_faces()
Returns the raw templates for faces of this template set.
TemplateMapByDim< 2 > FaceMap
Type of map from face refinement types to raw templates.
static constexpr int max_children()
Constexpr function for retrieving maximum number of children for any template of this template set.
RawTemplate< Shape::Hypercube< 3 > > RawCellTemplate
Raw cell template type.
String stringify(const T_ &item)
Converts an item into a String.
Hypercube shape tag struct template.