9#include <kernel/geometry/index_set.hpp>
10#include <kernel/geometry/intern/shape_convert_traits.hpp>
11#include <kernel/geometry/intern/entity_counter.hpp>
23 struct ShapeConvertIndex;
37 struct ShapeConvertIndex<Shape::Simplex<1>, 1>
39 static constexpr int shape_dim = 1;
40 static constexpr int cell_dim = 1;
41 typedef Shape::Simplex<shape_dim> ShapeType;
42 typedef Shape::Hypercube<shape_dim> OtherShapeType;
43 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
44 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
45 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
48 IndexSetType& index_set_out,
50 const Index index_offsets[],
51 const IndexSetHolderType& index_set_holder_in)
54 const Index iov = index_offsets[0];
57 typedef IndexSetType::IndexTupleType IndexTupleType;
60 typedef IndexSet<2> IndexSetTypeIn;
63 typedef IndexSetTypeIn::IndexTupleType IndexTupleTypeIn;
66 const IndexSetTypeIn& index_set_in = index_set_holder_in.get_index_set<1,0>();
69 const Index num_edges = index_set_in.get_num_entities();
72 FEAT_PRAGMA_OMP(parallel
for)
73 for(Index i = 0; i < num_edges; ++i)
76 const IndexTupleTypeIn& v_e = index_set_in[i];
79 IndexTupleType& e_0 = index_set_out[offset + i];
81 e_0[0] = iov + v_e[0];
82 e_0[1] = iov + v_e[1];
96 struct ShapeConvertIndex<Shape::Simplex<2>, 1>
98 static constexpr int shape_dim = 2;
99 static constexpr int cell_dim = 1;
100 typedef Shape::Simplex<shape_dim> ShapeType;
101 typedef Shape::Hypercube<shape_dim> OtherShapeType;
102 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
103 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
104 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
107 IndexSetType& index_set_out,
109 const Index index_offsets[],
110 const IndexSetHolderType& index_set_holder_in)
113 const Index iov = index_offsets[0];
114 const Index ioq = index_offsets[2];
117 typedef IndexSetType::IndexTupleType IndexTupleType;
120 typedef IndexSet<4> IndexSetTypeIn;
123 typedef IndexSetTypeIn::IndexTupleType IndexTupleTypeIn;
126 const IndexSetTypeIn& index_set_in = index_set_holder_in.get_index_set<2,0>();
129 const Index num_quads = index_set_in.get_num_entities();
151 FEAT_PRAGMA_OMP(parallel
for)
152 for(Index i = 0; i < num_quads; ++i)
155 const IndexTupleTypeIn& v_q = index_set_in[i];
158 IndexTupleType& e_0 = index_set_out[offset + 4*i + 0];
159 IndexTupleType& e_1 = index_set_out[offset + 4*i + 1];
160 IndexTupleType& e_2 = index_set_out[offset + 4*i + 2];
161 IndexTupleType& e_3 = index_set_out[offset + 4*i + 3];
163 e_0[0] = iov + v_q[0];
166 e_1[0] = iov + v_q[1];
169 e_2[0] = iov + v_q[2];
172 e_3[0] = iov + v_q[3];
187 struct ShapeConvertIndex<Shape::Simplex<3>, 1>
189 static constexpr int shape_dim = 3;
190 static constexpr int cell_dim = 1;
191 typedef Shape::Simplex<shape_dim> ShapeType;
192 typedef Shape::Hypercube<shape_dim> OtherShapeType;
193 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
194 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
195 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
198 IndexSetType& index_set_out,
200 const Index index_offsets[],
201 const IndexSetHolderType& index_set_holder_in)
204 const Index iov = index_offsets[0];
205 const Index ioq = index_offsets[2];
206 const Index ioc = index_offsets[3];
209 typedef IndexSetType::IndexTupleType IndexTupleType;
212 typedef IndexSet<8> IndexSetTypeIn_v_c;
213 typedef IndexSet<6> IndexSetTypeIn_q_c;
216 typedef IndexSetTypeIn_v_c::IndexTupleType IndexTupleType_v_c;
217 typedef IndexSetTypeIn_q_c::IndexTupleType IndexTupleType_q_c;
220 const IndexSetTypeIn_v_c& index_set_in_v_c = index_set_holder_in.get_index_set<3,0>();
221 const IndexSetTypeIn_q_c& index_set_in_q_c = index_set_holder_in.get_index_set<3,2>();
224 const Index num_hexas = index_set_in_v_c.get_num_entities();
227 FEAT_PRAGMA_OMP(parallel
for)
228 for(Index i = 0; i < num_hexas; ++i)
231 const IndexTupleType_v_c& v_c = index_set_in_v_c[i];
232 const IndexTupleType_q_c& q_c = index_set_in_q_c[i];
235 IndexTupleType& e_0 = index_set_out[offset + 14*i + 0];
236 IndexTupleType& e_1 = index_set_out[offset + 14*i + 1];
237 IndexTupleType& e_2 = index_set_out[offset + 14*i + 2];
238 IndexTupleType& e_3 = index_set_out[offset + 14*i + 3];
239 IndexTupleType& e_4 = index_set_out[offset + 14*i + 4];
240 IndexTupleType& e_5 = index_set_out[offset + 14*i + 5];
241 IndexTupleType& e_6 = index_set_out[offset + 14*i + 6];
242 IndexTupleType& e_7 = index_set_out[offset + 14*i + 7];
243 IndexTupleType& e_8 = index_set_out[offset + 14*i + 8];
244 IndexTupleType& e_9 = index_set_out[offset + 14*i + 9];
245 IndexTupleType& e_10 = index_set_out[offset + 14*i + 10];
246 IndexTupleType& e_11 = index_set_out[offset + 14*i + 11];
247 IndexTupleType& e_12 = index_set_out[offset + 14*i + 12];
248 IndexTupleType& e_13 = index_set_out[offset + 14*i + 13];
251 e_0[0] = iov + v_c[0];
254 e_1[0] = iov + v_c[1];
257 e_2[0] = iov + v_c[2];
260 e_3[0] = iov + v_c[3];
263 e_4[0] = iov + v_c[4];
266 e_5[0] = iov + v_c[5];
269 e_6[0] = iov + v_c[6];
272 e_7[0] = iov + v_c[7];
277 e_8[0] = ioq + q_c[0];
280 e_9[0] = ioq + q_c[1];
283 e_10[0] = ioq + q_c[2];
286 e_11[0] = ioq + q_c[3];
289 e_12[0] = ioq + q_c[4];
292 e_13[0] = ioq + q_c[5];
308 struct ShapeConvertIndex<Shape::Simplex<2>, 2>
310 static constexpr int shape_dim = 2;
311 static constexpr int cell_dim = 2;
312 typedef Shape::Simplex<shape_dim> ShapeType;
313 typedef Shape::Hypercube<shape_dim> OtherShapeType;
314 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
315 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
316 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
319 IndexSetType& index_set_out,
321 const Index index_offsets[],
322 const IndexSetHolderType& index_set_holder_in)
325 const Index iov = index_offsets[0];
326 const Index ioq = index_offsets[2];
329 typedef IndexSetType::IndexTupleType IndexTupleType;
332 typedef IndexSet<4> IndexSetTypeIn;
335 typedef IndexSetTypeIn::IndexTupleType IndexTupleTypeIn;
338 const IndexSetTypeIn& index_set_in = index_set_holder_in.get_index_set<2,0>();
341 const Index num_quads = index_set_in.get_num_entities();
363 FEAT_PRAGMA_OMP(parallel
for)
364 for(Index i = 0; i < num_quads; ++i)
367 const IndexTupleTypeIn& v_q = index_set_in[i];
370 IndexTupleType& t_0 = index_set_out[offset + 4*i + 0];
371 IndexTupleType& t_1 = index_set_out[offset + 4*i + 1];
372 IndexTupleType& t_2 = index_set_out[offset + 4*i + 2];
373 IndexTupleType& t_3 = index_set_out[offset + 4*i + 3];
376 t_0[1] = iov + v_q[0];
377 t_0[2] = iov + v_q[1];
380 t_1[1] = iov + v_q[3];
381 t_1[2] = iov + v_q[2];
384 t_2[1] = iov + v_q[2];
385 t_2[2] = iov + v_q[0];
388 t_3[1] = iov + v_q[1];
389 t_3[2] = iov + v_q[3];
404 struct ShapeConvertIndex<Shape::Simplex<3>, 2>
406 static constexpr int shape_dim = 3;
407 static constexpr int cell_dim = 2;
408 typedef Shape::Simplex<shape_dim> ShapeType;
409 typedef Shape::Hypercube<shape_dim> OtherShapeType;
410 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
411 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
412 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
415 IndexSetType& index_set_out,
417 const Index index_offsets[],
418 const IndexSetHolderType& index_set_holder_in)
421 const Index iov = index_offsets[0];
422 const Index ioq = index_offsets[2];
423 const Index ioc = index_offsets[3];
426 typedef IndexSetType::IndexTupleType IndexTupleType;
429 typedef IndexSet<8> IndexSetTypeIn_v_c;
430 typedef IndexSet<6> IndexSetTypeIn_q_c;
433 typedef IndexSetTypeIn_v_c::IndexTupleType IndexTupleType_v_c;
434 typedef IndexSetTypeIn_q_c::IndexTupleType IndexTupleType_q_c;
437 const IndexSetTypeIn_v_c& index_set_in_v_c = index_set_holder_in.get_index_set<3,0>();
438 const IndexSetTypeIn_q_c& index_set_in_q_c = index_set_holder_in.get_index_set<3,2>();
441 const Index num_cubes = index_set_in_v_c.get_num_entities();
444 FEAT_PRAGMA_OMP(parallel
for)
445 for(Index i = 0; i < num_cubes; ++i)
448 const IndexTupleType_v_c& v_c = index_set_in_v_c[i];
449 const IndexTupleType_q_c& q_c = index_set_in_q_c[i];
452 IndexTupleType& t_0 = index_set_out[offset + 36*i + 0];
453 IndexTupleType& t_1 = index_set_out[offset + 36*i + 1];
454 IndexTupleType& t_2 = index_set_out[offset + 36*i + 2];
455 IndexTupleType& t_3 = index_set_out[offset + 36*i + 3];
456 IndexTupleType& t_4 = index_set_out[offset + 36*i + 4];
457 IndexTupleType& t_5 = index_set_out[offset + 36*i + 5];
458 IndexTupleType& t_6 = index_set_out[offset + 36*i + 6];
459 IndexTupleType& t_7 = index_set_out[offset + 36*i + 7];
460 IndexTupleType& t_8 = index_set_out[offset + 36*i + 8];
461 IndexTupleType& t_9 = index_set_out[offset + 36*i + 9];
462 IndexTupleType& t_10 = index_set_out[offset + 36*i + 10];
463 IndexTupleType& t_11 = index_set_out[offset + 36*i + 11];
464 IndexTupleType& t_12 = index_set_out[offset + 36*i + 12];
465 IndexTupleType& t_13 = index_set_out[offset + 36*i + 13];
466 IndexTupleType& t_14 = index_set_out[offset + 36*i + 14];
467 IndexTupleType& t_15 = index_set_out[offset + 36*i + 15];
468 IndexTupleType& t_16 = index_set_out[offset + 36*i + 16];
469 IndexTupleType& t_17 = index_set_out[offset + 36*i + 17];
470 IndexTupleType& t_18 = index_set_out[offset + 36*i + 18];
471 IndexTupleType& t_19 = index_set_out[offset + 36*i + 19];
472 IndexTupleType& t_20 = index_set_out[offset + 36*i + 20];
473 IndexTupleType& t_21 = index_set_out[offset + 36*i + 21];
474 IndexTupleType& t_22 = index_set_out[offset + 36*i + 22];
475 IndexTupleType& t_23 = index_set_out[offset + 36*i + 23];
476 IndexTupleType& t_24 = index_set_out[offset + 36*i + 24];
477 IndexTupleType& t_25 = index_set_out[offset + 36*i + 25];
478 IndexTupleType& t_26 = index_set_out[offset + 36*i + 26];
479 IndexTupleType& t_27 = index_set_out[offset + 36*i + 27];
480 IndexTupleType& t_28 = index_set_out[offset + 36*i + 28];
481 IndexTupleType& t_29 = index_set_out[offset + 36*i + 29];
482 IndexTupleType& t_30 = index_set_out[offset + 36*i + 30];
483 IndexTupleType& t_31 = index_set_out[offset + 36*i + 31];
484 IndexTupleType& t_32 = index_set_out[offset + 36*i + 32];
485 IndexTupleType& t_33 = index_set_out[offset + 36*i + 33];
486 IndexTupleType& t_34 = index_set_out[offset + 36*i + 34];
487 IndexTupleType& t_35 = index_set_out[offset + 36*i + 35];
491 t_0[1] = iov + v_c[0];
492 t_0[2] = iov + v_c[1];
495 t_1[1] = iov + v_c[3];
496 t_1[2] = iov + v_c[2];
499 t_2[1] = iov + v_c[4];
500 t_2[2] = iov + v_c[5];
503 t_3[1] = iov + v_c[7];
504 t_3[2] = iov + v_c[6];
507 t_4[1] = iov + v_c[2];
508 t_4[2] = iov + v_c[0];
511 t_5[1] = iov + v_c[1];
512 t_5[2] = iov + v_c[3];
515 t_6[1] = iov + v_c[6];
516 t_6[2] = iov + v_c[4];
519 t_7[1] = iov + v_c[5];
520 t_7[2] = iov + v_c[7];
523 t_8[1] = iov + v_c[4];
524 t_8[2] = iov + v_c[0];
527 t_9[1] = iov + v_c[1];
528 t_9[2] = iov + v_c[5];
531 t_10[1] = iov + v_c[6];
532 t_10[2] = iov + v_c[2];
535 t_11[1] = iov + v_c[3];
536 t_11[2] = iov + v_c[7];
541 t_12[1] = ioq + q_c[0];
542 t_12[2] = iov + v_c[0];
545 t_13[1] = ioq + q_c[0];
546 t_13[2] = iov + v_c[1];
549 t_14[1] = ioq + q_c[0];
550 t_14[2] = iov + v_c[2];
553 t_15[1] = ioq + q_c[0];
554 t_15[2] = iov + v_c[3];
558 t_16[1] = ioq + q_c[1];
559 t_16[2] = iov + v_c[4];
562 t_17[1] = ioq + q_c[1];
563 t_17[2] = iov + v_c[5];
566 t_18[1] = ioq + q_c[1];
567 t_18[2] = iov + v_c[6];
570 t_19[1] = ioq + q_c[1];
571 t_19[2] = iov + v_c[7];
575 t_20[1] = ioq + q_c[2];
576 t_20[2] = iov + v_c[0];
579 t_21[1] = ioq + q_c[2];
580 t_21[2] = iov + v_c[1];
583 t_22[1] = ioq + q_c[2];
584 t_22[2] = iov + v_c[4];
587 t_23[1] = ioq + q_c[2];
588 t_23[2] = iov + v_c[5];
592 t_24[1] = ioq + q_c[3];
593 t_24[2] = iov + v_c[2];
596 t_25[1] = ioq + q_c[3];
597 t_25[2] = iov + v_c[3];
600 t_26[1] = ioq + q_c[3];
601 t_26[2] = iov + v_c[6];
604 t_27[1] = ioq + q_c[3];
605 t_27[2] = iov + v_c[7];
609 t_28[1] = ioq + q_c[4];
610 t_28[2] = iov + v_c[0];
613 t_29[1] = ioq + q_c[4];
614 t_29[2] = iov + v_c[2];
617 t_30[1] = ioq + q_c[4];
618 t_30[2] = iov + v_c[4];
621 t_31[1] = ioq + q_c[4];
622 t_31[2] = iov + v_c[6];
626 t_32[1] = ioq + q_c[5];
627 t_32[2] = iov + v_c[1];
630 t_33[1] = ioq + q_c[5];
631 t_33[2] = iov + v_c[3];
634 t_34[1] = ioq + q_c[5];
635 t_34[2] = iov + v_c[5];
638 t_35[1] = ioq + q_c[5];
639 t_35[2] = iov + v_c[7];
656 struct ShapeConvertIndex<Shape::Simplex<3>, 3>
658 static constexpr int shape_dim = 3;
659 static constexpr int cell_dim = 3;
660 typedef Shape::Simplex<shape_dim> ShapeType;
661 typedef Shape::Hypercube<shape_dim> OtherShapeType;
662 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
663 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
664 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
667 IndexSetType& index_set_out,
669 const Index index_offsets[],
670 const IndexSetHolderType& index_set_holder_in)
673 const Index iov = index_offsets[0];
674 const Index ioq = index_offsets[2];
675 const Index ioc = index_offsets[3];
678 typedef IndexSetType::IndexTupleType IndexTupleType;
681 typedef IndexSet<8> IndexSetTypeIn_v_c;
682 typedef IndexSet<6> IndexSetTypeIn_q_c;
685 typedef IndexSetTypeIn_v_c::IndexTupleType IndexTupleType_v_c;
686 typedef IndexSetTypeIn_q_c::IndexTupleType IndexTupleType_q_c;
689 const IndexSetTypeIn_v_c& index_set_in_v_c = index_set_holder_in.get_index_set<3,0>();
690 const IndexSetTypeIn_q_c& index_set_in_q_c = index_set_holder_in.get_index_set<3,2>();
693 const Index num_cubes = index_set_in_v_c.get_num_entities();
696 FEAT_PRAGMA_OMP(parallel
for)
697 for(Index i = 0; i < num_cubes; ++i)
700 const IndexTupleType_v_c& v_c = index_set_in_v_c[i];
701 const IndexTupleType_q_c& q_c = index_set_in_q_c[i];
704 IndexTupleType& t_0 = index_set_out[offset + 24*i + 0];
705 IndexTupleType& t_1 = index_set_out[offset + 24*i + 1];
706 IndexTupleType& t_2 = index_set_out[offset + 24*i + 2];
707 IndexTupleType& t_3 = index_set_out[offset + 24*i + 3];
708 IndexTupleType& t_4 = index_set_out[offset + 24*i + 4];
709 IndexTupleType& t_5 = index_set_out[offset + 24*i + 5];
710 IndexTupleType& t_6 = index_set_out[offset + 24*i + 6];
711 IndexTupleType& t_7 = index_set_out[offset + 24*i + 7];
712 IndexTupleType& t_8 = index_set_out[offset + 24*i + 8];
713 IndexTupleType& t_9 = index_set_out[offset + 24*i + 9];
714 IndexTupleType& t_10 = index_set_out[offset + 24*i + 10];
715 IndexTupleType& t_11 = index_set_out[offset + 24*i + 11];
716 IndexTupleType& t_12 = index_set_out[offset + 24*i + 12];
717 IndexTupleType& t_13 = index_set_out[offset + 24*i + 13];
718 IndexTupleType& t_14 = index_set_out[offset + 24*i + 14];
719 IndexTupleType& t_15 = index_set_out[offset + 24*i + 15];
720 IndexTupleType& t_16 = index_set_out[offset + 24*i + 16];
721 IndexTupleType& t_17 = index_set_out[offset + 24*i + 17];
722 IndexTupleType& t_18 = index_set_out[offset + 24*i + 18];
723 IndexTupleType& t_19 = index_set_out[offset + 24*i + 19];
724 IndexTupleType& t_20 = index_set_out[offset + 24*i + 20];
725 IndexTupleType& t_21 = index_set_out[offset + 24*i + 21];
726 IndexTupleType& t_22 = index_set_out[offset + 24*i + 22];
727 IndexTupleType& t_23 = index_set_out[offset + 24*i + 23];
731 t_0[0] = iov + v_c[0];
732 t_0[1] = iov + v_c[1];
733 t_0[2] = ioq + q_c[0];
736 t_1[0] = iov + v_c[3];
737 t_1[1] = iov + v_c[2];
738 t_1[2] = ioq + q_c[0];
741 t_2[0] = iov + v_c[2];
742 t_2[1] = iov + v_c[0];
743 t_2[2] = ioq + q_c[0];
746 t_3[0] = iov + v_c[1];
747 t_3[1] = iov + v_c[3];
748 t_3[2] = ioq + q_c[0];
752 t_4[0] = iov + v_c[5];
753 t_4[1] = iov + v_c[4];
754 t_4[2] = ioq + q_c[1];
757 t_5[0] = iov + v_c[6];
758 t_5[1] = iov + v_c[7];
759 t_5[2] = ioq + q_c[1];
762 t_6[0] = iov + v_c[4];
763 t_6[1] = iov + v_c[6];
764 t_6[2] = ioq + q_c[1];
767 t_7[0] = iov + v_c[7];
768 t_7[1] = iov + v_c[5];
769 t_7[2] = ioq + q_c[1];
773 t_8[0] = iov + v_c[1];
774 t_8[1] = iov + v_c[0];
775 t_8[2] = ioq + q_c[2];
778 t_9[0] = iov + v_c[4];
779 t_9[1] = iov + v_c[5];
780 t_9[2] = ioq + q_c[2];
783 t_10[0] = iov + v_c[0];
784 t_10[1] = iov + v_c[4];
785 t_10[2] = ioq + q_c[2];
788 t_11[0] = iov + v_c[5];
789 t_11[1] = iov + v_c[1];
790 t_11[2] = ioq + q_c[2];
794 t_12[0] = iov + v_c[2];
795 t_12[1] = iov + v_c[3];
796 t_12[2] = ioq + q_c[3];
799 t_13[0] = iov + v_c[7];
800 t_13[1] = iov + v_c[6];
801 t_13[2] = ioq + q_c[3];
804 t_14[0] = iov + v_c[6];
805 t_14[1] = iov + v_c[2];
806 t_14[2] = ioq + q_c[3];
809 t_15[0] = iov + v_c[3];
810 t_15[1] = iov + v_c[7];
811 t_15[2] = ioq + q_c[3];
815 t_16[0] = iov + v_c[0];
816 t_16[1] = iov + v_c[2];
817 t_16[2] = ioq + q_c[4];
820 t_17[0] = iov + v_c[6];
821 t_17[1] = iov + v_c[4];
822 t_17[2] = ioq + q_c[4];
825 t_18[0] = iov + v_c[4];
826 t_18[1] = iov + v_c[0];
827 t_18[2] = ioq + q_c[4];
830 t_19[0] = iov + v_c[2];
831 t_19[1] = iov + v_c[6];
832 t_19[2] = ioq + q_c[4];
836 t_20[0] = iov + v_c[3];
837 t_20[1] = iov + v_c[1];
838 t_20[2] = ioq + q_c[5];
841 t_21[0] = iov + v_c[5];
842 t_21[1] = iov + v_c[7];
843 t_21[2] = ioq + q_c[5];
846 t_22[0] = iov + v_c[1];
847 t_22[1] = iov + v_c[5];
848 t_22[2] = ioq + q_c[5];
851 t_23[0] = iov + v_c[7];
852 t_23[1] = iov + v_c[3];
853 t_23[2] = ioq + q_c[5];
874 struct ShapeConvertIndex<Shape::Hypercube<1>, 1>
876 static constexpr int shape_dim = 1;
877 static constexpr int cell_dim = 1;
878 typedef Shape::Hypercube<shape_dim> ShapeType;
879 typedef Shape::Simplex<shape_dim> OtherShapeType;
880 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
881 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
882 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
885 IndexSetType& index_set_out,
887 const Index index_offsets[],
888 const IndexSetHolderType& index_set_holder_in)
891 const Index iov = index_offsets[0];
892 const Index ioe = index_offsets[1];
895 typedef IndexSetType::IndexTupleType IndexTupleType;
898 typedef IndexSet<2> IndexSetTypeIn;
901 typedef IndexSetTypeIn::IndexTupleType IndexTupleTypeIn;
904 const IndexSetTypeIn& index_set_in = index_set_holder_in.get_index_set<1,0>();
907 const Index num_edges = index_set_in.get_num_entities();
910 FEAT_PRAGMA_OMP(parallel
for)
911 for(Index i = 0; i < num_edges; ++i)
914 const IndexTupleTypeIn& v_e = index_set_in[i];
917 IndexTupleType& e_0 = index_set_out[offset + 2*i+0];
918 IndexTupleType& e_1 = index_set_out[offset + 2*i+1];
920 e_0[0] = iov + v_e[0];
924 e_1[1] = iov + v_e[1];
938 struct ShapeConvertIndex<Shape::Hypercube<2>, 1>
940 static constexpr int shape_dim = 2;
941 static constexpr int cell_dim = 1;
942 typedef Shape::Hypercube<shape_dim> ShapeType;
943 typedef Shape::Simplex<shape_dim> OtherShapeType;
944 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
945 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
946 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
949 IndexSetType& index_set_out,
951 const Index index_offsets[],
952 const IndexSetHolderType& index_set_holder_in)
955 const Index ioe = index_offsets[1];
956 const Index iot = index_offsets[2];
959 typedef IndexSetType::IndexTupleType IndexTupleType;
962 typedef IndexSet<3> IndexSetTypeIn;
965 typedef IndexSetTypeIn::IndexTupleType IndexTupleTypeIn;
968 const IndexSetTypeIn& index_set_in = index_set_holder_in.get_index_set<2,1>();
971 const Index num_trias = index_set_in.get_num_entities();
974 FEAT_PRAGMA_OMP(parallel
for)
975 for(Index i = 0; i < num_trias; ++i)
978 const IndexTupleTypeIn& e_t = index_set_in[i];
981 IndexTupleType& e_0 = index_set_out[offset + 3*i + 0];
982 IndexTupleType& e_1 = index_set_out[offset + 3*i + 1];
983 IndexTupleType& e_2 = index_set_out[offset + 3*i + 2];
986 e_0[0] = ioe + e_t[0];
989 e_1[0] = ioe + e_t[1];
992 e_2[0] = ioe + e_t[2];
1007 struct ShapeConvertIndex<Shape::Hypercube<3>, 1>
1009 static constexpr int shape_dim = 3;
1010 static constexpr int cell_dim = 1;
1011 typedef Shape::Hypercube<shape_dim> ShapeType;
1012 typedef Shape::Simplex<shape_dim> OtherShapeType;
1013 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
1014 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1015 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1017 static Index refine(
1018 IndexSetType& index_set_out,
1020 const Index index_offsets[],
1021 const IndexSetHolderType& index_set_holder_in)
1024 const Index iot = index_offsets[2];
1025 const Index iotet = index_offsets[3];
1028 typedef IndexSetType::IndexTupleType IndexTupleType;
1031 typedef IndexSet<4> IndexSetTypeIn_t_tet;
1034 typedef IndexSetTypeIn_t_tet::IndexTupleType IndexTupleType_t_tet;
1037 const IndexSetTypeIn_t_tet& index_set_in_t_tet = index_set_holder_in.get_index_set<3,2>();
1040 const Index num_tetras = index_set_in_t_tet.get_num_entities();
1043 FEAT_PRAGMA_OMP(parallel
for)
1044 for(Index i = 0; i < num_tetras; ++i)
1047 const IndexTupleType_t_tet& t_tet = index_set_in_t_tet[i];
1050 IndexTupleType& e_0 = index_set_out[offset + 4*i + 0];
1051 IndexTupleType& e_1 = index_set_out[offset + 4*i + 1];
1052 IndexTupleType& e_2 = index_set_out[offset + 4*i + 2];
1053 IndexTupleType& e_3 = index_set_out[offset + 4*i + 3];
1057 e_0[0] = iot + t_tet[0];
1060 e_1[0] = iot + t_tet[1];
1063 e_2[0] = iot + t_tet[2];
1066 e_3[0] = iot + t_tet[3];
1072 return 4*num_tetras;
1082 struct ShapeConvertIndex<Shape::Hypercube<2>, 2>
1084 static constexpr int shape_dim = 2;
1085 static constexpr int cell_dim = 2;
1086 typedef Shape::Hypercube<shape_dim> ShapeType;
1087 typedef Shape::Simplex<shape_dim> OtherShapeType;
1088 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
1089 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1090 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1092 static Index refine(
1093 IndexSetType& index_set_out,
1095 const Index index_offsets[],
1096 const IndexSetHolderType& index_set_holder_in)
1099 const Index iov = index_offsets[0];
1100 const Index ioe = index_offsets[1];
1101 const Index iot = index_offsets[2];
1104 typedef IndexSetType::IndexTupleType IndexTupleType;
1107 typedef IndexSet<3> IndexSetTypeIn_v_t;
1108 typedef IndexSet<3> IndexSetTypeIn_e_t;
1111 typedef IndexSetTypeIn_v_t::IndexTupleType IndexTupleType_v_t;
1112 typedef IndexSetTypeIn_e_t::IndexTupleType IndexTupleType_e_t;
1115 const IndexSetTypeIn_v_t& index_set_in_v_t = index_set_holder_in.get_index_set<2,0>();
1116 const IndexSetTypeIn_e_t& index_set_in_e_t = index_set_holder_in.get_index_set<2,1>();
1119 const Index num_trias = index_set_in_e_t.get_num_entities();
1122 FEAT_PRAGMA_OMP(parallel
for)
1123 for(Index i = 0; i < num_trias; ++i)
1126 const IndexTupleType_v_t& v_t = index_set_in_v_t[i];
1127 const IndexTupleType_e_t& e_t = index_set_in_e_t[i];
1130 IndexTupleType& q_0 = index_set_out[offset + 3*i + 0];
1131 IndexTupleType& q_1 = index_set_out[offset + 3*i + 1];
1132 IndexTupleType& q_2 = index_set_out[offset + 3*i + 2];
1137 q_0[1] = ioe + e_t[1];
1138 q_0[2] = ioe + e_t[2];
1139 q_0[3] = iov + v_t[0];
1142 q_1[1] = ioe + e_t[2];
1143 q_1[2] = ioe + e_t[0];
1144 q_1[3] = iov + v_t[1];
1147 q_2[1] = ioe + e_t[0];
1148 q_2[2] = ioe + e_t[1];
1149 q_2[3] = iov + v_t[2];
1164 struct ShapeConvertIndex<Shape::Hypercube<3>, 2>
1166 static constexpr int shape_dim = 3;
1167 static constexpr int cell_dim = 2;
1168 typedef Shape::Hypercube<shape_dim> ShapeType;
1169 typedef Shape::Simplex<shape_dim> OtherShapeType;
1170 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
1171 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1172 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1174 static Index refine(
1175 IndexSetType& index_set_out,
1177 const Index index_offsets[],
1178 const IndexSetHolderType& index_set_holder_in)
1181 const Index ioe = index_offsets[1];
1182 const Index iot = index_offsets[2];
1183 const Index iotet = index_offsets[3];
1186 typedef IndexSetType::IndexTupleType IndexTupleType;
1189 typedef IndexSet<6> IndexSetTypeIn_e_tet;
1190 typedef IndexSet<4> IndexSetTypeIn_t_tet;
1193 typedef IndexSetTypeIn_e_tet::IndexTupleType IndexTupleType_e_tet;
1194 typedef IndexSetTypeIn_t_tet::IndexTupleType IndexTupleType_t_tet;
1197 const IndexSetTypeIn_e_tet& index_set_in_e_tet = index_set_holder_in.get_index_set<3,1>();
1198 const IndexSetTypeIn_t_tet& index_set_in_t_tet = index_set_holder_in.get_index_set<3,2>();
1201 const Index num_tetras = index_set_in_e_tet.get_num_entities();
1204 FEAT_PRAGMA_OMP(parallel
for)
1205 for(Index i = 0; i < num_tetras; ++i)
1208 const IndexTupleType_e_tet& e_tet = index_set_in_e_tet[i];
1209 const IndexTupleType_t_tet& t_tet = index_set_in_t_tet[i];
1212 IndexTupleType& q_0 = index_set_out[offset + 6*i + 0];
1213 IndexTupleType& q_1 = index_set_out[offset + 6*i + 1];
1214 IndexTupleType& q_2 = index_set_out[offset + 6*i + 2];
1215 IndexTupleType& q_3 = index_set_out[offset + 6*i + 3];
1216 IndexTupleType& q_4 = index_set_out[offset + 6*i + 4];
1217 IndexTupleType& q_5 = index_set_out[offset + 6*i + 5];
1222 q_0[1] = iot + t_tet[2];
1223 q_0[2] = iot + t_tet[3];
1224 q_0[3] = ioe + e_tet[0];
1227 q_1[1] = iot + t_tet[1];
1228 q_1[2] = iot + t_tet[3];
1229 q_1[3] = ioe + e_tet[1];
1232 q_2[1] = iot + t_tet[1];
1233 q_2[2] = iot + t_tet[2];
1234 q_2[3] = ioe + e_tet[2];
1237 q_3[1] = iot + t_tet[0];
1238 q_3[2] = iot + t_tet[3];
1239 q_3[3] = ioe + e_tet[3];
1242 q_4[1] = iot + t_tet[0];
1243 q_4[2] = iot + t_tet[2];
1244 q_4[3] = ioe + e_tet[4];
1247 q_5[1] = iot + t_tet[0];
1248 q_5[2] = iot + t_tet[1];
1249 q_5[3] = ioe + e_tet[5];
1254 return 6*num_tetras;
1265 struct ShapeConvertIndex<Shape::Hypercube<3>, 3>
1267 static constexpr int shape_dim = 3;
1268 static constexpr int cell_dim = 3;
1269 typedef Shape::Hypercube<shape_dim> ShapeType;
1270 typedef Shape::Simplex<shape_dim> OtherShapeType;
1271 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
1272 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1273 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1275 static Index refine(
1276 IndexSetType& index_set_out,
1278 const Index index_offsets[],
1279 const IndexSetHolderType& index_set_holder_in)
1282 const Index iov = index_offsets[0];
1283 const Index ioe = index_offsets[1];
1284 const Index iot = index_offsets[2];
1285 const Index iotet = index_offsets[3];
1288 typedef IndexSetType::IndexTupleType IndexTupleType;
1291 typedef IndexSet<4> IndexSetTypeIn_v_tet;
1292 typedef IndexSet<6> IndexSetTypeIn_e_tet;
1293 typedef IndexSet<4> IndexSetTypeIn_t_tet;
1296 typedef IndexSetTypeIn_v_tet::IndexTupleType IndexTupleType_v_tet;
1297 typedef IndexSetTypeIn_e_tet::IndexTupleType IndexTupleType_e_tet;
1298 typedef IndexSetTypeIn_t_tet::IndexTupleType IndexTupleType_t_tet;
1301 const IndexSetTypeIn_v_tet& index_set_in_v_tet = index_set_holder_in.get_index_set<3,0>();
1302 const IndexSetTypeIn_e_tet& index_set_in_e_tet = index_set_holder_in.get_index_set<3,1>();
1303 const IndexSetTypeIn_t_tet& index_set_in_t_tet = index_set_holder_in.get_index_set<3,2>();
1306 const Index num_tetras = index_set_in_e_tet.get_num_entities();
1309 FEAT_PRAGMA_OMP(parallel
for)
1310 for(Index i = 0; i < num_tetras; ++i)
1313 const IndexTupleType_v_tet& v_tet = index_set_in_v_tet[i];
1314 const IndexTupleType_e_tet& e_tet = index_set_in_e_tet[i];
1315 const IndexTupleType_t_tet& t_tet = index_set_in_t_tet[i];
1318 IndexTupleType& c_0 = index_set_out[offset + 4*i + 0];
1319 IndexTupleType& c_1 = index_set_out[offset + 4*i + 1];
1320 IndexTupleType& c_2 = index_set_out[offset + 4*i + 2];
1321 IndexTupleType& c_3 = index_set_out[offset + 4*i + 3];
1327 c_0[1] = iot + t_tet[1];
1328 c_0[2] = iot + t_tet[2];
1329 c_0[3] = ioe + e_tet[2];
1330 c_0[4] = iot + t_tet[3];
1331 c_0[5] = ioe + e_tet[1];
1332 c_0[6] = ioe + e_tet[0];
1333 c_0[7] = iov + v_tet[0];
1336 c_1[1] = iot + t_tet[0];
1337 c_1[2] = iot + t_tet[2];
1338 c_1[3] = ioe + e_tet[4];
1339 c_1[4] = iot + t_tet[3];
1340 c_1[5] = ioe + e_tet[3];
1341 c_1[6] = ioe + e_tet[0];
1342 c_1[7] = iov + v_tet[1];
1345 c_2[1] = iot + t_tet[0];
1346 c_2[2] = iot + t_tet[1];
1347 c_2[3] = ioe + e_tet[5];
1348 c_2[4] = iot + t_tet[3];
1349 c_2[5] = ioe + e_tet[3];
1350 c_2[6] = ioe + e_tet[1];
1351 c_2[7] = iov + v_tet[2];
1354 c_3[1] = iot + t_tet[0];
1355 c_3[2] = iot + t_tet[1];
1356 c_3[3] = ioe + e_tet[5];
1357 c_3[4] = iot + t_tet[2];
1358 c_3[5] = ioe + e_tet[4];
1359 c_3[6] = ioe + e_tet[2];
1360 c_3[7] = iov + v_tet[3];
1364 return 4*num_tetras;
1378 int shape_dim_ = Shape_::dimension>
1379 struct ShapeConvertIndexShapeWrapper
1381 static_assert(shape_dim_ == Shape_::dimension,
"invalid shape dimension");
1383 static_assert(shape_dim_ > cell_dim_,
"invalid cell dimension");
1384 static_assert(cell_dim_ > 0,
"invalid cell dimension");
1386 typedef Shape_ ShapeType;
1387 typedef typename OtherShape<Shape_>::Type OtherShapeType;
1388 typedef typename Shape::FaceTraits<ShapeType, cell_dim_>::ShapeType CellType;
1389 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1390 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1392 static String name()
1394 return "ShapeConvertIndexShapeWrapper<" + Shape_::name() +
"," +
stringify(cell_dim_) +
","
1398 static Index refine(
1399 IndexSetType& index_set_out,
1400 const Index index_offsets[],
1401 const IndexSetHolderType& index_set_holder_in)
1403 typedef typename Shape::FaceTraits<ShapeType, shape_dim_ - 1>::ShapeType FacetType;
1406 Index offset = ShapeConvertIndexShapeWrapper<FacetType, cell_dim_>
1407 ::refine(index_set_out, index_offsets, index_set_holder_in);
1410 Index num_faces = ShapeConvertIndex<Shape_, cell_dim_>
1411 ::refine(index_set_out, offset, index_offsets, index_set_holder_in);
1414 Index num_shapes = index_set_holder_in.template get_index_set<shape_dim_, 0>().get_num_entities();
1415 XASSERTM(num_faces == (ShapeConvertTraits<OtherShapeType, cell_dim_>::count * num_shapes),
1416 "ShapeConvertIndex output does not match ShapeConvertTraits prediction");
1419 return offset + num_faces;
1426 struct ShapeConvertIndexShapeWrapper<Shape_, cell_dim_, cell_dim_>
1428 static_assert(cell_dim_ == Shape_::dimension,
"invalid shape dimension");
1429 static_assert(cell_dim_ > 0,
"invalid cell dimension");
1431 typedef Shape_ ShapeType;
1432 typedef typename OtherShape<Shape_>::Type OtherShapeType;
1433 typedef typename Shape::FaceTraits<ShapeType, cell_dim_>::ShapeType CellType;
1434 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1435 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1437 static String name()
1439 return "ShapeConvertIndexShapeWrapper<" + Shape_::name() +
"," +
stringify(cell_dim_) +
","
1443 static Index refine(
1444 IndexSetType& index_set_out,
1445 const Index index_offsets[],
1446 const IndexSetHolderType& index_set_holder_in)
1449 Index num_faces = ShapeConvertIndex<Shape_, cell_dim_>
1450 ::refine(index_set_out, 0, index_offsets, index_set_holder_in);
1453 Index num_shapes = index_set_holder_in.template get_index_set<cell_dim_, 0>().get_num_entities();
1454 XASSERTM(num_faces == (ShapeConvertTraits<OtherShapeType, cell_dim_>::count * num_shapes),
1455 "ShapeConvertIndex output does not match ShapeConvertTraits prediction");
1466 int cell_dim_ = Shape_::dimension>
1467 struct ShapeConvertIndexWrapper
1470 static_assert(cell_dim_ > 1,
"invalid cell dimension");
1471 static_assert(cell_dim_ <= Shape_::dimension,
"invalid cell dimension");
1473 typedef Shape_ ShapeType;
1474 typedef typename OtherShape<Shape_>::Type OtherShapeType;
1475 typedef typename Shape::FaceTraits<ShapeType, cell_dim_>::ShapeType CellType;
1476 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1477 typedef IndexSetHolder<ShapeType> IndexSetHolderType;
1478 typedef IndexSetHolder<OtherShapeType> IndexSetHolderTypeIn;
1480 static String name()
1482 return "ShapeConvertIndexWrapper<" + Shape_::name() +
"," +
stringify(cell_dim_) +
">";
1486 IndexSetHolderType& index_set_holder_out,
1487 const Index num_entities[],
1488 const IndexSetHolderTypeIn& index_set_holder_in)
1491 ShapeConvertIndexWrapper<Shape_, cell_dim_ - 1>
1492 ::refine(index_set_holder_out, num_entities, index_set_holder_in);
1495 IndexSetType& index_set_out = index_set_holder_out.template get_index_set<cell_dim_, 0>();
1498 Index index_offsets[Shape_::dimension+1];
1499 EntityCounter<ShapeConvertTraits,OtherShapeType, 0>::offset(index_offsets, num_entities);
1502 ShapeConvertIndexShapeWrapper<Shape_, cell_dim_>
1503 ::refine(index_set_out, index_offsets, index_set_holder_in);
1507 template<
typename Shape_>
1508 struct ShapeConvertIndexWrapper<Shape_, 1>
1510 static_assert(1 <= Shape_::dimension,
"invalid shape dimension");
1512 typedef Shape_ ShapeType;
1513 typedef typename OtherShape<Shape_>::Type OtherShapeType;
1514 typedef typename Shape::FaceTraits<ShapeType, 1>::ShapeType CellType;
1515 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1516 typedef IndexSetHolder<ShapeType> IndexSetHolderType;
1517 typedef IndexSetHolder<OtherShapeType> IndexSetHolderTypeIn;
1519 static String name()
1521 return "ShapeConvertIndexWrapper<" + Shape_::name() +
",1>";
1525 IndexSetHolderType& index_set_holder_out,
1526 const Index num_entities[],
1527 const IndexSetHolderTypeIn& index_set_holder_in)
1530 IndexSetType& index_set_out = index_set_holder_out.template get_index_set<1, 0>();
1533 Index index_offsets[Shape_::dimension+1];
1534 EntityCounter<ShapeConvertTraits,OtherShapeType, 0>::offset(index_offsets, num_entities);
1537 ShapeConvertIndexShapeWrapper<Shape_, 1>::refine(index_set_out, index_offsets, index_set_holder_in);
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
String stringify(const T_ &item)
Converts an item into a String.
std::uint64_t Index
Index data type.