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];
489 const auto x = ioc + i;
490 const auto v_0 = iov + v_c[0];
491 const auto v_1 = iov + v_c[1];
492 const auto v_2 = iov + v_c[2];
493 const auto v_3 = iov + v_c[3];
494 const auto v_4 = iov + v_c[4];
495 const auto v_5 = iov + v_c[5];
496 const auto v_6 = iov + v_c[6];
497 const auto v_7 = iov + v_c[7];
498 const auto q_0 = ioq + q_c[0];
499 const auto q_1 = ioq + q_c[1];
500 const auto q_2 = ioq + q_c[2];
501 const auto q_3 = ioq + q_c[3];
502 const auto q_4 = ioq + q_c[4];
503 const auto q_5 = ioq + q_c[5];
506 for (Index j = 0; j < 36; ++j)
507 index_set_out[offset + 36*i +j][0] = x;
611 struct ShapeConvertIndex<Shape::Simplex<3>, 3>
613 static constexpr int shape_dim = 3;
614 static constexpr int cell_dim = 3;
615 typedef Shape::Simplex<shape_dim> ShapeType;
616 typedef Shape::Hypercube<shape_dim> OtherShapeType;
617 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
618 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
619 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
622 IndexSetType& index_set_out,
624 const Index index_offsets[],
625 const IndexSetHolderType& index_set_holder_in)
628 const Index iov = index_offsets[0];
629 const Index ioq = index_offsets[2];
630 const Index ioc = index_offsets[3];
633 typedef IndexSetType::IndexTupleType IndexTupleType;
636 typedef IndexSet<8> IndexSetTypeIn_v_c;
637 typedef IndexSet<6> IndexSetTypeIn_q_c;
640 typedef IndexSetTypeIn_v_c::IndexTupleType IndexTupleType_v_c;
641 typedef IndexSetTypeIn_q_c::IndexTupleType IndexTupleType_q_c;
644 const IndexSetTypeIn_v_c& index_set_in_v_c = index_set_holder_in.get_index_set<3,0>();
645 const IndexSetTypeIn_q_c& index_set_in_q_c = index_set_holder_in.get_index_set<3,2>();
648 const Index num_cubes = index_set_in_v_c.get_num_entities();
651 FEAT_PRAGMA_OMP(parallel
for)
652 for(Index i = 0; i < num_cubes; ++i)
655 const IndexTupleType_v_c& v_c = index_set_in_v_c[i];
656 const IndexTupleType_q_c& q_c = index_set_in_q_c[i];
659 IndexTupleType& t_0 = index_set_out[offset + 24*i + 0];
660 IndexTupleType& t_1 = index_set_out[offset + 24*i + 1];
661 IndexTupleType& t_2 = index_set_out[offset + 24*i + 2];
662 IndexTupleType& t_3 = index_set_out[offset + 24*i + 3];
663 IndexTupleType& t_4 = index_set_out[offset + 24*i + 4];
664 IndexTupleType& t_5 = index_set_out[offset + 24*i + 5];
665 IndexTupleType& t_6 = index_set_out[offset + 24*i + 6];
666 IndexTupleType& t_7 = index_set_out[offset + 24*i + 7];
667 IndexTupleType& t_8 = index_set_out[offset + 24*i + 8];
668 IndexTupleType& t_9 = index_set_out[offset + 24*i + 9];
669 IndexTupleType& t_10 = index_set_out[offset + 24*i + 10];
670 IndexTupleType& t_11 = index_set_out[offset + 24*i + 11];
671 IndexTupleType& t_12 = index_set_out[offset + 24*i + 12];
672 IndexTupleType& t_13 = index_set_out[offset + 24*i + 13];
673 IndexTupleType& t_14 = index_set_out[offset + 24*i + 14];
674 IndexTupleType& t_15 = index_set_out[offset + 24*i + 15];
675 IndexTupleType& t_16 = index_set_out[offset + 24*i + 16];
676 IndexTupleType& t_17 = index_set_out[offset + 24*i + 17];
677 IndexTupleType& t_18 = index_set_out[offset + 24*i + 18];
678 IndexTupleType& t_19 = index_set_out[offset + 24*i + 19];
679 IndexTupleType& t_20 = index_set_out[offset + 24*i + 20];
680 IndexTupleType& t_21 = index_set_out[offset + 24*i + 21];
681 IndexTupleType& t_22 = index_set_out[offset + 24*i + 22];
682 IndexTupleType& t_23 = index_set_out[offset + 24*i + 23];
686 t_0[0] = iov + v_c[0];
687 t_0[1] = iov + v_c[1];
688 t_0[2] = ioq + q_c[0];
691 t_1[0] = iov + v_c[3];
692 t_1[1] = iov + v_c[2];
693 t_1[2] = ioq + q_c[0];
696 t_2[0] = iov + v_c[2];
697 t_2[1] = iov + v_c[0];
698 t_2[2] = ioq + q_c[0];
701 t_3[0] = iov + v_c[1];
702 t_3[1] = iov + v_c[3];
703 t_3[2] = ioq + q_c[0];
707 t_4[0] = iov + v_c[5];
708 t_4[1] = iov + v_c[4];
709 t_4[2] = ioq + q_c[1];
712 t_5[0] = iov + v_c[6];
713 t_5[1] = iov + v_c[7];
714 t_5[2] = ioq + q_c[1];
717 t_6[0] = iov + v_c[4];
718 t_6[1] = iov + v_c[6];
719 t_6[2] = ioq + q_c[1];
722 t_7[0] = iov + v_c[7];
723 t_7[1] = iov + v_c[5];
724 t_7[2] = ioq + q_c[1];
728 t_8[0] = iov + v_c[1];
729 t_8[1] = iov + v_c[0];
730 t_8[2] = ioq + q_c[2];
733 t_9[0] = iov + v_c[4];
734 t_9[1] = iov + v_c[5];
735 t_9[2] = ioq + q_c[2];
738 t_10[0] = iov + v_c[0];
739 t_10[1] = iov + v_c[4];
740 t_10[2] = ioq + q_c[2];
743 t_11[0] = iov + v_c[5];
744 t_11[1] = iov + v_c[1];
745 t_11[2] = ioq + q_c[2];
749 t_12[0] = iov + v_c[2];
750 t_12[1] = iov + v_c[3];
751 t_12[2] = ioq + q_c[3];
754 t_13[0] = iov + v_c[7];
755 t_13[1] = iov + v_c[6];
756 t_13[2] = ioq + q_c[3];
759 t_14[0] = iov + v_c[6];
760 t_14[1] = iov + v_c[2];
761 t_14[2] = ioq + q_c[3];
764 t_15[0] = iov + v_c[3];
765 t_15[1] = iov + v_c[7];
766 t_15[2] = ioq + q_c[3];
770 t_16[0] = iov + v_c[0];
771 t_16[1] = iov + v_c[2];
772 t_16[2] = ioq + q_c[4];
775 t_17[0] = iov + v_c[6];
776 t_17[1] = iov + v_c[4];
777 t_17[2] = ioq + q_c[4];
780 t_18[0] = iov + v_c[4];
781 t_18[1] = iov + v_c[0];
782 t_18[2] = ioq + q_c[4];
785 t_19[0] = iov + v_c[2];
786 t_19[1] = iov + v_c[6];
787 t_19[2] = ioq + q_c[4];
791 t_20[0] = iov + v_c[3];
792 t_20[1] = iov + v_c[1];
793 t_20[2] = ioq + q_c[5];
796 t_21[0] = iov + v_c[5];
797 t_21[1] = iov + v_c[7];
798 t_21[2] = ioq + q_c[5];
801 t_22[0] = iov + v_c[1];
802 t_22[1] = iov + v_c[5];
803 t_22[2] = ioq + q_c[5];
806 t_23[0] = iov + v_c[7];
807 t_23[1] = iov + v_c[3];
808 t_23[2] = ioq + q_c[5];
829 struct ShapeConvertIndex<Shape::Hypercube<1>, 1>
831 static constexpr int shape_dim = 1;
832 static constexpr int cell_dim = 1;
833 typedef Shape::Hypercube<shape_dim> ShapeType;
834 typedef Shape::Simplex<shape_dim> OtherShapeType;
835 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
836 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
837 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
840 IndexSetType& index_set_out,
842 const Index index_offsets[],
843 const IndexSetHolderType& index_set_holder_in)
846 const Index iov = index_offsets[0];
847 const Index ioe = index_offsets[1];
850 typedef IndexSetType::IndexTupleType IndexTupleType;
853 typedef IndexSet<2> IndexSetTypeIn;
856 typedef IndexSetTypeIn::IndexTupleType IndexTupleTypeIn;
859 const IndexSetTypeIn& index_set_in = index_set_holder_in.get_index_set<1,0>();
862 const Index num_edges = index_set_in.get_num_entities();
865 FEAT_PRAGMA_OMP(parallel
for)
866 for(Index i = 0; i < num_edges; ++i)
869 const IndexTupleTypeIn& v_e = index_set_in[i];
872 IndexTupleType& e_0 = index_set_out[offset + 2*i+0];
873 IndexTupleType& e_1 = index_set_out[offset + 2*i+1];
875 e_0[0] = iov + v_e[0];
879 e_1[1] = iov + v_e[1];
893 struct ShapeConvertIndex<Shape::Hypercube<2>, 1>
895 static constexpr int shape_dim = 2;
896 static constexpr int cell_dim = 1;
897 typedef Shape::Hypercube<shape_dim> ShapeType;
898 typedef Shape::Simplex<shape_dim> OtherShapeType;
899 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
900 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
901 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
904 IndexSetType& index_set_out,
906 const Index index_offsets[],
907 const IndexSetHolderType& index_set_holder_in)
910 const Index ioe = index_offsets[1];
911 const Index iot = index_offsets[2];
914 typedef IndexSetType::IndexTupleType IndexTupleType;
917 typedef IndexSet<3> IndexSetTypeIn;
920 typedef IndexSetTypeIn::IndexTupleType IndexTupleTypeIn;
923 const IndexSetTypeIn& index_set_in = index_set_holder_in.get_index_set<2,1>();
926 const Index num_trias = index_set_in.get_num_entities();
929 FEAT_PRAGMA_OMP(parallel
for)
930 for(Index i = 0; i < num_trias; ++i)
933 const IndexTupleTypeIn& e_t = index_set_in[i];
936 IndexTupleType& e_0 = index_set_out[offset + 3*i + 0];
937 IndexTupleType& e_1 = index_set_out[offset + 3*i + 1];
938 IndexTupleType& e_2 = index_set_out[offset + 3*i + 2];
941 e_0[0] = ioe + e_t[0];
944 e_1[0] = ioe + e_t[1];
947 e_2[0] = ioe + e_t[2];
962 struct ShapeConvertIndex<Shape::Hypercube<3>, 1>
964 static constexpr int shape_dim = 3;
965 static constexpr int cell_dim = 1;
966 typedef Shape::Hypercube<shape_dim> ShapeType;
967 typedef Shape::Simplex<shape_dim> OtherShapeType;
968 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
969 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
970 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
973 IndexSetType& index_set_out,
975 const Index index_offsets[],
976 const IndexSetHolderType& index_set_holder_in)
979 const Index iot = index_offsets[2];
980 const Index iotet = index_offsets[3];
983 typedef IndexSetType::IndexTupleType IndexTupleType;
986 typedef IndexSet<4> IndexSetTypeIn_t_tet;
989 typedef IndexSetTypeIn_t_tet::IndexTupleType IndexTupleType_t_tet;
992 const IndexSetTypeIn_t_tet& index_set_in_t_tet = index_set_holder_in.get_index_set<3,2>();
995 const Index num_tetras = index_set_in_t_tet.get_num_entities();
998 FEAT_PRAGMA_OMP(parallel
for)
999 for(Index i = 0; i < num_tetras; ++i)
1002 const IndexTupleType_t_tet& t_tet = index_set_in_t_tet[i];
1005 IndexTupleType& e_0 = index_set_out[offset + 4*i + 0];
1006 IndexTupleType& e_1 = index_set_out[offset + 4*i + 1];
1007 IndexTupleType& e_2 = index_set_out[offset + 4*i + 2];
1008 IndexTupleType& e_3 = index_set_out[offset + 4*i + 3];
1012 e_0[0] = iot + t_tet[0];
1015 e_1[0] = iot + t_tet[1];
1018 e_2[0] = iot + t_tet[2];
1021 e_3[0] = iot + t_tet[3];
1027 return 4*num_tetras;
1037 struct ShapeConvertIndex<Shape::Hypercube<2>, 2>
1039 static constexpr int shape_dim = 2;
1040 static constexpr int cell_dim = 2;
1041 typedef Shape::Hypercube<shape_dim> ShapeType;
1042 typedef Shape::Simplex<shape_dim> OtherShapeType;
1043 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
1044 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1045 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1047 static Index refine(
1048 IndexSetType& index_set_out,
1050 const Index index_offsets[],
1051 const IndexSetHolderType& index_set_holder_in)
1054 const Index iov = index_offsets[0];
1055 const Index ioe = index_offsets[1];
1056 const Index iot = index_offsets[2];
1059 typedef IndexSetType::IndexTupleType IndexTupleType;
1062 typedef IndexSet<3> IndexSetTypeIn_v_t;
1063 typedef IndexSet<3> IndexSetTypeIn_e_t;
1066 typedef IndexSetTypeIn_v_t::IndexTupleType IndexTupleType_v_t;
1067 typedef IndexSetTypeIn_e_t::IndexTupleType IndexTupleType_e_t;
1070 const IndexSetTypeIn_v_t& index_set_in_v_t = index_set_holder_in.get_index_set<2,0>();
1071 const IndexSetTypeIn_e_t& index_set_in_e_t = index_set_holder_in.get_index_set<2,1>();
1074 const Index num_trias = index_set_in_e_t.get_num_entities();
1077 FEAT_PRAGMA_OMP(parallel
for)
1078 for(Index i = 0; i < num_trias; ++i)
1081 const IndexTupleType_v_t& v_t = index_set_in_v_t[i];
1082 const IndexTupleType_e_t& e_t = index_set_in_e_t[i];
1085 IndexTupleType& q_0 = index_set_out[offset + 3*i + 0];
1086 IndexTupleType& q_1 = index_set_out[offset + 3*i + 1];
1087 IndexTupleType& q_2 = index_set_out[offset + 3*i + 2];
1092 q_0[1] = ioe + e_t[1];
1093 q_0[2] = ioe + e_t[2];
1094 q_0[3] = iov + v_t[0];
1097 q_1[1] = ioe + e_t[2];
1098 q_1[2] = ioe + e_t[0];
1099 q_1[3] = iov + v_t[1];
1102 q_2[1] = ioe + e_t[0];
1103 q_2[2] = ioe + e_t[1];
1104 q_2[3] = iov + v_t[2];
1119 struct ShapeConvertIndex<Shape::Hypercube<3>, 2>
1121 static constexpr int shape_dim = 3;
1122 static constexpr int cell_dim = 2;
1123 typedef Shape::Hypercube<shape_dim> ShapeType;
1124 typedef Shape::Simplex<shape_dim> OtherShapeType;
1125 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
1126 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1127 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1129 static Index refine(
1130 IndexSetType& index_set_out,
1132 const Index index_offsets[],
1133 const IndexSetHolderType& index_set_holder_in)
1136 const Index ioe = index_offsets[1];
1137 const Index iot = index_offsets[2];
1138 const Index iotet = index_offsets[3];
1141 typedef IndexSetType::IndexTupleType IndexTupleType;
1144 typedef IndexSet<6> IndexSetTypeIn_e_tet;
1145 typedef IndexSet<4> IndexSetTypeIn_t_tet;
1148 typedef IndexSetTypeIn_e_tet::IndexTupleType IndexTupleType_e_tet;
1149 typedef IndexSetTypeIn_t_tet::IndexTupleType IndexTupleType_t_tet;
1152 const IndexSetTypeIn_e_tet& index_set_in_e_tet = index_set_holder_in.get_index_set<3,1>();
1153 const IndexSetTypeIn_t_tet& index_set_in_t_tet = index_set_holder_in.get_index_set<3,2>();
1156 const Index num_tetras = index_set_in_e_tet.get_num_entities();
1159 FEAT_PRAGMA_OMP(parallel
for)
1160 for(Index i = 0; i < num_tetras; ++i)
1163 const IndexTupleType_e_tet& e_tet = index_set_in_e_tet[i];
1164 const IndexTupleType_t_tet& t_tet = index_set_in_t_tet[i];
1167 IndexTupleType& q_0 = index_set_out[offset + 6*i + 0];
1168 IndexTupleType& q_1 = index_set_out[offset + 6*i + 1];
1169 IndexTupleType& q_2 = index_set_out[offset + 6*i + 2];
1170 IndexTupleType& q_3 = index_set_out[offset + 6*i + 3];
1171 IndexTupleType& q_4 = index_set_out[offset + 6*i + 4];
1172 IndexTupleType& q_5 = index_set_out[offset + 6*i + 5];
1177 q_0[1] = iot + t_tet[2];
1178 q_0[2] = iot + t_tet[3];
1179 q_0[3] = ioe + e_tet[0];
1182 q_1[1] = iot + t_tet[1];
1183 q_1[2] = iot + t_tet[3];
1184 q_1[3] = ioe + e_tet[1];
1187 q_2[1] = iot + t_tet[1];
1188 q_2[2] = iot + t_tet[2];
1189 q_2[3] = ioe + e_tet[2];
1192 q_3[1] = iot + t_tet[0];
1193 q_3[2] = iot + t_tet[3];
1194 q_3[3] = ioe + e_tet[3];
1197 q_4[1] = iot + t_tet[0];
1198 q_4[2] = iot + t_tet[2];
1199 q_4[3] = ioe + e_tet[4];
1202 q_5[1] = iot + t_tet[0];
1203 q_5[2] = iot + t_tet[1];
1204 q_5[3] = ioe + e_tet[5];
1209 return 6*num_tetras;
1220 struct ShapeConvertIndex<Shape::Hypercube<3>, 3>
1222 static constexpr int shape_dim = 3;
1223 static constexpr int cell_dim = 3;
1224 typedef Shape::Hypercube<shape_dim> ShapeType;
1225 typedef Shape::Simplex<shape_dim> OtherShapeType;
1226 typedef Shape::FaceTraits<ShapeType, cell_dim>::ShapeType CellType;
1227 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1228 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1230 static Index refine(
1231 IndexSetType& index_set_out,
1233 const Index index_offsets[],
1234 const IndexSetHolderType& index_set_holder_in)
1237 const Index iov = index_offsets[0];
1238 const Index ioe = index_offsets[1];
1239 const Index iot = index_offsets[2];
1240 const Index iotet = index_offsets[3];
1243 typedef IndexSetType::IndexTupleType IndexTupleType;
1246 typedef IndexSet<4> IndexSetTypeIn_v_tet;
1247 typedef IndexSet<6> IndexSetTypeIn_e_tet;
1248 typedef IndexSet<4> IndexSetTypeIn_t_tet;
1251 typedef IndexSetTypeIn_v_tet::IndexTupleType IndexTupleType_v_tet;
1252 typedef IndexSetTypeIn_e_tet::IndexTupleType IndexTupleType_e_tet;
1253 typedef IndexSetTypeIn_t_tet::IndexTupleType IndexTupleType_t_tet;
1256 const IndexSetTypeIn_v_tet& index_set_in_v_tet = index_set_holder_in.get_index_set<3,0>();
1257 const IndexSetTypeIn_e_tet& index_set_in_e_tet = index_set_holder_in.get_index_set<3,1>();
1258 const IndexSetTypeIn_t_tet& index_set_in_t_tet = index_set_holder_in.get_index_set<3,2>();
1261 const Index num_tetras = index_set_in_e_tet.get_num_entities();
1264 FEAT_PRAGMA_OMP(parallel
for)
1265 for(Index i = 0; i < num_tetras; ++i)
1268 const IndexTupleType_v_tet& v_tet = index_set_in_v_tet[i];
1269 const IndexTupleType_e_tet& e_tet = index_set_in_e_tet[i];
1270 const IndexTupleType_t_tet& t_tet = index_set_in_t_tet[i];
1273 IndexTupleType& c_0 = index_set_out[offset + 4*i + 0];
1274 IndexTupleType& c_1 = index_set_out[offset + 4*i + 1];
1275 IndexTupleType& c_2 = index_set_out[offset + 4*i + 2];
1276 IndexTupleType& c_3 = index_set_out[offset + 4*i + 3];
1282 c_0[1] = iot + t_tet[1];
1283 c_0[2] = iot + t_tet[2];
1284 c_0[3] = ioe + e_tet[2];
1285 c_0[4] = iot + t_tet[3];
1286 c_0[5] = ioe + e_tet[1];
1287 c_0[6] = ioe + e_tet[0];
1288 c_0[7] = iov + v_tet[0];
1291 c_1[1] = iot + t_tet[0];
1292 c_1[2] = iot + t_tet[2];
1293 c_1[3] = ioe + e_tet[4];
1294 c_1[4] = iot + t_tet[3];
1295 c_1[5] = ioe + e_tet[3];
1296 c_1[6] = ioe + e_tet[0];
1297 c_1[7] = iov + v_tet[1];
1300 c_2[1] = iot + t_tet[0];
1301 c_2[2] = iot + t_tet[1];
1302 c_2[3] = ioe + e_tet[5];
1303 c_2[4] = iot + t_tet[3];
1304 c_2[5] = ioe + e_tet[3];
1305 c_2[6] = ioe + e_tet[1];
1306 c_2[7] = iov + v_tet[2];
1309 c_3[1] = iot + t_tet[0];
1310 c_3[2] = iot + t_tet[1];
1311 c_3[3] = ioe + e_tet[5];
1312 c_3[4] = iot + t_tet[2];
1313 c_3[5] = ioe + e_tet[4];
1314 c_3[6] = ioe + e_tet[2];
1315 c_3[7] = iov + v_tet[3];
1319 return 4*num_tetras;
1333 int shape_dim_ = Shape_::dimension>
1334 struct ShapeConvertIndexShapeWrapper
1336 static_assert(shape_dim_ == Shape_::dimension,
"invalid shape dimension");
1338 static_assert(shape_dim_ > cell_dim_,
"invalid cell dimension");
1339 static_assert(cell_dim_ > 0,
"invalid cell dimension");
1341 typedef Shape_ ShapeType;
1342 typedef typename OtherShape<Shape_>::Type OtherShapeType;
1343 typedef typename Shape::FaceTraits<ShapeType, cell_dim_>::ShapeType CellType;
1344 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1345 typedef IndexSetHolder<OtherShapeType> IndexSetHolderType;
1347 static String name()
1349 return "ShapeConvertIndexShapeWrapper<" + Shape_::name() +
"," +
stringify(cell_dim_) +
","
1353 static Index refine(
1354 IndexSetType& index_set_out,
1355 const Index index_offsets[],
1356 const IndexSetHolderType& index_set_holder_in)
1358 typedef typename Shape::FaceTraits<ShapeType, shape_dim_ - 1>::ShapeType FacetType;
1361 Index offset = ShapeConvertIndexShapeWrapper<FacetType, cell_dim_>
1362 ::refine(index_set_out, index_offsets, index_set_holder_in);
1365 Index num_faces = ShapeConvertIndex<Shape_, cell_dim_>
1366 ::refine(index_set_out, offset, index_offsets, index_set_holder_in);
1369 Index num_shapes = index_set_holder_in.template get_index_set<shape_dim_, 0>().get_num_entities();
1370 XASSERTM(num_faces == (ShapeConvertTraits<OtherShapeType, cell_dim_>::count * num_shapes),
1371 "ShapeConvertIndex output does not match ShapeConvertTraits prediction");
1374 return offset + num_faces;
1381 struct ShapeConvertIndexShapeWrapper<Shape_, cell_dim_, cell_dim_>
1383 static_assert(cell_dim_ == Shape_::dimension,
"invalid shape 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)
1404 Index num_faces = ShapeConvertIndex<Shape_, cell_dim_>
1405 ::refine(index_set_out, 0, index_offsets, index_set_holder_in);
1408 Index num_shapes = index_set_holder_in.template get_index_set<cell_dim_, 0>().get_num_entities();
1409 XASSERTM(num_faces == (ShapeConvertTraits<OtherShapeType, cell_dim_>::count * num_shapes),
1410 "ShapeConvertIndex output does not match ShapeConvertTraits prediction");
1421 int cell_dim_ = Shape_::dimension>
1422 struct ShapeConvertIndexWrapper
1425 static_assert(cell_dim_ > 1,
"invalid cell dimension");
1426 static_assert(cell_dim_ <= Shape_::dimension,
"invalid cell dimension");
1428 typedef Shape_ ShapeType;
1429 typedef typename OtherShape<Shape_>::Type OtherShapeType;
1430 typedef typename Shape::FaceTraits<ShapeType, cell_dim_>::ShapeType CellType;
1431 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1432 typedef IndexSetHolder<ShapeType> IndexSetHolderType;
1433 typedef IndexSetHolder<OtherShapeType> IndexSetHolderTypeIn;
1435 static String name()
1437 return "ShapeConvertIndexWrapper<" + Shape_::name() +
"," +
stringify(cell_dim_) +
">";
1441 IndexSetHolderType& index_set_holder_out,
1442 const Index num_entities[],
1443 const IndexSetHolderTypeIn& index_set_holder_in)
1446 ShapeConvertIndexWrapper<Shape_, cell_dim_ - 1>
1447 ::refine(index_set_holder_out, num_entities, index_set_holder_in);
1450 IndexSetType& index_set_out = index_set_holder_out.template get_index_set<cell_dim_, 0>();
1453 Index index_offsets[Shape_::dimension+1];
1454 EntityCounter<ShapeConvertTraits,OtherShapeType, 0>::offset(index_offsets, num_entities);
1457 ShapeConvertIndexShapeWrapper<Shape_, cell_dim_>
1458 ::refine(index_set_out, index_offsets, index_set_holder_in);
1462 template<
typename Shape_>
1463 struct ShapeConvertIndexWrapper<Shape_, 1>
1465 static_assert(1 <= Shape_::dimension,
"invalid shape dimension");
1467 typedef Shape_ ShapeType;
1468 typedef typename OtherShape<Shape_>::Type OtherShapeType;
1469 typedef typename Shape::FaceTraits<ShapeType, 1>::ShapeType CellType;
1470 typedef IndexSet<Shape::FaceTraits<CellType, 0>::count> IndexSetType;
1471 typedef IndexSetHolder<ShapeType> IndexSetHolderType;
1472 typedef IndexSetHolder<OtherShapeType> IndexSetHolderTypeIn;
1474 static String name()
1476 return "ShapeConvertIndexWrapper<" + Shape_::name() +
",1>";
1480 IndexSetHolderType& index_set_holder_out,
1481 const Index num_entities[],
1482 const IndexSetHolderTypeIn& index_set_holder_in)
1485 IndexSetType& index_set_out = index_set_holder_out.template get_index_set<1, 0>();
1488 Index index_offsets[Shape_::dimension+1];
1489 EntityCounter<ShapeConvertTraits,OtherShapeType, 0>::offset(index_offsets, num_entities);
1492 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.