8#define CASE_EDGE_POSITION_L_3D \
9 case EdgePosition::L_xnn_3D: \
10 case EdgePosition::L_xn0_3D: \
11 case EdgePosition::L_xnN_3D: \
12 case EdgePosition::L_x0n_3D: \
13 case EdgePosition::L_x00_3D: \
14 case EdgePosition::L_x0N_3D: \
15 case EdgePosition::L_xNn_3D: \
16 case EdgePosition::L_xN0_3D: \
17 case EdgePosition::L_xNN_3D
18#define CASE_EDGE_POSITION_H_3D \
19 case EdgePosition::H_nyn_3D: \
20 case EdgePosition::H_ny0_3D: \
21 case EdgePosition::H_nyN_3D: \
22 case EdgePosition::H_0yn_3D: \
23 case EdgePosition::H_0y0_3D: \
24 case EdgePosition::H_0yN_3D: \
25 case EdgePosition::H_Nyn_3D: \
26 case EdgePosition::H_Ny0_3D: \
27 case EdgePosition::H_NyN_3D
28#define CASE_EDGE_POSITION_P_3D \
29 case EdgePosition::P_nnz_3D: \
30 case EdgePosition::P_n0z_3D: \
31 case EdgePosition::P_nNz_3D: \
32 case EdgePosition::P_0nz_3D: \
33 case EdgePosition::P_00z_3D: \
34 case EdgePosition::P_0Nz_3D: \
35 case EdgePosition::P_Nnz_3D: \
36 case EdgePosition::P_N0z_3D: \
37 case EdgePosition::P_NNz_3D
38#define CASE_EDGE_POSITION_D1_3D \
39 case EdgePosition::D1_xyn_3D: \
40 case EdgePosition::D1_xy0_3D: \
41 case EdgePosition::D1_xyN_3D
42#define CASE_EDGE_POSITION_D2_3D \
43 case EdgePosition::D2_nyz_3D: \
44 case EdgePosition::D2_0yz_3D: \
45 case EdgePosition::D2_Nyz_3D
46#define CASE_EDGE_POSITION_D3_3D \
47 case EdgePosition::D3_xnz_3D: \
48 case EdgePosition::D3_x0z_3D: \
49 case EdgePosition::D3_xNz_3D
50#define CASE_EDGE_POSITION_L_2D \
51 case EdgePosition::L_xn_2D: \
52 case EdgePosition::L_x0_2D: \
53 case EdgePosition::L_xN_2D
54#define CASE_EDGE_POSITION_H_2D \
55 case EdgePosition::H_ny_2D: \
56 case EdgePosition::H_0y_2D: \
57 case EdgePosition::H_Ny_2D
60 : cellNumber_{}, vertexNumber_{}, edgeNumber_{}, triangleNumber_{},
61 tetrahedronNumber_{}, isAccelerated_{} {
64 this->hasPreconditionedDistributedEdges_ =
true;
65 this->hasPreconditionedDistributedTriangles_ =
true;
74 const float &xSpacing,
75 const float &ySpacing,
76 const float &zSpacing,
82 if(xDim < 1 or yDim < 1 or zDim < 1)
84 else if(xDim > 1 and yDim > 1 and zDim > 1)
86 else if((xDim > 1 and yDim > 1) or (yDim > 1 and zDim > 1)
87 or (xDim > 1 and zDim > 1))
89 else if(xDim > 1 or yDim > 1 or zDim > 1)
116 esetdims_[3] = (xDim - 1) * (yDim - 1) * zDim;
117 esetdims_[4] = xDim * (yDim - 1) * (zDim - 1);
118 esetdims_[5] = (xDim - 1) * yDim * (zDim - 1);
119 esetdims_[6] = (xDim - 1) * (yDim - 1) * (zDim - 1);
122 for(
int k = 1; k < 7; ++k)
126 eshift_[1] = (xDim - 1) * yDim;
128 eshift_[3] = xDim * (yDim - 1);
132 eshift_[7] = (xDim - 1) * (yDim - 1);
134 eshift_[9] = xDim * (yDim - 1);
136 eshift_[11] = (xDim - 1) * yDim;
138 eshift_[13] = (xDim - 1) * (yDim - 1);
140 tsetdims_[0] = (xDim - 1) * (yDim - 1) * zDim * 2;
141 tsetdims_[1] = (xDim - 1) * yDim * (zDim - 1) * 2;
142 tsetdims_[2] = xDim * (yDim - 1) * (zDim - 1) * 2;
143 tsetdims_[3] = (xDim - 1) * (yDim - 1) * (zDim - 1) * 2;
144 tsetdims_[4] = (xDim - 1) * (yDim - 1) * (zDim - 1) * 2;
145 tsetdims_[5] = (xDim - 1) * (yDim - 1) * (zDim - 1) * 2;
148 for(
int k = 1; k < 6; ++k)
152 tshift_[1] = (xDim - 1) * (yDim - 1) * 2;
154 tshift_[3] = (xDim - 1) * yDim * 2;
156 tshift_[5] = xDim * (yDim - 1) * 2;
158 tshift_[7] = (xDim - 1) * (yDim - 1) * 2;
160 tshift_[9] = (xDim - 1) * (yDim - 1) * 2;
162 tshift_[11] = (xDim - 1) * (yDim - 1) * 2;
165 tetshift_[1] = (xDim - 1) * (yDim - 1) * 6;
170 for(
int k = 0; k < 7; ++k)
173 for(
int k = 0; k < 6; ++k)
184 }
else if(yDim == 1) {
199 for(
int k = 1; k < 3; ++k)
211 for(
int k = 0; k < 3; ++k)
219 for(
int k = 0; k < 3; ++k) {
238 unsigned long long int msb[3];
240 bool allDimensionsArePowerOfTwo =
true;
241 for(
int k = 0; k < 3; ++k)
243 allDimensionsArePowerOfTwo =
false;
245 if(allDimensionsArePowerOfTwo) {
249 div_[1] = msb[0] + msb[1];
255 bool const allDimensionsArePowerOfTwo = (isDi and isDj);
257 if(allDimensionsArePowerOfTwo) {
272 unsigned long long int &r) {
273 if(v && !(v & (v - 1))) {
282template <
typename Derived>
287 if(this->metaGrid_ !=
nullptr) {
288 return this->isVertexOnGlobalBoundaryInternal(vertexId);
292#ifndef TTK_ENABLE_KAMIKAZE
293 if(vertexId < 0 or vertexId >= vertexNumber_)
297 switch(this->underlying().getVertexPosition(vertexId)) {
298 case VertexPosition::CENTER_3D:
299 case VertexPosition::CENTER_2D:
300 case VertexPosition::CENTER_1D:
307template <
typename Derived>
312 if(this->metaGrid_ !=
nullptr) {
313 return this->isEdgeOnGlobalBoundaryInternal(edgeId);
317#ifndef TTK_ENABLE_KAMIKAZE
318 if(edgeId < 0 or edgeId >= edgeNumber_)
322 switch(this->underlying().getEdgePosition(edgeId)) {
323 case EdgePosition::L_xnn_3D:
324 case EdgePosition::H_nyn_3D:
325 case EdgePosition::P_nnz_3D:
326 case EdgePosition::D1_xyn_3D:
327 case EdgePosition::D2_nyz_3D:
328 case EdgePosition::D3_xnz_3D:
329 case EdgePosition::D4_3D:
330 case EdgePosition::L_xn_2D:
331 case EdgePosition::H_ny_2D:
332 case EdgePosition::D1_2D:
344 if(this->metaGrid_ !=
nullptr) {
345 return this->isTriangleOnGlobalBoundaryInternal(triangleId);
349#ifndef TTK_ENABLE_KAMIKAZE
350 if(triangleId < 0 or triangleId >= triangleNumber_)
354 if(dimensionality_ == 3)
360const vector<vector<SimplexId>> *
362 if(vertexNeighborList_.empty()) {
364 vertexNeighborList_.resize(vertexNumber_);
365 for(
SimplexId i = 0; i < vertexNumber_; ++i) {
371 printMsg(
"Built " + to_string(vertexNumber_) +
" vertex neighbors.", 1,
375 return &vertexNeighborList_;
383template <
typename Derived>
386#ifndef TTK_ENABLE_KAMIKAZE
387 if(localEdgeId < 0 or localEdgeId >= getVertexEdgeNumberInternal(vertexId))
407 const auto &p = this->underlying().getVertexCoords(vertexId);
409 switch(this->underlying().getVertexPosition(vertexId)) {
410 case VertexPosition::CENTER_3D:
411 edgeId = getVertexEdgeABCDEFGH(p.data(), localEdgeId);
413 case VertexPosition::FRONT_FACE_3D:
414 edgeId = getVertexEdgeABDC(p.data(), localEdgeId);
416 case VertexPosition::BACK_FACE_3D:
417 edgeId = getVertexEdgeEFHG(p.data(), localEdgeId);
419 case VertexPosition::TOP_FACE_3D:
420 edgeId = getVertexEdgeAEFB(p.data(), localEdgeId);
422 case VertexPosition::BOTTOM_FACE_3D:
423 edgeId = getVertexEdgeGHDC(p.data(), localEdgeId);
425 case VertexPosition::LEFT_FACE_3D:
426 edgeId = getVertexEdgeAEGC(p.data(), localEdgeId);
428 case VertexPosition::RIGHT_FACE_3D:
429 edgeId = getVertexEdgeBFHD(p.data(), localEdgeId);
431 case VertexPosition::TOP_FRONT_EDGE_3D:
432 edgeId = getVertexEdgeAB(p.data(), localEdgeId);
434 case VertexPosition::BOTTOM_FRONT_EDGE_3D:
435 edgeId = getVertexEdgeCD(p.data(), localEdgeId);
437 case VertexPosition::LEFT_FRONT_EDGE_3D:
438 edgeId = getVertexEdgeAC(p.data(), localEdgeId);
440 case VertexPosition::RIGHT_FRONT_EDGE_3D:
441 edgeId = getVertexEdgeBD(p.data(), localEdgeId);
443 case VertexPosition::TOP_BACK_EDGE_3D:
444 edgeId = getVertexEdgeEF(p.data(), localEdgeId);
446 case VertexPosition::BOTTOM_BACK_EDGE_3D:
447 edgeId = getVertexEdgeGH(p.data(), localEdgeId);
449 case VertexPosition::LEFT_BACK_EDGE_3D:
450 edgeId = getVertexEdgeEG(p.data(), localEdgeId);
452 case VertexPosition::RIGHT_BACK_EDGE_3D:
453 edgeId = getVertexEdgeFH(p.data(), localEdgeId);
455 case VertexPosition::TOP_LEFT_EDGE_3D:
456 edgeId = getVertexEdgeAE(p.data(), localEdgeId);
458 case VertexPosition::TOP_RIGHT_EDGE_3D:
459 edgeId = getVertexEdgeBF(p.data(), localEdgeId);
461 case VertexPosition::BOTTOM_LEFT_EDGE_3D:
462 edgeId = getVertexEdgeCG(p.data(), localEdgeId);
464 case VertexPosition::BOTTOM_RIGHT_EDGE_3D:
465 edgeId = getVertexEdgeDH(p.data(), localEdgeId);
467 case VertexPosition::TOP_LEFT_FRONT_CORNER_3D:
468 edgeId = getVertexEdgeA(p.data(), localEdgeId);
470 case VertexPosition::TOP_RIGHT_FRONT_CORNER_3D:
471 edgeId = getVertexEdgeB(p.data(), localEdgeId);
473 case VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D:
474 edgeId = getVertexEdgeC(p.data(), localEdgeId);
476 case VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D:
477 edgeId = getVertexEdgeD(p.data(), localEdgeId);
479 case VertexPosition::TOP_LEFT_BACK_CORNER_3D:
480 edgeId = getVertexEdgeE(p.data(), localEdgeId);
482 case VertexPosition::TOP_RIGHT_BACK_CORNER_3D:
483 edgeId = getVertexEdgeF(p.data(), localEdgeId);
485 case VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D:
486 edgeId = getVertexEdgeG(p.data(), localEdgeId);
488 case VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D:
489 edgeId = getVertexEdgeH(p.data(), localEdgeId);
491 case VertexPosition::CENTER_2D:
492 edgeId = getVertexEdge2dABCD(p.data(), localEdgeId);
494 case VertexPosition::TOP_EDGE_2D:
495 edgeId = getVertexEdge2dAB(p.data(), localEdgeId);
497 case VertexPosition::BOTTOM_EDGE_2D:
498 edgeId = getVertexEdge2dCD(p.data(), localEdgeId);
500 case VertexPosition::LEFT_EDGE_2D:
501 edgeId = getVertexEdge2dAC(p.data(), localEdgeId);
503 case VertexPosition::RIGHT_EDGE_2D:
504 edgeId = getVertexEdge2dBD(p.data(), localEdgeId);
506 case VertexPosition::TOP_LEFT_CORNER_2D:
507 edgeId = getVertexEdge2dA(p.data(), localEdgeId);
509 case VertexPosition::TOP_RIGHT_CORNER_2D:
510 edgeId = getVertexEdge2dB(p.data(), localEdgeId);
512 case VertexPosition::BOTTOM_LEFT_CORNER_2D:
513 edgeId = getVertexEdge2dC(p.data(), localEdgeId);
515 case VertexPosition::BOTTOM_RIGHT_CORNER_2D:
516 edgeId = getVertexEdge2dD(p.data(), localEdgeId);
518 case VertexPosition::CENTER_1D:
519 edgeId = (localEdgeId == 0 ? vertexId : vertexId - 1);
521 case VertexPosition::LEFT_CORNER_1D:
524 case VertexPosition::RIGHT_CORNER_1D:
525 edgeId = vertexId - 1;
534const vector<vector<SimplexId>> *
553template <
typename Derived>
556#ifndef TTK_ENABLE_KAMIKAZE
557 if(vertexId < 0 or vertexId >= vertexNumber_)
561 switch(this->underlying().getVertexPosition(vertexId)) {
562 case VertexPosition::CENTER_3D:
564 case VertexPosition::FRONT_FACE_3D:
565 case VertexPosition::BACK_FACE_3D:
566 case VertexPosition::TOP_FACE_3D:
567 case VertexPosition::BOTTOM_FACE_3D:
568 case VertexPosition::LEFT_FACE_3D:
569 case VertexPosition::RIGHT_FACE_3D:
571 case VertexPosition::TOP_FRONT_EDGE_3D:
572 case VertexPosition::RIGHT_FRONT_EDGE_3D:
573 case VertexPosition::BOTTOM_BACK_EDGE_3D:
574 case VertexPosition::LEFT_BACK_EDGE_3D:
575 case VertexPosition::BOTTOM_LEFT_EDGE_3D:
576 case VertexPosition::TOP_RIGHT_EDGE_3D:
578 case VertexPosition::TOP_RIGHT_FRONT_CORNER_3D:
579 case VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D:
581 case VertexPosition::TOP_BACK_EDGE_3D:
582 case VertexPosition::BOTTOM_FRONT_EDGE_3D:
583 case VertexPosition::LEFT_FRONT_EDGE_3D:
584 case VertexPosition::TOP_LEFT_EDGE_3D:
585 case VertexPosition::RIGHT_BACK_EDGE_3D:
586 case VertexPosition::BOTTOM_RIGHT_EDGE_3D:
588 case VertexPosition::TOP_LEFT_FRONT_CORNER_3D:
589 case VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D:
590 case VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D:
591 case VertexPosition::TOP_LEFT_BACK_CORNER_3D:
592 case VertexPosition::TOP_RIGHT_BACK_CORNER_3D:
593 case VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D:
602template <
typename Derived>
605 const int &localTriangleId,
607#ifndef TTK_ENABLE_KAMIKAZE
608 if(localTriangleId < 0
609 or localTriangleId >= getVertexTriangleNumberInternal(vertexId))
613 const auto &p = this->underlying().getVertexCoords(vertexId);
615 switch(this->underlying().getVertexPosition(vertexId)) {
616 case VertexPosition::CENTER_3D:
617 triangleId = getVertexTriangleABCDEFGH(p.data(), localTriangleId);
619 case VertexPosition::FRONT_FACE_3D:
620 triangleId = getVertexTriangleABDC(p.data(), localTriangleId);
622 case VertexPosition::BACK_FACE_3D:
623 triangleId = getVertexTriangleEFHG(p.data(), localTriangleId);
625 case VertexPosition::TOP_FACE_3D:
626 triangleId = getVertexTriangleAEFB(p.data(), localTriangleId);
628 case VertexPosition::BOTTOM_FACE_3D:
629 triangleId = getVertexTriangleGHDC(p.data(), localTriangleId);
631 case VertexPosition::LEFT_FACE_3D:
632 triangleId = getVertexTriangleAEGC(p.data(), localTriangleId);
634 case VertexPosition::RIGHT_FACE_3D:
635 triangleId = getVertexTriangleBFHD(p.data(), localTriangleId);
637 case VertexPosition::TOP_FRONT_EDGE_3D:
638 triangleId = getVertexTriangleAB(p.data(), localTriangleId);
640 case VertexPosition::BOTTOM_FRONT_EDGE_3D:
641 triangleId = getVertexTriangleCD(p.data(), localTriangleId);
643 case VertexPosition::LEFT_FRONT_EDGE_3D:
644 triangleId = getVertexTriangleAC(p.data(), localTriangleId);
646 case VertexPosition::RIGHT_FRONT_EDGE_3D:
647 triangleId = getVertexTriangleBD(p.data(), localTriangleId);
649 case VertexPosition::TOP_BACK_EDGE_3D:
650 triangleId = getVertexTriangleEF(p.data(), localTriangleId);
652 case VertexPosition::BOTTOM_BACK_EDGE_3D:
653 triangleId = getVertexTriangleGH(p.data(), localTriangleId);
655 case VertexPosition::LEFT_BACK_EDGE_3D:
656 triangleId = getVertexTriangleEG(p.data(), localTriangleId);
658 case VertexPosition::RIGHT_BACK_EDGE_3D:
659 triangleId = getVertexTriangleFH(p.data(), localTriangleId);
661 case VertexPosition::TOP_LEFT_EDGE_3D:
662 triangleId = getVertexTriangleAE(p.data(), localTriangleId);
664 case VertexPosition::TOP_RIGHT_EDGE_3D:
665 triangleId = getVertexTriangleBF(p.data(), localTriangleId);
667 case VertexPosition::BOTTOM_LEFT_EDGE_3D:
668 triangleId = getVertexTriangleCG(p.data(), localTriangleId);
670 case VertexPosition::BOTTOM_RIGHT_EDGE_3D:
671 triangleId = getVertexTriangleDH(p.data(), localTriangleId);
673 case VertexPosition::TOP_LEFT_FRONT_CORNER_3D:
674 triangleId = getVertexTriangleA(p.data(), localTriangleId);
676 case VertexPosition::TOP_RIGHT_FRONT_CORNER_3D:
677 triangleId = getVertexTriangleB(p.data(), localTriangleId);
679 case VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D:
680 triangleId = getVertexTriangleC(p.data(), localTriangleId);
682 case VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D:
683 triangleId = getVertexTriangleD(p.data(), localTriangleId);
685 case VertexPosition::TOP_LEFT_BACK_CORNER_3D:
686 triangleId = getVertexTriangleE(p.data(), localTriangleId);
688 case VertexPosition::TOP_RIGHT_BACK_CORNER_3D:
689 triangleId = getVertexTriangleF(p.data(), localTriangleId);
691 case VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D:
692 triangleId = getVertexTriangleG(p.data(), localTriangleId);
694 case VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D:
695 triangleId = getVertexTriangleH(p.data(), localTriangleId);
705const vector<vector<SimplexId>> *
724SimplexId ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL(
729template <
typename Derived>
732 const int &localLinkId,
735#ifndef TTK_ENABLE_KAMIKAZE
740 const auto &p = this->underlying().getVertexCoords(vertexId);
742 switch(this->underlying().getVertexPosition(vertexId)) {
743 case VertexPosition::CENTER_3D:
744 linkId = getVertexLinkABCDEFGH(p.data(), localLinkId);
746 case VertexPosition::FRONT_FACE_3D:
747 linkId = getVertexLinkABDC(p.data(), localLinkId);
749 case VertexPosition::BACK_FACE_3D:
750 linkId = getVertexLinkEFHG(p.data(), localLinkId);
752 case VertexPosition::TOP_FACE_3D:
753 linkId = getVertexLinkAEFB(p.data(), localLinkId);
755 case VertexPosition::BOTTOM_FACE_3D:
756 linkId = getVertexLinkGHDC(p.data(), localLinkId);
758 case VertexPosition::LEFT_FACE_3D:
759 linkId = getVertexLinkAEGC(p.data(), localLinkId);
761 case VertexPosition::RIGHT_FACE_3D:
762 linkId = getVertexLinkBFHD(p.data(), localLinkId);
764 case VertexPosition::TOP_FRONT_EDGE_3D:
765 linkId = getVertexLinkAB(p.data(), localLinkId);
767 case VertexPosition::BOTTOM_FRONT_EDGE_3D:
768 linkId = getVertexLinkCD(p.data(), localLinkId);
770 case VertexPosition::LEFT_FRONT_EDGE_3D:
771 linkId = getVertexLinkAC(p.data(), localLinkId);
773 case VertexPosition::RIGHT_FRONT_EDGE_3D:
774 linkId = getVertexLinkBD(p.data(), localLinkId);
776 case VertexPosition::TOP_BACK_EDGE_3D:
777 linkId = getVertexLinkEF(p.data(), localLinkId);
779 case VertexPosition::BOTTOM_BACK_EDGE_3D:
780 linkId = getVertexLinkGH(p.data(), localLinkId);
782 case VertexPosition::LEFT_BACK_EDGE_3D:
783 linkId = getVertexLinkEG(p.data(), localLinkId);
785 case VertexPosition::RIGHT_BACK_EDGE_3D:
786 linkId = getVertexLinkFH(p.data(), localLinkId);
788 case VertexPosition::TOP_LEFT_EDGE_3D:
789 linkId = getVertexLinkAE(p.data(), localLinkId);
791 case VertexPosition::TOP_RIGHT_EDGE_3D:
792 linkId = getVertexLinkBF(p.data(), localLinkId);
794 case VertexPosition::BOTTOM_LEFT_EDGE_3D:
795 linkId = getVertexLinkCG(p.data(), localLinkId);
797 case VertexPosition::BOTTOM_RIGHT_EDGE_3D:
798 linkId = getVertexLinkDH(p.data(), localLinkId);
800 case VertexPosition::TOP_LEFT_FRONT_CORNER_3D:
801 linkId = getVertexLinkA(p.data(), localLinkId);
803 case VertexPosition::TOP_RIGHT_FRONT_CORNER_3D:
804 linkId = getVertexLinkB(p.data(), localLinkId);
806 case VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D:
807 linkId = getVertexLinkC(p.data(), localLinkId);
809 case VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D:
810 linkId = getVertexLinkD(p.data(), localLinkId);
812 case VertexPosition::TOP_LEFT_BACK_CORNER_3D:
813 linkId = getVertexLinkE(p.data(), localLinkId);
815 case VertexPosition::TOP_RIGHT_BACK_CORNER_3D:
816 linkId = getVertexLinkF(p.data(), localLinkId);
818 case VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D:
819 linkId = getVertexLinkG(p.data(), localLinkId);
821 case VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D:
822 linkId = getVertexLinkH(p.data(), localLinkId);
824 case VertexPosition::CENTER_2D:
825 linkId = getVertexLink2dABCD(p.data(), localLinkId);
827 case VertexPosition::TOP_EDGE_2D:
828 linkId = getVertexLink2dAB(p.data(), localLinkId);
830 case VertexPosition::BOTTOM_EDGE_2D:
831 linkId = getVertexLink2dCD(p.data(), localLinkId);
833 case VertexPosition::LEFT_EDGE_2D:
834 linkId = getVertexLink2dAC(p.data(), localLinkId);
836 case VertexPosition::RIGHT_EDGE_2D:
837 linkId = getVertexLink2dBD(p.data(), localLinkId);
839 case VertexPosition::TOP_LEFT_CORNER_2D:
840 linkId = getVertexLink2dA(p.data(), localLinkId);
842 case VertexPosition::TOP_RIGHT_CORNER_2D:
843 linkId = getVertexLink2dB(p.data(), localLinkId);
845 case VertexPosition::BOTTOM_LEFT_CORNER_2D:
846 linkId = getVertexLink2dC(p.data(), localLinkId);
848 case VertexPosition::BOTTOM_RIGHT_CORNER_2D:
849 linkId = getVertexLink2dD(p.data(), localLinkId);
859const vector<vector<SimplexId>> *
861 if(vertexLinkList_.empty()) {
864 vertexLinkList_.resize(vertexNumber_);
865 for(
SimplexId i = 0; i < vertexNumber_; ++i) {
871 printMsg(
"Built " + to_string(vertexNumber_) +
" vertex links.", 1,
875 return &vertexLinkList_;
878template <
typename Derived>
882#ifndef TTK_ENABLE_KAMIKAZE
883 if(vertexId < 0 or vertexId >= vertexNumber_)
887 switch(this->underlying().getVertexPosition(vertexId)) {
888 case VertexPosition::CENTER_3D:
890 case VertexPosition::FRONT_FACE_3D:
891 case VertexPosition::BACK_FACE_3D:
892 case VertexPosition::TOP_FACE_3D:
893 case VertexPosition::BOTTOM_FACE_3D:
894 case VertexPosition::LEFT_FACE_3D:
895 case VertexPosition::RIGHT_FACE_3D:
897 case VertexPosition::TOP_FRONT_EDGE_3D:
898 case VertexPosition::RIGHT_FRONT_EDGE_3D:
899 case VertexPosition::BOTTOM_BACK_EDGE_3D:
900 case VertexPosition::LEFT_BACK_EDGE_3D:
901 case VertexPosition::BOTTOM_LEFT_EDGE_3D:
902 case VertexPosition::TOP_RIGHT_EDGE_3D:
904 case VertexPosition::TOP_RIGHT_FRONT_CORNER_3D:
905 case VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D:
906 case VertexPosition::CENTER_2D:
908 case VertexPosition::TOP_BACK_EDGE_3D:
909 case VertexPosition::BOTTOM_FRONT_EDGE_3D:
910 case VertexPosition::LEFT_FRONT_EDGE_3D:
911 case VertexPosition::TOP_LEFT_EDGE_3D:
912 case VertexPosition::RIGHT_BACK_EDGE_3D:
913 case VertexPosition::BOTTOM_RIGHT_EDGE_3D:
915 case VertexPosition::TOP_EDGE_2D:
916 case VertexPosition::BOTTOM_EDGE_2D:
917 case VertexPosition::LEFT_EDGE_2D:
918 case VertexPosition::RIGHT_EDGE_2D:
920 case VertexPosition::TOP_LEFT_FRONT_CORNER_3D:
921 case VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D:
922 case VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D:
923 case VertexPosition::TOP_LEFT_BACK_CORNER_3D:
924 case VertexPosition::TOP_RIGHT_BACK_CORNER_3D:
925 case VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D:
926 case VertexPosition::TOP_RIGHT_CORNER_2D:
927 case VertexPosition::BOTTOM_LEFT_CORNER_2D:
929 case VertexPosition::TOP_LEFT_CORNER_2D:
930 case VertexPosition::BOTTOM_RIGHT_CORNER_2D:
939template <
typename Derived>
942 const int &localStarId,
945#ifndef TTK_ENABLE_KAMIKAZE
950 const auto &p = this->underlying().getVertexCoords(vertexId);
952 switch(this->underlying().getVertexPosition(vertexId)) {
953 case VertexPosition::CENTER_3D:
954 starId = getVertexStarABCDEFGH(p.data(), localStarId);
956 case VertexPosition::FRONT_FACE_3D:
957 starId = getVertexStarABDC(p.data(), localStarId);
959 case VertexPosition::BACK_FACE_3D:
960 starId = getVertexStarEFHG(p.data(), localStarId);
962 case VertexPosition::TOP_FACE_3D:
963 starId = getVertexStarAEFB(p.data(), localStarId);
965 case VertexPosition::BOTTOM_FACE_3D:
966 starId = getVertexStarGHDC(p.data(), localStarId);
968 case VertexPosition::LEFT_FACE_3D:
969 starId = getVertexStarAEGC(p.data(), localStarId);
971 case VertexPosition::RIGHT_FACE_3D:
972 starId = getVertexStarBFHD(p.data(), localStarId);
974 case VertexPosition::TOP_FRONT_EDGE_3D:
975 starId = getVertexStarAB(p.data(), localStarId);
977 case VertexPosition::BOTTOM_FRONT_EDGE_3D:
978 starId = getVertexStarCD(p.data(), localStarId);
980 case VertexPosition::LEFT_FRONT_EDGE_3D:
981 starId = getVertexStarAC(p.data(), localStarId);
983 case VertexPosition::RIGHT_FRONT_EDGE_3D:
984 starId = getVertexStarBD(p.data(), localStarId);
986 case VertexPosition::TOP_BACK_EDGE_3D:
987 starId = getVertexStarEF(p.data(), localStarId);
989 case VertexPosition::BOTTOM_BACK_EDGE_3D:
990 starId = getVertexStarGH(p.data(), localStarId);
992 case VertexPosition::LEFT_BACK_EDGE_3D:
993 starId = getVertexStarEG(p.data(), localStarId);
995 case VertexPosition::RIGHT_BACK_EDGE_3D:
996 starId = getVertexStarFH(p.data(), localStarId);
998 case VertexPosition::TOP_LEFT_EDGE_3D:
999 starId = getVertexStarAE(p.data(), localStarId);
1001 case VertexPosition::TOP_RIGHT_EDGE_3D:
1002 starId = getVertexStarBF(p.data(), localStarId);
1004 case VertexPosition::BOTTOM_LEFT_EDGE_3D:
1005 starId = getVertexStarCG(p.data(), localStarId);
1007 case VertexPosition::BOTTOM_RIGHT_EDGE_3D:
1008 starId = getVertexStarDH(p.data(), localStarId);
1010 case VertexPosition::TOP_LEFT_FRONT_CORNER_3D:
1011 starId = getVertexStarA(p.data(), localStarId);
1013 case VertexPosition::TOP_RIGHT_FRONT_CORNER_3D:
1014 starId = getVertexStarB(p.data(), localStarId);
1016 case VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D:
1017 starId = getVertexStarC(p.data(), localStarId);
1019 case VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D:
1020 starId = getVertexStarD(p.data(), localStarId);
1022 case VertexPosition::TOP_LEFT_BACK_CORNER_3D:
1023 starId = getVertexStarE(p.data(), localStarId);
1025 case VertexPosition::TOP_RIGHT_BACK_CORNER_3D:
1026 starId = getVertexStarF(p.data(), localStarId);
1028 case VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D:
1029 starId = getVertexStarG(p.data(), localStarId);
1031 case VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D:
1032 starId = getVertexStarH(p.data(), localStarId);
1034 case VertexPosition::CENTER_2D:
1035 starId = getVertexStar2dABCD(p.data(), localStarId);
1037 case VertexPosition::TOP_EDGE_2D:
1038 starId = getVertexStar2dAB(p.data(), localStarId);
1040 case VertexPosition::BOTTOM_EDGE_2D:
1041 starId = getVertexStar2dCD(p.data(), localStarId);
1043 case VertexPosition::LEFT_EDGE_2D:
1044 starId = getVertexStar2dAC(p.data(), localStarId);
1046 case VertexPosition::RIGHT_EDGE_2D:
1047 starId = getVertexStar2dBD(p.data(), localStarId);
1049 case VertexPosition::TOP_LEFT_CORNER_2D:
1050 starId = getVertexStar2dA(p.data(), localStarId);
1052 case VertexPosition::TOP_RIGHT_CORNER_2D:
1053 starId = getVertexStar2dB(p.data(), localStarId);
1055 case VertexPosition::BOTTOM_LEFT_CORNER_2D:
1056 starId = getVertexStar2dC(p.data(), localStarId);
1058 case VertexPosition::BOTTOM_RIGHT_CORNER_2D:
1059 starId = getVertexStar2dD(p.data(), localStarId);
1069const vector<vector<SimplexId>> *
1072 if(vertexStarList_.empty()) {
1074 vertexStarList_.resize(vertexNumber_);
1075 for(
SimplexId i = 0; i < vertexNumber_; ++i) {
1081 printMsg(
"Built " + to_string(vertexNumber_) +
" vertex stars.", 1,
1085 return &vertexStarList_;
1088template <
typename Derived>
1095 if(dimensionality_ == 3) {
1096 const auto &p = this->underlying().getVertexCoords(vertexId);
1098 x = origin_[0] + spacing_[0] * p[0];
1099 y = origin_[1] + spacing_[1] * p[1];
1100 z = origin_[2] + spacing_[2] * p[2];
1101 }
else if(dimensionality_ == 2) {
1102 const auto &p = this->underlying().getVertexCoords(vertexId);
1104 if(dimensions_[0] > 1 and dimensions_[1] > 1) {
1105 x = origin_[0] + spacing_[0] * p[0];
1106 y = origin_[1] + spacing_[1] * p[1];
1108 }
else if(dimensions_[1] > 1 and dimensions_[2] > 1) {
1110 y = origin_[1] + spacing_[1] * p[0];
1111 z = origin_[2] + spacing_[2] * p[1];
1112 }
else if(dimensions_[0] > 1 and dimensions_[2] > 1) {
1113 x = origin_[0] + spacing_[0] * p[0];
1115 z = origin_[2] + spacing_[2] * p[1];
1117 }
else if(dimensionality_ == 1) {
1118 if(dimensions_[0] > 1) {
1119 x = origin_[0] + spacing_[0] * vertexId;
1122 }
else if(dimensions_[1] > 1) {
1124 y = origin_[1] + spacing_[1] * vertexId;
1126 }
else if(dimensions_[2] > 1) {
1129 z = origin_[2] + spacing_[2] * vertexId;
1136template <
typename Derived>
1139 const int &localVertexId,
1141#ifndef TTK_ENABLE_KAMIKAZE
1142 if(edgeId < 0 or edgeId >= edgeNumber_)
1144 if(localVertexId < 0 or localVertexId >= 2)
1148 const auto &p = this->underlying().getEdgeCoords(edgeId);
1151 if(isAccelerated_) {
1152 const auto tmp = p[0] + (p[1] << div_[0]) + (p[2] << div_[1]);
1153 return (localVertexId == 0) ? tmp + a : tmp + b;
1155 const auto tmp = p[0] + (p[1] * vshift_[0]) + (p[2] * vshift_[1]);
1156 return (localVertexId == 0) ? tmp + a : tmp + b;
1161 if(isAccelerated_) {
1162 const auto tmp = p[0] + (p[1] << div_[0]);
1163 return localVertexId == 0 ? tmp + a : tmp + b;
1165 const auto tmp = p[0] + (p[1] * vshift_[0]);
1166 return localVertexId == 0 ? tmp + a : tmp + b;
1170 switch(this->underlying().getEdgePosition(edgeId)) {
1172 vertexId = helper3d(0, 1);
1175 vertexId = helper3d(0, vshift_[0]);
1178 vertexId = helper3d(0, vshift_[1]);
1181 vertexId = helper3d(1, vshift_[0]);
1184 vertexId = helper3d(0, vshift_[0] + vshift_[1]);
1187 vertexId = helper3d(1, vshift_[1]);
1189 case EdgePosition::D4_3D:
1190 vertexId = helper3d(1, vshift_[0] + vshift_[1]);
1194 vertexId = helper2d(0, 1);
1197 vertexId = helper2d(0, vshift_[0]);
1199 case EdgePosition::D1_2D:
1200 vertexId = helper2d(1, vshift_[0]);
1203 case EdgePosition::FIRST_EDGE_1D:
1204 vertexId = localVertexId == 0 ? 0 : 1;
1206 case EdgePosition::LAST_EDGE_1D:
1207 vertexId = localVertexId == 0 ? edgeNumber_ - 1 : edgeNumber_;
1209 case EdgePosition::CENTER_1D:
1210 vertexId = localVertexId == 0 ? edgeId : edgeId + 1;
1217const vector<std::array<SimplexId, 2>> *
1218 ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL(
getEdges)() {
1220 if(edgeList_.empty()) {
1223 edgeList_.resize(edgeNumber_);
1224 for(
SimplexId i = 0; i < edgeNumber_; ++i) {
1226 getEdgeVertexInternal(i, 0, id0);
1227 getEdgeVertexInternal(i, 1, id1);
1228 edgeList_[i] = {id0, id1};
1232 "Built " + to_string(edgeNumber_) +
" edges.", 1, t.
getElapsedTime(), 1);
1238template <
typename Derived>
1241#ifndef TTK_ENABLE_KAMIKAZE
1242 if(edgeId < 0 or edgeId >= edgeNumber_)
1246 switch(this->underlying().getEdgePosition(edgeId)) {
1247 case EdgePosition::L_xnn_3D:
1248 case EdgePosition::H_nyn_3D:
1249 case EdgePosition::P_nnz_3D:
1250 case EdgePosition::D4_3D:
1252 case EdgePosition::L_x0n_3D:
1253 case EdgePosition::L_xNn_3D:
1254 case EdgePosition::L_xn0_3D:
1255 case EdgePosition::L_xnN_3D:
1256 case EdgePosition::H_ny0_3D:
1257 case EdgePosition::H_nyN_3D:
1258 case EdgePosition::H_0yn_3D:
1259 case EdgePosition::H_Nyn_3D:
1260 case EdgePosition::P_n0z_3D:
1261 case EdgePosition::P_nNz_3D:
1262 case EdgePosition::P_0nz_3D:
1263 case EdgePosition::P_Nnz_3D:
1264 case EdgePosition::D1_xyn_3D:
1265 case EdgePosition::D2_nyz_3D:
1266 case EdgePosition::D3_xnz_3D:
1268 case EdgePosition::L_x00_3D:
1269 case EdgePosition::L_xNN_3D:
1270 case EdgePosition::H_0yN_3D:
1271 case EdgePosition::H_Ny0_3D:
1272 case EdgePosition::P_0Nz_3D:
1273 case EdgePosition::P_N0z_3D:
1274 case EdgePosition::D1_xy0_3D:
1275 case EdgePosition::D1_xyN_3D:
1276 case EdgePosition::D2_0yz_3D:
1277 case EdgePosition::D2_Nyz_3D:
1278 case EdgePosition::D3_x0z_3D:
1279 case EdgePosition::D3_xNz_3D:
1281 case EdgePosition::L_xN0_3D:
1282 case EdgePosition::L_x0N_3D:
1283 case EdgePosition::H_0y0_3D:
1284 case EdgePosition::H_NyN_3D:
1285 case EdgePosition::P_00z_3D:
1286 case EdgePosition::P_NNz_3D:
1287 case EdgePosition::L_xn_2D:
1288 case EdgePosition::H_ny_2D:
1289 case EdgePosition::D1_2D:
1291 case EdgePosition::L_x0_2D:
1292 case EdgePosition::L_xN_2D:
1293 case EdgePosition::H_0y_2D:
1294 case EdgePosition::H_Ny_2D:
1304template <
typename Derived>
1307 const int &localTriangleId,
1309#ifndef TTK_ENABLE_KAMIKAZE
1310 if(localTriangleId < 0
1311 or localTriangleId >= getEdgeTriangleNumberInternal(edgeId))
1315 const auto &p = this->underlying().getEdgeCoords(edgeId);
1317 switch(this->underlying().getEdgePosition(edgeId)) {
1318 case EdgePosition::L_xnn_3D:
1319 triangleId = getEdgeTriangleL_xnn(p.data(), localTriangleId);
1321 case EdgePosition::L_xn0_3D:
1322 triangleId = getEdgeTriangleL_xn0(p.data(), localTriangleId);
1324 case EdgePosition::L_xnN_3D:
1325 triangleId = getEdgeTriangleL_xnN(p.data(), localTriangleId);
1327 case EdgePosition::L_x0n_3D:
1328 triangleId = getEdgeTriangleL_x0n(p.data(), localTriangleId);
1330 case EdgePosition::L_x00_3D:
1331 triangleId = getEdgeTriangleL_x00(p.data(), localTriangleId);
1333 case EdgePosition::L_x0N_3D:
1334 triangleId = getEdgeTriangleL_x0N(p.data(), localTriangleId);
1336 case EdgePosition::L_xNn_3D:
1337 triangleId = getEdgeTriangleL_xNn(p.data(), localTriangleId);
1339 case EdgePosition::L_xN0_3D:
1340 triangleId = getEdgeTriangleL_xN0(p.data(), localTriangleId);
1342 case EdgePosition::L_xNN_3D:
1343 triangleId = getEdgeTriangleL_xNN(p.data(), localTriangleId);
1345 case EdgePosition::H_nyn_3D:
1346 triangleId = getEdgeTriangleH_nyn(p.data(), localTriangleId);
1348 case EdgePosition::H_ny0_3D:
1349 triangleId = getEdgeTriangleH_ny0(p.data(), localTriangleId);
1351 case EdgePosition::H_nyN_3D:
1352 triangleId = getEdgeTriangleH_nyN(p.data(), localTriangleId);
1354 case EdgePosition::H_0yn_3D:
1355 triangleId = getEdgeTriangleH_0yn(p.data(), localTriangleId);
1357 case EdgePosition::H_0y0_3D:
1358 triangleId = getEdgeTriangleH_0y0(p.data(), localTriangleId);
1360 case EdgePosition::H_0yN_3D:
1361 triangleId = getEdgeTriangleH_0yN(p.data(), localTriangleId);
1363 case EdgePosition::H_Nyn_3D:
1364 triangleId = getEdgeTriangleH_Nyn(p.data(), localTriangleId);
1366 case EdgePosition::H_Ny0_3D:
1367 triangleId = getEdgeTriangleH_Ny0(p.data(), localTriangleId);
1369 case EdgePosition::H_NyN_3D:
1370 triangleId = getEdgeTriangleH_NyN(p.data(), localTriangleId);
1372 case EdgePosition::P_nnz_3D:
1373 triangleId = getEdgeTriangleP_nnz(p.data(), localTriangleId);
1375 case EdgePosition::P_n0z_3D:
1376 triangleId = getEdgeTriangleP_n0z(p.data(), localTriangleId);
1378 case EdgePosition::P_nNz_3D:
1379 triangleId = getEdgeTriangleP_nNz(p.data(), localTriangleId);
1381 case EdgePosition::P_0nz_3D:
1382 triangleId = getEdgeTriangleP_0nz(p.data(), localTriangleId);
1384 case EdgePosition::P_00z_3D:
1385 triangleId = getEdgeTriangleP_00z(p.data(), localTriangleId);
1387 case EdgePosition::P_0Nz_3D:
1388 triangleId = getEdgeTriangleP_0Nz(p.data(), localTriangleId);
1390 case EdgePosition::P_Nnz_3D:
1391 triangleId = getEdgeTriangleP_Nnz(p.data(), localTriangleId);
1393 case EdgePosition::P_N0z_3D:
1394 triangleId = getEdgeTriangleP_N0z(p.data(), localTriangleId);
1396 case EdgePosition::P_NNz_3D:
1397 triangleId = getEdgeTriangleP_NNz(p.data(), localTriangleId);
1399 case EdgePosition::D1_xyn_3D:
1400 triangleId = getEdgeTriangleD1_xyn(p.data(), localTriangleId);
1402 case EdgePosition::D1_xy0_3D:
1403 triangleId = getEdgeTriangleD1_xy0(p.data(), localTriangleId);
1405 case EdgePosition::D1_xyN_3D:
1406 triangleId = getEdgeTriangleD1_xyN(p.data(), localTriangleId);
1408 case EdgePosition::D2_nyz_3D:
1409 triangleId = getEdgeTriangleD2_nyz(p.data(), localTriangleId);
1411 case EdgePosition::D2_0yz_3D:
1412 triangleId = getEdgeTriangleD2_0yz(p.data(), localTriangleId);
1414 case EdgePosition::D2_Nyz_3D:
1415 triangleId = getEdgeTriangleD2_Nyz(p.data(), localTriangleId);
1417 case EdgePosition::D3_xnz_3D:
1418 triangleId = getEdgeTriangleD3_xnz(p.data(), localTriangleId);
1420 case EdgePosition::D3_x0z_3D:
1421 triangleId = getEdgeTriangleD3_x0z(p.data(), localTriangleId);
1423 case EdgePosition::D3_xNz_3D:
1424 triangleId = getEdgeTriangleD3_xNz(p.data(), localTriangleId);
1426 case EdgePosition::D4_3D:
1427 triangleId = getEdgeTriangleD4_xyz(p.data(), localTriangleId);
1430 case EdgePosition::L_xn_2D:
1431 triangleId = getEdgeTriangleL_xn(p.data(), localTriangleId);
1433 case EdgePosition::L_x0_2D:
1434 triangleId = getEdgeTriangleL_x0(p.data(), localTriangleId);
1436 case EdgePosition::L_xN_2D:
1437 triangleId = getEdgeTriangleL_xN(p.data(), localTriangleId);
1439 case EdgePosition::H_ny_2D:
1440 triangleId = getEdgeTriangleH_ny(p.data(), localTriangleId);
1442 case EdgePosition::H_0y_2D:
1443 triangleId = getEdgeTriangleH_0y(p.data(), localTriangleId);
1445 case EdgePosition::H_Ny_2D:
1446 triangleId = getEdgeTriangleH_Ny(p.data(), localTriangleId);
1448 case EdgePosition::D1_2D:
1449 triangleId = getEdgeTriangleD1_xy(p.data(), localTriangleId);
1460const vector<vector<SimplexId>> *
1484template <
typename Derived>
1488#ifndef TTK_ENABLE_KAMIKAZE
1493 const auto &p = this->underlying().getEdgeCoords(edgeId);
1495 switch(this->underlying().getEdgePosition(edgeId)) {
1497 linkId = getEdgeLinkL(p.data(), localLinkId);
1500 linkId = getEdgeLinkH(p.data(), localLinkId);
1503 linkId = getEdgeLinkP(p.data(), localLinkId);
1506 linkId = getEdgeLinkD1(p.data(), localLinkId);
1509 linkId = getEdgeLinkD2(p.data(), localLinkId);
1512 linkId = getEdgeLinkD3(p.data(), localLinkId);
1514 case EdgePosition::D4_3D:
1515 linkId = getEdgeLinkD4(p.data(), localLinkId);
1519 linkId = getEdgeLink2dL(p.data(), localLinkId);
1522 linkId = getEdgeLink2dH(p.data(), localLinkId);
1524 case EdgePosition::D1_2D:
1525 linkId = getEdgeLink2dD1(p.data(), localLinkId);
1536const vector<vector<SimplexId>> *
1539 if(edgeLinkList_.empty()) {
1542 edgeLinkList_.resize(edgeNumber_);
1543 for(
SimplexId i = 0; i < edgeNumber_; ++i) {
1549 printMsg(
"Built " + to_string(edgeNumber_) +
" edge links.", 1,
1553 return &edgeLinkList_;
1556template <
typename Derived>
1560#ifndef TTK_ENABLE_KAMIKAZE
1561 if(edgeId < 0 or edgeId >= edgeNumber_)
1565 switch(this->underlying().getEdgePosition(edgeId)) {
1566 case EdgePosition::L_xnn_3D:
1567 case EdgePosition::H_nyn_3D:
1568 case EdgePosition::P_nnz_3D:
1569 case EdgePosition::D4_3D:
1571 case EdgePosition::D1_xyn_3D:
1572 case EdgePosition::D2_nyz_3D:
1573 case EdgePosition::D3_xnz_3D:
1575 case EdgePosition::L_x0n_3D:
1576 case EdgePosition::L_xNn_3D:
1577 case EdgePosition::L_xn0_3D:
1578 case EdgePosition::L_xnN_3D:
1579 case EdgePosition::H_ny0_3D:
1580 case EdgePosition::H_nyN_3D:
1581 case EdgePosition::H_0yn_3D:
1582 case EdgePosition::H_Nyn_3D:
1583 case EdgePosition::P_n0z_3D:
1584 case EdgePosition::P_nNz_3D:
1585 case EdgePosition::P_0nz_3D:
1586 case EdgePosition::P_Nnz_3D:
1588 case EdgePosition::L_x00_3D:
1589 case EdgePosition::L_xNN_3D:
1590 case EdgePosition::H_0yN_3D:
1591 case EdgePosition::H_Ny0_3D:
1592 case EdgePosition::P_0Nz_3D:
1593 case EdgePosition::P_N0z_3D:
1594 case EdgePosition::D1_xy0_3D:
1595 case EdgePosition::D1_xyN_3D:
1596 case EdgePosition::D2_0yz_3D:
1597 case EdgePosition::D2_Nyz_3D:
1598 case EdgePosition::D3_x0z_3D:
1599 case EdgePosition::D3_xNz_3D:
1600 case EdgePosition::L_xn_2D:
1601 case EdgePosition::H_ny_2D:
1602 case EdgePosition::D1_2D:
1604 case EdgePosition::L_xN0_3D:
1605 case EdgePosition::L_x0N_3D:
1606 case EdgePosition::H_0y0_3D:
1607 case EdgePosition::H_NyN_3D:
1608 case EdgePosition::P_00z_3D:
1609 case EdgePosition::P_NNz_3D:
1610 case EdgePosition::L_x0_2D:
1611 case EdgePosition::L_xN_2D:
1612 case EdgePosition::H_0y_2D:
1613 case EdgePosition::H_Ny_2D:
1623template <
typename Derived>
1627#ifndef TTK_ENABLE_KAMIKAZE
1632 const auto &p = this->underlying().getEdgeCoords(edgeId);
1634 switch(this->underlying().getEdgePosition(edgeId)) {
1636 starId = getEdgeStarL(p.data(), localStarId);
1639 starId = getEdgeStarH(p.data(), localStarId);
1642 starId = getEdgeStarP(p.data(), localStarId);
1645 starId = getEdgeStarD1(p.data(), localStarId);
1648 starId = getEdgeStarD2(p.data(), localStarId);
1651 starId = getEdgeStarD3(p.data(), localStarId);
1653 case EdgePosition::D4_3D:
1655 = p[2] * tetshift_[1] + p[1] * tetshift_[0] + p[0] * 6 + localStarId;
1659 starId = getEdgeStar2dL(p.data(), localStarId);
1662 starId = getEdgeStar2dH(p.data(), localStarId);
1664 case EdgePosition::D1_2D:
1665 starId = p[0] * 2 + p[1] * tshift_[0] + localStarId;
1676const vector<vector<SimplexId>> *
1679 if(edgeStarList_.empty()) {
1682 edgeStarList_.resize(edgeNumber_);
1683 for(
SimplexId i = 0; i < edgeNumber_; ++i) {
1689 printMsg(
"Built " + to_string(edgeNumber_) +
" edge stars.", 1,
1693 return &edgeStarList_;
1696template <
typename Derived>
1699 const int &localVertexId,
1701#ifndef TTK_ENABLE_KAMIKAZE
1702 if(triangleId < 0 or triangleId >= triangleNumber_)
1704 if(localVertexId < 0 or localVertexId >= 3)
1724 const auto &p = this->underlying().getTriangleCoords(triangleId);
1727 switch(this->underlying().getTrianglePosition(triangleId)) {
1728 case TrianglePosition::F_3D:
1729 vertexId = getTriangleVertexF(p.data(), localVertexId);
1731 case TrianglePosition::H_3D:
1732 vertexId = getTriangleVertexH(p.data(), localVertexId);
1734 case TrianglePosition::C_3D:
1735 vertexId = getTriangleVertexC(p.data(), localVertexId);
1737 case TrianglePosition::D1_3D:
1738 vertexId = getTriangleVertexD1(p.data(), localVertexId);
1740 case TrianglePosition::D2_3D:
1741 vertexId = getTriangleVertexD2(p.data(), localVertexId);
1743 case TrianglePosition::D3_3D:
1744 vertexId = getTriangleVertexD3(p.data(), localVertexId);
1746 case TrianglePosition::TOP_2D:
1747 switch(localVertexId) {
1750 vertexId = p[0] / 2 + p[1] * vshift_[0];
1753 vertexId = p[0] / 2 + p[1] * vshift_[0] + 1;
1756 vertexId = p[0] / 2 + p[1] * vshift_[0] + vshift_[0];
1760 case TrianglePosition::BOTTOM_2D:
1761 switch(localVertexId) {
1764 vertexId = p[0] / 2 + p[1] * vshift_[0] + 1;
1767 vertexId = p[0] / 2 + p[1] * vshift_[0] + vshift_[0] + 1;
1770 vertexId = p[0] / 2 + p[1] * vshift_[0] + vshift_[0];
1778template <
typename Derived>
1781 const int &localEdgeId,
1783#ifndef TTK_ENABLE_KAMIKAZE
1784 if(triangleId < 0 or triangleId >= triangleNumber_)
1786 if(localEdgeId < 0 or localEdgeId >= 3)
1790 const auto &p = this->underlying().getTriangleCoords(triangleId);
1791 const auto par = triangleId % 2;
1794 switch(this->underlying().getTrianglePosition(triangleId)) {
1795 case TrianglePosition::F_3D:
1796 edgeId = (par == 1) ? getTriangleEdgeF_1(p.data(), localEdgeId)
1797 : getTriangleEdgeF_0(p.data(), localEdgeId);
1799 case TrianglePosition::H_3D:
1800 edgeId = (par == 1) ? getTriangleEdgeH_1(p.data(), localEdgeId)
1801 : getTriangleEdgeH_0(p.data(), localEdgeId);
1803 case TrianglePosition::C_3D:
1804 edgeId = (par == 1) ? getTriangleEdgeC_1(p.data(), localEdgeId)
1805 : getTriangleEdgeC_0(p.data(), localEdgeId);
1807 case TrianglePosition::D1_3D:
1808 edgeId = (par == 1) ? getTriangleEdgeD1_1(p.data(), localEdgeId)
1809 : getTriangleEdgeD1_0(p.data(), localEdgeId);
1811 case TrianglePosition::D2_3D:
1812 edgeId = (par == 1) ? getTriangleEdgeD2_1(p.data(), localEdgeId)
1813 : getTriangleEdgeD2_0(p.data(), localEdgeId);
1815 case TrianglePosition::D3_3D:
1816 edgeId = (par == 1) ? getTriangleEdgeD3_1(p.data(), localEdgeId)
1817 : getTriangleEdgeD3_0(p.data(), localEdgeId);
1819 case TrianglePosition::TOP_2D:
1820 switch(localEdgeId) {
1823 edgeId = p[0] / 2 + p[1] * eshift_[0];
1826 edgeId = esetshift_[0] + p[0] / 2 + p[1] * eshift_[2];
1829 edgeId = esetshift_[1] + p[0] / 2 + p[1] * eshift_[4];
1833 case TrianglePosition::BOTTOM_2D:
1834 switch(localEdgeId) {
1837 edgeId = p[0] / 2 + (p[1] + 1) * eshift_[0];
1840 edgeId = esetshift_[0] + (p[0] + 1) / 2 + p[1] * eshift_[2];
1843 edgeId = esetshift_[1] + p[0] / 2 + p[1] * eshift_[4];
1852 vector<vector<SimplexId>> &edges)
const {
1856 for(
int j = 0; j < 3; ++j)
1862const vector<vector<SimplexId>> *
1876const vector<std::array<SimplexId, 3>> *
1879 if(triangleList_.empty()) {
1882 triangleList_.resize(triangleNumber_);
1883 for(
SimplexId i = 0; i < triangleNumber_; ++i) {
1884 for(
int j = 0; j < 3; ++j)
1885 getTriangleVertexInternal(i, j, triangleList_[i][j]);
1888 printMsg(
"Built " + to_string(triangleNumber_) +
" triangles.", 1,
1892 return &triangleList_;
1895template <
typename Derived>
1898 const int &localLinkId,
1901#ifndef TTK_ENABLE_KAMIKAZE
1906 const auto &p = this->underlying().getTriangleCoords(triangleId);
1908 switch(this->underlying().getTrianglePosition(triangleId)) {
1909 case TrianglePosition::F_3D:
1910 linkId = getTriangleLinkF(p.data(), localLinkId);
1912 case TrianglePosition::H_3D:
1913 linkId = getTriangleLinkH(p.data(), localLinkId);
1915 case TrianglePosition::C_3D:
1916 linkId = getTriangleLinkC(p.data(), localLinkId);
1918 case TrianglePosition::D1_3D:
1919 linkId = getTriangleLinkD1(p.data(), localLinkId);
1921 case TrianglePosition::D2_3D:
1922 linkId = getTriangleLinkD2(p.data(), localLinkId);
1924 case TrianglePosition::D3_3D:
1925 linkId = getTriangleLinkD3(p.data(), localLinkId);
1940const vector<vector<SimplexId>> *
1942 if(triangleLinkList_.empty()) {
1945 triangleLinkList_.resize(triangleNumber_);
1946 for(
SimplexId i = 0; i < triangleNumber_; ++i) {
1952 printMsg(
"Built " + to_string(triangleNumber_) +
" triangle links.", 1,
1955 return &triangleLinkList_;
1958template <
typename Derived>
1962#ifndef TTK_ENABLE_KAMIKAZE
1963 if(triangleId < 0 or triangleId >= triangleNumber_)
1967 const auto &p = this->underlying().getTriangleCoords(triangleId);
1969 switch(this->underlying().getTrianglePosition(triangleId)) {
1970 case TrianglePosition::F_3D:
1971 return (p[2] > 0 and p[2] < nbvoxels_[2]) ? 2 : 1;
1972 case TrianglePosition::H_3D:
1973 return (p[1] > 0 and p[1] < nbvoxels_[1]) ? 2 : 1;
1974 case TrianglePosition::C_3D:
1975 return (p[0] < 2 or p[0] >= (dimensions_[0] * 2 - 2)) ? 1 : 2;
1977 case TrianglePosition::D1_3D:
1978 case TrianglePosition::D2_3D:
1979 case TrianglePosition::D3_3D:
1987template <
typename Derived>
1990 const int &localStarId,
1993#ifndef TTK_ENABLE_KAMIKAZE
1998 const auto &p = this->underlying().getTriangleCoords(triangleId);
2000 switch(this->underlying().getTrianglePosition(triangleId)) {
2001 case TrianglePosition::F_3D:
2002 starId = getTriangleStarF(p.data(), localStarId);
2004 case TrianglePosition::H_3D:
2005 starId = getTriangleStarH(p.data(), localStarId);
2007 case TrianglePosition::C_3D:
2008 starId = getTriangleStarC(p.data(), localStarId);
2010 case TrianglePosition::D1_3D:
2011 starId = getTriangleStarD1(p.data(), localStarId);
2013 case TrianglePosition::D2_3D:
2014 starId = getTriangleStarD2(p.data(), localStarId);
2016 case TrianglePosition::D3_3D:
2017 starId = getTriangleStarD3(p.data(), localStarId);
2027const vector<vector<SimplexId>> *
2030 if(triangleStarList_.empty()) {
2033 triangleStarList_.resize(triangleNumber_);
2034 for(
SimplexId i = 0; i < triangleNumber_; ++i) {
2040 printMsg(
"Built " + to_string(triangleNumber_) +
" triangle stars.", 1,
2043 return &triangleStarList_;
2046template <
typename Derived>
2049#ifndef TTK_ENABLE_KAMIKAZE
2050 if(triangleId < 0 or triangleId >= triangleNumber_)
2054 if(dimensionality_ == 2) {
2055 const auto &p = this->underlying().getTriangleCoords(triangleId);
2059 if(p[0] / 2 == nbvoxels_[Di_] - 1 and p[1] == nbvoxels_[Dj_] - 1)
2061 else if(p[0] / 2 == nbvoxels_[Di_] - 1 or p[1] == nbvoxels_[Dj_] - 1)
2066 if(p[0] == 0 and p[1] == 0)
2068 else if(p[0] == 0 or p[1] == 0)
2078template <
typename Derived>
2081 const int &localNeighborId,
2083#ifndef TTK_ENABLE_KAMIKAZE
2084 if(localNeighborId < 0
2085 or localNeighborId >= getTriangleNeighborNumber(triangleId))
2091 if(dimensionality_ == 2) {
2092 const auto &p = this->underlying().getTriangleCoords(triangleId);
2096 if(p[0] / 2 == nbvoxels_[Di_] - 1 and p[1] == nbvoxels_[Dj_] - 1)
2097 neighborId = triangleId - 1;
2098 else if(p[0] / 2 == nbvoxels_[Di_] - 1) {
2099 switch(localNeighborId) {
2101 neighborId = triangleId - 1;
2104 neighborId = triangleId + tshift_[0] - 1;
2107 }
else if(p[1] == nbvoxels_[Dj_] - 1) {
2108 switch(localNeighborId) {
2110 neighborId = triangleId - 1;
2113 neighborId = triangleId + 1;
2117 switch(localNeighborId) {
2119 neighborId = triangleId - 1;
2122 neighborId = triangleId + 1;
2125 neighborId = triangleId + tshift_[0] - 1;
2130 if(p[0] == 0 and p[1] == 0)
2131 neighborId = triangleId + 1;
2132 else if(p[0] == 0) {
2133 switch(localNeighborId) {
2135 neighborId = triangleId + 1;
2138 neighborId = triangleId - tshift_[0] + 1;
2141 }
else if(p[1] == 0) {
2142 switch(localNeighborId) {
2144 neighborId = triangleId + 1;
2147 neighborId = triangleId - 1;
2151 switch(localNeighborId) {
2153 neighborId = triangleId + 1;
2156 neighborId = triangleId - 1;
2159 neighborId = triangleId - tshift_[0] + 1;
2170 vector<vector<SimplexId>> &neighbors) {
2180template <
typename Derived>
2183#ifndef TTK_ENABLE_KAMIKAZE
2184 if(tetId < 0 or tetId >= tetrahedronNumber_)
2186 if(localVertexId < 0 or localVertexId >= 4)
2192 if(dimensionality_ == 3) {
2194 const auto &c = this->underlying().getTetrahedronCoords(tetId);
2195 const auto p{c.data()};
2199 vertexId = getTetrahedronVertexABCG(p, localVertexId);
2202 vertexId = getTetrahedronVertexBCDG(p, localVertexId);
2205 vertexId = getTetrahedronVertexABEG(p, localVertexId);
2208 vertexId = getTetrahedronVertexBEFG(p, localVertexId);
2211 vertexId = getTetrahedronVertexBFGH(p, localVertexId);
2214 vertexId = getTetrahedronVertexBDGH(p, localVertexId);
2221template <
typename Derived>
2224#ifndef TTK_ENABLE_KAMIKAZE
2225 if(tetId < 0 or tetId >= tetrahedronNumber_)
2227 if(localEdgeId < 0 or localEdgeId >= 6)
2233 if(dimensionality_ == 3) {
2235 const auto &c = this->underlying().getTetrahedronCoords(tetId);
2236 const auto p{c.data()};
2240 edgeId = getTetrahedronEdgeABCG(p, localEdgeId);
2243 edgeId = getTetrahedronEdgeBCDG(p, localEdgeId);
2246 edgeId = getTetrahedronEdgeABEG(p, localEdgeId);
2249 edgeId = getTetrahedronEdgeBEFG(p, localEdgeId);
2252 edgeId = getTetrahedronEdgeBFGH(p, localEdgeId);
2255 edgeId = getTetrahedronEdgeBDGH(p, localEdgeId);
2264 vector<vector<SimplexId>> &edges)
const {
2268 for(
int j = 0; j < 6; ++j)
2275template <
typename Derived>
2278 const int &localTriangleId,
2280#ifndef TTK_ENABLE_KAMIKAZE
2281 if(tetId < 0 or tetId >= tetrahedronNumber_)
2283 if(localTriangleId < 0 or localTriangleId >= 4)
2289 if(dimensionality_ == 3) {
2291 const auto &c = this->underlying().getTetrahedronCoords(tetId);
2292 const auto p{c.data()};
2296 triangleId = getTetrahedronTriangleABCG(p, localTriangleId);
2299 triangleId = getTetrahedronTriangleBCDG(p, localTriangleId);
2302 triangleId = getTetrahedronTriangleABEG(p, localTriangleId);
2305 triangleId = getTetrahedronTriangleBEFG(p, localTriangleId);
2308 triangleId = getTetrahedronTriangleBFGH(p, localTriangleId);
2311 triangleId = getTetrahedronTriangleBDGH(p, localTriangleId);
2320 vector<vector<SimplexId>> &triangles)
const {
2323 triangles[i].resize(4);
2324 for(
int j = 0; j < 4; ++j)
2331template <
typename Derived>
2334#ifndef TTK_ENABLE_KAMIKAZE
2335 if(tetId < 0 or tetId >= tetrahedronNumber_)
2339 if(dimensionality_ == 3) {
2341 const auto &c = this->underlying().getTetrahedronCoords(tetId);
2342 const auto p{c.data()};
2346 if(p[0] == 0 and p[2] == 0)
2348 else if(p[0] == 0 or p[2] == 0)
2354 if(p[1] == nbvoxels_[1] - 1 and p[2] == 0)
2356 else if(p[1] == nbvoxels_[1] - 1 or p[2] == 0)
2362 if(p[0] == 0 and p[1] == 0)
2364 else if(p[0] == 0 or p[1] == 0)
2370 if(p[1] == 0 and p[2] == nbvoxels_[2] - 1)
2372 else if(p[1] == 0 or p[2] == nbvoxels_[2] - 1)
2378 if(p[0] == nbvoxels_[0] - 1 and p[2] == nbvoxels_[2] - 1)
2380 else if(p[0] == nbvoxels_[0] - 1 or p[2] == nbvoxels_[2] - 1)
2386 if(p[0] == nbvoxels_[0] - 1 and p[1] == nbvoxels_[1] - 1)
2388 else if(p[0] == nbvoxels_[0] - 1 or p[1] == nbvoxels_[1] - 1)
2399template <
typename Derived>
2402 const int &localNeighborId,
2404#ifndef TTK_ENABLE_KAMIKAZE
2405 if(localNeighborId < 0
2406 or localNeighborId >= getTetrahedronNeighborNumber(tetId))
2412 if(dimensionality_ == 3) {
2414 const auto &c = this->underlying().getTetrahedronCoords(tetId);
2415 const auto p{c.data()};
2419 neighborId = getTetrahedronNeighborABCG(tetId, p, localNeighborId);
2422 neighborId = getTetrahedronNeighborBCDG(tetId, p, localNeighborId);
2425 neighborId = getTetrahedronNeighborABEG(tetId, p, localNeighborId);
2428 neighborId = getTetrahedronNeighborBEFG(tetId, p, localNeighborId);
2431 neighborId = getTetrahedronNeighborBFGH(tetId, p, localNeighborId);
2434 neighborId = getTetrahedronNeighborBDGH(tetId, p, localNeighborId);
2443 vector<vector<SimplexId>> &neighbors) {
2456 return dimensionality_ + 1;
2461 const int &localVertexId,
2464 if(dimensionality_ == 3)
2465 getTetrahedronVertex(cellId, localVertexId, vertexId);
2466 else if(dimensionality_ == 2)
2467 getTriangleVertexInternal(cellId, localVertexId, vertexId);
2468 else if(dimensionality_ == 1)
2469 getEdgeVertexInternal(cellId, localVertexId, vertexId);
2485 const int &localEdgeId,
2515 const int &localTriangleId,
2523const vector<vector<SimplexId>> *
2540 if(dimensionality_ == 3)
2541 return getTetrahedronNeighborNumber(cellId);
2542 else if(dimensionality_ == 2)
2543 return getTriangleNeighborNumber(cellId);
2544 else if(dimensionality_ == 1) {
2545 printErr(
"getCellNeighborNumber() not implemented in 1D! (TODO)");
2554 const int &localNeighborId,
2556 if(dimensionality_ == 3)
2557 getTetrahedronNeighbor(cellId, localNeighborId, neighborId);
2558 else if(dimensionality_ == 2)
2559 getTriangleNeighbor(cellId, localNeighborId, neighborId);
2560 else if(dimensionality_ == 1) {
2561 printErr(
"getCellNeighbor() not implemented in 1D! (TODO)");
2568const vector<vector<SimplexId>> *
2570 if(cellNeighborList_.empty()) {
2573 if(dimensionality_ == 3)
2574 getTetrahedronNeighbors(cellNeighborList_);
2575 else if(dimensionality_ == 2)
2576 getTriangleNeighbors(cellNeighborList_);
2577 else if(dimensionality_ == 1) {
2578 printErr(
"getCellNeighbors() not implemented in 1D! (TODO)");
2582 printMsg(
"Built " + to_string(cellNumber_) +
" cell neighbors.", 1,
2586 return &cellNeighborList_;
2933#ifdef TTK_ENABLE_MPI
2935int ttk::ImplicitTriangulation::preconditionDistributedCells() {
2936 if(this->hasPreconditionedDistributedCells_) {
2939 if(!ttk::isRunningWithMPI()) {
2942 if(this->cellGhost_ ==
nullptr) {
2943 if(ttk::isRunningWithMPI()) {
2944 this->printErr(
"Missing cell ghost array!");
2953 const auto spacing{this->metaGrid_->spacing_};
2954 const auto origin{this->metaGrid_->origin_};
2958 double globalBounds[6]{
2959 origin[0], origin[0] + (this->metaGrid_->dimensions_[0] - 1) * spacing[0],
2960 origin[1], origin[1] + (this->metaGrid_->dimensions_[1] - 1) * spacing[1],
2961 origin[2], origin[2] + (this->metaGrid_->dimensions_[2] - 1) * spacing[2]};
2963 for(
int i = 0; i < 3; i++) {
2964 if(std::abs(globalBounds[2 * i] - boundingBox_[2 * i]) > spacing[i] / 2) {
2965 Bbox[2 * i] = boundingBox_[2 * i] + spacing[i];
2967 Bbox[2 * i] = boundingBox_[2 * i];
2969 if(std::abs(globalBounds[2 * i + 1] - boundingBox_[2 * i + 1])
2971 Bbox[2 * i + 1] = boundingBox_[2 * i + 1] - spacing[i];
2973 Bbox[2 * i + 1] = boundingBox_[2 * i + 1];
2976 for(
size_t i = 0; i < this->neighborRanks_.size(); ++i) {
2977 const auto neigh{this->neighborRanks_[i]};
2978 MPI_Sendrecv(this->neighborCellBBoxes_[
ttk::MPIrank_].data(), 6, MPI_DOUBLE,
2979 neigh,
ttk::MPIrank_, this->neighborCellBBoxes_[neigh].data(),
2980 6, MPI_DOUBLE, neigh, neigh, ttk::MPIcomm_, MPI_STATUS_IGNORE);
2983 this->hasPreconditionedDistributedCells_ =
true;
2988void ttk::ImplicitTriangulation::createMetaGrid(
const double *
const bounds) {
2991 if(!ttk::isRunningWithMPI()) {
2996 if(this->metaGrid_ !=
nullptr) {
3000 this->setBoundingBox(bounds);
3003 std::array<double, 6> tempBounds = {
3004 bounds[0], bounds[2], bounds[4], bounds[1], bounds[3], bounds[5],
3006 std::array<double, 6> tempGlobalBounds{};
3009 MPI_Allreduce(tempBounds.data(), tempGlobalBounds.data(), 3, MPI_DOUBLE,
3010 MPI_MIN, ttk::MPIcomm_);
3012 MPI_Allreduce(&tempBounds[3], &tempGlobalBounds[3], 3, MPI_DOUBLE, MPI_MAX,
3016 std::array<double, 6> globalBounds{
3017 tempGlobalBounds[0], tempGlobalBounds[3], tempGlobalBounds[1],
3018 tempGlobalBounds[4], tempGlobalBounds[2], tempGlobalBounds[5],
3021 const std::array<int, 3> dimensions = {
3023 std::round((globalBounds[1] - globalBounds[0]) / this->spacing_[0]))
3026 std::round((globalBounds[3] - globalBounds[2]) / this->spacing_[1]))
3029 std::round((globalBounds[5] - globalBounds[4]) / this->spacing_[2]))
3033 this->localGridOffset_ = {
3035 std::round((this->origin_[0] - globalBounds[0]) / this->spacing_[0])),
3037 std::round((this->origin_[1] - globalBounds[2]) / this->spacing_[1])),
3039 std::round((this->origin_[2] - globalBounds[4]) / this->spacing_[2])),
3042 this->metaGrid_ = std::make_shared<ImplicitNoPreconditions>();
3043 this->metaGrid_->setInputGrid(globalBounds[0], globalBounds[2],
3044 globalBounds[4], this->spacing_[0],
3045 this->spacing_[1], this->spacing_[2],
3046 dimensions[0], dimensions[1], dimensions[2]);
3047 this->metaGrid_->preconditionBoundaryVertices();
3048 this->metaGrid_->preconditionBoundaryEdges();
3049 this->metaGrid_->preconditionBoundaryTriangles();
3052std::array<SimplexId, 3>
3053 ttk::ImplicitTriangulation::getVertGlobalCoords(
const SimplexId lvid)
const {
3056 std::array<SimplexId, 3> p{};
3057 if(this->dimensionality_ == 3) {
3058 this->vertexToPosition(lvid, p.data());
3059 }
else if(this->dimensionality_ == 2) {
3060 this->vertexToPosition2d(lvid, p.data());
3064 p[0] += this->localGridOffset_[0];
3065 p[1] += this->localGridOffset_[1];
3066 p[2] += this->localGridOffset_[2];
3071std::array<SimplexId, 3>
3072 ttk::ImplicitTriangulation::getVertLocalCoords(
const SimplexId gvid)
const {
3075 std::array<SimplexId, 3> p{};
3076 if(this->dimensionality_ == 3) {
3077 this->metaGrid_->vertexToPosition(gvid, p.data());
3078 }
else if(this->dimensionality_ == 2) {
3079 this->metaGrid_->vertexToPosition2d(gvid, p.data());
3083 p[0] -= this->localGridOffset_[0];
3084 p[1] -= this->localGridOffset_[1];
3085 p[2] -= this->localGridOffset_[2];
3090bool ImplicitTriangulation::isVertexOnGlobalBoundaryInternal(
3093 if(!ttk::isRunningWithMPI()) {
3097#ifndef TTK_ENABLE_KAMIKAZE
3102 if(this->metaGrid_ ==
nullptr) {
3107 const auto gvid{this->getVertexGlobalIdInternal(lvid)};
3111 return this->metaGrid_->isVertexOnBoundary(gvid);
3114bool ImplicitTriangulation::isEdgeOnGlobalBoundaryInternal(
3117 if(!ttk::isRunningWithMPI()) {
3121#ifndef TTK_ENABLE_KAMIKAZE
3125 if(this->metaGrid_ ==
nullptr) {
3130 const auto geid{this->getEdgeGlobalIdInternal(leid)};
3134 return this->metaGrid_->isEdgeOnBoundary(geid);
3137bool ImplicitTriangulation::isTriangleOnGlobalBoundaryInternal(
3140 if(!ttk::isRunningWithMPI()) {
3144#ifndef TTK_ENABLE_KAMIKAZE
3148 if(this->metaGrid_ ==
nullptr) {
3153 const auto gtid{this->getTriangleGlobalIdInternal(ltid)};
3157 return this->metaGrid_->isTriangleOnBoundary(gtid);
3160int ttk::ImplicitTriangulation::getCellRankInternal(
3163 const int nTetraPerCube{this->dimensionality_ == 3 ? 6 : 2};
3164 const auto locCubeId{lcid / nTetraPerCube};
3166 if(this->cellGhost_[locCubeId] == 0) {
3170#ifndef TTK_ENABLE_KAMIKAZE
3172 this->printErr(
"Empty neighborsRanks_!");
3177 float p[3] = {0, 0, 0};
3178 this->metaGrid_->getCellIncenter(
3179 this->getCellGlobalId(lcid), this->dimensionality_, p);
3180 for(
const auto neigh : this->neighborRanks_) {
3181 const auto &bbox{this->neighborCellBBoxes_[neigh]};
3182 if(p[0] >= bbox[0] && p[0] <= bbox[1] && p[1] >= bbox[2] && p[1] <= bbox[3]
3183 && p[2] >= bbox[4] && p[2] <= bbox[5]) {
#define TTK_TRIANGULATION_INTERNAL(NAME)
bool ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() isTriangleOnBoundary(const SimplexId &triangleId) const
#define CASE_EDGE_POSITION_P_3D
int ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getEdgeStar(const SimplexId &edgeId, const int &localStarId, SimplexId &starId) const
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getCellNeighbors()
SimplexId ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getTriangleStarNumber(const SimplexId &triangleId) const
int ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getCellNeighbor(const SimplexId &cellId, const int &localNeighborId, SimplexId &neighborId) const
int ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getVertexStar(const SimplexId &vertexId, const int &localStarId, SimplexId &starId) const
SimplexId ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getTriangleLinkNumber(const SimplexId &triangleId) const
int ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getEdgeLink(const SimplexId &edgeId, const int &localLinkId, SimplexId &linkId) const
#define CASE_EDGE_POSITION_D2_3D
#define CASE_EDGE_POSITION_D1_3D
int ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getTriangleLink(const SimplexId &triangleId, const int &localLinkId, SimplexId &linkId) const
SimplexId ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getCellVertexNumber(const SimplexId &) const
SimplexId ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getEdgeStarNumber(const SimplexId &edgeId) const
#define CASE_EDGE_POSITION_L_2D
#define CASE_EDGE_POSITION_H_2D
#define CASE_EDGE_POSITION_H_3D
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getTriangleLinks()
#define CASE_EDGE_POSITION_L_3D
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getTriangleStars()
SimplexId ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getVertexLinkNumber(const SimplexId &vertexId) const
SimplexId ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getCellNeighborNumber(const SimplexId &cellId) const
SimplexId ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getVertexStarNumber(const SimplexId &vertexId) const
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getVertexLinks()
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getEdgeStars()
#define CASE_EDGE_POSITION_D3_3D
bool ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() isEdgeOnBoundary(const SimplexId &edgeId) const
int ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getCellVertex(const SimplexId &cellId, const int &localVertexId, SimplexId &vertexId) const
SimplexId ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getEdgeLinkNumber(const SimplexId &edgeId) const
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getVertexNeighbors()
int ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getTriangleStar(const SimplexId &triangleId, const int &localStarId, SimplexId &starId) const
const vector< std::array< SimplexId, 3 > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getTriangles()
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getVertexStars()
int ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getVertexPoint(const SimplexId &vertexId, float &x, float &y, float &z) const
const vector< std::array< SimplexId, 2 > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getEdges()
bool ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() isVertexOnBoundary(const SimplexId &vertexId) const
int ImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getVertexLink(const SimplexId &vertexId, const int &localLinkId, SimplexId &linkId) const
const vector< vector< SimplexId > > *ImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getEdgeLinks()
SimplexId PeriodicImplicitTriangulation::TTK_TRIANGULATION_INTERNAL() getVertexNeighborNumber(const SimplexId &vertexId) const
int PeriodicImplicitTriangulationCRTP< Derived >::TTK_TRIANGULATION_INTERNAL() getVertexNeighbor(const SimplexId &vertexId, const int &localNeighborId, SimplexId &neighborId) const
virtual SimplexId getVertexTriangleNumberInternal(const SimplexId &ttkNotUsed(vertexId)) const
virtual SimplexId getVertexNeighborNumber(const SimplexId &vertexId) const
virtual bool isVertexOnBoundary(const SimplexId &vertexId) const
virtual int getVertexTriangleInternal(const SimplexId &ttkNotUsed(vertexId), const int &ttkNotUsed(localTriangleId), SimplexId &ttkNotUsed(triangleId)) const
virtual bool isEdgeOnBoundary(const SimplexId &edgeId) const
std::vector< std::vector< SimplexId > > vertexEdgeList_
std::vector< std::vector< SimplexId > > triangleEdgeVector_
virtual int getTriangleEdgeInternal(const SimplexId &ttkNotUsed(triangleId), const int &ttkNotUsed(localEdgeId), SimplexId &ttkNotUsed(edgeId)) const
virtual SimplexId getEdgeTriangleNumberInternal(const SimplexId &ttkNotUsed(edgeId)) const
virtual int getEdgeTriangleInternal(const SimplexId &ttkNotUsed(edgeId), const int &ttkNotUsed(localTriangleId), SimplexId &ttkNotUsed(triangleId)) const
virtual int getVertexEdgeInternal(const SimplexId &ttkNotUsed(vertexId), const int &ttkNotUsed(localEdgeId), SimplexId &ttkNotUsed(edgeId)) const
std::vector< std::vector< SimplexId > > vertexTriangleList_
std::vector< std::vector< SimplexId > > cellEdgeVector_
std::vector< std::vector< SimplexId > > cellTriangleVector_
std::vector< std::vector< SimplexId > > edgeTriangleList_
void setDebugMsgPrefix(const std::string &prefix)
int getTriangleVertexInternal(const SimplexId &triangleId, const int &localVertexId, SimplexId &vertexId) const override
int getTetrahedronVertex(const SimplexId &tetId, const int &localVertexId, SimplexId &vertexId) const override
int getTetrahedronTriangle(const SimplexId &tetId, const int &id, SimplexId &triangleId) const override
SimplexId getEdgeTriangleNumberInternal(const SimplexId &edgeId) const override
int getVertexEdgeInternal(const SimplexId &vertexId, const int &id, SimplexId &edgeId) const override
int getEdgeVertexInternal(const SimplexId &edgeId, const int &localVertexId, SimplexId &vertexId) const override
SimplexId getVertexTriangleNumberInternal(const SimplexId &vertexId) const override
SimplexId getTriangleNeighborNumber(const SimplexId &triangleId) const override
int getEdgeTriangleInternal(const SimplexId &edgeId, const int &id, SimplexId &triangleId) const override
int getTetrahedronNeighbor(const SimplexId &tetId, const int &localNeighborId, SimplexId &neighborId) const override
int getVertexTriangleInternal(const SimplexId &vertexId, const int &id, SimplexId &triangleId) const override
SimplexId getTetrahedronNeighborNumber(const SimplexId &tetId) const override
int getTriangleNeighbor(const SimplexId &triangleId, const int &localNeighborId, SimplexId &neighborId) const override
int getTriangleEdgeInternal(const SimplexId &triangleId, const int &id, SimplexId &edgeId) const override
int getTetrahedronEdge(const SimplexId &tetId, const int &id, SimplexId &edgeId) const override
std::array< SimplexId, 8 > vertexNeighborGH_
std::array< SimplexId, 4 > vertexNeighbor2dAC_
std::array< SimplexId, 8 > vertexNeighborBF_
std::array< SimplexId, 8 > vertexNeighborBD_
std::array< SimplexId, 3 > vertexNeighbor2dB_
std::array< SimplexId, 7 > vertexNeighborB_
std::array< SimplexId, 6 > vertexNeighborEF_
SimplexId tetrahedronNumber_
std::array< SimplexId, 14 > vertexNeighborABCDEFGH_
const std::vector< std::vector< SimplexId > > * getTriangleEdgesInternal() override
SimplexId getCellEdgeNumberInternal(const SimplexId &cellId) const override
std::array< SimplexId, 8 > vertexNeighborEG_
int getCellTriangleInternal(const SimplexId &cellId, const int &id, SimplexId &triangleId) const override
std::array< SimplexId, 4 > vertexNeighborH_
std::array< SimplexId, 4 > vertexNeighborE_
std::array< SimplexId, 2 > vertexNeighbor2dD_
bool TTK_TRIANGULATION_INTERNAL() isTriangleOnBoundary(const SimplexId &triangleId) const override
const std::vector< std::vector< SimplexId > > * getVertexEdgesInternal() override
std::array< SimplexId, 10 > vertexNeighborAEFB_
virtual int getTriangleNeighbor(const SimplexId &triangleId, const int &localNeighborId, SimplexId &neighborId) const =0
std::array< SimplexId, 6 > vertexNeighbor2dABCD_
std::array< SimplexId, 6 > vertexNeighborFH_
std::array< SimplexId, 6 > vertexNeighborDH_
std::array< SimplexId, 6 > vertexNeighborCD_
const std::vector< std::vector< SimplexId > > * getCellEdgesInternal() override
std::array< SimplexId, 7 > vertexNeighborG_
int setInputGrid(const float &xOrigin, const float &yOrigin, const float &zOrigin, const float &xSpacing, const float &ySpacing, const float &zSpacing, const SimplexId &xDim, const SimplexId &yDim, const SimplexId &zDim) override
int getTetrahedronNeighbors(std::vector< std::vector< SimplexId > > &neighbors)
int TTK_TRIANGULATION_INTERNAL() getCellNeighbor(const SimplexId &cellId, const int &localNeighborId, SimplexId &neighborId) const override
const std::vector< std::vector< SimplexId > > * getVertexTrianglesInternal() override
virtual SimplexId getTetrahedronNeighborNumber(const SimplexId &tetId) const =0
virtual int getTetrahedronNeighbor(const SimplexId &tetId, const int &localNeighborId, SimplexId &neighborId) const =0
std::array< SimplexId, 10 > vertexNeighborAEGC_
virtual int getTetrahedronTriangle(const SimplexId &tetId, const int &id, SimplexId &triangleId) const =0
std::array< SimplexId, 10 > vertexNeighborEFGH_
std::array< SimplexId, 2 > vertexNeighbor2dA_
bool isPowerOfTwo(unsigned long long int v, unsigned long long int &r)
SimplexId TTK_TRIANGULATION_INTERNAL() getNumberOfVertices() const override
SimplexId getVertexEdgeNumberInternal(const SimplexId &vertexId) const override
std::array< SimplexId, 4 > vertexNeighbor2dBD_
std::array< SimplexId, 10 > vertexNeighborBFHD_
int getTriangleNeighbors(std::vector< std::vector< SimplexId > > &neighbors)
std::array< SimplexId, 4 > vertexNeighborD_
SimplexId getNumberOfEdgesInternal() const override
std::array< SimplexId, 4 > vertexNeighborC_
virtual int getTetrahedronEdge(const SimplexId &tetId, const int &id, SimplexId &edgeId) const =0
virtual SimplexId getTriangleNeighborNumber(const SimplexId &triangleId) const =0
int getTetrahedronEdges(std::vector< std::vector< SimplexId > > &edges) const
std::array< SimplexId, 4 > vertexNeighbor2dCD_
std::array< SimplexId, 8 > vertexNeighborCG_
std::array< SimplexId, 3 > vertexNeighbor2dC_
std::array< SimplexId, 6 > vertexNeighborAC_
const std::vector< std::vector< SimplexId > > * getEdgeTrianglesInternal() override
std::array< SimplexId, 10 > vertexNeighborABCD_
std::array< SimplexId, 10 > vertexNeighborGHDC_
std::array< SimplexId, 8 > vertexNeighborAB_
std::array< SimplexId, 6 > vertexNeighborAE_
int getCellEdgeInternal(const SimplexId &cellId, const int &id, SimplexId &edgeId) const override
std::array< SimplexId, 4 > vertexNeighborA_
SimplexId getNumberOfTrianglesInternal() const override
std::array< SimplexId, 4 > vertexNeighborF_
const std::vector< std::vector< SimplexId > > * getCellTrianglesInternal() override
std::array< SimplexId, 4 > vertexNeighbor2dAB_
int preconditionVertexNeighborsInternal() override
~ImplicitTriangulation() override
SimplexId triangleNumber_
int getTetrahedronTriangles(std::vector< std::vector< SimplexId > > &triangles) const
std::array< SimplexId, 3 > dimensions_
COMMON_EXPORTS int MPIsize_
COMMON_EXPORTS int MPIrank_
int SimplexId
Identifier type for simplices of any dimension.
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)