TTK
Loading...
Searching...
No Matches
ImplicitPreconditions.cpp
Go to the documentation of this file.
2
4
5 vertexPositions_.resize(this->vertexNumber_);
6 vertexCoords_.resize(this->vertexNumber_);
7
8 if(this->dimensionality_ == 1) {
9 vertexPositions_[0] = VertexPosition::LEFT_CORNER_1D;
10#ifdef TTK_ENABLE_OPENMP
11#pragma omp parallel for num_threads(this->threadNumber_)
12#endif // TTK_ENABLE_OPENMP
13 for(SimplexId i = 1; i < this->vertexNumber_ - 1; ++i) {
14 vertexPositions_[i] = VertexPosition::CENTER_1D;
15 }
16 vertexPositions_[this->vertexNumber_ - 1] = VertexPosition::RIGHT_CORNER_1D;
17
18 } else if(this->dimensionality_ == 2) {
19#ifdef TTK_ENABLE_OPENMP
20#pragma omp parallel for num_threads(this->threadNumber_)
21#endif // TTK_ENABLE_OPENMP
22 for(SimplexId i = 0; i < this->vertexNumber_; ++i) {
23 auto &p = vertexCoords_[i];
24 this->vertexToPosition2d(i, p.data());
25
26 if(0 < p[0] and p[0] < this->nbvoxels_[this->Di_]) {
27 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
28 vertexPositions_[i] = VertexPosition::CENTER_2D;
29 else if(p[1] == 0)
30 vertexPositions_[i] = VertexPosition::TOP_EDGE_2D; // ab
31 else
32 vertexPositions_[i] = VertexPosition::BOTTOM_EDGE_2D; // cd
33 } else if(p[0] == 0) {
34 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
35 vertexPositions_[i] = VertexPosition::LEFT_EDGE_2D; // ac
36 else if(p[1] == 0)
37 vertexPositions_[i] = VertexPosition::TOP_LEFT_CORNER_2D; // a
38 else
39 vertexPositions_[i] = VertexPosition::BOTTOM_LEFT_CORNER_2D; // c
40 } else {
41 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
42 vertexPositions_[i] = VertexPosition::RIGHT_EDGE_2D; // bd
43 else if(p[1] == 0)
44 vertexPositions_[i] = VertexPosition::TOP_RIGHT_CORNER_2D; // b
45 else
46 vertexPositions_[i] = VertexPosition::BOTTOM_RIGHT_CORNER_2D; // d
47 }
48 }
49
50 } else if(this->dimensionality_ == 3) {
51#ifdef TTK_ENABLE_OPENMP
52#pragma omp parallel for num_threads(this->threadNumber_)
53#endif // TTK_ENABLE_OPENMP
54 for(SimplexId i = 0; i < this->vertexNumber_; ++i) {
55 auto &p = vertexCoords_[i];
56 this->vertexToPosition(i, p.data());
57
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])
61 vertexPositions_[i] = VertexPosition::CENTER_3D;
62 else if(p[2] == 0)
63 vertexPositions_[i] = VertexPosition::FRONT_FACE_3D; // abcd
64 else
65 vertexPositions_[i] = VertexPosition::BACK_FACE_3D; // efgh
66 } else if(p[1] == 0) {
67 if(0 < p[2] and p[2] < this->nbvoxels_[2])
68 vertexPositions_[i] = VertexPosition::TOP_FACE_3D; // abef
69 else if(p[2] == 0)
70 vertexPositions_[i] = VertexPosition::TOP_FRONT_EDGE_3D; // ab
71 else
72 vertexPositions_[i] = VertexPosition::TOP_BACK_EDGE_3D; // ef
73 } else {
74 if(0 < p[2] and p[2] < this->nbvoxels_[2])
75 vertexPositions_[i] = VertexPosition::BOTTOM_FACE_3D; // cdgh
76 else if(p[2] == 0)
77 vertexPositions_[i] = VertexPosition::BOTTOM_FRONT_EDGE_3D; // cd
78 else
79 vertexPositions_[i] = VertexPosition::BOTTOM_BACK_EDGE_3D; // gh
80 }
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])
84 vertexPositions_[i] = VertexPosition::LEFT_FACE_3D; // aceg
85 else if(p[2] == 0)
86 vertexPositions_[i] = VertexPosition::LEFT_FRONT_EDGE_3D; // ac
87 else
88 vertexPositions_[i] = VertexPosition::LEFT_BACK_EDGE_3D; // eg
89 } else if(p[1] == 0) {
90 if(0 < p[2] and p[2] < this->nbvoxels_[2])
91 vertexPositions_[i] = VertexPosition::TOP_LEFT_EDGE_3D; // ae
92 else if(p[2] == 0)
93 vertexPositions_[i] = VertexPosition::TOP_LEFT_FRONT_CORNER_3D; // a
94 else
95 vertexPositions_[i] = VertexPosition::TOP_LEFT_BACK_CORNER_3D; // e
96 } else {
97 if(0 < p[2] and p[2] < this->nbvoxels_[2])
98 vertexPositions_[i] = VertexPosition::BOTTOM_LEFT_EDGE_3D; // cg
99 else if(p[2] == 0)
100 vertexPositions_[i]
102 else
103 vertexPositions_[i]
105 }
106 } else {
107 if(0 < p[1] and p[1] < this->nbvoxels_[1]) {
108 if(0 < p[2] and p[2] < this->nbvoxels_[2])
109 vertexPositions_[i] = VertexPosition::RIGHT_FACE_3D; // bdfh
110 else if(p[2] == 0)
111 vertexPositions_[i] = VertexPosition::RIGHT_FRONT_EDGE_3D; // bd
112 else
113 vertexPositions_[i] = VertexPosition::RIGHT_BACK_EDGE_3D; // fh
114 } else if(p[1] == 0) {
115 if(0 < p[2] and p[2] < this->nbvoxels_[2])
116 vertexPositions_[i] = VertexPosition::TOP_RIGHT_EDGE_3D; // bf
117 else if(p[2] == 0)
118 vertexPositions_[i]
120 else
121 vertexPositions_[i] = VertexPosition::TOP_RIGHT_BACK_CORNER_3D; // f
122 } else {
123 if(0 < p[2] and p[2] < this->nbvoxels_[2])
124 vertexPositions_[i] = VertexPosition::BOTTOM_RIGHT_EDGE_3D; // dh
125 else if(p[2] == 0)
126 vertexPositions_[i]
128 else
129 vertexPositions_[i]
131 }
132 }
133 }
134 }
135
136 return 0;
137}
138
140 edgePositions_.resize(this->edgeNumber_);
141 edgeCoords_.resize(this->edgeNumber_);
142
143 if(this->dimensionality_ == 3) {
144#ifdef TTK_ENABLE_OPENMP
145#pragma omp parallel for num_threads(this->threadNumber_)
146#endif // TTK_ENABLE_OPENMP
147 for(SimplexId i = 0; i < this->edgeNumber_; ++i) {
148 auto &p = edgeCoords_[i];
149
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;
155 else if(p[2] == 0)
156 edgePositions_[i] = EdgePosition::L_xn0_3D;
157 else
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;
162 else if(p[2] == 0)
163 edgePositions_[i] = EdgePosition::L_x00_3D;
164 else
165 edgePositions_[i] = EdgePosition::L_x0N_3D;
166 } else {
167 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
168 edgePositions_[i] = EdgePosition::L_xNn_3D;
169 else if(p[2] == 0)
170 edgePositions_[i] = EdgePosition::L_xN0_3D;
171 else
172 edgePositions_[i] = EdgePosition::L_xNN_3D;
173 }
174
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;
180 else if(p[2] == 0)
181 edgePositions_[i] = EdgePosition::H_ny0_3D;
182 else
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;
187 else if(p[2] == 0)
188 edgePositions_[i] = EdgePosition::H_0y0_3D;
189 else
190 edgePositions_[i] = EdgePosition::H_0yN_3D;
191 } else {
192 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
193 edgePositions_[i] = EdgePosition::H_Nyn_3D;
194 else if(p[2] == 0)
195 edgePositions_[i] = EdgePosition::H_Ny0_3D;
196 else
197 edgePositions_[i] = EdgePosition::H_NyN_3D;
198 }
199
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;
205 else if(p[1] == 0)
206 edgePositions_[i] = EdgePosition::P_n0z_3D;
207 else
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;
212 else if(p[1] == 0)
213 edgePositions_[i] = EdgePosition::P_00z_3D;
214 else
215 edgePositions_[i] = EdgePosition::P_0Nz_3D;
216 } else {
217 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
218 edgePositions_[i] = EdgePosition::P_Nnz_3D;
219 else if(p[1] == 0)
220 edgePositions_[i] = EdgePosition::P_N0z_3D;
221 else
222 edgePositions_[i] = EdgePosition::P_NNz_3D;
223 }
224
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;
229 else if(p[2] == 0)
230 edgePositions_[i] = EdgePosition::D1_xy0_3D;
231 else
232 edgePositions_[i] = EdgePosition::D1_xyN_3D;
233
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;
238 else if(p[0] == 0)
239 edgePositions_[i] = EdgePosition::D2_0yz_3D;
240 else
241 edgePositions_[i] = EdgePosition::D2_Nyz_3D;
242
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;
247 else if(p[1] == 0)
248 edgePositions_[i] = EdgePosition::D3_x0z_3D;
249 else
250 edgePositions_[i] = EdgePosition::D3_xNz_3D;
251
252 } else if(i < this->esetshift_[6]) {
253 this->edgeToPosition(i, 6, p.data());
254 edgePositions_[i] = EdgePosition::D4_3D;
255 }
256 }
257
258 } else if(this->dimensionality_ == 2) {
259#ifdef TTK_ENABLE_OPENMP
260#pragma omp parallel for num_threads(this->threadNumber_)
261#endif // TTK_ENABLE_OPENMP
262 for(SimplexId i = 0; i < this->edgeNumber_; ++i) {
263 auto &p = edgeCoords_[i];
264
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;
269 else if(p[1] == 0)
270 edgePositions_[i] = EdgePosition::L_x0_2D;
271 else
272 edgePositions_[i] = EdgePosition::L_xN_2D;
273
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;
278 else if(p[0] == 0)
279 edgePositions_[i] = EdgePosition::H_0y_2D;
280 else
281 edgePositions_[i] = EdgePosition::H_Ny_2D;
282
283 } else if(i < this->esetshift_[2]) {
284 this->edgeToPosition2d(i, 2, p.data());
285 edgePositions_[i] = EdgePosition::D1_2D;
286 }
287 }
288
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_)
293#endif // TTK_ENABLE_OPENMP
294 for(SimplexId i = 1; i < this->edgeNumber_ - 1; ++i) {
295 edgePositions_[i] = EdgePosition::CENTER_1D;
296 }
297 edgePositions_[this->edgeNumber_ - 1] = EdgePosition::LAST_EDGE_1D;
298 }
299
300 return 0;
301}
302
304
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_)
310#endif // TTK_ENABLE_OPENMP
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;
330 }
331 }
332
333 } else if(this->dimensionality_ == 2) {
334#ifdef TTK_ENABLE_OPENMP
335#pragma omp parallel for num_threads(this->threadNumber_)
336#endif // TTK_ENABLE_OPENMP
337 for(SimplexId i = 0; i < this->triangleNumber_; ++i) {
338 this->triangleToPosition2d(i, triangleCoords_[i].data());
339 if(i % 2 == 0) {
340 trianglePositions_[i] = TrianglePosition::TOP_2D;
341 } else {
342 trianglePositions_[i] = TrianglePosition::BOTTOM_2D;
343 }
344 }
345 }
346
347 return 0;
348}
349
351
352 if(this->dimensionality_ != 3) {
353 return 1;
354 }
355 tetrahedronCoords_.resize(this->tetrahedronNumber_);
356
357#ifdef TTK_ENABLE_OPENMP
358#pragma omp parallel for num_threads(this->threadNumber_)
359#endif // TTK_ENABLE_OPENMP
360 for(SimplexId i = 0; i < this->tetrahedronNumber_; ++i) {
361 this->tetrahedronToPosition(i, tetrahedronCoords_[i].data());
362 }
363
364 return 0;
365}
366
369
370 if(this->dimensionality_ == 1) {
371 if(v == 0) {
372 return VertexPosition::LEFT_CORNER_1D;
373 } else if(v == this->vertexNumber_ - 1) {
374 return VertexPosition::RIGHT_CORNER_1D;
375 }
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;
382 else if(p[1] == 0)
383 return VertexPosition::TOP_EDGE_2D; // ab
384 else
385 return VertexPosition::BOTTOM_EDGE_2D; // cd
386 } else if(p[0] == 0) {
387 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
388 return VertexPosition::LEFT_EDGE_2D; // ac
389 else if(p[1] == 0)
390 return VertexPosition::TOP_LEFT_CORNER_2D; // a
391 else
392 return VertexPosition::BOTTOM_LEFT_CORNER_2D; // c
393 } else {
394 if(0 < p[1] and p[1] < this->nbvoxels_[this->Dj_])
395 return VertexPosition::RIGHT_EDGE_2D; // bd
396 else if(p[1] == 0)
397 return VertexPosition::TOP_RIGHT_CORNER_2D; // b
398 else
399 return VertexPosition::BOTTOM_RIGHT_CORNER_2D; // d
400 }
401
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;
408 else if(p[2] == 0)
409 return VertexPosition::FRONT_FACE_3D; // abcd
410 else
411 return VertexPosition::BACK_FACE_3D; // efgh
412 } else if(p[1] == 0) {
413 if(0 < p[2] and p[2] < this->nbvoxels_[2])
414 return VertexPosition::TOP_FACE_3D; // abef
415 else if(p[2] == 0)
416 return VertexPosition::TOP_FRONT_EDGE_3D; // ab
417 else
418 return VertexPosition::TOP_BACK_EDGE_3D; // ef
419 } else {
420 if(0 < p[2] and p[2] < this->nbvoxels_[2])
421 return VertexPosition::BOTTOM_FACE_3D; // cdgh
422 else if(p[2] == 0)
423 return VertexPosition::BOTTOM_FRONT_EDGE_3D; // cd
424 else
425 return VertexPosition::BOTTOM_BACK_EDGE_3D; // gh
426 }
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; // aceg
431 else if(p[2] == 0)
432 return VertexPosition::LEFT_FRONT_EDGE_3D; // ac
433 else
434 return VertexPosition::LEFT_BACK_EDGE_3D; // eg
435 } else if(p[1] == 0) {
436 if(0 < p[2] and p[2] < this->nbvoxels_[2])
437 return VertexPosition::TOP_LEFT_EDGE_3D; // ae
438 else if(p[2] == 0)
439 return VertexPosition::TOP_LEFT_FRONT_CORNER_3D; // a
440 else
441 return VertexPosition::TOP_LEFT_BACK_CORNER_3D; // e
442 } else {
443 if(0 < p[2] and p[2] < this->nbvoxels_[2])
444 return VertexPosition::BOTTOM_LEFT_EDGE_3D; // cg
445 else if(p[2] == 0)
446 return VertexPosition::BOTTOM_LEFT_FRONT_CORNER_3D; // c
447 else
448 return VertexPosition::BOTTOM_LEFT_BACK_CORNER_3D; // g
449 }
450 } else {
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; // bdfh
454 else if(p[2] == 0)
455 return VertexPosition::RIGHT_FRONT_EDGE_3D; // bd
456 else
457 return VertexPosition::RIGHT_BACK_EDGE_3D; // fh
458 } else if(p[1] == 0) {
459 if(0 < p[2] and p[2] < this->nbvoxels_[2])
460 return VertexPosition::TOP_RIGHT_EDGE_3D; // bf
461 else if(p[2] == 0)
462 return VertexPosition::TOP_RIGHT_FRONT_CORNER_3D; // b
463 else
464 return VertexPosition::TOP_RIGHT_BACK_CORNER_3D; // f
465 } else {
466 if(0 < p[2] and p[2] < this->nbvoxels_[2])
467 return VertexPosition::BOTTOM_RIGHT_EDGE_3D; // dh
468 else if(p[2] == 0)
469 return VertexPosition::BOTTOM_RIGHT_FRONT_CORNER_3D; // d
470 else
471 return VertexPosition::BOTTOM_RIGHT_BACK_CORNER_3D; // h
472 }
473 }
474 }
475 return VertexPosition::CENTER_3D;
476}
477
480 std::array<SimplexId, 3> p{};
481 if(this->dimensionality_ == 3) {
482
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;
488 else if(p[2] == 0)
489 return EdgePosition::L_xn0_3D;
490 else
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;
495 else if(p[2] == 0)
496 return EdgePosition::L_x00_3D;
497 else
498 return EdgePosition::L_x0N_3D;
499 } else {
500 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
501 return EdgePosition::L_xNn_3D;
502 else if(p[2] == 0)
503 return EdgePosition::L_xN0_3D;
504 else
505 return EdgePosition::L_xNN_3D;
506 }
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;
512 else if(p[2] == 0)
513 return EdgePosition::H_ny0_3D;
514 else
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;
519 else if(p[2] == 0)
520 return EdgePosition::H_0y0_3D;
521 else
522 return EdgePosition::H_0yN_3D;
523 } else {
524 if(p[2] > 0 and p[2] < this->nbvoxels_[2])
525 return EdgePosition::H_Nyn_3D;
526 else if(p[2] == 0)
527 return EdgePosition::H_Ny0_3D;
528 else
529 return EdgePosition::H_NyN_3D;
530 }
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;
536 else if(p[1] == 0)
537 return EdgePosition::P_n0z_3D;
538 else
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;
543 else if(p[1] == 0)
544 return EdgePosition::P_00z_3D;
545 else
546 return EdgePosition::P_0Nz_3D;
547 } else {
548 if(p[1] > 0 and p[1] < this->nbvoxels_[1])
549 return EdgePosition::P_Nnz_3D;
550 else if(p[1] == 0)
551 return EdgePosition::P_N0z_3D;
552 else
553 return EdgePosition::P_NNz_3D;
554 }
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;
559 else if(p[2] == 0)
560 return EdgePosition::D1_xy0_3D;
561 else
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;
567 else if(p[0] == 0)
568 return EdgePosition::D2_0yz_3D;
569 else
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;
575 else if(p[1] == 0)
576 return EdgePosition::D3_x0z_3D;
577 else
578 return EdgePosition::D3_xNz_3D;
579 } else if(e < this->esetshift_[6]) {
580 return EdgePosition::D4_3D;
581 }
582
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;
588 else if(p[1] == 0)
589 return EdgePosition::L_x0_2D;
590 else
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;
596 else if(p[0] == 0)
597 return EdgePosition::H_0y_2D;
598 else
599 return EdgePosition::H_Ny_2D;
600 } else if(e < this->esetshift_[2]) {
601 return EdgePosition::D1_2D;
602 }
603
604 } else if(this->dimensionality_ == 1) {
605 if(e == 0) {
606 return EdgePosition::FIRST_EDGE_1D;
607 } else if(e == this->edgeNumber_ - 1)
608 return EdgePosition::CENTER_1D;
609 } else {
610 return EdgePosition::LAST_EDGE_1D;
611 }
612
613 return EdgePosition::CENTER_1D;
614}
615
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());
634 }
635
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());
643 }
644 }
645 return p;
646}
647
650 if(this->dimensionality_ == 2) {
651 if(t % 2 == 0) {
652 return TrianglePosition::TOP_2D;
653 } else {
654 return TrianglePosition::BOTTOM_2D;
655 }
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;
669 }
670 }
671 return TrianglePosition::C_3D;
672}
673
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());
692 }
693 }
694 return p;
695}
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
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.
Definition: DataTypes.h:22