18 static constexpr
int edges_conn[] = {0, 1, 1, 2, 2, 0, 0, 3, 1, 3, 2, 3};
21 {0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4},
22 {3, 4, 0, 2, 5, 1}, {4, 5, 1, 0, 3, 2}, {5, 3, 2, 1, 4, 0}};
26 {3, 1, 0, 2}, {0, 1, 2, 3}, {2, 1, 3, 0}};
28 {4, 0, 3, 5, 1, 2}, {0, 1, 2, 3, 4, 5}, {1, 4, 5, 2, 0, 3}};
36 new_tets_conn[0 * 4 + 0] = conn[0];
37 new_tets_conn[0 * 4 + 1] = edge_new_nodes[0];
38 new_tets_conn[0 * 4 + 2] = edge_new_nodes[2];
39 new_tets_conn[0 * 4 + 3] = edge_new_nodes[3];
41 new_tets_conn[1 * 4 + 0] = conn[1];
42 new_tets_conn[1 * 4 + 1] = edge_new_nodes[0];
43 new_tets_conn[1 * 4 + 2] = edge_new_nodes[4];
44 new_tets_conn[1 * 4 + 3] = edge_new_nodes[1];
46 new_tets_conn[2 * 4 + 0] = conn[2];
47 new_tets_conn[2 * 4 + 1] = edge_new_nodes[1];
48 new_tets_conn[2 * 4 + 2] = edge_new_nodes[5];
49 new_tets_conn[2 * 4 + 3] = edge_new_nodes[2];
51 new_tets_conn[3 * 4 + 0] = conn[3];
52 new_tets_conn[3 * 4 + 1] = edge_new_nodes[3];
53 new_tets_conn[3 * 4 + 2] = edge_new_nodes[5];
54 new_tets_conn[3 * 4 + 3] = edge_new_nodes[4];
56 moab.get_coords(edge_new_nodes, 6, coords);
57 cblas_daxpy(3, -1, &coords[4 * 3], 1, &coords[2 * 3], 1);
58 cblas_daxpy(3, -1, &coords[3 * 3], 1, &coords[1 * 3], 1);
59 cblas_daxpy(3, -1, &coords[5 * 3], 1, &coords[0 * 3], 1);
60 double L[3] = {cblas_dnrm2(3, &coords[2 * 3], 1),
61 cblas_dnrm2(3, &coords[1 * 3], 1),
62 cblas_dnrm2(3, &coords[0 * 3], 1)};
64 if (
L[0] <=
L[1] &&
L[0] <=
L[2]) {
66 new_tets_conn[4 * 4 + 0] = edge_new_nodes[4];
67 new_tets_conn[4 * 4 + 1] = edge_new_nodes[3];
68 new_tets_conn[4 * 4 + 2] = edge_new_nodes[2];
69 new_tets_conn[4 * 4 + 3] = edge_new_nodes[0];
71 new_tets_conn[5 * 4 + 0] = edge_new_nodes[4];
72 new_tets_conn[5 * 4 + 1] = edge_new_nodes[2];
73 new_tets_conn[5 * 4 + 2] = edge_new_nodes[3];
74 new_tets_conn[5 * 4 + 3] = edge_new_nodes[5];
76 new_tets_conn[6 * 4 + 0] = edge_new_nodes[4];
77 new_tets_conn[6 * 4 + 1] = edge_new_nodes[2];
78 new_tets_conn[6 * 4 + 2] = edge_new_nodes[1];
79 new_tets_conn[6 * 4 + 3] = edge_new_nodes[0];
81 new_tets_conn[7 * 4 + 0] = edge_new_nodes[4];
82 new_tets_conn[7 * 4 + 1] = edge_new_nodes[1];
83 new_tets_conn[7 * 4 + 2] = edge_new_nodes[2];
84 new_tets_conn[7 * 4 + 3] = edge_new_nodes[5];
88 if (
L[1] <=
L[0] &&
L[1] <=
L[2]) {
90 new_tets_conn[4 * 4 + 0] = edge_new_nodes[4];
91 new_tets_conn[4 * 4 + 1] = edge_new_nodes[3];
92 new_tets_conn[4 * 4 + 2] = edge_new_nodes[1];
93 new_tets_conn[4 * 4 + 3] = edge_new_nodes[0];
95 new_tets_conn[5 * 4 + 0] = edge_new_nodes[4];
96 new_tets_conn[5 * 4 + 1] = edge_new_nodes[1];
97 new_tets_conn[5 * 4 + 2] = edge_new_nodes[3];
98 new_tets_conn[5 * 4 + 3] = edge_new_nodes[5];
100 new_tets_conn[6 * 4 + 0] = edge_new_nodes[1];
101 new_tets_conn[6 * 4 + 1] = edge_new_nodes[3];
102 new_tets_conn[6 * 4 + 2] = edge_new_nodes[2];
103 new_tets_conn[6 * 4 + 3] = edge_new_nodes[0];
105 new_tets_conn[7 * 4 + 0] = edge_new_nodes[1];
106 new_tets_conn[7 * 4 + 1] = edge_new_nodes[2];
107 new_tets_conn[7 * 4 + 2] = edge_new_nodes[3];
108 new_tets_conn[7 * 4 + 3] = edge_new_nodes[5];
113 new_tets_conn[4 * 4 + 0] = edge_new_nodes[5];
114 new_tets_conn[4 * 4 + 1] = edge_new_nodes[2];
115 new_tets_conn[4 * 4 + 2] = edge_new_nodes[0];
116 new_tets_conn[4 * 4 + 3] = edge_new_nodes[3];
118 new_tets_conn[5 * 4 + 0] = edge_new_nodes[5];
119 new_tets_conn[5 * 4 + 1] = edge_new_nodes[0];
120 new_tets_conn[5 * 4 + 2] = edge_new_nodes[2];
121 new_tets_conn[5 * 4 + 3] = edge_new_nodes[1];
123 new_tets_conn[6 * 4 + 0] = edge_new_nodes[5];
124 new_tets_conn[6 * 4 + 1] = edge_new_nodes[0];
125 new_tets_conn[6 * 4 + 2] = edge_new_nodes[4];
126 new_tets_conn[6 * 4 + 3] = edge_new_nodes[3];
128 new_tets_conn[7 * 4 + 0] = edge_new_nodes[5];
129 new_tets_conn[7 * 4 + 1] = edge_new_nodes[4];
130 new_tets_conn[7 * 4 + 2] = edge_new_nodes[0];
131 new_tets_conn[7 * 4 + 3] = edge_new_nodes[1];
137 for (
int ee = 0; ee < 6; ee++) {
149 for (
int ee = 0; ee < 6; ee++)
150 edge_new_nodes_[ee] = edge_new_nodes[edges_[ee]];
151 bool free_edge_swappped =
false;
152 if (conn_[3] < conn_[2]) {
153 free_edge_swappped =
true;
168 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
169 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[0];
170 new_tets_conn[0 * 4 + 2] = edge_new_nodes_[1];
171 new_tets_conn[0 * 4 + 3] = conn_[1];
173 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[2];
174 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[0];
175 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[3];
176 new_tets_conn[1 * 4 + 3] = conn_[0];
178 new_tets_conn[2 * 4 + 0] = conn_[2];
179 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[3];
180 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[4];
181 if (free_edge_swappped) {
182 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
183 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[2];
185 new_tets_conn[2 * 4 + 3] = conn_[3];
186 double coords[6 * 3];
187 moab.get_coords(edge_new_nodes_, 6, coords);
188 cblas_daxpy(3, -1, &coords[4 * 3], 1, &coords[2 * 3], 1);
189 cblas_daxpy(3, -1, &coords[3 * 3], 1, &coords[1 * 3], 1);
190 double L[2] = {cblas_dnrm2(3, &coords[2 * 3], 1),
191 cblas_dnrm2(3, &coords[1 * 3], 1)};
195 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
196 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[3];
197 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[1];
198 new_tets_conn[3 * 4 + 3] = edge_new_nodes_[0];
200 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[2];
201 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[1];
202 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[3];
203 new_tets_conn[4 * 4 + 3] = edge_new_nodes_[0];
205 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[4];
206 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[1];
207 new_tets_conn[5 * 4 + 2] = edge_new_nodes_[3];
208 new_tets_conn[5 * 4 + 3] = conn_[2];
210 new_tets_conn[6 * 4 + 0] = edge_new_nodes_[1];
211 new_tets_conn[6 * 4 + 1] = edge_new_nodes_[2];
212 new_tets_conn[6 * 4 + 2] = edge_new_nodes_[3];
213 new_tets_conn[6 * 4 + 3] = conn_[2];
218 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
219 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[3];
220 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[2];
221 new_tets_conn[3 * 4 + 3] = edge_new_nodes_[0];
223 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[2];
224 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[1];
225 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
226 new_tets_conn[4 * 4 + 3] = edge_new_nodes_[0];
228 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[4];
229 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[1];
230 new_tets_conn[5 * 4 + 2] = edge_new_nodes_[2];
231 new_tets_conn[5 * 4 + 3] = conn_[2];
233 new_tets_conn[6 * 4 + 0] = edge_new_nodes_[4];
234 new_tets_conn[6 * 4 + 1] = edge_new_nodes_[2];
235 new_tets_conn[6 * 4 + 2] = edge_new_nodes_[3];
236 new_tets_conn[6 * 4 + 3] = conn_[2];
242 char mach_pattern = 0;
243 for (
int ee = 0; ee < 4; ee++)
248 for (
int ee = 0; ee < 6; ee++) {
249 char pattern0, pattern1;
258 if (pattern0 == mach_pattern || pattern1 == mach_pattern) {
262 conn_[2] = conn[
edges_conn[free_edge * 2 + 0]];
263 conn_[3] = conn[
edges_conn[free_edge * 2 + 1]];
264 for (
int EE = 0; EE < 6; EE++)
266 if (pattern0 == mach_pattern)
268 else if (pattern1 == mach_pattern)
281 if (pattern0 == mach_pattern || pattern1 == mach_pattern) {
285 conn_[2] = conn[
edges_conn[free_edge * 2 + 1]];
286 conn_[3] = conn[
edges_conn[free_edge * 2 + 0]];
287 for (
int EE = 0; EE < 6; EE++)
289 if (pattern0 == mach_pattern)
291 else if (pattern1 == mach_pattern)
299 for (
int ee = 0; ee < 6; ee++)
300 edge_new_nodes_[ee] = edge_new_nodes[edges_[ee]];
306 bool free_edge_swappped5 =
false;
307 if (conn_[3] < conn_[2]) {
308 free_edge_swappped5 =
true;
310 bool free_edge_swappped2 =
false;
311 if (conn_[0] < conn_[2]) {
312 free_edge_swappped2 =
true;
315 new_tets_conn[0 * 4 + 0] = conn_[1];
316 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
317 new_tets_conn[0 * 4 + 2] = edge_new_nodes_[0];
318 new_tets_conn[0 * 4 + 3] = edge_new_nodes_[4];
319 if (free_edge_swappped5 && (!free_edge_swappped2)) {
321 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
322 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[3];
323 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
324 new_tets_conn[1 * 4 + 3] = conn_[3];
326 new_tets_conn[2 * 4 + 0] = conn_[3];
327 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
328 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[3];
329 new_tets_conn[2 * 4 + 3] = conn_[2];
331 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[0];
332 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[3];
333 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[4];
334 new_tets_conn[3 * 4 + 3] = edge_new_nodes_[1];
336 new_tets_conn[4 * 4 + 0] = conn_[2];
337 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[0];
338 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[3];
339 new_tets_conn[4 * 4 + 3] = conn_[0];
341 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[1];
342 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[0];
343 new_tets_conn[5 * 4 + 2] = edge_new_nodes_[3];
344 new_tets_conn[5 * 4 + 3] = conn_[2];
346 }
else if (free_edge_swappped2 && (!free_edge_swappped5)) {
348 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[3];
349 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
350 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[0];
351 new_tets_conn[1 * 4 + 3] = conn_[0];
353 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[3];
354 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
355 new_tets_conn[2 * 4 + 2] = conn_[0];
356 new_tets_conn[2 * 4 + 3] = conn_[2];
358 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[0];
359 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[3];
360 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[4];
361 new_tets_conn[3 * 4 + 3] = edge_new_nodes_[1];
363 new_tets_conn[4 * 4 + 0] = conn_[2];
364 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[3];
365 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
366 new_tets_conn[4 * 4 + 3] = conn_[3];
368 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[1];
369 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[3];
370 new_tets_conn[5 * 4 + 2] = edge_new_nodes_[4];
371 new_tets_conn[5 * 4 + 3] = conn_[2];
373 }
else if (free_edge_swappped2 && free_edge_swappped5) {
375 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[3];
376 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
377 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[0];
378 new_tets_conn[1 * 4 + 3] = conn_[0];
380 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[3];
381 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
382 new_tets_conn[2 * 4 + 2] = conn_[0];
383 new_tets_conn[2 * 4 + 3] = conn_[2];
385 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[0];
386 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[3];
387 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[4];
388 new_tets_conn[3 * 4 + 3] = edge_new_nodes_[1];
390 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[1];
391 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[3];
392 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
393 new_tets_conn[4 * 4 + 3] = conn_[3];
395 new_tets_conn[5 * 4 + 0] = conn_[3];
396 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[1];
397 new_tets_conn[5 * 4 + 2] = edge_new_nodes_[3];
398 new_tets_conn[5 * 4 + 3] = conn_[2];
402 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[0];
403 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[3];
404 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
405 new_tets_conn[1 * 4 + 3] = conn_[2];
407 new_tets_conn[2 * 4 + 0] = conn_[2];
408 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
409 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[4];
410 new_tets_conn[2 * 4 + 3] = edge_new_nodes_[0];
412 new_tets_conn[3 * 4 + 0] = conn_[2];
413 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[0];
414 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[3];
415 new_tets_conn[3 * 4 + 3] = conn_[0];
417 new_tets_conn[4 * 4 + 0] = conn_[2];
418 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[3];
419 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
420 new_tets_conn[4 * 4 + 3] = conn_[3];
422 }
else if (
type == 1) {
427 bool free_edge_swappped5 =
false;
428 if (conn_[3] < conn_[2]) {
429 free_edge_swappped5 =
true;
431 bool free_edge_swappped0 =
false;
432 if (conn_[0] > conn_[1]) {
433 free_edge_swappped0 =
true;
435 if (free_edge_swappped0 && (!free_edge_swappped5)) {
437 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[3];
438 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[2];
439 new_tets_conn[0 * 4 + 2] = conn_[1];
440 new_tets_conn[0 * 4 + 3] = conn_[0];
442 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[3];
443 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
444 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
445 new_tets_conn[1 * 4 + 3] = conn_[1];
447 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[3];
448 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
449 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[1];
450 new_tets_conn[2 * 4 + 3] = conn_[1];
452 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[1];
453 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
454 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[3];
455 new_tets_conn[3 * 4 + 3] = conn_[2];
457 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[1];
458 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[3];
459 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
460 new_tets_conn[4 * 4 + 3] = conn_[2];
462 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[3];
463 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[4];
464 new_tets_conn[5 * 4 + 2] = conn_[2];
465 new_tets_conn[5 * 4 + 3] = conn_[3];
467 }
else if (free_edge_swappped5 && (!free_edge_swappped0)) {
469 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
470 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
471 new_tets_conn[0 * 4 + 2] = conn_[1];
472 new_tets_conn[0 * 4 + 3] = conn_[0];
474 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[3];
475 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
476 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
477 new_tets_conn[1 * 4 + 3] = conn_[0];
479 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[2];
480 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
481 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[3];
482 new_tets_conn[2 * 4 + 3] = conn_[0];
484 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[1];
485 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
486 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[3];
487 new_tets_conn[3 * 4 + 3] = conn_[3];
489 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[1];
490 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[3];
491 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
492 new_tets_conn[4 * 4 + 3] = conn_[3];
494 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[1];
495 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[2];
496 new_tets_conn[5 * 4 + 2] = conn_[3];
497 new_tets_conn[5 * 4 + 3] = conn_[2];
499 }
else if (free_edge_swappped5 && free_edge_swappped0) {
501 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[3];
502 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[2];
503 new_tets_conn[0 * 4 + 2] = conn_[1];
504 new_tets_conn[0 * 4 + 3] = conn_[0];
506 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[3];
507 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
508 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
509 new_tets_conn[1 * 4 + 3] = conn_[1];
511 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[3];
512 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
513 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[1];
514 new_tets_conn[2 * 4 + 3] = conn_[1];
516 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[1];
517 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
518 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[3];
519 new_tets_conn[3 * 4 + 3] = conn_[3];
521 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[1];
522 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[3];
523 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
524 new_tets_conn[4 * 4 + 3] = conn_[3];
526 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[1];
527 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[2];
528 new_tets_conn[5 * 4 + 2] = conn_[3];
529 new_tets_conn[5 * 4 + 3] = conn_[2];
533 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
534 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
535 new_tets_conn[0 * 4 + 2] = conn_[1];
536 new_tets_conn[0 * 4 + 3] = conn_[0];
538 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[3];
539 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
540 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
541 new_tets_conn[1 * 4 + 3] = conn_[0];
543 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[2];
544 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
545 new_tets_conn[2 * 4 + 2] = edge_new_nodes_[3];
546 new_tets_conn[2 * 4 + 3] = conn_[0];
548 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[1];
549 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
550 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[3];
551 new_tets_conn[3 * 4 + 3] = conn_[2];
553 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[1];
554 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[3];
555 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[4];
556 new_tets_conn[4 * 4 + 3] = conn_[2];
558 new_tets_conn[5 * 4 + 0] = edge_new_nodes_[3];
559 new_tets_conn[5 * 4 + 1] = edge_new_nodes_[4];
560 new_tets_conn[5 * 4 + 2] = conn_[2];
561 new_tets_conn[5 * 4 + 3] = conn_[3];
568 char mach_pattern = 0;
569 for (
int ee = 0; ee < 3; ee++)
574 bool is_rotated =
false;
575 for (
int ee = 0; ee < 6; ee++) {
576 char pattern0, pattern1, pattern2;
586 if (pattern0 == mach_pattern || pattern1 == mach_pattern ||
587 pattern2 == mach_pattern) {
592 conn_[2] = conn[
edges_conn[free_edge * 2 + 0]];
593 conn_[3] = conn[
edges_conn[free_edge * 2 + 1]];
594 for (
int EE = 0; EE < 6; EE++)
596 if (pattern0 == mach_pattern) {
599 }
else if (pattern1 == mach_pattern)
601 else if (pattern2 == mach_pattern)
614 if (pattern0 == mach_pattern || pattern1 == mach_pattern ||
615 pattern2 == mach_pattern) {
620 conn_[2] = conn[
edges_conn[free_edge * 2 + 1]];
621 conn_[3] = conn[
edges_conn[free_edge * 2 + 0]];
622 for (
int EE = 0; EE < 6; EE++)
624 if (pattern0 == mach_pattern) {
627 }
else if (pattern1 == mach_pattern)
629 else if (pattern2 == mach_pattern)
636 if (pattern2 == mach_pattern) {
642 conn_[2] = conn[
edges_conn[free_edge * 2 + 1]];
643 conn_[3] = conn[
edges_conn[free_edge * 2 + 0]];
644 for (
int EE = 0; EE < 6; EE++)
646 if (pattern0 == mach_pattern) {
649 }
else if (pattern1 == mach_pattern)
651 else if (pattern2 == mach_pattern)
662 if (pattern2 == mach_pattern) {
667 conn_[2] = conn[
edges_conn[free_edge * 2 + 0]];
668 conn_[3] = conn[
edges_conn[free_edge * 2 + 1]];
669 for (
int EE = 0; EE < 6; EE++)
672 if (pattern0 == mach_pattern) {
675 }
else if (pattern1 == mach_pattern)
677 else if (pattern2 == mach_pattern)
684 for (
int ee = 0; ee < 6; ee++)
685 edge_new_nodes_[ee] = edge_new_nodes[edges_[ee]];
690 bcopy(edge_new_nodes_, edge_new_nodes__, 6 *
sizeof(
EntityHandle));
691 for (
int rotate_idx = 0; rotate_idx < 3; rotate_idx++) {
693 for (
int ii = 0; ii < 4; ii++)
695 for (
int ee = 0; ee < 6; ee++)
696 edge_new_nodes_[ee] =
698 if ((conn_[0] > conn_[2]) && (conn_[0] > conn_[3]))
701 assert(conn_[0] > conn_[2]);
702 assert(conn_[0] > conn_[3]);
707 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[0];
708 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
709 new_tets_conn[0 * 4 + 2] = edge_new_nodes_[4];
710 new_tets_conn[0 * 4 + 3] = conn_[1];
711 bool free_edge_swappped5 =
false;
712 if (conn_[3] < conn_[2]) {
713 free_edge_swappped5 =
true;
715 if (free_edge_swappped5) {
717 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
718 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[0];
719 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
720 new_tets_conn[1 * 4 + 3] = conn_[3];
722 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[0];
723 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[1];
724 new_tets_conn[2 * 4 + 2] = conn_[2];
725 new_tets_conn[2 * 4 + 3] = conn_[3];
727 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[0];
728 new_tets_conn[3 * 4 + 1] = conn_[0];
729 new_tets_conn[3 * 4 + 2] = conn_[3];
730 new_tets_conn[3 * 4 + 3] = conn_[2];
734 assert(conn_[3] > conn_[2]);
736 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
737 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[0];
738 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
739 new_tets_conn[1 * 4 + 3] = conn_[2];
741 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[0];
742 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[4];
743 new_tets_conn[2 * 4 + 2] = conn_[2];
744 new_tets_conn[2 * 4 + 3] = conn_[3];
746 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[0];
747 new_tets_conn[3 * 4 + 1] = conn_[0];
748 new_tets_conn[3 * 4 + 2] = conn_[3];
749 new_tets_conn[3 * 4 + 3] = conn_[2];
751 }
else if (
type == 1) {
756 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[1];
757 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[4];
758 new_tets_conn[0 * 4 + 2] = edge_new_nodes_[5];
759 new_tets_conn[0 * 4 + 3] = conn_[0];
761 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[4];
762 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[5];
763 new_tets_conn[1 * 4 + 2] = conn_[0];
764 new_tets_conn[1 * 4 + 3] = conn_[3];
766 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[1];
767 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[5];
768 new_tets_conn[2 * 4 + 2] = conn_[2];
769 new_tets_conn[2 * 4 + 3] = conn_[0];
771 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
772 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[1];
773 new_tets_conn[3 * 4 + 2] = conn_[1];
774 new_tets_conn[3 * 4 + 3] = conn_[0];
775 }
else if (
type == 2) {
779 bool free_edge_swappped5 =
false;
780 if (conn_[3] < conn_[2]) {
781 free_edge_swappped5 =
true;
783 bool free_edge_swappped0 =
false;
784 if (conn_[0] > conn_[1]) {
785 free_edge_swappped0 =
true;
787 if (free_edge_swappped5 && (!free_edge_swappped0)) {
789 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
790 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
792 new_tets_conn[0 * 4 + 2] = conn_[0];
793 new_tets_conn[0 * 4 + 3] = conn_[1];
795 new_tets_conn[0 * 4 + 2] = conn_[1];
796 new_tets_conn[0 * 4 + 3] = conn_[0];
799 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
800 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[2];
802 new_tets_conn[1 * 4 + 2] = conn_[3];
803 new_tets_conn[1 * 4 + 3] = conn_[0];
805 new_tets_conn[1 * 4 + 2] = conn_[0];
806 new_tets_conn[1 * 4 + 3] = conn_[3];
809 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[1];
810 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
812 new_tets_conn[2 * 4 + 2] = conn_[2];
813 new_tets_conn[2 * 4 + 3] = conn_[3];
815 new_tets_conn[2 * 4 + 2] = conn_[3];
816 new_tets_conn[2 * 4 + 3] = conn_[2];
819 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
820 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[1];
822 new_tets_conn[3 * 4 + 2] = conn_[3];
823 new_tets_conn[3 * 4 + 3] = conn_[0];
825 new_tets_conn[3 * 4 + 2] = conn_[0];
826 new_tets_conn[3 * 4 + 3] = conn_[3];
829 }
else if (free_edge_swappped0 && (!free_edge_swappped5)) {
831 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
832 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
834 new_tets_conn[0 * 4 + 2] = edge_new_nodes_[2];
835 new_tets_conn[0 * 4 + 3] = conn_[1];
837 new_tets_conn[0 * 4 + 2] = conn_[1];
838 new_tets_conn[0 * 4 + 3] = edge_new_nodes_[2];
841 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[4];
842 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
844 new_tets_conn[1 * 4 + 2] = conn_[2];
845 new_tets_conn[1 * 4 + 3] = edge_new_nodes_[2];
847 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[2];
848 new_tets_conn[1 * 4 + 3] = conn_[2];
851 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[4];
852 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
854 new_tets_conn[2 * 4 + 2] = conn_[0];
855 new_tets_conn[2 * 4 + 3] = conn_[1];
857 new_tets_conn[2 * 4 + 2] = conn_[1];
858 new_tets_conn[2 * 4 + 3] = conn_[0];
861 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
862 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
864 new_tets_conn[3 * 4 + 2] = conn_[3];
865 new_tets_conn[3 * 4 + 3] = conn_[0];
867 new_tets_conn[3 * 4 + 2] = conn_[0];
868 new_tets_conn[3 * 4 + 3] = conn_[3];
871 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[4];
872 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[2];
874 new_tets_conn[4 * 4 + 2] = conn_[2];
875 new_tets_conn[4 * 4 + 3] = conn_[3];
877 new_tets_conn[4 * 4 + 2] = conn_[3];
878 new_tets_conn[4 * 4 + 3] = conn_[2];
881 }
else if (free_edge_swappped0 && free_edge_swappped5) {
883 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
884 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
886 new_tets_conn[0 * 4 + 2] = edge_new_nodes_[2];
887 new_tets_conn[0 * 4 + 3] = conn_[1];
889 new_tets_conn[0 * 4 + 2] = conn_[1];
890 new_tets_conn[0 * 4 + 3] = edge_new_nodes_[2];
893 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
894 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[2];
896 new_tets_conn[1 * 4 + 2] = conn_[2];
897 new_tets_conn[1 * 4 + 3] = conn_[3];
899 new_tets_conn[1 * 4 + 2] = conn_[3];
900 new_tets_conn[1 * 4 + 3] = conn_[2];
903 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[4];
904 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
906 new_tets_conn[2 * 4 + 2] = conn_[0];
907 new_tets_conn[2 * 4 + 3] = conn_[1];
909 new_tets_conn[2 * 4 + 2] = conn_[1];
910 new_tets_conn[2 * 4 + 3] = conn_[0];
913 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
914 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
916 new_tets_conn[3 * 4 + 2] = conn_[3];
917 new_tets_conn[3 * 4 + 3] = conn_[0];
919 new_tets_conn[3 * 4 + 2] = conn_[0];
920 new_tets_conn[3 * 4 + 3] = conn_[3];
923 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[4];
924 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[2];
926 new_tets_conn[4 * 4 + 2] = edge_new_nodes_[1];
927 new_tets_conn[4 * 4 + 3] = conn_[3];
929 new_tets_conn[4 * 4 + 2] = conn_[3];
930 new_tets_conn[4 * 4 + 3] = edge_new_nodes_[1];
935 new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
936 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
938 new_tets_conn[0 * 4 + 2] = conn_[0];
939 new_tets_conn[0 * 4 + 3] = conn_[1];
941 new_tets_conn[0 * 4 + 2] = conn_[1];
942 new_tets_conn[0 * 4 + 3] = conn_[0];
945 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
946 new_tets_conn[1 * 4 + 1] = edge_new_nodes_[2];
948 new_tets_conn[1 * 4 + 2] = conn_[2];
949 new_tets_conn[1 * 4 + 3] = edge_new_nodes_[4];
951 new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
952 new_tets_conn[1 * 4 + 3] = conn_[2];
955 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[4];
956 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
958 new_tets_conn[2 * 4 + 2] = conn_[2];
959 new_tets_conn[2 * 4 + 3] = conn_[3];
961 new_tets_conn[2 * 4 + 2] = conn_[3];
962 new_tets_conn[2 * 4 + 3] = conn_[2];
965 new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
966 new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
968 new_tets_conn[3 * 4 + 2] = conn_[0];
969 new_tets_conn[3 * 4 + 3] = edge_new_nodes_[1];
971 new_tets_conn[3 * 4 + 2] = edge_new_nodes_[1];
972 new_tets_conn[3 * 4 + 3] = conn_[0];
975 new_tets_conn[4 * 4 + 0] = edge_new_nodes_[4];
976 new_tets_conn[4 * 4 + 1] = edge_new_nodes_[2];
978 new_tets_conn[4 * 4 + 2] = conn_[3];
979 new_tets_conn[4 * 4 + 3] = conn_[0];
981 new_tets_conn[4 * 4 + 2] = conn_[0];
982 new_tets_conn[4 * 4 + 3] = conn_[3];
998 new_tets_conn[0 * 4 + 0] = edge_new_nodes[split_edges[0]];
999 new_tets_conn[0 * 4 + 1] = edge_new_nodes[split_edges[1]];
1000 new_tets_conn[0 * 4 + 2] = n2;
1001 new_tets_conn[0 * 4 + 3] = n0;
1003 new_tets_conn[1 * 4 + 0] = edge_new_nodes[split_edges[0]];
1004 new_tets_conn[1 * 4 + 1] = edge_new_nodes[split_edges[1]];
1005 new_tets_conn[1 * 4 + 2] = n1;
1006 new_tets_conn[1 * 4 + 3] = n2;
1008 new_tets_conn[2 * 4 + 0] = edge_new_nodes[split_edges[0]];
1009 new_tets_conn[2 * 4 + 1] = edge_new_nodes[split_edges[1]];
1010 new_tets_conn[2 * 4 + 2] = n0;
1011 new_tets_conn[2 * 4 + 3] = n3;
1013 new_tets_conn[3 * 4 + 0] = edge_new_nodes[split_edges[0]];
1014 new_tets_conn[3 * 4 + 1] = edge_new_nodes[split_edges[1]];
1015 new_tets_conn[3 * 4 + 2] = n3;
1016 new_tets_conn[3 * 4 + 3] = n1;
1021 const char mach_pattern =
1025 for (
int ee = 0; ee < 6; ee++) {
1029 if (pattern == mach_pattern) {
1033 conn_[2] = conn[
edges_conn[free_edge * 2 + 0]];
1034 conn_[3] = conn[
edges_conn[free_edge * 2 + 1]];
1035 for (
int EE = 0; EE < 6; EE++)
1042 if (pattern == mach_pattern) {
1046 conn_[2] = conn[
edges_conn[free_edge * 2 + 1]];
1047 conn_[3] = conn[
edges_conn[free_edge * 2 + 0]];
1048 for (
int EE = 0; EE < 6; EE++)
1055 for (
int ee = 0; ee < 6; ee++)
1056 edge_new_nodes_[ee] = edge_new_nodes[edges_[ee]];
1057 assert(edge_new_nodes_[1] !=
no_handle);
1058 assert(edge_new_nodes_[4] !=
no_handle);
1060 new_tets_conn[0 * 4 + 0] = conn_[1];
1061 new_tets_conn[0 * 4 + 1] = edge_new_nodes_[4];
1062 new_tets_conn[0 * 4 + 2] = edge_new_nodes_[1];
1063 new_tets_conn[0 * 4 + 3] = conn_[0];
1064 bool free_edge_swappped5 =
false;
1065 if (conn_[3] < conn_[2]) {
1066 free_edge_swappped5 =
true;
1069 if (free_edge_swappped5) {
1071 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
1072 new_tets_conn[1 * 4 + 1] = conn_[2];
1073 new_tets_conn[1 * 4 + 2] = conn_[0];
1074 new_tets_conn[1 * 4 + 3] = conn_[3];
1076 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[1];
1077 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[4];
1078 new_tets_conn[2 * 4 + 2] = conn_[3];
1079 new_tets_conn[2 * 4 + 3] = conn_[0];
1083 new_tets_conn[1 * 4 + 0] = edge_new_nodes_[4];
1084 new_tets_conn[1 * 4 + 1] = conn_[2];
1085 new_tets_conn[1 * 4 + 2] = conn_[0];
1086 new_tets_conn[1 * 4 + 3] = conn_[3];
1088 new_tets_conn[2 * 4 + 0] = edge_new_nodes_[1];
1089 new_tets_conn[2 * 4 + 1] = edge_new_nodes_[4];
1090 new_tets_conn[2 * 4 + 2] = conn_[2];
1091 new_tets_conn[2 * 4 + 3] = conn_[0];
1099 new_tets_conn[0 * 4 + 0] = edge_new_node;
1100 new_tets_conn[0 * 4 + 1] = conn[
edges_conn[2 * split_edge + 0]];
1104 new_tets_conn[1 * 4 + 0] = edge_new_node;
1105 new_tets_conn[1 * 4 + 1] = conn[
edges_conn[2 * split_edge + 1]];
1116 new_tris_conn[0 * 3 + 0] = conn[0];
1117 new_tris_conn[0 * 3 + 1] = edge_new_nodes[0];
1118 new_tris_conn[0 * 3 + 2] = edge_new_nodes[2];
1121 new_tris_conn[1 * 3 + 0] = edge_new_nodes[0];
1122 new_tris_conn[1 * 3 + 1] = conn[1];
1123 new_tris_conn[1 * 3 + 2] = edge_new_nodes[1];
1126 new_tris_conn[2 * 3 + 0] = edge_new_nodes[2];
1127 new_tris_conn[2 * 3 + 1] = edge_new_nodes[1];
1128 new_tris_conn[2 * 3 + 2] = conn[2];
1131 new_tris_conn[3 * 3 + 0] = edge_new_nodes[0];
1132 new_tris_conn[3 * 3 + 1] = edge_new_nodes[1];
1133 new_tris_conn[3 * 3 + 2] = edge_new_nodes[2];
1143 if (split_edge == 0) {
1145 new_tris_conn[0 * 3 + 0] = conn[0];
1146 new_tris_conn[0 * 3 + 1] = edge_new_node;
1147 new_tris_conn[0 * 3 + 2] = conn[2];
1149 new_tris_conn[1 * 3 + 0] = edge_new_node;
1150 new_tris_conn[1 * 3 + 1] = conn[1];
1151 new_tris_conn[1 * 3 + 2] = conn[2];
1152 }
else if (split_edge == 1) {
1154 new_tris_conn[0 * 3 + 0] = conn[0];
1155 new_tris_conn[0 * 3 + 1] = conn[1];
1156 new_tris_conn[0 * 3 + 2] = edge_new_node;
1158 new_tris_conn[1 * 3 + 0] = conn[0];
1159 new_tris_conn[1 * 3 + 1] = edge_new_node;
1160 new_tris_conn[1 * 3 + 2] = conn[2];
1161 }
else if (split_edge == 2) {
1163 new_tris_conn[0 * 3 + 0] = conn[0];
1164 new_tris_conn[0 * 3 + 1] = conn[1];
1165 new_tris_conn[0 * 3 + 2] = edge_new_node;
1167 new_tris_conn[1 * 3 + 0] = edge_new_node;;
1168 new_tris_conn[1 * 3 + 1] = conn[1];
1169 new_tris_conn[1 * 3 + 2] = conn[2];
1183 if(split_edges[0] == 0 && split_edges[1] == 1) {
1185 new_tris_conn[0 * 3 + 0] = conn[0];
1186 new_tris_conn[0 * 3 + 1] = edge_new_nodes[0];
1187 new_tris_conn[0 * 3 + 2] = edge_new_nodes[1];
1189 new_tris_conn[1 * 3 + 0] = edge_new_nodes[0];
1190 new_tris_conn[1 * 3 + 1] = conn[1];
1191 new_tris_conn[1 * 3 + 2] = edge_new_nodes[1];
1193 new_tris_conn[2 * 3 + 0] = conn[0];
1194 new_tris_conn[2 * 3 + 1] = edge_new_nodes[1];
1195 new_tris_conn[2 * 3 + 2] = conn[2];
1196 }
else if(split_edges[0] == 0 && split_edges[1] == 2) {
1198 new_tris_conn[0 * 3 + 0] = conn[0];
1199 new_tris_conn[0 * 3 + 1] = edge_new_nodes[0];
1200 new_tris_conn[0 * 3 + 2] = edge_new_nodes[2];
1202 new_tris_conn[1 * 3 + 0] = edge_new_nodes[0];
1203 new_tris_conn[1 * 3 + 1] = conn[1];
1204 new_tris_conn[1 * 3 + 2] = edge_new_nodes[2];
1206 new_tris_conn[2 * 3 + 0] = edge_new_nodes[2];
1207 new_tris_conn[2 * 3 + 1] = conn[1];
1208 new_tris_conn[2 * 3 + 2] = conn[2];
1209 }
else if(split_edges[0] == 1 && split_edges[1] == 2) {
1211 new_tris_conn[0 * 3 + 0] = conn[0];
1212 new_tris_conn[0 * 3 + 1] = conn[1];
1213 new_tris_conn[0 * 3 + 2] = edge_new_nodes[2];
1215 new_tris_conn[1 * 3 + 0] = edge_new_nodes[2];
1216 new_tris_conn[1 * 3 + 1] = conn[1];
1217 new_tris_conn[1 * 3 + 2] = edge_new_nodes[1];
1219 new_tris_conn[2 * 3 + 0] = edge_new_nodes[2];
1220 new_tris_conn[2 * 3 + 1] = edge_new_nodes[1];
1221 new_tris_conn[2 * 3 + 2] = conn[2];
1236 for (; ee < 6; ee++) {
1237 if (split_edges.test(ee))
1242 const int cycle_edges[3][6] = {
1243 {0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4}};
1244 const int cycle_nodes[3][6] = {
1245 {0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4}};
1246 if (edge_new_nodes[cycle_nodes[ee][0]] ==
no_handle)
1248 if (edge_new_nodes[cycle_nodes[ee][3]] ==
no_handle)
1251 new_prism_conn[0 * 6 + 0] = edge_new_nodes[cycle_edges[ee][0]];
1252 new_prism_conn[0 * 6 + 1] = conn[cycle_nodes[ee][2]];
1253 new_prism_conn[0 * 6 + 2] = conn[cycle_nodes[ee][0]];
1254 new_prism_conn[0 * 6 + 3] = edge_new_nodes[cycle_edges[ee][3]];
1255 new_prism_conn[0 * 6 + 4] = conn[cycle_nodes[ee][5]];
1256 new_prism_conn[0 * 6 + 5] = conn[cycle_nodes[ee][3]];
1258 new_prism_conn[1 * 6 + 0] = edge_new_nodes[cycle_edges[ee][0]];
1259 new_prism_conn[1 * 6 + 1] = conn[cycle_nodes[ee][2]];
1260 new_prism_conn[1 * 6 + 2] = conn[cycle_nodes[ee][1]];
1261 new_prism_conn[1 * 6 + 3] = edge_new_nodes[cycle_edges[ee][3]];
1262 new_prism_conn[1 * 6 + 4] = conn[cycle_nodes[ee][5]];
1263 new_prism_conn[1 * 6 + 5] = conn[cycle_nodes[ee][4]];
1271 const int cycle_edges[3][6] = {
1272 {0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4}};
1273 const int cycle_nodes[3][6] = {
1274 {0, 1, 2, 3, 4, 5}, {1, 2, 0, 4, 5, 3}, {2, 0, 1, 5, 3, 4}};
1276 for (; ee < 3; ee++) {
1278 mach_pattern.set(cycle_edges[ee][0]);
1279 mach_pattern.set(cycle_edges[ee][2]);
1280 mach_pattern.set(cycle_edges[ee][3]);
1281 mach_pattern.set(cycle_edges[ee][5]);
1282 if (mach_pattern == split_edges)
1289 for (; nn < 6; nn++) {
1290 _conn_[nn] = conn[cycle_nodes[ee][nn]];
1291 _edge_new_nodes_[nn] = edge_new_nodes[cycle_edges[ee][nn]];
1293 if (_conn_[1] < _conn_[2]) {
1295 _conn____ = _conn_[2];
1296 _conn_[2] = _conn_[1];
1297 _conn_[1] = _conn____;
1298 _conn____ = _conn_[5];
1299 _conn_[5] = _conn_[4];
1300 _conn_[4] = _conn____;
1301 _conn____ = _edge_new_nodes_[0];
1302 _edge_new_nodes_[0] = _edge_new_nodes_[2];
1303 _edge_new_nodes_[2] = _conn____;
1304 _conn____ = _edge_new_nodes_[6 - 3];
1305 _edge_new_nodes_[6 - 3] = _edge_new_nodes_[8 - 3];
1306 _edge_new_nodes_[8 - 3] = _conn____;
1312 if (_edge_new_nodes_[6 - 3] ==
no_handle)
1314 if (_edge_new_nodes_[8 - 3] ==
no_handle)
1317 new_prism_conn[0 * 6 + 0] = _conn_[0];
1318 new_prism_conn[0 * 6 + 1] = _edge_new_nodes_[0];
1319 new_prism_conn[0 * 6 + 2] = _edge_new_nodes_[2];
1320 new_prism_conn[0 * 6 + 3] = _conn_[3];
1321 new_prism_conn[0 * 6 + 4] = _edge_new_nodes_[6 - 3];
1322 new_prism_conn[0 * 6 + 5] = _edge_new_nodes_[8 - 3];
1324 new_prism_conn[1 * 6 + 0] = _conn_[1];
1325 new_prism_conn[1 * 6 + 1] = _conn_[2];
1326 new_prism_conn[1 * 6 + 2] = _edge_new_nodes_[0];
1327 new_prism_conn[1 * 6 + 3] = _conn_[4];
1328 new_prism_conn[1 * 6 + 4] = _conn_[5];
1329 new_prism_conn[1 * 6 + 5] = _edge_new_nodes_[6 - 3];
1331 new_prism_conn[2 * 6 + 0] = _conn_[2];
1332 new_prism_conn[2 * 6 + 1] = _edge_new_nodes_[0];
1333 new_prism_conn[2 * 6 + 2] = _edge_new_nodes_[2];
1334 new_prism_conn[2 * 6 + 3] = _conn_[5];
1335 new_prism_conn[2 * 6 + 4] = _edge_new_nodes_[6 - 3];
1336 new_prism_conn[2 * 6 + 5] = _edge_new_nodes_[8 - 3];
1345 for (; ee < 6; ee++) {
1346 if (!split_edges.test(ee))
1350 new_prism_conn[0 * 6 + 0] = edge_new_nodes[0];
1351 new_prism_conn[0 * 6 + 1] = edge_new_nodes[2];
1352 new_prism_conn[0 * 6 + 2] = conn[0];
1353 new_prism_conn[0 * 6 + 3] = edge_new_nodes[6 - 3];
1354 new_prism_conn[0 * 6 + 4] = edge_new_nodes[8 - 3];
1355 new_prism_conn[0 * 6 + 5] = conn[3];
1357 new_prism_conn[1 * 6 + 0] = edge_new_nodes[0];
1358 new_prism_conn[1 * 6 + 1] = edge_new_nodes[1];
1359 new_prism_conn[1 * 6 + 2] = conn[1];
1360 new_prism_conn[1 * 6 + 3] = edge_new_nodes[6 - 3];
1361 new_prism_conn[1 * 6 + 4] = edge_new_nodes[7 - 3];
1362 new_prism_conn[1 * 6 + 5] = conn[4];
1364 new_prism_conn[2 * 6 + 0] = edge_new_nodes[1];
1365 new_prism_conn[2 * 6 + 1] = edge_new_nodes[2];
1366 new_prism_conn[2 * 6 + 2] = conn[2];
1367 new_prism_conn[2 * 6 + 3] = edge_new_nodes[7 - 3];
1368 new_prism_conn[2 * 6 + 4] = edge_new_nodes[8 - 3];
1369 new_prism_conn[2 * 6 + 5] = conn[5];
1371 new_prism_conn[3 * 6 + 0] = edge_new_nodes[0];
1372 new_prism_conn[3 * 6 + 1] = edge_new_nodes[1];
1373 new_prism_conn[3 * 6 + 2] = edge_new_nodes[2];
1374 new_prism_conn[3 * 6 + 3] = edge_new_nodes[6 - 3];
1375 new_prism_conn[3 * 6 + 4] = edge_new_nodes[7 - 3];
1376 new_prism_conn[3 * 6 + 5] = edge_new_nodes[8 - 3];