v0.14.0
EntityRefine.cpp
Go to the documentation of this file.
1 /* \file EntityRefine.cpp
2  * \brief Tetrahedral refinement algorithm
3 
4  It is based on \cite ruprecht1998scheme
5 
6  \todo tet refinement should be rewritten, with better error control, and more
7  clear refinement patterns.
8 
9 */
10 
11 
12 
13 // A scheme for Edge-based Adaptive Tetrahedral Subdivision; Delft Ruprecht
14 
15 namespace MoFEM {
16 
17 // TET
18 static constexpr int edges_conn[] = {0, 1, 1, 2, 2, 0, 0, 3, 1, 3, 2, 3};
19 static constexpr int oposite_edge[] = {5, 3, 4, 1, 2, 0};
20 static constexpr int edge_permutations[6][6] = {
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}};
23 static constexpr int edge_mirror_cross[6] = {0, 3, 4, 1, 2, 5};
24 static constexpr int edge_mirror_vertical[6] = {0, 4, 3, 2, 1, 5};
25 static constexpr int cyclic_node_rotate_face_3[3][4] = {
26  {3, 1, 0, 2}, {0, 1, 2, 3}, {2, 1, 3, 0}}; // 2,0,1
27 static constexpr int cyclic_edge_rotate_face_3[3][6] = {
28  {4, 0, 3, 5, 1, 2}, {0, 1, 2, 3, 4, 5}, {1, 4, 5, 2, 0, 3}};
29 static constexpr char edge_bits_mark[] = {1, 2, 4, 8, 16, 32};
30 
31 void tet_type_6(moab::Interface &moab, const EntityHandle *conn,
32  const EntityHandle *edge_new_nodes,
33  EntityHandle *new_tets_conn) {
34  // 0:01 - 4 1:12-5 2:20-6 3:03-7 4:13-8 5:23-9
35  // TET0
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];
40  // TET1
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];
45  // TET2
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];
50  // TET3
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];
55  double coords[6 * 3];
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)};
63  // VARIANT 1 - diag 4-2
64  if (L[0] <= L[1] && L[0] <= L[2]) {
65  // TET4
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];
70  // TET5
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];
75  // TET6
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];
80  // TET7
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];
85  return;
86  }
87  // VARIANT 2 - diag 3-1
88  if (L[1] <= L[0] && L[1] <= L[2]) {
89  // TET4
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];
94  // TET5
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];
99  // TET6
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];
104  // TET7
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];
109  return;
110  }
111  // VARIANT 3 - diag 5-0
112  // TET4
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];
117  // TET5
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];
122  // TET6
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];
127  // TET7
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];
132 }
133 int tet_type_5(moab::Interface &moab, const EntityHandle *conn,
134  const EntityHandle *edge_new_nodes,
135  EntityHandle *new_tets_conn) {
136  int free_edge = -1;
137  for (int ee = 0; ee < 6; ee++) {
138  if (edge_new_nodes[ee] == no_handle) {
139  free_edge = ee;
140  break;
141  }
142  }
143  int edge0 = oposite_edge[free_edge];
144  EntityHandle conn_[] = {
145  conn[edges_conn[edge0 * 2 + 0]], conn[edges_conn[edge0 * 2 + 1]],
146  conn[edges_conn[free_edge * 2 + 0]], conn[edges_conn[free_edge * 2 + 1]]};
147  const int *edges_ = &edge_permutations[edge0][0];
148  EntityHandle edge_new_nodes_[6];
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;
154  EntityHandle conn__2_ = conn_[2];
155  conn_[2] = conn_[3];
156  conn_[3] = conn__2_;
157  }
158  assert(conn_[0] != no_handle);
159  assert(conn_[1] != no_handle);
160  assert(conn_[2] != no_handle);
161  assert(conn_[3] != no_handle);
162  assert(edge_new_nodes_[0] != no_handle);
163  assert(edge_new_nodes_[1] != no_handle);
164  assert(edge_new_nodes_[2] != no_handle);
165  assert(edge_new_nodes_[3] != no_handle);
166  assert(edge_new_nodes_[4] != no_handle);
167  // TET0
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];
172  // TET1
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];
177  // TET4
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];
184  }
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)};
192  if (L[1] <= L[0]) {
193  // VARIANT 1 diag 4-2
194  // TET2
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];
199  // TET3
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];
204  // TET5
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];
209  // TET6
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];
214  return 1;
215  }
216  // VARIANT 2 diag 1-3
217  // TET2
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];
222  // TET3
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];
227  // TET5
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];
232  // TET6
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];
237  return 0;
238 }
239 int tet_type_4(const EntityHandle *conn, const int *split_edges,
240  const EntityHandle *edge_new_nodes,
241  EntityHandle *new_tets_conn) {
242  char mach_pattern = 0;
243  for (int ee = 0; ee < 4; ee++)
244  mach_pattern |= edge_bits_mark[split_edges[ee]];
246  int edges_[6];
247  int type = -1;
248  for (int ee = 0; ee < 6; ee++) {
249  char pattern0, pattern1;
250  pattern0 = edge_bits_mark[edge_permutations[ee][0]] |
254  pattern1 = edge_bits_mark[edge_permutations[ee][1]] |
258  if (pattern0 == mach_pattern || pattern1 == mach_pattern) {
259  int free_edge = oposite_edge[ee];
260  conn_[0] = conn[edges_conn[ee * 2 + 0]];
261  conn_[1] = conn[edges_conn[ee * 2 + 1]];
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++)
265  edges_[EE] = edge_permutations[ee][EE];
266  if (pattern0 == mach_pattern)
267  type = 0;
268  else if (pattern1 == mach_pattern)
269  type = 1;
270  // printf("no mirror\n");
271  break;
272  }
277  pattern1 = edge_bits_mark[edge_permutations[ee][1]] |
281  if (pattern0 == mach_pattern || pattern1 == mach_pattern) {
282  int free_edge = oposite_edge[ee];
283  conn_[0] = conn[edges_conn[ee * 2 + 1]];
284  conn_[1] = conn[edges_conn[ee * 2 + 0]];
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++)
288  edges_[EE] = edge_permutations[ee][edge_mirror_cross[EE]];
289  if (pattern0 == mach_pattern)
290  type = 0;
291  else if (pattern1 == mach_pattern)
292  type = 1;
293  // printf("mirror\n");
294  break;
295  }
296  }
297  assert(type != -1);
298  EntityHandle edge_new_nodes_[6];
299  for (int ee = 0; ee < 6; ee++)
300  edge_new_nodes_[ee] = edge_new_nodes[edges_[ee]];
301  if (type == 0) {
302  assert(edge_new_nodes_[0] != no_handle);
303  assert(edge_new_nodes_[1] != no_handle);
304  assert(edge_new_nodes_[4] != no_handle);
305  assert(edge_new_nodes_[3] != no_handle);
306  bool free_edge_swappped5 = false;
307  if (conn_[3] < conn_[2]) {
308  free_edge_swappped5 = true;
309  }
310  bool free_edge_swappped2 = false;
311  if (conn_[0] < conn_[2]) {
312  free_edge_swappped2 = true;
313  }
314  // TET0
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)) {
320  // TET1
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];
325  // TET2
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];
330  // TET3
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];
335  // TET4
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];
340  // TET5
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];
345  return 2;
346  } else if (free_edge_swappped2 && (!free_edge_swappped5)) {
347  // TET1
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];
352  // TET2
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];
357  // TET3
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];
362  // TET4
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];
367  // TET5
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];
372  return 3;
373  } else if (free_edge_swappped2 && free_edge_swappped5) {
374  // TET1
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];
379  // TET2
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];
384  // TET3
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];
389  // TET4
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];
394  // TET5
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];
399  return 4;
400  } else {
401  // TET1
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];
406  // TET2
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];
411  // TET3
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];
416  // TET4
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];
421  }
422  } else if (type == 1) {
423  assert(edge_new_nodes_[1] != no_handle);
424  assert(edge_new_nodes_[2] != no_handle);
425  assert(edge_new_nodes_[3] != no_handle);
426  assert(edge_new_nodes_[4] != no_handle);
427  bool free_edge_swappped5 = false;
428  if (conn_[3] < conn_[2]) {
429  free_edge_swappped5 = true;
430  }
431  bool free_edge_swappped0 = false;
432  if (conn_[0] > conn_[1]) {
433  free_edge_swappped0 = true;
434  }
435  if (free_edge_swappped0 && (!free_edge_swappped5)) {
436  // TET0
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];
441  // TET1
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];
446  // TET2
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];
451  // TET3
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];
456  // TET4
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];
461  // TET5
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];
466  return 5;
467  } else if (free_edge_swappped5 && (!free_edge_swappped0)) {
468  // TET0
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];
473  // TET1
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];
478  // TET2
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];
483  // TET3
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];
488  // TET4
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];
493  // TET5
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];
498  return 6;
499  } else if (free_edge_swappped5 && free_edge_swappped0) {
500  // TET0
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];
505  // TET1
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];
510  // TET2
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];
515  // TET3
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];
520  // TET4
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];
525  // TET5
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];
530  return 7;
531  }
532  // TET0
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];
537  // TET1
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];
542  // TET2
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];
547  // TET3
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];
552  // TET4
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];
557  // TET5
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];
562  }
563  return type;
564 }
565 int tet_type_3(const EntityHandle *conn, const int *split_edges,
566  const EntityHandle *edge_new_nodes,
567  EntityHandle *new_tets_conn) {
568  char mach_pattern = 0;
569  for (int ee = 0; ee < 3; ee++)
570  mach_pattern |= edge_bits_mark[split_edges[ee]];
571  EntityHandle conn_[4];
572  int edges_[6];
573  int type = -1;
574  bool is_rotated = false;
575  for (int ee = 0; ee < 6; ee++) {
576  char pattern0, pattern1, pattern2;
577  pattern0 = edge_bits_mark[edge_permutations[ee][0]] |
580  pattern1 = edge_bits_mark[edge_permutations[ee][1]] |
583  pattern2 = edge_bits_mark[edge_permutations[ee][4]] |
586  if (pattern0 == mach_pattern || pattern1 == mach_pattern ||
587  pattern2 == mach_pattern) {
588  // printf("nothing\n");
589  int free_edge = oposite_edge[ee];
590  conn_[0] = conn[edges_conn[ee * 2 + 0]];
591  conn_[1] = conn[edges_conn[ee * 2 + 1]];
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++)
595  edges_[EE] = edge_permutations[ee][EE];
596  if (pattern0 == mach_pattern) {
597  // printf("nothing\n");
598  type = 0;
599  } else if (pattern1 == mach_pattern)
600  type = 1;
601  else if (pattern2 == mach_pattern)
602  type = 2;
603  break;
604  }
614  if (pattern0 == mach_pattern || pattern1 == mach_pattern ||
615  pattern2 == mach_pattern) {
616  // printf("edge_mirror_cross\n");
617  int free_edge = oposite_edge[ee];
618  conn_[0] = conn[edges_conn[ee * 2 + 1]];
619  conn_[1] = conn[edges_conn[ee * 2 + 0]];
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++)
623  edges_[EE] = edge_permutations[ee][edge_mirror_cross[EE]];
624  if (pattern0 == mach_pattern) {
625  // printf("edge_mirror_cross\n");
626  type = 0;
627  } else if (pattern1 == mach_pattern)
628  type = 1;
629  else if (pattern2 == mach_pattern)
630  type = 2;
631  break;
632  }
636  if (pattern2 == mach_pattern) {
637  is_rotated = true;
638  // printf("edge_mirror_vertical\n");
639  int free_edge = oposite_edge[ee];
640  conn_[0] = conn[edges_conn[ee * 2 + 0]];
641  conn_[1] = conn[edges_conn[ee * 2 + 1]];
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++)
645  edges_[EE] = edge_permutations[ee][edge_mirror_vertical[EE]];
646  if (pattern0 == mach_pattern) {
647  // printf("edge_mirror_vertical\n");
648  type = 0;
649  } else if (pattern1 == mach_pattern)
650  type = 1;
651  else if (pattern2 == mach_pattern)
652  type = 2;
653  break;
654  }
655  pattern2 =
662  if (pattern2 == mach_pattern) {
663  is_rotated = true;
664  int free_edge = oposite_edge[ee];
665  conn_[0] = conn[edges_conn[ee * 2 + 1]];
666  conn_[1] = conn[edges_conn[ee * 2 + 0]];
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++)
670  edges_[EE] =
672  if (pattern0 == mach_pattern) {
673  // printf("edge_mirror_cross|edge_mirror_vertical\n");
674  type = 0;
675  } else if (pattern1 == mach_pattern)
676  type = 1;
677  else if (pattern2 == mach_pattern)
678  type = 2;
679  break;
680  }
681  }
682  assert(type != -1);
683  EntityHandle edge_new_nodes_[6];
684  for (int ee = 0; ee < 6; ee++)
685  edge_new_nodes_[ee] = edge_new_nodes[edges_[ee]];
686  if (type == 0) {
687  EntityHandle conn__[4];
688  EntityHandle edge_new_nodes__[6];
689  bcopy(conn_, conn__, 4 * sizeof(EntityHandle));
690  bcopy(edge_new_nodes_, edge_new_nodes__, 6 * sizeof(EntityHandle));
691  for (int rotate_idx = 0; rotate_idx < 3; rotate_idx++) {
692  // fprintf(stderr,"%d\n",rotate_idx);
693  for (int ii = 0; ii < 4; ii++)
694  conn_[ii] = conn__[cyclic_node_rotate_face_3[rotate_idx][ii]];
695  for (int ee = 0; ee < 6; ee++)
696  edge_new_nodes_[ee] =
697  edge_new_nodes__[cyclic_edge_rotate_face_3[rotate_idx][ee]];
698  if ((conn_[0] > conn_[2]) && (conn_[0] > conn_[3]))
699  break;
700  }
701  assert(conn_[0] > conn_[2]);
702  assert(conn_[0] > conn_[3]);
703  assert(edge_new_nodes_[0] != no_handle);
704  assert(edge_new_nodes_[1] != no_handle);
705  assert(edge_new_nodes_[4] != no_handle);
706  // TET0
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;
714  }
715  if (free_edge_swappped5) {
716  // TET1
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];
721  // TET2
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];
726  // TET3
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];
731  // printf("free_edge_swappped5\n");
732  return 4;
733  }
734  assert(conn_[3] > conn_[2]);
735  // TET1
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];
740  // TET2
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];
745  // TET3
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];
750  // printf("no free_edge_swappped5\n");
751  } else if (type == 1) {
752  assert(edge_new_nodes_[1] != no_handle);
753  assert(edge_new_nodes_[4] != no_handle);
754  assert(edge_new_nodes_[5] != no_handle);
755  // TET0
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];
760  // TET1
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];
765  // TET2
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];
770  // TET3
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) {
776  assert(edge_new_nodes_[1] != no_handle);
777  assert(edge_new_nodes_[4] != no_handle);
778  assert(edge_new_nodes_[2] != no_handle);
779  bool free_edge_swappped5 = false;
780  if (conn_[3] < conn_[2]) {
781  free_edge_swappped5 = true;
782  }
783  bool free_edge_swappped0 = false;
784  if (conn_[0] > conn_[1]) {
785  free_edge_swappped0 = true;
786  }
787  if (free_edge_swappped5 && (!free_edge_swappped0)) {
788  // TET0
789  new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
790  new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
791  if (is_rotated) {
792  new_tets_conn[0 * 4 + 2] = conn_[0];
793  new_tets_conn[0 * 4 + 3] = conn_[1];
794  } else {
795  new_tets_conn[0 * 4 + 2] = conn_[1];
796  new_tets_conn[0 * 4 + 3] = conn_[0];
797  }
798  // TET1
799  new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
800  new_tets_conn[1 * 4 + 1] = edge_new_nodes_[2];
801  if (is_rotated) {
802  new_tets_conn[1 * 4 + 2] = conn_[3];
803  new_tets_conn[1 * 4 + 3] = conn_[0];
804  } else {
805  new_tets_conn[1 * 4 + 2] = conn_[0];
806  new_tets_conn[1 * 4 + 3] = conn_[3];
807  }
808  // TET2
809  new_tets_conn[2 * 4 + 0] = edge_new_nodes_[1];
810  new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
811  if (is_rotated) {
812  new_tets_conn[2 * 4 + 2] = conn_[2];
813  new_tets_conn[2 * 4 + 3] = conn_[3];
814  } else {
815  new_tets_conn[2 * 4 + 2] = conn_[3];
816  new_tets_conn[2 * 4 + 3] = conn_[2];
817  }
818  // TET3
819  new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
820  new_tets_conn[3 * 4 + 1] = edge_new_nodes_[1];
821  if (is_rotated) {
822  new_tets_conn[3 * 4 + 2] = conn_[3];
823  new_tets_conn[3 * 4 + 3] = conn_[0];
824  } else {
825  new_tets_conn[3 * 4 + 2] = conn_[0];
826  new_tets_conn[3 * 4 + 3] = conn_[3];
827  }
828  return type;
829  } else if (free_edge_swappped0 && (!free_edge_swappped5)) {
830  // TET0
831  new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
832  new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
833  if (is_rotated) {
834  new_tets_conn[0 * 4 + 2] = edge_new_nodes_[2];
835  new_tets_conn[0 * 4 + 3] = conn_[1];
836  } else {
837  new_tets_conn[0 * 4 + 2] = conn_[1];
838  new_tets_conn[0 * 4 + 3] = edge_new_nodes_[2];
839  }
840  // TET1
841  new_tets_conn[1 * 4 + 0] = edge_new_nodes_[4];
842  new_tets_conn[1 * 4 + 1] = edge_new_nodes_[1];
843  if (is_rotated) {
844  new_tets_conn[1 * 4 + 2] = conn_[2];
845  new_tets_conn[1 * 4 + 3] = edge_new_nodes_[2];
846  } else {
847  new_tets_conn[1 * 4 + 2] = edge_new_nodes_[2];
848  new_tets_conn[1 * 4 + 3] = conn_[2];
849  }
850  // TET2
851  new_tets_conn[2 * 4 + 0] = edge_new_nodes_[4];
852  new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
853  if (is_rotated) {
854  new_tets_conn[2 * 4 + 2] = conn_[0];
855  new_tets_conn[2 * 4 + 3] = conn_[1];
856  } else {
857  new_tets_conn[2 * 4 + 2] = conn_[1];
858  new_tets_conn[2 * 4 + 3] = conn_[0];
859  }
860  // TET3
861  new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
862  new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
863  if (is_rotated) {
864  new_tets_conn[3 * 4 + 2] = conn_[3];
865  new_tets_conn[3 * 4 + 3] = conn_[0];
866  } else {
867  new_tets_conn[3 * 4 + 2] = conn_[0];
868  new_tets_conn[3 * 4 + 3] = conn_[3];
869  }
870  // TET4
871  new_tets_conn[4 * 4 + 0] = edge_new_nodes_[4];
872  new_tets_conn[4 * 4 + 1] = edge_new_nodes_[2];
873  if (is_rotated) {
874  new_tets_conn[4 * 4 + 2] = conn_[2];
875  new_tets_conn[4 * 4 + 3] = conn_[3];
876  } else {
877  new_tets_conn[4 * 4 + 2] = conn_[3];
878  new_tets_conn[4 * 4 + 3] = conn_[2];
879  }
880  return 5;
881  } else if (free_edge_swappped0 && free_edge_swappped5) {
882  // TET0
883  new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
884  new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
885  if (is_rotated) {
886  new_tets_conn[0 * 4 + 2] = edge_new_nodes_[2];
887  new_tets_conn[0 * 4 + 3] = conn_[1];
888  } else {
889  new_tets_conn[0 * 4 + 2] = conn_[1];
890  new_tets_conn[0 * 4 + 3] = edge_new_nodes_[2];
891  }
892  // TET1
893  new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
894  new_tets_conn[1 * 4 + 1] = edge_new_nodes_[2];
895  if (is_rotated) {
896  new_tets_conn[1 * 4 + 2] = conn_[2];
897  new_tets_conn[1 * 4 + 3] = conn_[3];
898  } else {
899  new_tets_conn[1 * 4 + 2] = conn_[3];
900  new_tets_conn[1 * 4 + 3] = conn_[2];
901  }
902  // TET2
903  new_tets_conn[2 * 4 + 0] = edge_new_nodes_[4];
904  new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
905  if (is_rotated) {
906  new_tets_conn[2 * 4 + 2] = conn_[0];
907  new_tets_conn[2 * 4 + 3] = conn_[1];
908  } else {
909  new_tets_conn[2 * 4 + 2] = conn_[1];
910  new_tets_conn[2 * 4 + 3] = conn_[0];
911  }
912  // TET3
913  new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
914  new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
915  if (is_rotated) {
916  new_tets_conn[3 * 4 + 2] = conn_[3];
917  new_tets_conn[3 * 4 + 3] = conn_[0];
918  } else {
919  new_tets_conn[3 * 4 + 2] = conn_[0];
920  new_tets_conn[3 * 4 + 3] = conn_[3];
921  }
922  // TET4
923  new_tets_conn[4 * 4 + 0] = edge_new_nodes_[4];
924  new_tets_conn[4 * 4 + 1] = edge_new_nodes_[2];
925  if (is_rotated) {
926  new_tets_conn[4 * 4 + 2] = edge_new_nodes_[1];
927  new_tets_conn[4 * 4 + 3] = conn_[3];
928  } else {
929  new_tets_conn[4 * 4 + 2] = conn_[3];
930  new_tets_conn[4 * 4 + 3] = edge_new_nodes_[1];
931  }
932  return 6;
933  }
934  // TET0
935  new_tets_conn[0 * 4 + 0] = edge_new_nodes_[4];
936  new_tets_conn[0 * 4 + 1] = edge_new_nodes_[1];
937  if (is_rotated) {
938  new_tets_conn[0 * 4 + 2] = conn_[0];
939  new_tets_conn[0 * 4 + 3] = conn_[1];
940  } else {
941  new_tets_conn[0 * 4 + 2] = conn_[1];
942  new_tets_conn[0 * 4 + 3] = conn_[0];
943  }
944  // TET1
945  new_tets_conn[1 * 4 + 0] = edge_new_nodes_[1];
946  new_tets_conn[1 * 4 + 1] = edge_new_nodes_[2];
947  if (is_rotated) {
948  new_tets_conn[1 * 4 + 2] = conn_[2];
949  new_tets_conn[1 * 4 + 3] = edge_new_nodes_[4];
950  } else {
951  new_tets_conn[1 * 4 + 2] = edge_new_nodes_[4];
952  new_tets_conn[1 * 4 + 3] = conn_[2];
953  }
954  // TET2
955  new_tets_conn[2 * 4 + 0] = edge_new_nodes_[4];
956  new_tets_conn[2 * 4 + 1] = edge_new_nodes_[2];
957  if (is_rotated) {
958  new_tets_conn[2 * 4 + 2] = conn_[2];
959  new_tets_conn[2 * 4 + 3] = conn_[3];
960  } else {
961  new_tets_conn[2 * 4 + 2] = conn_[3];
962  new_tets_conn[2 * 4 + 3] = conn_[2];
963  }
964  // TET3
965  new_tets_conn[3 * 4 + 0] = edge_new_nodes_[4];
966  new_tets_conn[3 * 4 + 1] = edge_new_nodes_[2];
967  if (is_rotated) {
968  new_tets_conn[3 * 4 + 2] = conn_[0];
969  new_tets_conn[3 * 4 + 3] = edge_new_nodes_[1];
970  } else {
971  new_tets_conn[3 * 4 + 2] = edge_new_nodes_[1];
972  new_tets_conn[3 * 4 + 3] = conn_[0];
973  }
974  // TET4
975  new_tets_conn[4 * 4 + 0] = edge_new_nodes_[4];
976  new_tets_conn[4 * 4 + 1] = edge_new_nodes_[2];
977  if (is_rotated) {
978  new_tets_conn[4 * 4 + 2] = conn_[3];
979  new_tets_conn[4 * 4 + 3] = conn_[0];
980  } else {
981  new_tets_conn[4 * 4 + 2] = conn_[0];
982  new_tets_conn[4 * 4 + 3] = conn_[3];
983  }
984  return 7;
985  }
986  return type;
987 }
988 int tet_type_2(const EntityHandle *conn, const int *split_edges,
989  const EntityHandle *edge_new_nodes,
990  EntityHandle *new_tets_conn) {
991  if (split_edges[0] == oposite_edge[split_edges[1]]) {
992  // type 2b
993  EntityHandle n0 = conn[edges_conn[2 * split_edges[0] + 0]];
994  EntityHandle n1 = conn[edges_conn[2 * split_edges[0] + 1]];
995  EntityHandle n2 = conn[edges_conn[2 * split_edges[1] + 0]];
996  EntityHandle n3 = conn[edges_conn[2 * split_edges[1] + 1]];
997  // TET0
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;
1002  // TET1
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;
1007  // TET3
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;
1012  // TET4
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;
1017  return 1;
1018  } else {
1019  int sub_type = 0;
1020  // type 2a
1021  const char mach_pattern =
1022  edge_bits_mark[split_edges[0]] | edge_bits_mark[split_edges[1]];
1024  int edges_[6];
1025  for (int ee = 0; ee < 6; ee++) {
1026  char pattern;
1027  pattern = edge_bits_mark[edge_permutations[ee][1]] |
1029  if (pattern == mach_pattern) {
1030  int free_edge = oposite_edge[ee];
1031  conn_[0] = conn[edges_conn[ee * 2 + 0]];
1032  conn_[1] = conn[edges_conn[ee * 2 + 1]];
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++)
1036  edges_[EE] = edge_permutations[ee][EE];
1037  sub_type |= 4;
1038  break;
1039  }
1042  if (pattern == mach_pattern) {
1043  int free_edge = oposite_edge[ee];
1044  conn_[0] = conn[edges_conn[ee * 2 + 1]];
1045  conn_[1] = conn[edges_conn[ee * 2 + 0]];
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++)
1049  edges_[EE] = edge_permutations[ee][edge_mirror_cross[EE]];
1050  sub_type |= 8;
1051  break;
1052  }
1053  }
1054  EntityHandle edge_new_nodes_[6];
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);
1059  // TET0
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;
1067  sub_type |= 16;
1068  }
1069  if (free_edge_swappped5) {
1070  // TET1
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];
1075  // TET2
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];
1080  return sub_type;
1081  }
1082  // TET1
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];
1087  // TET2
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];
1092  return sub_type;
1093  }
1094  return -1;
1095 }
1096 void tet_type_1(const EntityHandle *conn, const int split_edge,
1097  const EntityHandle edge_new_node, EntityHandle *new_tets_conn) {
1098  // TET0
1099  new_tets_conn[0 * 4 + 0] = edge_new_node;
1100  new_tets_conn[0 * 4 + 1] = conn[edges_conn[2 * split_edge + 0]];
1101  new_tets_conn[0 * 4 + 2] = conn[edges_conn[2 * oposite_edge[split_edge] + 1]];
1102  new_tets_conn[0 * 4 + 3] = conn[edges_conn[2 * oposite_edge[split_edge] + 0]];
1103  // TET1
1104  new_tets_conn[1 * 4 + 0] = edge_new_node;
1105  new_tets_conn[1 * 4 + 1] = conn[edges_conn[2 * split_edge + 1]];
1106  new_tets_conn[1 * 4 + 2] = conn[edges_conn[2 * oposite_edge[split_edge] + 0]];
1107  new_tets_conn[1 * 4 + 3] = conn[edges_conn[2 * oposite_edge[split_edge] + 1]];
1108 }
1109 
1110 // TRIS
1112  const EntityHandle *edge_new_nodes,
1113  EntityHandle *new_tris_conn) {
1115  // TRI0
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];
1119 
1120  // TRI1
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];
1124 
1125  // TRI2
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];
1129 
1130  // TRI3
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];
1135 }
1136 
1137 MoFEMErrorCode tri_type_1(const EntityHandle *conn, const int split_edge,
1138  const EntityHandle edge_new_node,
1139  EntityHandle *new_tris_conn) {
1140 
1142 
1143  if (split_edge == 0) {
1144  // TRI0
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];
1148  // TRI1
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) {
1153  // TRI0
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;
1157  // TRI1
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) {
1162  // TRI0
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;
1166  // TRI1
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];
1170  } else {
1171  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Impossible case");
1172  }
1173 
1175 }
1176 
1177 MoFEMErrorCode tri_type_2(const EntityHandle *conn, const int *split_edges,
1178  const EntityHandle *edge_new_nodes,
1179  EntityHandle *new_tris_conn) {
1180 
1182 
1183  if(split_edges[0] == 0 && split_edges[1] == 1) {
1184  // TRI0
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];
1188  // TRI1
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];
1192  // TRI2
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) {
1197  // TRI0
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];
1201  // TRI1
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];
1205  // TRI2
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) {
1210  // TRI0
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];
1214  // TRI1
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];
1218  // TRI2
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];
1222  } else {
1223  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Impossible case");
1224  }
1225 
1227 }
1228 
1229 // PRISM
1231  const BitRefEdges split_edges,
1232  const EntityHandle *edge_new_nodes,
1233  EntityHandle *new_prism_conn) {
1235  int ee = 0;
1236  for (; ee < 6; ee++) {
1237  if (split_edges.test(ee))
1238  break;
1239  }
1240  if (ee > 2)
1241  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
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)
1247  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1248  if (edge_new_nodes[cycle_nodes[ee][3]] == no_handle)
1249  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1250  // PRISM0
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]];
1257  // PRISM1
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]];
1265 }
1267  const BitRefEdges split_edges,
1268  const EntityHandle *edge_new_nodes,
1269  EntityHandle *new_prism_conn) {
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}};
1275  int ee = 0;
1276  for (; ee < 3; ee++) {
1277  BitRefEdges mach_pattern(0);
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)
1283  break;
1284  }
1285  if (ee > 2)
1286  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1287  EntityHandle _conn_[6], _edge_new_nodes_[6];
1288  int nn = 0;
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]];
1292  }
1293  if (_conn_[1] < _conn_[2]) {
1294  EntityHandle _conn____;
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____;
1307  }
1308  if (_edge_new_nodes_[0] == no_handle)
1309  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1310  if (_edge_new_nodes_[2] == no_handle)
1311  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1312  if (_edge_new_nodes_[6 - 3] == no_handle)
1313  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1314  if (_edge_new_nodes_[8 - 3] == no_handle)
1315  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1316  // PRIMS0
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];
1323  // PRISM1
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];
1330  // PRISM2
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];
1338 }
1340  const BitRefEdges split_edges,
1341  const EntityHandle *edge_new_nodes,
1342  EntityHandle *new_prism_conn) {
1344  int ee = 0;
1345  for (; ee < 6; ee++) {
1346  if (!split_edges.test(ee))
1347  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1348  }
1349  // PRISM0
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];
1356  // PRISM1
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];
1363  // PRISM2
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];
1370  // PRISM3
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];
1378 }
1379 
1381  const BitRefEdges split_edges,
1382  const EntityHandle *edge_new_nodes,
1383  EntityHandle *new_quad_conn) {
1384 
1385  return 0;
1386  }
1387 
1388 } // namespace MoFEM
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
EntityHandle
MoFEM::edge_mirror_cross
static constexpr int edge_mirror_cross[6]
Definition: EntityRefine.cpp:23
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::oposite_edge
static constexpr int oposite_edge[]
Definition: EntityRefine.cpp:19
MoFEM::quad_split_all_edges
MoFEMErrorCode quad_split_all_edges(const EntityHandle *conn, const EntityHandle *edge_new_nodes, EntityHandle *new_quad_conn)
MoFEM::tet_type_2
int tet_type_2(const EntityHandle *conn, const int *split_edges, const EntityHandle *edge_new_nodes, EntityHandle *new_tets_conn)
Definition: EntityRefine.cpp:988
MoFEM::prism_type_2
MoFEMErrorCode prism_type_2(const EntityHandle *conn, const BitRefEdges split_edges, const EntityHandle *edge_new_nodes, EntityHandle *new_prism_conn)
Definition: EntityRefine.cpp:1266
MoFEM::no_handle
const EntityHandle no_handle
No entity handle is indicated by zero handle, i.e. root meshset.
Definition: Common.hpp:12
MoFEM::prism_type_1
MoFEMErrorCode prism_type_1(const EntityHandle *conn, const BitRefEdges split_edges, const EntityHandle *edge_new_nodes, EntityHandle *new_prism_conn)
Definition: EntityRefine.cpp:1230
MoFEM::tri_type_3
MoFEMErrorCode tri_type_3(const EntityHandle *conn, const EntityHandle *edge_new_nodes, EntityHandle *new_tris_conn)
Definition: EntityRefine.cpp:1111
MoFEM::cyclic_node_rotate_face_3
static constexpr int cyclic_node_rotate_face_3[3][4]
Definition: EntityRefine.cpp:25
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
MoFEM::edge_mirror_vertical
static constexpr int edge_mirror_vertical[6]
Definition: EntityRefine.cpp:24
MoFEM::tet_type_3
int tet_type_3(const EntityHandle *conn, const int *split_edges, const EntityHandle *edge_new_nodes, EntityHandle *new_tets_conn)
Definition: EntityRefine.cpp:565
MoFEM::edge_bits_mark
static constexpr char edge_bits_mark[]
Definition: EntityRefine.cpp:29
MoFEM::tet_type_5
int tet_type_5(moab::Interface &moab, const EntityHandle *conn, const EntityHandle *edge_new_nodes, EntityHandle *new_tets_conn)
Definition: EntityRefine.cpp:133
MoFEM::edge_permutations
static constexpr int edge_permutations[6][6]
Definition: EntityRefine.cpp:20
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
convert.type
type
Definition: convert.py:64
MoFEM::L
VectorDouble L
Definition: Projection10NodeCoordsOnField.cpp:124
MoFEM::tri_type_2
MoFEMErrorCode tri_type_2(const EntityHandle *conn, const int *split_edges, const EntityHandle *edge_new_nodes, EntityHandle *new_tris_conn)
Definition: EntityRefine.cpp:1177
MoFEM::cyclic_edge_rotate_face_3
static constexpr int cyclic_edge_rotate_face_3[3][6]
Definition: EntityRefine.cpp:27
MoFEM::Types::BitRefEdges
std::bitset< BITREFEDGES_SIZE > BitRefEdges
Definition: Types.hpp:34
MoFEM::tet_type_4
int tet_type_4(const EntityHandle *conn, const int *split_edges, const EntityHandle *edge_new_nodes, EntityHandle *new_tets_conn)
Definition: EntityRefine.cpp:239
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::edges_conn
static constexpr int edges_conn[]
Definition: EntityRefine.cpp:18
MoFEM::prism_type_3
MoFEMErrorCode prism_type_3(const EntityHandle *conn, const BitRefEdges split_edges, const EntityHandle *edge_new_nodes, EntityHandle *new_prism_conn)
Definition: EntityRefine.cpp:1339
MoFEM::tet_type_1
void tet_type_1(const EntityHandle *conn, const int split_edge, const EntityHandle edge_new_node, EntityHandle *new_tets_conn)
Definition: EntityRefine.cpp:1096
MoFEM::tet_type_6
void tet_type_6(moab::Interface &moab, const EntityHandle *conn, const EntityHandle *edge_new_nodes, EntityHandle *new_tets_conn)
Definition: EntityRefine.cpp:31
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::tri_type_1
MoFEMErrorCode tri_type_1(const EntityHandle *conn, const int split_edge, const EntityHandle edge_new_node, EntityHandle *new_tris_conn)
Definition: EntityRefine.cpp:1137