10#ifdef TTK_ENABLE_OPENMP
11#pragma omp parallel for num_threads(this->threadNumber_)
19#ifdef TTK_ENABLE_OPENMP
20#pragma omp parallel for num_threads(this->threadNumber_)
23 auto &p = vertexCoords_[i];
33 }
else if(p[0] == 0) {
51#ifdef TTK_ENABLE_OPENMP
52#pragma omp parallel for num_threads(this->threadNumber_)
55 auto &p = vertexCoords_[i];
58 if(0 < p[0] and p[0] < this->
nbvoxels_[0]) {
59 if(0 < p[1] and p[1] < this->
nbvoxels_[1]) {
60 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
66 }
else if(p[1] == 0) {
67 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
74 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
81 }
else if(p[0] == 0) {
82 if(0 < p[1] and p[1] < this->
nbvoxels_[1]) {
83 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
89 }
else if(p[1] == 0) {
90 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
97 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
107 if(0 < p[1] and p[1] < this->
nbvoxels_[1]) {
108 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
114 }
else if(p[1] == 0) {
115 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
123 if(0 < p[2] and p[2] < this->
nbvoxels_[2])
140 edgePositions_.resize(this->edgeNumber_);
141 edgeCoords_.resize(this->edgeNumber_);
143 if(this->dimensionality_ == 3) {
144#ifdef TTK_ENABLE_OPENMP
145#pragma omp parallel for num_threads(this->threadNumber_)
147 for(
SimplexId i = 0; i < this->edgeNumber_; ++i) {
148 auto &p = edgeCoords_[i];
150 if(i < this->esetshift_[0]) {
151 this->edgeToPosition(i, 0, p.data());
152 if(p[1] > 0 and p[1] < this->nbvoxels_[1]) {
153 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
154 edgePositions_[i] = EdgePosition::L_xnn_3D;
156 edgePositions_[i] = EdgePosition::L_xn0_3D;
158 edgePositions_[i] = EdgePosition::L_xnN_3D;
159 }
else if(p[1] == 0) {
160 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
161 edgePositions_[i] = EdgePosition::L_x0n_3D;
163 edgePositions_[i] = EdgePosition::L_x00_3D;
165 edgePositions_[i] = EdgePosition::L_x0N_3D;
167 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
168 edgePositions_[i] = EdgePosition::L_xNn_3D;
170 edgePositions_[i] = EdgePosition::L_xN0_3D;
172 edgePositions_[i] = EdgePosition::L_xNN_3D;
175 }
else if(i < this->esetshift_[1]) {
176 this->edgeToPosition(i, 1, p.data());
177 if(p[0] > 0 and p[0] < this->nbvoxels_[0]) {
178 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
179 edgePositions_[i] = EdgePosition::H_nyn_3D;
181 edgePositions_[i] = EdgePosition::H_ny0_3D;
183 edgePositions_[i] = EdgePosition::H_nyN_3D;
184 }
else if(p[0] == 0) {
185 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
186 edgePositions_[i] = EdgePosition::H_0yn_3D;
188 edgePositions_[i] = EdgePosition::H_0y0_3D;
190 edgePositions_[i] = EdgePosition::H_0yN_3D;
192 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
193 edgePositions_[i] = EdgePosition::H_Nyn_3D;
195 edgePositions_[i] = EdgePosition::H_Ny0_3D;
197 edgePositions_[i] = EdgePosition::H_NyN_3D;
200 }
else if(i < this->esetshift_[2]) {
201 this->edgeToPosition(i, 2, p.data());
202 if(p[0] > 0 and p[0] < this->nbvoxels_[0]) {
203 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
204 edgePositions_[i] = EdgePosition::P_nnz_3D;
206 edgePositions_[i] = EdgePosition::P_n0z_3D;
208 edgePositions_[i] = EdgePosition::P_nNz_3D;
209 }
else if(p[0] == 0) {
210 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
211 edgePositions_[i] = EdgePosition::P_0nz_3D;
213 edgePositions_[i] = EdgePosition::P_00z_3D;
215 edgePositions_[i] = EdgePosition::P_0Nz_3D;
217 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
218 edgePositions_[i] = EdgePosition::P_Nnz_3D;
220 edgePositions_[i] = EdgePosition::P_N0z_3D;
222 edgePositions_[i] = EdgePosition::P_NNz_3D;
225 }
else if(i < this->esetshift_[3]) {
226 this->edgeToPosition(i, 3, p.data());
227 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
228 edgePositions_[i] = EdgePosition::D1_xyn_3D;
230 edgePositions_[i] = EdgePosition::D1_xy0_3D;
232 edgePositions_[i] = EdgePosition::D1_xyN_3D;
234 }
else if(i < this->esetshift_[4]) {
235 this->edgeToPosition(i, 4, p.data());
236 if(p[0] > 0 and p[0] < this->nbvoxels_[0])
237 edgePositions_[i] = EdgePosition::D2_nyz_3D;
239 edgePositions_[i] = EdgePosition::D2_0yz_3D;
241 edgePositions_[i] = EdgePosition::D2_Nyz_3D;
243 }
else if(i < this->esetshift_[5]) {
244 this->edgeToPosition(i, 5, p.data());
245 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
246 edgePositions_[i] = EdgePosition::D3_xnz_3D;
248 edgePositions_[i] = EdgePosition::D3_x0z_3D;
250 edgePositions_[i] = EdgePosition::D3_xNz_3D;
252 }
else if(i < this->esetshift_[6]) {
253 this->edgeToPosition(i, 6, p.data());
254 edgePositions_[i] = EdgePosition::D4_3D;
258 }
else if(this->dimensionality_ == 2) {
259#ifdef TTK_ENABLE_OPENMP
260#pragma omp parallel for num_threads(this->threadNumber_)
262 for(
SimplexId i = 0; i < this->edgeNumber_; ++i) {
263 auto &p = edgeCoords_[i];
265 if(i < this->esetshift_[0]) {
266 this->edgeToPosition2d(i, 0, p.data());
267 if(p[1] > 0 and p[1] < this->nbvoxels_[this->Dj_])
268 edgePositions_[i] = EdgePosition::L_xn_2D;
270 edgePositions_[i] = EdgePosition::L_x0_2D;
272 edgePositions_[i] = EdgePosition::L_xN_2D;
274 }
else if(i < this->esetshift_[1]) {
275 this->edgeToPosition2d(i, 1, p.data());
276 if(p[0] > 0 and p[0] < this->nbvoxels_[this->Di_])
277 edgePositions_[i] = EdgePosition::H_ny_2D;
279 edgePositions_[i] = EdgePosition::H_0y_2D;
281 edgePositions_[i] = EdgePosition::H_Ny_2D;
283 }
else if(i < this->esetshift_[2]) {
284 this->edgeToPosition2d(i, 2, p.data());
285 edgePositions_[i] = EdgePosition::D1_2D;
289 }
else if(this->dimensionality_ == 1) {
290 edgePositions_[0] = EdgePosition::FIRST_EDGE_1D;
291#ifdef TTK_ENABLE_OPENMP
292#pragma omp parallel for num_threads(this->threadNumber_)
294 for(
SimplexId i = 1; i < this->edgeNumber_ - 1; ++i) {
295 edgePositions_[i] = EdgePosition::CENTER_1D;
297 edgePositions_[this->edgeNumber_ - 1] = EdgePosition::LAST_EDGE_1D;
305 trianglePositions_.resize(this->triangleNumber_);
306 triangleCoords_.resize(this->triangleNumber_);
307 if(this->dimensionality_ == 3) {
308#ifdef TTK_ENABLE_OPENMP
309#pragma omp parallel for num_threads(this->threadNumber_)
311 for(
SimplexId i = 0; i < this->triangleNumber_; ++i) {
312 if(i < this->tsetshift_[0]) {
313 this->triangleToPosition(i, 0, triangleCoords_[i].data());
314 trianglePositions_[i] = TrianglePosition::F_3D;
315 }
else if(i < this->tsetshift_[1]) {
316 this->triangleToPosition(i, 1, triangleCoords_[i].data());
317 trianglePositions_[i] = TrianglePosition::H_3D;
318 }
else if(i < this->tsetshift_[2]) {
319 this->triangleToPosition(i, 2, triangleCoords_[i].data());
320 trianglePositions_[i] = TrianglePosition::C_3D;
321 }
else if(i < this->tsetshift_[3]) {
322 this->triangleToPosition(i, 3, triangleCoords_[i].data());
323 trianglePositions_[i] = TrianglePosition::D1_3D;
324 }
else if(i < this->tsetshift_[4]) {
325 this->triangleToPosition(i, 4, triangleCoords_[i].data());
326 trianglePositions_[i] = TrianglePosition::D2_3D;
327 }
else if(i < this->tsetshift_[5]) {
328 this->triangleToPosition(i, 5, triangleCoords_[i].data());
329 trianglePositions_[i] = TrianglePosition::D3_3D;
333 }
else if(this->dimensionality_ == 2) {
334#ifdef TTK_ENABLE_OPENMP
335#pragma omp parallel for num_threads(this->threadNumber_)
337 for(
SimplexId i = 0; i < this->triangleNumber_; ++i) {
338 this->triangleToPosition2d(i, triangleCoords_[i].data());
340 trianglePositions_[i] = TrianglePosition::TOP_2D;
342 trianglePositions_[i] = TrianglePosition::BOTTOM_2D;
352 if(this->dimensionality_ != 3) {
355 tetrahedronCoords_.resize(this->tetrahedronNumber_);
357#ifdef TTK_ENABLE_OPENMP
358#pragma omp parallel for num_threads(this->threadNumber_)
360 for(
SimplexId i = 0; i < this->tetrahedronNumber_; ++i) {
361 this->tetrahedronToPosition(i, tetrahedronCoords_[i].data());
370 if(this->dimensionality_ == 1) {
372 return VertexPosition::LEFT_CORNER_1D;
373 }
else if(v == this->vertexNumber_ - 1) {
374 return VertexPosition::RIGHT_CORNER_1D;
376 return VertexPosition::CENTER_1D;
377 }
else if(this->dimensionality_ == 2) {
378 const auto p{this->getVertexCoords(v)};
379 if(0 < p[0] and p[0] < this->nbvoxels_[this->Di_]) {
380 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
381 return VertexPosition::CENTER_2D;
383 return VertexPosition::TOP_EDGE_2D;
385 return VertexPosition::BOTTOM_EDGE_2D;
386 }
else if(p[0] == 0) {
387 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
388 return VertexPosition::LEFT_EDGE_2D;
390 return VertexPosition::TOP_LEFT_CORNER_2D;
392 return VertexPosition::BOTTOM_LEFT_CORNER_2D;
394 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
395 return VertexPosition::RIGHT_EDGE_2D;
397 return VertexPosition::TOP_RIGHT_CORNER_2D;
399 return VertexPosition::BOTTOM_RIGHT_CORNER_2D;
402 }
else if(this->dimensionality_ == 3) {
403 const auto p{this->getVertexCoords(v)};
404 if(0 < p[0] and p[0] < this->nbvoxels_[0]) {
405 if(0 < p[1] and p[1] < this->nbvoxels_[1]) {
406 if(0 < p[2] and p[2] < this->nbvoxels_[2])
407 return VertexPosition::CENTER_3D;
409 return VertexPosition::FRONT_FACE_3D;
411 return VertexPosition::BACK_FACE_3D;
412 }
else if(p[1] == 0) {
413 if(0 < p[2] and p[2] < this->nbvoxels_[2])
414 return VertexPosition::TOP_FACE_3D;
416 return VertexPosition::TOP_FRONT_EDGE_3D;
418 return VertexPosition::TOP_BACK_EDGE_3D;
420 if(0 < p[2] and p[2] < this->nbvoxels_[2])
421 return VertexPosition::BOTTOM_FACE_3D;
423 return VertexPosition::BOTTOM_FRONT_EDGE_3D;
425 return VertexPosition::BOTTOM_BACK_EDGE_3D;
427 }
else if(p[0] == 0) {
428 if(0 < p[1] and p[1] < this->nbvoxels_[1]) {
429 if(0 < p[2] and p[2] < this->nbvoxels_[2])
430 return VertexPosition::LEFT_FACE_3D;
432 return VertexPosition::LEFT_FRONT_EDGE_3D;
434 return VertexPosition::LEFT_BACK_EDGE_3D;
435 }
else if(p[1] == 0) {
436 if(0 < p[2] and p[2] < this->nbvoxels_[2])
437 return VertexPosition::TOP_LEFT_EDGE_3D;
439 return VertexPosition::TOP_LEFT_FRONT_CORNER_3D;
441 return VertexPosition::TOP_LEFT_BACK_CORNER_3D;
443 if(0 < p[2] and p[2] < this->nbvoxels_[2])
444 return VertexPosition::BOTTOM_LEFT_EDGE_3D;
446 return VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D;
448 return VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D;
451 if(0 < p[1] and p[1] < this->nbvoxels_[1]) {
452 if(0 < p[2] and p[2] < this->nbvoxels_[2])
453 return VertexPosition::RIGHT_FACE_3D;
455 return VertexPosition::RIGHT_FRONT_EDGE_3D;
457 return VertexPosition::RIGHT_BACK_EDGE_3D;
458 }
else if(p[1] == 0) {
459 if(0 < p[2] and p[2] < this->nbvoxels_[2])
460 return VertexPosition::TOP_RIGHT_EDGE_3D;
462 return VertexPosition::TOP_RIGHT_FRONT_CORNER_3D;
464 return VertexPosition::TOP_RIGHT_BACK_CORNER_3D;
466 if(0 < p[2] and p[2] < this->nbvoxels_[2])
467 return VertexPosition::BOTTOM_RIGHT_EDGE_3D;
469 return VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D;
471 return VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D;
475 return VertexPosition::CENTER_3D;
480 std::array<SimplexId, 3> p{};
481 if(this->dimensionality_ == 3) {
483 if(e < this->esetshift_[0]) {
484 this->edgeToPosition(e, 0, p.data());
485 if(p[1] > 0 and p[1] < this->nbvoxels_[1]) {
486 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
487 return EdgePosition::L_xnn_3D;
489 return EdgePosition::L_xn0_3D;
491 return EdgePosition::L_xnN_3D;
492 }
else if(p[1] == 0) {
493 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
494 return EdgePosition::L_x0n_3D;
496 return EdgePosition::L_x00_3D;
498 return EdgePosition::L_x0N_3D;
500 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
501 return EdgePosition::L_xNn_3D;
503 return EdgePosition::L_xN0_3D;
505 return EdgePosition::L_xNN_3D;
507 }
else if(e < this->esetshift_[1]) {
508 this->edgeToPosition(e, 1, p.data());
509 if(p[0] > 0 and p[0] < this->nbvoxels_[0]) {
510 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
511 return EdgePosition::H_nyn_3D;
513 return EdgePosition::H_ny0_3D;
515 return EdgePosition::H_nyN_3D;
516 }
else if(p[0] == 0) {
517 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
518 return EdgePosition::H_0yn_3D;
520 return EdgePosition::H_0y0_3D;
522 return EdgePosition::H_0yN_3D;
524 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
525 return EdgePosition::H_Nyn_3D;
527 return EdgePosition::H_Ny0_3D;
529 return EdgePosition::H_NyN_3D;
531 }
else if(e < this->esetshift_[2]) {
532 this->edgeToPosition(e, 2, p.data());
533 if(p[0] > 0 and p[0] < this->nbvoxels_[0]) {
534 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
535 return EdgePosition::P_nnz_3D;
537 return EdgePosition::P_n0z_3D;
539 return EdgePosition::P_nNz_3D;
540 }
else if(p[0] == 0) {
541 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
542 return EdgePosition::P_0nz_3D;
544 return EdgePosition::P_00z_3D;
546 return EdgePosition::P_0Nz_3D;
548 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
549 return EdgePosition::P_Nnz_3D;
551 return EdgePosition::P_N0z_3D;
553 return EdgePosition::P_NNz_3D;
555 }
else if(e < this->esetshift_[3]) {
556 this->edgeToPosition(e, 3, p.data());
557 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
558 return EdgePosition::D1_xyn_3D;
560 return EdgePosition::D1_xy0_3D;
562 return EdgePosition::D1_xyN_3D;
563 }
else if(e < this->esetshift_[4]) {
564 this->edgeToPosition(e, 4, p.data());
565 if(p[0] > 0 and p[0] < this->nbvoxels_[0])
566 return EdgePosition::D2_nyz_3D;
568 return EdgePosition::D2_0yz_3D;
570 return EdgePosition::D2_Nyz_3D;
571 }
else if(e < this->esetshift_[5]) {
572 this->edgeToPosition(e, 5, p.data());
573 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
574 return EdgePosition::D3_xnz_3D;
576 return EdgePosition::D3_x0z_3D;
578 return EdgePosition::D3_xNz_3D;
579 }
else if(e < this->esetshift_[6]) {
580 return EdgePosition::D4_3D;
583 }
else if(this->dimensionality_ == 2) {
584 if(e < this->esetshift_[0]) {
585 this->edgeToPosition2d(e, 0, p.data());
586 if(p[1] > 0 and p[1] < this->nbvoxels_[this->Dj_])
587 return EdgePosition::L_xn_2D;
589 return EdgePosition::L_x0_2D;
591 return EdgePosition::L_xN_2D;
592 }
else if(e < this->esetshift_[1]) {
593 this->edgeToPosition2d(e, 1, p.data());
594 if(p[0] > 0 and p[0] < this->nbvoxels_[this->Di_])
595 return EdgePosition::H_ny_2D;
597 return EdgePosition::H_0y_2D;
599 return EdgePosition::H_Ny_2D;
600 }
else if(e < this->esetshift_[2]) {
601 return EdgePosition::D1_2D;
604 }
else if(this->dimensionality_ == 1) {
606 return EdgePosition::FIRST_EDGE_1D;
607 }
else if(e == this->edgeNumber_ - 1)
608 return EdgePosition::CENTER_1D;
610 return EdgePosition::LAST_EDGE_1D;
613 return EdgePosition::CENTER_1D;
616std::array<ttk::SimplexId, 3>
618 std::array<SimplexId, 3> p{};
619 if(this->dimensionality_ == 3) {
620 if(e < this->esetshift_[0]) {
621 this->edgeToPosition(e, 0, p.data());
622 }
else if(e < this->esetshift_[1]) {
623 this->edgeToPosition(e, 1, p.data());
624 }
else if(e < this->esetshift_[2]) {
625 this->edgeToPosition(e, 2, p.data());
626 }
else if(e < this->esetshift_[3]) {
627 this->edgeToPosition(e, 3, p.data());
628 }
else if(e < this->esetshift_[4]) {
629 this->edgeToPosition(e, 4, p.data());
630 }
else if(e < this->esetshift_[5]) {
631 this->edgeToPosition(e, 5, p.data());
632 }
else if(e < this->esetshift_[6]) {
633 this->edgeToPosition(e, 6, p.data());
636 }
else if(this->dimensionality_ == 2) {
637 if(e < this->esetshift_[0]) {
638 this->edgeToPosition2d(e, 0, p.data());
639 }
else if(e < this->esetshift_[1]) {
640 this->edgeToPosition2d(e, 1, p.data());
641 }
else if(e < this->esetshift_[2]) {
642 this->edgeToPosition2d(e, 2, p.data());
650 if(this->dimensionality_ == 2) {
652 return TrianglePosition::TOP_2D;
654 return TrianglePosition::BOTTOM_2D;
656 }
else if(this->dimensionality_ == 3) {
657 if(t < this->tsetshift_[0]) {
658 return TrianglePosition::F_3D;
659 }
else if(t < this->tsetshift_[1]) {
660 return TrianglePosition::H_3D;
661 }
else if(t < this->tsetshift_[2]) {
662 return TrianglePosition::C_3D;
663 }
else if(t < this->tsetshift_[3]) {
664 return TrianglePosition::D1_3D;
665 }
else if(t < this->tsetshift_[4]) {
666 return TrianglePosition::D2_3D;
667 }
else if(t < this->tsetshift_[5]) {
668 return TrianglePosition::D3_3D;
671 return TrianglePosition::C_3D;
674std::array<ttk::SimplexId, 3>
676 std::array<SimplexId, 3> p{};
677 if(this->dimensionality_ == 2) {
678 this->triangleToPosition2d(t, p.data());
679 }
else if(this->dimensionality_ == 3) {
680 if(t < this->tsetshift_[0]) {
681 this->triangleToPosition(t, 0, p.data());
682 }
else if(t < this->tsetshift_[1]) {
683 this->triangleToPosition(t, 1, p.data());
684 }
else if(t < this->tsetshift_[2]) {
685 this->triangleToPosition(t, 2, p.data());
686 }
else if(t < this->tsetshift_[3]) {
687 this->triangleToPosition(t, 3, p.data());
688 }
else if(t < this->tsetshift_[4]) {
689 this->triangleToPosition(t, 4, p.data());
690 }
else if(t < this->tsetshift_[5]) {
691 this->triangleToPosition(t, 5, p.data());
VertexPosition getVertexPosition(const SimplexId v) const
EdgePosition getEdgePosition(const SimplexId e) const
TrianglePosition getTrianglePosition(const SimplexId t) const
std::array< SimplexId, 3 > getTriangleCoords(const SimplexId t) const
std::array< SimplexId, 3 > getEdgeCoords(const SimplexId e) const
@ BOTTOM_RIGHT_BACK_CORNER_3D
@ BOTTOM_LEFT_FRONT_CORNER_3D
@ BOTTOM_LEFT_BACK_CORNER_3D
@ TOP_LEFT_FRONT_CORNER_3D
@ BOTTOM_RIGHT_FRONT_CORNER_3D
@ TOP_RIGHT_BACK_CORNER_3D
@ TOP_RIGHT_FRONT_CORNER_3D
@ TOP_LEFT_BACK_CORNER_3D
int preconditionEdgesInternal() override
int preconditionTetrahedronsInternal() override
int preconditionTrianglesInternal() override
int preconditionVerticesInternal() override
virtual void vertexToPosition(const SimplexId vertex, SimplexId p[3]) const =0
virtual void vertexToPosition2d(const SimplexId vertex, SimplexId p[2]) const =0
int SimplexId
Identifier type for simplices of any dimension.