FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_vis_intersection_find.c
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 
7 
8 #include "hecmw_vis_calc_attr.h"
9 
10 /* provide information for rotation of cube */
11 int get_hex_rotation_info(int rot_type, Rotation_info *rot_info) {
12  static Rotation_info rotation[24] = {
13  {{0, 1, 2, 3, 4, 5},
14  {0, 1, 2, 3, 4, 5, 6, 7}, /* rotation No.0 */
15  {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
16  {0, 1, 2, 3, 4, 5, 6}},
17  {{5, 2, 4, 0, 1, 3},
18  {0, 4, 5, 1, 3, 7, 6, 2}, /* rotation No.1 */
19  {8, 4, 9, 0, 10, 6, 11, 2, 3, 7, 1, 5},
20  {0, 2, 3, 1, 6, 4, 5}},
21  {{3, 4, 1, 5, 2, 0},
22  {0, 3, 7, 4, 1, 2, 6, 5}, /* rotation No.2 */
23  {3, 10, 7, 8, 1, 11, 5, 9, 0, 2, 4, 6},
24  {0, 3, 1, 2, 5, 6, 4}},
25  {{1, 2, 3, 0, 4, 5},
26  {1, 5, 6, 2, 0, 4, 7, 3}, /* rotation No.3 */
27  {9, 5, 11, 1, 8, 7, 10, 3, 0, 4, 2, 6},
28  {1, 3, 0, 2, 5, 4, 6}},
29  {{5, 3, 4, 1, 2, 0},
30  {1, 0, 4, 5, 2, 3, 7, 6}, /* rotation No.4 */
31  {0, 8, 4, 9, 2, 10, 6, 11, 1, 3, 5, 7},
32  {1, 0, 2, 3, 6, 5, 4}},
33  {{0, 4, 2, 5, 3, 1},
34  {1, 2, 3, 0, 5, 6, 7, 4}, /* rotation No.5 */
35  {1, 2, 3, 0, 5, 6, 7, 4, 9, 11, 8, 10},
36  {1, 2, 3, 0, 4, 6, 5}},
37  {{1, 5, 3, 4, 2, 0},
38  {2, 1, 5, 6, 3, 0, 4, 7}, /* rotation No.6 */
39  {1, 9, 5, 11, 3, 8, 7, 10, 2, 0, 6, 4},
40  {2, 1, 3, 0, 5, 6, 4}},
41  {{0, 3, 2, 1, 5, 4},
42  {2, 3, 0, 1, 6, 7, 4, 5}, /* rotation No.7 */
43  {2, 3, 0, 1, 6, 7, 4, 5, 11, 10, 9, 8},
44  {2, 3, 0, 1, 4, 5, 6}},
45  {{4, 2, 5, 0, 3, 1},
46  {2, 6, 7, 3, 1, 5, 4, 0}, /* rotation No.8 */
47  {11, 6, 10, 2, 9, 4, 8, 0, 1, 5, 3, 7},
48  {2, 0, 1, 3, 6, 4, 5}},
49  {{4, 1, 5, 3, 2, 0},
50  {3, 2, 6, 7, 0, 1, 5, 4}, /* rotation No.9 */
51  {2, 11, 6, 10, 0, 9, 4, 8, 3, 1, 7, 5},
52  {3, 2, 0, 1, 6, 5, 4}},
53  {{0, 5, 2, 4, 1, 3},
54  {3, 0, 1, 2, 7, 4, 5, 6}, /* rotation No.10 */
55  {3, 0, 1, 2, 7, 4, 5, 6, 10, 8, 11, 9},
56  {3, 0, 1, 2, 4, 6, 5}},
57  {{3, 2, 1, 0, 5, 4},
58  {3, 7, 4, 0, 2, 6, 5, 1}, /* rotation No.11 */
59  {10, 7, 8, 3, 11, 5, 9, 1, 2, 6, 0, 4},
60  {3, 1, 2, 0, 5, 4, 6}},
61  {{5, 1, 4, 3, 0, 2},
62  {4, 5, 1, 0, 7, 6, 2, 3}, /* rotation No.12 */
63  {4, 9, 0, 8, 6, 11, 2, 10, 7, 5, 3, 1},
64  {2, 3, 1, 0, 6, 5, 4}},
65  {{2, 4, 0, 5, 1, 3},
66  {4, 7, 6, 5, 0, 3, 2, 1}, /* rotation No.13 */
67  {7, 6, 5, 4, 3, 2, 1, 0, 8, 10, 9, 11},
68  {2, 1, 0, 3, 4, 6, 5}},
69  {{3, 0, 1, 2, 4, 5},
70  {4, 0, 3, 7, 5, 1, 2, 6}, /* rotation No.14 */
71  {8, 3, 10, 7, 9, 1, 11, 5, 4, 0, 6, 2},
72  {2, 0, 3, 1, 5, 4, 6}},
73  {{2, 3, 0, 1, 4, 5},
74  {5, 4, 7, 6, 1, 0, 3, 2}, /* rotation No.15 */
75  {4, 7, 6, 5, 0, 3, 2, 1, 9, 8, 11, 10},
76  {3, 2, 1, 0, 4, 5, 6}},
77  {{5, 0, 4, 2, 3, 1},
78  {5, 1, 0, 4, 6, 2, 3, 7}, /* rotation No.16 */
79  {9, 0, 8, 4, 11, 2, 10, 6, 5, 1, 7, 3},
80  {3, 1, 0, 2, 6, 4, 5}},
81  {{1, 4, 3, 5, 0, 2},
82  {5, 6, 2, 1, 4, 7, 3, 0}, /* rotation No.17 */
83  {5, 11, 1, 9, 7, 10, 3, 8, 4, 6, 0, 2},
84  {3, 0, 2, 1, 5, 6, 4}},
85  {{1, 0, 3, 2, 5, 4},
86  {6, 2, 1, 5, 7, 3, 0, 4}, /* rotation No.18 */
87  {11, 1, 9, 5, 10, 3, 8, 7, 6, 2, 4, 0},
88  {0, 2, 1, 3, 5, 4, 6}},
89  {{4, 3, 5, 1, 0, 2},
90  {6, 7, 3, 2, 5, 4, 0, 1}, /* rotation No.19 */
91  {6, 10, 2, 11, 4, 8, 0, 9, 5, 7, 1, 3},
92  {0, 1, 3, 2, 6, 5, 4}},
93  {{2, 5, 0, 4, 3, 1},
94  {6, 5, 4, 7, 2, 1, 0, 3}, /* rotation No.20 */
95  {5, 4, 7, 6, 1, 0, 3, 2, 11, 9, 10, 8},
96  {0, 3, 2, 1, 4, 6, 5}},
97  {{4, 0, 5, 2, 1, 3},
98  {7, 3, 2, 6, 4, 0, 1, 5}, /* rotation No.21 */
99  {10, 2, 11, 6, 8, 0, 9, 4, 7, 3, 5, 1},
100  {1, 3, 2, 0, 6, 4, 5}},
101  {{3, 5, 1, 4, 0, 2},
102  {7, 4, 0, 3, 6, 5, 1, 2}, /* rotation No.22 */
103  {7, 8, 3, 10, 5, 9, 1, 11, 6, 4, 2, 0},
104  {1, 2, 0, 3, 5, 6, 4}},
105  {{2, 1, 0, 3, 5, 4},
106  {7, 6, 5, 4, 3, 2, 1, 0}, /* rotation No.23 */
107  {6, 5, 4, 7, 2, 1, 0, 3, 10, 11, 8, 9},
108  {1, 0, 3, 2, 4, 5, 6}}};
109 
110  *rot_info = rotation[rot_type];
111 
112  return 1;
113 }
114 
115 /* decide the point location after the rotation */
116 int point_convert(int point_index, Rotation_info *rot_info) {
117  int converted_index;
118 
119  if (point_index < 100) {
120  converted_index = (int)rot_info->edge[point_index];
121  } else if (point_index < 200) {
122  converted_index = 100 + (int)rot_info->inside[point_index - 100];
123  } else {
124  converted_index = 200 + (int)rot_info->grid_point[point_index - 200];
125  }
126 
127  return converted_index;
128 }
129 
130 /* decide the separation pattern on ambiguous face */
131 int separation_test(struct hecmwST_local_mesh *mesh, Cell *cell, int amb,
132  double fvalue, int CS_type, int disamb_flag) {
133  int sep;
134 
135  switch (amb) {
136  case 0:
137  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[0],
138  cell->s_data[1], cell->s_data[2],
139  cell->s_data[3]);
140  break;
141  case 1:
142  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[1],
143  cell->s_data[2], cell->s_data[3],
144  cell->s_data[0]);
145  break;
146  case 2:
147  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[1],
148  cell->s_data[5], cell->s_data[6],
149  cell->s_data[2]);
150  break;
151  case 3:
152  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[5],
153  cell->s_data[6], cell->s_data[2],
154  cell->s_data[1]);
155  break;
156  case 4:
157  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[5],
158  cell->s_data[4], cell->s_data[7],
159  cell->s_data[6]);
160  break;
161  case 5:
162  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[4],
163  cell->s_data[7], cell->s_data[6],
164  cell->s_data[5]);
165  break;
166  case 6:
167  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[4],
168  cell->s_data[0], cell->s_data[3],
169  cell->s_data[7]);
170  break;
171  case 7:
172  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[0],
173  cell->s_data[3], cell->s_data[7],
174  cell->s_data[4]);
175  break;
176  case 8:
177  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[3],
178  cell->s_data[2], cell->s_data[6],
179  cell->s_data[7]);
180  break;
181  case 9:
182  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[2],
183  cell->s_data[6], cell->s_data[7],
184  cell->s_data[3]);
185  break;
186  case 10:
187  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[4],
188  cell->s_data[5], cell->s_data[1],
189  cell->s_data[0]);
190  break;
191  case 11:
192  sep = choice_disambiguation(disamb_flag, fvalue, CS_type, cell->s_data[5],
193  cell->s_data[1], cell->s_data[0],
194  cell->s_data[4]);
195  break;
196  }
197 
198  return sep;
199 }
200 
201 /* make the boundary polygons of (alpha || beta) interval volume in cube */
203  int i;
204  static int verts[8] = {200, 201, 202, 203, 204, 205, 206, 207};
205  static int isosurf[1] = {-1};
206  /* static int bounds[6][6] = {{4, 0,1,2,3, -1},{4, 1,5,6,2, -1},
207  {4, 5,4,7,6, -1},{4, 4,0,3,7, -1},
208  {4, 3,2,6,7, -1},{4, 4,5,1,0, -1}};
209  */
210 
211  cube_polys->verts_num = 8;
212  for (i = 0; i < 8; i++) cube_polys->verts[i] = verts[i];
213 
214  *cube_polys->isosurf = isosurf;
215  /* for (i = 0; i < 6; i++) {
216  *cube_polys->bounds[i] = bounds[i];
217 }
218  */
219 }
220 
221 void case1_tiler_hex(int index, Cube_polygons *cube_polys) {
222  int i;
223  Rotation_info rot_info;
224  static int verts[4] = {0, 3, 8, 200};
225  static int isosurf[4] = {0, 2, 1, -1};
226  /* static int bounds[6][5] = {{3, 3,0,1, -1},{-1, -1,-1,-1,-1},
227  {-1, -1,-1,-1,-1},{3, 3,1,2, -1},
228  {-1, -1,-1,-1,-1},{3, 3,2,0, -1}};
229  */
230  switch (index) {
231  case 1:
232  get_hex_rotation_info(0, &rot_info);
233  break;
234  case 2:
235  get_hex_rotation_info(3, &rot_info);
236  break;
237  case 4:
238  get_hex_rotation_info(6, &rot_info);
239  break;
240  case 8:
241  get_hex_rotation_info(9, &rot_info);
242  break;
243  case 16:
244  get_hex_rotation_info(12, &rot_info);
245  break;
246  case 32:
247  get_hex_rotation_info(15, &rot_info);
248  break;
249  case 64:
250  get_hex_rotation_info(18, &rot_info);
251  break;
252  case 128:
253  get_hex_rotation_info(21, &rot_info);
254  break;
255  }
256 
257  cube_polys->verts_num = 4;
258  for (i = 0; i < 4; i++) {
259  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
260  }
261 
262  *cube_polys->isosurf = isosurf;
263  /* for (i = 0; i < 6; i++) {
264  *cube_polys->bounds[rot_info.face[i]] = bounds[i];
265 }
266  */
267 }
268 
269 void case1opp_tiler_hex(int index, Cube_polygons *cube_polys) {
270  int i;
271  Rotation_info rot_info;
272  static int verts[10] = {0, 3, 8, 201, 202, 203, 204, 205, 206, 207};
273  static int isosurf[4] = {0, 1, 2, -1};
274  /* static int bounds[6][7] = {{5, 0,3,4,5,1, -1},{4, 3,7,8,4, -1,-1},
275  {4, 7,6,9,8, -1,-1},{5, 1,5,9,6,2, -1},
276  {4, 5,4,8,9, -1,-1},{5, 2,6,7,3,0, -1}};
277  */
278  switch (index) {
279  case 254:
280  get_hex_rotation_info(0, &rot_info);
281  break;
282  case 253:
283  get_hex_rotation_info(3, &rot_info);
284  break;
285  case 251:
286  get_hex_rotation_info(6, &rot_info);
287  break;
288  case 247:
289  get_hex_rotation_info(9, &rot_info);
290  break;
291  case 239:
292  get_hex_rotation_info(12, &rot_info);
293  break;
294  case 223:
295  get_hex_rotation_info(15, &rot_info);
296  break;
297  case 191:
298  get_hex_rotation_info(18, &rot_info);
299  break;
300  case 127:
301  get_hex_rotation_info(21, &rot_info);
302  break;
303  }
304 
305  cube_polys->verts_num = 10;
306  for (i = 0; i < 10; i++) {
307  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
308  }
309 
310  *cube_polys->isosurf = isosurf;
311  /* for (i = 0; i < 6; i++) {
312  *cube_polys->bounds[rot_info.face[i]] = bounds[i];
313 }
314  */
315 }
316 
317 void case2_tiler_hex(int index, Cube_polygons *cube_polys) {
318  int i;
319  Rotation_info rot_info;
320  static int verts[6] = {1, 3, 8, 9, 200, 201};
321  static int isosurf[7] = {1, 0, 2, 3, 2, 0, -1};
322  /* static int bounds[6][6] = {{4, 4,5,0,1, -1},{3, 5,3,0, -1,-1},
323  {-1, -1,-1,-1,-1,-1},{3, 4,1,2, -1,-1},
324  {-1, -1,-1,-1,-1,-1},{4, 4,2,3,5, -1}};
325  */
326  switch (index) {
327  case 3:
328  get_hex_rotation_info(0, &rot_info);
329  break;
330  case 6:
331  get_hex_rotation_info(5, &rot_info);
332  break;
333  case 9:
334  get_hex_rotation_info(2, &rot_info);
335  break;
336  case 12:
337  get_hex_rotation_info(7, &rot_info);
338  break;
339  case 17:
340  get_hex_rotation_info(1, &rot_info);
341  break;
342  case 34:
343  get_hex_rotation_info(3, &rot_info);
344  break;
345  case 48:
346  get_hex_rotation_info(12, &rot_info);
347  break;
348  case 68:
349  get_hex_rotation_info(8, &rot_info);
350  break;
351  case 96:
352  get_hex_rotation_info(17, &rot_info);
353  break;
354  case 136:
355  get_hex_rotation_info(11, &rot_info);
356  break;
357  case 144:
358  get_hex_rotation_info(13, &rot_info);
359  break;
360  case 192:
361  get_hex_rotation_info(19, &rot_info);
362  break;
363  }
364 
365  cube_polys->verts_num = 6;
366  for (i = 0; i < 6; i++) {
367  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
368  }
369 
370  *cube_polys->isosurf = isosurf;
371  /* for (i = 0; i < 6; i++) {
372  *cube_polys->bounds[rot_info.face[i]] = bounds[i];
373 }
374  */
375 }
376 
377 void case2opp_tiler_hex(int index, Cube_polygons *cube_polys) {
378  int i;
379  Rotation_info rot_info;
380  static int verts[10] = {1, 3, 8, 9, 202, 203, 204, 205, 206, 207};
381  static int isosurf[7] = {0, 1, 2, 2, 3, 0, -1};
382  /* static int bounds[6][7] = {{4, 5,1,0,4, -1,-1},{5, 4,0,3,7,8, -1},
383  {4, 7,6,9,8, -1,-1},{5, 1,5,9,6,2, -1},
384  {4, 5,4,8,9, -1,-1},{4, 2,6,7,3, -1,-1}};
385  */
386  switch (index) {
387  case 252:
388  get_hex_rotation_info(0, &rot_info);
389  break;
390  case 249:
391  get_hex_rotation_info(5, &rot_info);
392  break;
393  case 246:
394  get_hex_rotation_info(2, &rot_info);
395  break;
396  case 243:
397  get_hex_rotation_info(7, &rot_info);
398  break;
399  case 238:
400  get_hex_rotation_info(1, &rot_info);
401  break;
402  case 221:
403  get_hex_rotation_info(3, &rot_info);
404  break;
405  case 207:
406  get_hex_rotation_info(12, &rot_info);
407  break;
408  case 187:
409  get_hex_rotation_info(8, &rot_info);
410  break;
411  case 159:
412  get_hex_rotation_info(17, &rot_info);
413  break;
414  case 119:
415  get_hex_rotation_info(11, &rot_info);
416  break;
417  case 111:
418  get_hex_rotation_info(13, &rot_info);
419  break;
420  case 63:
421  get_hex_rotation_info(19, &rot_info);
422  break;
423  }
424 
425  cube_polys->verts_num = 10;
426  for (i = 0; i < 10; i++) {
427  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
428  }
429 
430  *cube_polys->isosurf = isosurf;
431  /* for (i = 0; i < 6; i++) {
432  *cube_polys->bounds[rot_info.face[i]] = bounds[i];
433 }
434  */
435 }
436 
437 void case3_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue,
438  int CS_type, int index, Cube_polygons *cube_polys,
439  int disamb_flag) {
440  int i;
441  int amb_index;
442  Rotation_info rot_info;
443  static int verts[8] = {0, 1, 2, 3, 8, 11, 200, 202};
444  static int isosurf_A[7] = {0, 4, 3, 2, 5, 1, -1};
445  static int isosurf_B[13] = {3, 2, 4, 2, 5, 4, 4, 5, 1, 4, 1, 0, -1};
446  /* static int bounds_0[2][9] = {{3, 6,0,3, 3, 7,2,1, -1},
447  {6, 6,0,1,7,2,3, -1,-1}};
448 static int bounds_1[5] = {3, 7,1,5, -1};
449 static int bounds_2[1] = {-1};
450 static int bounds_3[5] = {3, 6,3,4, -1};
451 static int bounds_4[5] = {3, 7,5,2, -1};
452 static int bounds_5[5] = {3, 6,4,0, -1};
453  */
454  if (disamb_flag == 0) { /* disambiguation : none */
455  amb_index = 0; /* isosurf_A */
456  switch (index) {
457  case 5:
458  get_hex_rotation_info(0, &rot_info);
459  break;
460  case 10:
461  get_hex_rotation_info(10, &rot_info);
462  break;
463  case 18:
464  get_hex_rotation_info(4, &rot_info);
465  break;
466  case 24:
467  get_hex_rotation_info(11, &rot_info);
468  break;
469  case 33:
470  get_hex_rotation_info(1, &rot_info);
471  break;
472  case 36:
473  get_hex_rotation_info(6, &rot_info);
474  break;
475  case 66:
476  get_hex_rotation_info(18, &rot_info);
477  break;
478  case 72:
479  get_hex_rotation_info(9, &rot_info);
480  break;
481  case 80:
482  get_hex_rotation_info(13, &rot_info);
483  break;
484  case 129:
485  get_hex_rotation_info(22, &rot_info);
486  break;
487  case 132:
488  get_hex_rotation_info(21, &rot_info);
489  break;
490  case 160:
491  get_hex_rotation_info(15, &rot_info);
492  break;
493  }
494  } else {
495  switch (index) {
496  case 5:
497  amb_index =
498  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
499  get_hex_rotation_info(0, &rot_info);
500  break;
501  case 10:
502  amb_index =
503  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
504  get_hex_rotation_info(10, &rot_info);
505  break;
506  case 18:
507  amb_index =
508  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
509  get_hex_rotation_info(4, &rot_info);
510  break;
511  case 24:
512  amb_index =
513  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
514  get_hex_rotation_info(11, &rot_info);
515  break;
516  case 33:
517  amb_index =
518  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
519  get_hex_rotation_info(1, &rot_info);
520  break;
521  case 36:
522  amb_index =
523  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
524  get_hex_rotation_info(6, &rot_info);
525  break;
526  case 66:
527  amb_index =
528  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
529  get_hex_rotation_info(18, &rot_info);
530  break;
531  case 72:
532  amb_index =
533  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
534  get_hex_rotation_info(9, &rot_info);
535  break;
536  case 80:
537  amb_index =
538  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
539  get_hex_rotation_info(13, &rot_info);
540  break;
541  case 129:
542  amb_index =
543  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
544  get_hex_rotation_info(22, &rot_info);
545  break;
546  case 132:
547  amb_index =
548  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
549  get_hex_rotation_info(21, &rot_info);
550  break;
551  case 160:
552  amb_index =
553  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
554  get_hex_rotation_info(15, &rot_info);
555  break;
556  }
557  }
558 
559  cube_polys->verts_num = 8;
560  for (i = 0; i < 8; i++) {
561  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
562  }
563 
564  if (!amb_index) {
565  *cube_polys->isosurf = isosurf_A;
566  /* *cube_polys->bounds[rot_info.face[0]] = bounds_0[0];*/
567  } else {
568  *cube_polys->isosurf = isosurf_B;
569  /* *cube_polys->bounds[rot_info.face[0]] = bounds_0[1];*/
570  }
571 
572  /* *cube_polys->bounds[rot_info.face[1]] = bounds_1;
573  *cube_polys->bounds[rot_info.face[2]] = bounds_2;
574  *cube_polys->bounds[rot_info.face[3]] = bounds_3;
575  *cube_polys->bounds[rot_info.face[4]] = bounds_4;
576  *cube_polys->bounds[rot_info.face[5]] = bounds_5;
577  */
578 }
579 
580 void case3opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell,
581  double fvalue, int CS_type, int index,
582  Cube_polygons *cube_polys, int disamb_flag) {
583  int i;
584  int amb_index;
585  Rotation_info rot_info;
586  static int verts[12] = {0, 1, 2, 3, 8, 11, 201, 203, 204, 205, 206, 207};
587  static int isosurf_A[7] = {0, 3, 4, 2, 1, 5, -1};
588  static int isosurf_B[13] = {3, 4, 2, 2, 4, 5, 4, 1, 5, 4, 0, 1, -1};
589  /* static int bounds_0[2][9] = {{6, 7,3,0,6,1,2, -1,-1},
590  {3, 6,1,0, 3, 7,3,2, -1}};
591 static int bounds_1[7] = {5, 6,9,10,5,1, -1};
592 static int bounds_2[6] = {4, 9,8,11,10, -1};
593 static int bounds_3[7] = {5, 7,11,8,4,3, -1};
594 static int bounds_4[7] = {5, 10,11,7,2,5, -1};
595 static int bounds_5[7] = {5, 8,9,6,0,4, -1};
596  */
597  if (disamb_flag == 0) { /* disambiguation : none */
598  amb_index = 0; /* isosurf_A */
599  switch (index) {
600  case 250:
601  get_hex_rotation_info(0, &rot_info);
602  break;
603  case 245:
604  get_hex_rotation_info(10, &rot_info);
605  break;
606  case 237:
607  get_hex_rotation_info(4, &rot_info);
608  break;
609  case 231:
610  get_hex_rotation_info(11, &rot_info);
611  break;
612  case 222:
613  get_hex_rotation_info(1, &rot_info);
614  break;
615  case 219:
616  get_hex_rotation_info(6, &rot_info);
617  break;
618  case 189:
619  get_hex_rotation_info(18, &rot_info);
620  break;
621  case 183:
622  get_hex_rotation_info(9, &rot_info);
623  break;
624  case 175:
625  get_hex_rotation_info(13, &rot_info);
626  break;
627  case 126:
628  get_hex_rotation_info(22, &rot_info);
629  break;
630  case 123:
631  get_hex_rotation_info(21, &rot_info);
632  break;
633  case 95:
634  get_hex_rotation_info(15, &rot_info);
635  break;
636  }
637  } else {
638  switch (index) {
639  case 250:
640  amb_index =
641  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
642  get_hex_rotation_info(0, &rot_info);
643  break;
644  case 245:
645  amb_index =
646  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
647  get_hex_rotation_info(10, &rot_info);
648  break;
649  case 237:
650  amb_index =
651  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
652  get_hex_rotation_info(4, &rot_info);
653  break;
654  case 231:
655  amb_index =
656  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
657  get_hex_rotation_info(11, &rot_info);
658  break;
659  case 222:
660  amb_index =
661  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
662  get_hex_rotation_info(1, &rot_info);
663  break;
664  case 219:
665  amb_index =
666  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
667  get_hex_rotation_info(6, &rot_info);
668  break;
669  case 189:
670  amb_index =
671  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
672  get_hex_rotation_info(18, &rot_info);
673  break;
674  case 183:
675  amb_index =
676  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
677  get_hex_rotation_info(9, &rot_info);
678  break;
679  case 175:
680  amb_index =
681  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
682  get_hex_rotation_info(13, &rot_info);
683  break;
684  case 126:
685  amb_index =
686  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
687  get_hex_rotation_info(22, &rot_info);
688  break;
689  case 123:
690  amb_index =
691  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
692  get_hex_rotation_info(21, &rot_info);
693  break;
694  case 95:
695  amb_index =
696  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
697  get_hex_rotation_info(15, &rot_info);
698  break;
699  }
700  }
701 
702  cube_polys->verts_num = 12;
703  for (i = 0; i < 12; i++) {
704  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
705  }
706 
707  if (!amb_index) {
708  *cube_polys->isosurf = isosurf_A;
709  /* *cube_polys->bounds[rot_info.face[0]] = bounds_0[0];*/
710  } else {
711  *cube_polys->isosurf = isosurf_B;
712  /* *cube_polys->bounds[rot_info.face[0]] = bounds_0[1];*/
713  }
714 
715  /* *cube_polys->bounds[rot_info.face[1]] = bounds_1;
716  *cube_polys->bounds[rot_info.face[2]] = bounds_2;
717  *cube_polys->bounds[rot_info.face[3]] = bounds_3;
718  *cube_polys->bounds[rot_info.face[4]] = bounds_4;
719  *cube_polys->bounds[rot_info.face[5]] = bounds_5;
720  */
721 }
722 
723 void case4_tiler_hex(int index, Cube_polygons *cube_polys) {
724  int i;
725  Rotation_info rot_info;
726  static int verts[8] = {0, 3, 5, 6, 8, 11, 200, 206};
727  static int isosurf[7] = {0, 4, 1, 5, 3, 2, -1};
728  /* static int bounds[6][5] = {{3, 6,0,1, -1},{3, 7,5,2, -1},
729  {3, 7,2,3, -1},{3, 6,1,4, -1},
730  {3, 7,3,5, -1},{3, 6,4,0, -1}};
731  */
732  switch (index) {
733  case 20:
734  get_hex_rotation_info(6, &rot_info);
735  break;
736  case 40:
737  get_hex_rotation_info(9, &rot_info);
738  break;
739  case 65:
740  get_hex_rotation_info(0, &rot_info);
741  break;
742  case 130:
743  get_hex_rotation_info(4, &rot_info);
744  break;
745  }
746 
747  cube_polys->verts_num = 8;
748  for (i = 0; i < 8; i++) {
749  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
750  }
751 
752  *cube_polys->isosurf = isosurf;
753  for (i = 0; i < 6; i++) {
754  /* *cube_polys->bounds[rot_info.face[i]] = bounds[i];*/
755  }
756 }
757 
758 void case4opp_tiler_hex(int index, Cube_polygons *cube_polys) {
759  int i;
760  Rotation_info rot_info;
761  static int verts[12] = {0, 3, 5, 6, 8, 11, 201, 202, 203, 204, 205, 207};
762  static int isosurf[7] = {0, 1, 4, 5, 2, 3, -1};
763  /* static int bounds[6][7] = {{5, 6,7,8,1,0, -1},{5, 7,6,10,2,5, -1},
764  {5, 10,9,11,3,2, -1},{5, 8,11,9,4,1, -1},
765  {5, 11,8,7,5,3, -1},{5, 9,10,6,0,4, -1}};
766  */
767  switch (index) {
768  case 235:
769  get_hex_rotation_info(6, &rot_info);
770  break;
771  case 215:
772  get_hex_rotation_info(9, &rot_info);
773  break;
774  case 190:
775  get_hex_rotation_info(0, &rot_info);
776  break;
777  case 125:
778  get_hex_rotation_info(4, &rot_info);
779  break;
780  }
781 
782  cube_polys->verts_num = 12;
783  for (i = 0; i < 12; i++) {
784  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
785  }
786 
787  *cube_polys->isosurf = isosurf;
788  for (i = 0; i < 6; i++) {
789  /* *cube_polys->bounds[rot_info.face[i]] = bounds[i];*/
790  }
791 }
792 
793 void case5_tiler_hex(int index, Cube_polygons *cube_polys) {
794  int i;
795  Rotation_info rot_info;
796  static int verts[8] = {0, 1, 5, 7, 8, 201, 204, 205};
797  static int isosurf[10] = {0, 1, 4, 1, 3, 4, 1, 2, 3, -1};
798  /* static int bounds[6][7] = {{3, 5,1,0, -1,-1,-1},{4, 5,7,2,1,
799  -1,-1},
800  {4, 7,6,3,2, -1,-1},{3, 6,4,3, -1,-1,-1},
801  {-1, -1,-1,-1,-1,-1,-1},{5, 6,7,5,0,4, -1}};
802  */
803  if (index < 80) {
804  switch (index) {
805  case 7:
806  get_hex_rotation_info(9, &rot_info);
807  break;
808  case 11:
809  get_hex_rotation_info(6, &rot_info);
810  break;
811  case 13:
812  get_hex_rotation_info(4, &rot_info);
813  break;
814  case 14:
815  get_hex_rotation_info(2, &rot_info);
816  break;
817  case 19:
818  get_hex_rotation_info(15, &rot_info);
819  break;
820  case 25:
821  get_hex_rotation_info(21, &rot_info);
822  break;
823  case 35:
824  get_hex_rotation_info(14, &rot_info);
825  break;
826  case 38:
827  get_hex_rotation_info(20, &rot_info);
828  break;
829  case 49:
830  get_hex_rotation_info(3, &rot_info);
831  break;
832  case 50:
833  get_hex_rotation_info(0, &rot_info);
834  break;
835  case 70:
836  get_hex_rotation_info(16, &rot_info);
837  break;
838  case 76:
839  get_hex_rotation_info(23, &rot_info);
840  break;
841  }
842  } else {
843  switch (index) {
844  case 98:
845  get_hex_rotation_info(8, &rot_info);
846  break;
847  case 100:
848  get_hex_rotation_info(5, &rot_info);
849  break;
850  case 112:
851  get_hex_rotation_info(22, &rot_info);
852  break;
853  case 137:
854  get_hex_rotation_info(13, &rot_info);
855  break;
856  case 140:
857  get_hex_rotation_info(18, &rot_info);
858  break;
859  case 145:
860  get_hex_rotation_info(10, &rot_info);
861  break;
862  case 152:
863  get_hex_rotation_info(1, &rot_info);
864  break;
865  case 176:
866  get_hex_rotation_info(19, &rot_info);
867  break;
868  case 196:
869  get_hex_rotation_info(11, &rot_info);
870  break;
871  case 200:
872  get_hex_rotation_info(7, &rot_info);
873  break;
874  case 208:
875  get_hex_rotation_info(17, &rot_info);
876  break;
877  case 224:
878  get_hex_rotation_info(12, &rot_info);
879  break;
880  }
881  }
882 
883  cube_polys->verts_num = 8;
884  for (i = 0; i < 8; i++) {
885  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
886  }
887 
888  *cube_polys->isosurf = isosurf;
889  for (i = 0; i < 6; i++) {
890  /* *cube_polys->bounds[rot_info.face[i]] = bounds[i];*/
891  }
892 }
893 
894 void case5opp_tiler_hex(int index, Cube_polygons *cube_polys) {
895  int i;
896  Rotation_info rot_info;
897  static int verts[10] = {0, 1, 5, 7, 8, 200, 202, 203, 206, 207};
898  static int isosurf[10] = {0, 4, 1, 1, 4, 3, 1, 3, 2, -1};
899  /* static int bounds[6][7] = {{5, 6,7,5,0,1, -1},{4, 8,6,1,2, -1,-1},
900  {4, 9,8,2,3, -1,-1},{5, 5,7,9,3,4, -1},
901  {4, 6,8,9,7, -1,-1},{3, 5,4,0, -1,-1,-1}};
902  */
903  if (index > 170) {
904  switch (index) {
905  case 248:
906  get_hex_rotation_info(9, &rot_info);
907  break;
908  case 244:
909  get_hex_rotation_info(6, &rot_info);
910  break;
911  case 242:
912  get_hex_rotation_info(4, &rot_info);
913  break;
914  case 241:
915  get_hex_rotation_info(2, &rot_info);
916  break;
917  case 236:
918  get_hex_rotation_info(15, &rot_info);
919  break;
920  case 230:
921  get_hex_rotation_info(21, &rot_info);
922  break;
923  case 220:
924  get_hex_rotation_info(14, &rot_info);
925  break;
926  case 217:
927  get_hex_rotation_info(20, &rot_info);
928  break;
929  case 206:
930  get_hex_rotation_info(3, &rot_info);
931  break;
932  case 205:
933  get_hex_rotation_info(0, &rot_info);
934  break;
935  case 185:
936  get_hex_rotation_info(16, &rot_info);
937  break;
938  case 179:
939  get_hex_rotation_info(23, &rot_info);
940  break;
941  }
942  } else {
943  switch (index) {
944  case 157:
945  get_hex_rotation_info(8, &rot_info);
946  break;
947  case 155:
948  get_hex_rotation_info(5, &rot_info);
949  break;
950  case 143:
951  get_hex_rotation_info(22, &rot_info);
952  break;
953  case 118:
954  get_hex_rotation_info(13, &rot_info);
955  break;
956  case 115:
957  get_hex_rotation_info(18, &rot_info);
958  break;
959  case 110:
960  get_hex_rotation_info(10, &rot_info);
961  break;
962  case 103:
963  get_hex_rotation_info(1, &rot_info);
964  break;
965  case 79:
966  get_hex_rotation_info(19, &rot_info);
967  break;
968  case 59:
969  get_hex_rotation_info(11, &rot_info);
970  break;
971  case 55:
972  get_hex_rotation_info(7, &rot_info);
973  break;
974  case 47:
975  get_hex_rotation_info(17, &rot_info);
976  break;
977  case 31:
978  get_hex_rotation_info(12, &rot_info);
979  break;
980  }
981  }
982  cube_polys->verts_num = 10;
983  for (i = 0; i < 10; i++) {
984  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
985  }
986 
987  *cube_polys->isosurf = isosurf;
988  for (i = 0; i < 6; i++) {
989  /* *cube_polys->bounds[rot_info.face[i]] = bounds[i];*/
990  }
991 }
992 
993 void case6_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue,
994  int CS_type, int index, Cube_polygons *cube_polys,
995  int disamb_flag) {
996  int i;
997  int amb_index;
998  Rotation_info rot_info;
999  static int verts[10] = {1, 3, 5, 6, 8, 9, 11, 200, 201, 206};
1000  static int isosurf_A[16] = {0, 6, 1, 1, 6, 3, 1, 3, 4, 4, 3, 2, 4, 2, 5, -1};
1001  static int isosurf_B[10] = {1, 0, 4, 4, 0, 5, 6, 3, 2, -1};
1002  /* static int bounds_0[6] = {4, 7,8,0,1, -1};
1003 static int bounds_1[2][9] = {{6, 8,5,2,9,6,0, -1,-1},
1004  {3, 8,5,0, 3, 9,6,2, -1}};
1005 static int bounds_2[5] = {3, 9,2,3, -1};
1006 static int bounds_3[5] = {3, 7,1,4, -1};
1007 static int bounds_4[5] = {3, 9,3,6, -1};
1008 static int bounds_5[6] = {4, 8,7,4,5, -1};
1009  */
1010  if (disamb_flag == 0) { /* disambiguation : none */
1011  amb_index = 0; /* isosurf_B */
1012  if (index < 82) {
1013  switch (index) {
1014  case 21:
1015  get_hex_rotation_info(14, &rot_info);
1016  break;
1017  case 22:
1018  get_hex_rotation_info(6, &rot_info);
1019  break;
1020  case 28:
1021  get_hex_rotation_info(7, &rot_info);
1022  break;
1023  case 41:
1024  get_hex_rotation_info(10, &rot_info);
1025  break;
1026  case 42:
1027  get_hex_rotation_info(16, &rot_info);
1028  break;
1029  case 44:
1030  get_hex_rotation_info(9, &rot_info);
1031  break;
1032  case 52:
1033  get_hex_rotation_info(12, &rot_info);
1034  break;
1035  case 56:
1036  get_hex_rotation_info(15, &rot_info);
1037  break;
1038  case 67:
1039  get_hex_rotation_info(0, &rot_info);
1040  break;
1041  case 69:
1042  get_hex_rotation_info(18, &rot_info);
1043  break;
1044  case 73:
1045  get_hex_rotation_info(2, &rot_info);
1046  break;
1047  case 81:
1048  get_hex_rotation_info(1, &rot_info);
1049  break;
1050  }
1051  } else {
1052  switch (index) {
1053  case 84:
1054  get_hex_rotation_info(8, &rot_info);
1055  break;
1056  case 97:
1057  get_hex_rotation_info(20, &rot_info);
1058  break;
1059  case 104:
1060  get_hex_rotation_info(17, &rot_info);
1061  break;
1062  case 131:
1063  get_hex_rotation_info(4, &rot_info);
1064  break;
1065  case 134:
1066  get_hex_rotation_info(5, &rot_info);
1067  break;
1068  case 138:
1069  get_hex_rotation_info(21, &rot_info);
1070  break;
1071  case 146:
1072  get_hex_rotation_info(22, &rot_info);
1073  break;
1074  case 148:
1075  get_hex_rotation_info(13, &rot_info);
1076  break;
1077  case 162:
1078  get_hex_rotation_info(3, &rot_info);
1079  break;
1080  case 168:
1081  get_hex_rotation_info(11, &rot_info);
1082  break;
1083  case 193:
1084  get_hex_rotation_info(19, &rot_info);
1085  break;
1086  case 194:
1087  get_hex_rotation_info(23, &rot_info);
1088  break;
1089  }
1090  }
1091  } else {
1092  if (index < 82) {
1093  switch (index) {
1094  case 21:
1095  amb_index =
1096  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1097  get_hex_rotation_info(14, &rot_info);
1098  break;
1099  case 22:
1100  amb_index =
1101  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1102  get_hex_rotation_info(6, &rot_info);
1103  break;
1104  case 28:
1105  amb_index =
1106  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1107  get_hex_rotation_info(7, &rot_info);
1108  break;
1109  case 41:
1110  amb_index =
1111  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1112  get_hex_rotation_info(10, &rot_info);
1113  break;
1114  case 42:
1115  amb_index =
1116  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1117  get_hex_rotation_info(16, &rot_info);
1118  break;
1119  case 44:
1120  amb_index =
1121  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
1122  get_hex_rotation_info(9, &rot_info);
1123  break;
1124  case 52:
1125  amb_index =
1126  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
1127  get_hex_rotation_info(12, &rot_info);
1128  break;
1129  case 56:
1130  amb_index =
1131  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1132  get_hex_rotation_info(15, &rot_info);
1133  break;
1134  case 67:
1135  amb_index =
1136  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1137  get_hex_rotation_info(0, &rot_info);
1138  break;
1139  case 69:
1140  amb_index =
1141  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1142  get_hex_rotation_info(18, &rot_info);
1143  break;
1144  case 73:
1145  amb_index =
1146  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1147  get_hex_rotation_info(2, &rot_info);
1148  break;
1149  case 81:
1150  amb_index =
1151  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1152  get_hex_rotation_info(1, &rot_info);
1153  break;
1154  }
1155  } else {
1156  switch (index) {
1157  case 84:
1158  amb_index =
1159  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1160  get_hex_rotation_info(8, &rot_info);
1161  break;
1162  case 97:
1163  amb_index =
1164  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1165  get_hex_rotation_info(20, &rot_info);
1166  break;
1167  case 104:
1168  amb_index =
1169  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1170  get_hex_rotation_info(17, &rot_info);
1171  break;
1172  case 131:
1173  amb_index =
1174  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1175  get_hex_rotation_info(4, &rot_info);
1176  break;
1177  case 134:
1178  amb_index =
1179  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
1180  get_hex_rotation_info(5, &rot_info);
1181  break;
1182  case 138:
1183  amb_index =
1184  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1185  get_hex_rotation_info(21, &rot_info);
1186  break;
1187  case 146:
1188  amb_index =
1189  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1190  get_hex_rotation_info(22, &rot_info);
1191  break;
1192  case 148:
1193  amb_index =
1194  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
1195  get_hex_rotation_info(13, &rot_info);
1196  break;
1197  case 162:
1198  amb_index =
1199  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
1200  get_hex_rotation_info(3, &rot_info);
1201  break;
1202  case 168:
1203  amb_index =
1204  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
1205  get_hex_rotation_info(11, &rot_info);
1206  break;
1207  case 193:
1208  amb_index =
1209  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1210  get_hex_rotation_info(19, &rot_info);
1211  break;
1212  case 194:
1213  amb_index =
1214  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1215  get_hex_rotation_info(23, &rot_info);
1216  break;
1217  }
1218  }
1219  }
1220 
1221  cube_polys->verts_num = 10;
1222  for (i = 0; i < 10; i++) {
1223  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
1224  }
1225 
1226  /* *cube_polys->bounds[rot_info.face[0]] = bounds_0;*/
1227 
1228  if (amb_index) {
1229  *cube_polys->isosurf = isosurf_A;
1230  /* *cube_polys->bounds[rot_info.face[1]] = bounds_1[0];*/
1231  } else {
1232  *cube_polys->isosurf = isosurf_B;
1233  /* *cube_polys->bounds[rot_info.face[1]] = bounds_1[1];*/
1234  }
1235 
1236  /* *cube_polys->bounds[rot_info.face[2]] = bounds_2;
1237  *cube_polys->bounds[rot_info.face[3]] = bounds_3;
1238  *cube_polys->bounds[rot_info.face[4]] = bounds_4;
1239  *cube_polys->bounds[rot_info.face[5]] = bounds_5;
1240  */
1241 }
1242 
1243 void case6opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell,
1244  double fvalue, int CS_type, int index,
1245  Cube_polygons *cube_polys, int disamb_flag) {
1246  int i;
1247  int amb_index;
1248  Rotation_info rot_info;
1249  static int verts[12] = {1, 3, 5, 6, 8, 9, 11, 202, 203, 204, 205, 207};
1250  static int isosurf_A[16] = {0, 1, 6, 1, 3, 6, 1, 4, 3, 4, 2, 3, 4, 5, 2, -1};
1251  static int isosurf_B[10] = {1, 4, 0, 4, 5, 0, 6, 2, 3, -1};
1252  /* static int bounds_0[6] = {4, 7,8,1,0, -1};
1253 static int bounds_1[2][9] = {{3, 7,0,6, 3, 10,2,5, -1},
1254  {6, 7,0,5,10,2,6, -1,-1}};
1255 static int bounds_2[7] = {5, 10,9,11,3,2, -1};
1256 static int bounds_3[7] = {5, 8,11,9,4,1, -1};
1257 static int bounds_4[7] = {5, 11,8,7,6,3, -1};
1258 static int bounds_5[6] = {4, 9,10,5,4, -1};
1259  */
1260  if (disamb_flag == 0) { /* disambiguation : none */
1261  amb_index = 0; /* isosurf_B */
1262  if (index > 173) {
1263  switch (index) {
1264  case 234:
1265  get_hex_rotation_info(14, &rot_info);
1266  break;
1267  case 233:
1268  get_hex_rotation_info(6, &rot_info);
1269  break;
1270  case 227:
1271  get_hex_rotation_info(7, &rot_info);
1272  break;
1273  case 214:
1274  get_hex_rotation_info(10, &rot_info);
1275  break;
1276  case 213:
1277  get_hex_rotation_info(16, &rot_info);
1278  break;
1279  case 211:
1280  get_hex_rotation_info(9, &rot_info);
1281  break;
1282  case 203:
1283  get_hex_rotation_info(12, &rot_info);
1284  break;
1285  case 199:
1286  get_hex_rotation_info(15, &rot_info);
1287  break;
1288  case 188:
1289  get_hex_rotation_info(0, &rot_info);
1290  break;
1291  case 186:
1292  get_hex_rotation_info(18, &rot_info);
1293  break;
1294  case 182:
1295  get_hex_rotation_info(2, &rot_info);
1296  break;
1297  case 174:
1298  get_hex_rotation_info(1, &rot_info);
1299  break;
1300  }
1301  } else {
1302  switch (index) {
1303  case 171:
1304  get_hex_rotation_info(8, &rot_info);
1305  break;
1306  case 158:
1307  get_hex_rotation_info(20, &rot_info);
1308  break;
1309  case 151:
1310  get_hex_rotation_info(17, &rot_info);
1311  break;
1312  case 124:
1313  get_hex_rotation_info(4, &rot_info);
1314  break;
1315  case 121:
1316  get_hex_rotation_info(5, &rot_info);
1317  break;
1318  case 117:
1319  get_hex_rotation_info(21, &rot_info);
1320  break;
1321  case 109:
1322  get_hex_rotation_info(22, &rot_info);
1323  break;
1324  case 107:
1325  get_hex_rotation_info(13, &rot_info);
1326  break;
1327  case 93:
1328  get_hex_rotation_info(3, &rot_info);
1329  break;
1330  case 87:
1331  get_hex_rotation_info(11, &rot_info);
1332  break;
1333  case 62:
1334  get_hex_rotation_info(19, &rot_info);
1335  break;
1336  case 61:
1337  get_hex_rotation_info(23, &rot_info);
1338  break;
1339  }
1340  }
1341  } else {
1342  if (index > 173) {
1343  switch (index) {
1344  case 234:
1345  amb_index =
1346  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1347  get_hex_rotation_info(14, &rot_info);
1348  break;
1349  case 233:
1350  amb_index =
1351  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1352  get_hex_rotation_info(6, &rot_info);
1353  break;
1354  case 227:
1355  amb_index =
1356  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1357  get_hex_rotation_info(7, &rot_info);
1358  break;
1359  case 214:
1360  amb_index =
1361  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1362  get_hex_rotation_info(10, &rot_info);
1363  break;
1364  case 213:
1365  amb_index =
1366  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1367  get_hex_rotation_info(16, &rot_info);
1368  break;
1369  case 211:
1370  amb_index =
1371  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
1372  get_hex_rotation_info(9, &rot_info);
1373  break;
1374  case 203:
1375  amb_index =
1376  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
1377  get_hex_rotation_info(12, &rot_info);
1378  break;
1379  case 199:
1380  amb_index =
1381  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1382  get_hex_rotation_info(15, &rot_info);
1383  break;
1384  case 188:
1385  amb_index =
1386  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1387  get_hex_rotation_info(0, &rot_info);
1388  break;
1389  case 186:
1390  amb_index =
1391  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1392  get_hex_rotation_info(18, &rot_info);
1393  break;
1394  case 182:
1395  amb_index =
1396  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1397  get_hex_rotation_info(2, &rot_info);
1398  break;
1399  case 174:
1400  amb_index =
1401  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1402  get_hex_rotation_info(1, &rot_info);
1403  break;
1404  }
1405  } else {
1406  switch (index) {
1407  case 171:
1408  amb_index =
1409  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1410  get_hex_rotation_info(8, &rot_info);
1411  break;
1412  case 158:
1413  amb_index =
1414  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1415  get_hex_rotation_info(20, &rot_info);
1416  break;
1417  case 151:
1418  amb_index =
1419  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1420  get_hex_rotation_info(17, &rot_info);
1421  break;
1422  case 124:
1423  amb_index =
1424  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1425  get_hex_rotation_info(4, &rot_info);
1426  break;
1427  case 121:
1428  amb_index =
1429  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
1430  get_hex_rotation_info(5, &rot_info);
1431  break;
1432  case 117:
1433  amb_index =
1434  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1435  get_hex_rotation_info(21, &rot_info);
1436  break;
1437  case 109:
1438  amb_index =
1439  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1440  get_hex_rotation_info(22, &rot_info);
1441  break;
1442  case 107:
1443  amb_index =
1444  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
1445  get_hex_rotation_info(13, &rot_info);
1446  break;
1447  case 93:
1448  amb_index =
1449  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
1450  get_hex_rotation_info(3, &rot_info);
1451  break;
1452  case 87:
1453  amb_index =
1454  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
1455  get_hex_rotation_info(11, &rot_info);
1456  break;
1457  case 62:
1458  amb_index =
1459  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1460  get_hex_rotation_info(19, &rot_info);
1461  break;
1462  case 61:
1463  amb_index =
1464  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1465  get_hex_rotation_info(23, &rot_info);
1466  break;
1467  }
1468  }
1469  }
1470 
1471  cube_polys->verts_num = 12;
1472  for (i = 0; i < 12; i++) {
1473  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
1474  }
1475 
1476  /* *cube_polys->bounds[rot_info.face[0]] = bounds_0;*/
1477 
1478  if (amb_index) {
1479  *cube_polys->isosurf = isosurf_A;
1480  /* *cube_polys->bounds[rot_info.face[1]] = bounds_1[0];*/
1481  } else {
1482  *cube_polys->isosurf = isosurf_B;
1483  /* *cube_polys->bounds[rot_info.face[1]] = bounds_1[1];*/
1484  }
1485 
1486  /* *cube_polys->bounds[rot_info.face[2]] = bounds_2;
1487  *cube_polys->bounds[rot_info.face[3]] = bounds_3;
1488  *cube_polys->bounds[rot_info.face[4]] = bounds_4;
1489  *cube_polys->bounds[rot_info.face[5]] = bounds_5;
1490  */
1491 }
1492 
1493 void case7_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue,
1494  int CS_type, int index, Cube_polygons *cube_polys,
1495  int disamb_flag) {
1496  int i;
1497  int amb_index;
1498  Rotation_info rot_info;
1499  static int verts[13] = {0, 1, 2, 3, 5, 6, 9, 10, 11, 201, 203, 206, 101};
1500  static int isosurf_A[10] = {0, 1, 6, 3, 7, 2, 8, 5, 4, -1};
1501  static int isosurf_B[16] = {8, 5, 4, 3, 7, 0, 0, 7, 6, 6, 7, 2, 6, 2, 1, -1};
1502  static int isosurf_C[28] = {6, 0, 12, 0, 3, 12, 3, 7, 12, 7, 2, 12, 2, 1, 12,
1503  1, 8, 12, 8, 5, 12, 5, 4, 12, 4, 6, 12, -1};
1504  static int isosurf_D[16] = {8, 2, 1, 0, 3, 7, 0, 7, 5, 0, 5, 6, 6, 5, 4, -1};
1505 
1506  if (disamb_flag == 0) { /* disambiguation : none */
1507  amb_index = 0;
1508  switch (index) {
1509  case 26:
1510  get_hex_rotation_info(16, &rot_info);
1511  break;
1512  case 37:
1513  get_hex_rotation_info(10, &rot_info);
1514  break;
1515  case 74:
1516  get_hex_rotation_info(0, &rot_info);
1517  break;
1518  case 82:
1519  get_hex_rotation_info(6, &rot_info);
1520  break;
1521  case 88:
1522  get_hex_rotation_info(2, &rot_info);
1523  break;
1524  case 133:
1525  get_hex_rotation_info(14, &rot_info);
1526  break;
1527  case 161:
1528  get_hex_rotation_info(4, &rot_info);
1529  break;
1530  case 164:
1531  get_hex_rotation_info(9, &rot_info);
1532  break;
1533  }
1534  } else {
1535  amb_index = 0;
1536  switch (index) {
1537  case 26:
1538  amb_index |=
1539  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1540  amb_index <<= 1;
1541  amb_index |=
1542  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1543  amb_index <<= 1;
1544  amb_index |=
1545  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1546  switch (amb_index) {
1547  case 0:
1548  case 1:
1549  case 3:
1550  case 7:
1551  get_hex_rotation_info(16, &rot_info);
1552  break;
1553  case 2:
1554  case 6:
1555  get_hex_rotation_info(7, &rot_info);
1556  break;
1557  case 4:
1558  case 5:
1559  get_hex_rotation_info(22, &rot_info);
1560  break;
1561  }
1562  break;
1563  case 37:
1564  amb_index |=
1565  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
1566  amb_index <<= 1;
1567  amb_index |=
1568  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1569  amb_index <<= 1;
1570  amb_index |=
1571  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1572  switch (amb_index) {
1573  case 0:
1574  case 1:
1575  case 3:
1576  case 7:
1577  get_hex_rotation_info(10, &rot_info);
1578  break;
1579  case 2:
1580  case 6:
1581  get_hex_rotation_info(12, &rot_info);
1582  break;
1583  case 4:
1584  case 5:
1585  get_hex_rotation_info(18, &rot_info);
1586  break;
1587  }
1588  break;
1589  case 74:
1590  amb_index |=
1591  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1592  amb_index <<= 1;
1593  amb_index |=
1594  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1595  amb_index <<= 1;
1596  amb_index |=
1597  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1598  switch (amb_index) {
1599  case 0:
1600  case 1:
1601  case 3:
1602  case 7:
1603  get_hex_rotation_info(0, &rot_info);
1604  break;
1605  case 2:
1606  case 6:
1607  get_hex_rotation_info(17, &rot_info);
1608  break;
1609  case 4:
1610  case 5:
1611  get_hex_rotation_info(21, &rot_info);
1612  break;
1613  }
1614  break;
1615  case 82:
1616  amb_index |=
1617  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1618  amb_index <<= 1;
1619  amb_index |=
1620  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1621  amb_index <<= 1;
1622  amb_index |=
1623  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1624  switch (amb_index) {
1625  case 0:
1626  case 1:
1627  case 3:
1628  case 7:
1629  get_hex_rotation_info(6, &rot_info);
1630  break;
1631  case 2:
1632  case 6:
1633  get_hex_rotation_info(1, &rot_info);
1634  break;
1635  case 4:
1636  case 5:
1637  get_hex_rotation_info(23, &rot_info);
1638  break;
1639  }
1640  break;
1641  case 88:
1642  amb_index |=
1643  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1644  amb_index <<= 1;
1645  amb_index |=
1646  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1647  amb_index <<= 1;
1648  amb_index |=
1649  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1650  switch (amb_index) {
1651  case 0:
1652  case 1:
1653  case 3:
1654  case 7:
1655  get_hex_rotation_info(2, &rot_info);
1656  break;
1657  case 2:
1658  case 6:
1659  get_hex_rotation_info(8, &rot_info);
1660  break;
1661  case 4:
1662  case 5:
1663  get_hex_rotation_info(15, &rot_info);
1664  break;
1665  }
1666  break;
1667  case 133:
1668  amb_index |=
1669  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
1670  amb_index <<= 1;
1671  amb_index |=
1672  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1673  amb_index <<= 1;
1674  amb_index |=
1675  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1676  switch (amb_index) {
1677  case 0:
1678  case 1:
1679  case 3:
1680  case 7:
1681  get_hex_rotation_info(14, &rot_info);
1682  break;
1683  case 2:
1684  case 6:
1685  get_hex_rotation_info(5, &rot_info);
1686  break;
1687  case 4:
1688  case 5:
1689  get_hex_rotation_info(19, &rot_info);
1690  break;
1691  }
1692  break;
1693  case 161:
1694  amb_index |=
1695  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
1696  amb_index <<= 1;
1697  amb_index |=
1698  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1699  amb_index <<= 1;
1700  amb_index |=
1701  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1702  switch (amb_index) {
1703  case 0:
1704  case 1:
1705  case 3:
1706  case 7:
1707  get_hex_rotation_info(4, &rot_info);
1708  break;
1709  case 2:
1710  case 6:
1711  get_hex_rotation_info(11, &rot_info);
1712  break;
1713  case 4:
1714  case 5:
1715  get_hex_rotation_info(20, &rot_info);
1716  break;
1717  }
1718  break;
1719  case 164:
1720  amb_index |=
1721  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
1722  amb_index <<= 1;
1723  amb_index |=
1724  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
1725  amb_index <<= 1;
1726  amb_index |=
1727  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
1728  switch (amb_index) {
1729  case 0:
1730  case 1:
1731  case 3:
1732  case 7:
1733  get_hex_rotation_info(9, &rot_info);
1734  break;
1735  case 2:
1736  case 6:
1737  get_hex_rotation_info(3, &rot_info);
1738  break;
1739  case 4:
1740  case 5:
1741  get_hex_rotation_info(13, &rot_info);
1742  break;
1743  }
1744  break;
1745  }
1746  }
1747 
1748  switch (amb_index) {
1749  case 0:
1750  cube_polys->verts_num = 12;
1751  for (i = 0; i < 12; i++) {
1752  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
1753  }
1754  *cube_polys->isosurf = isosurf_A;
1755 
1756  break;
1757  case 1:
1758  case 2:
1759  case 4:
1760  cube_polys->verts_num = 12;
1761  for (i = 0; i < 12; i++) {
1762  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
1763  }
1764  *cube_polys->isosurf = isosurf_B;
1765 
1766  break;
1767  case 3:
1768  case 5:
1769  case 6:
1770  cube_polys->verts_num = 13;
1771  for (i = 0; i < 13; i++) {
1772  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
1773  }
1774  *cube_polys->isosurf = isosurf_C;
1775 
1776  break;
1777  case 7:
1778  cube_polys->verts_num = 12;
1779  for (i = 0; i < 12; i++) {
1780  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
1781  }
1782  *cube_polys->isosurf = isosurf_D;
1783 
1784  break;
1785  }
1786 }
1787 
1788 void case7opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell,
1789  double fvalue, int CS_type, int index,
1790  Cube_polygons *cube_polys, int disamb_flag) {
1791  int i;
1792  int amb_index;
1793  Rotation_info rot_info;
1794  static int verts[15] = {0, 1, 2, 3, 5, 6, 9, 10,
1795  11, 200, 202, 204, 205, 207, 101};
1796  static int isosurf_A[10] = {0, 6, 1, 3, 2, 7, 8, 4, 5, -1};
1797  static int isosurf_B[16] = {8, 4, 5, 3, 0, 7, 0, 6, 7, 6, 2, 7, 6, 1, 2, -1};
1798  static int isosurf_C[28] = {0, 6, 14, 3, 0, 14, 7, 3, 14, 2, 7, 14, 1, 2, 14,
1799  8, 1, 14, 5, 8, 14, 4, 5, 14, 6, 4, 14, -1};
1800  static int isosurf_D[16] = {8, 1, 2, 0, 7, 3, 0, 5, 7, 0, 6, 5, 6, 4, 5, -1};
1801 
1802  if (disamb_flag == 0) { /* disambiguation : none */
1803  amb_index = 0;
1804  switch (index) {
1805  case 229:
1806  get_hex_rotation_info(16, &rot_info);
1807  break;
1808  case 218:
1809  get_hex_rotation_info(10, &rot_info);
1810  break;
1811  case 181:
1812  get_hex_rotation_info(0, &rot_info);
1813  break;
1814  case 173:
1815  get_hex_rotation_info(6, &rot_info);
1816  break;
1817  case 167:
1818  get_hex_rotation_info(2, &rot_info);
1819  break;
1820  case 122:
1821  get_hex_rotation_info(14, &rot_info);
1822  break;
1823  case 94:
1824  get_hex_rotation_info(4, &rot_info);
1825  break;
1826  case 91:
1827  get_hex_rotation_info(9, &rot_info);
1828  break;
1829  }
1830  } else {
1831  amb_index = 0;
1832  switch (index) {
1833  case 229:
1834  amb_index |=
1835  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1836  amb_index <<= 1;
1837  amb_index |=
1838  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1839  amb_index <<= 1;
1840  amb_index |=
1841  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1842  switch (amb_index) {
1843  case 0:
1844  case 1:
1845  case 3:
1846  case 7:
1847  get_hex_rotation_info(16, &rot_info);
1848  break;
1849  case 2:
1850  case 6:
1851  get_hex_rotation_info(7, &rot_info);
1852  break;
1853  case 4:
1854  case 5:
1855  get_hex_rotation_info(22, &rot_info);
1856  break;
1857  }
1858  break;
1859  case 218:
1860  amb_index |=
1861  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
1862  amb_index <<= 1;
1863  amb_index |=
1864  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1865  amb_index <<= 1;
1866  amb_index |=
1867  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1868  switch (amb_index) {
1869  case 0:
1870  case 1:
1871  case 3:
1872  case 7:
1873  get_hex_rotation_info(10, &rot_info);
1874  break;
1875  case 2:
1876  case 6:
1877  get_hex_rotation_info(12, &rot_info);
1878  break;
1879  case 4:
1880  case 5:
1881  get_hex_rotation_info(18, &rot_info);
1882  break;
1883  }
1884  break;
1885  case 181:
1886  amb_index |=
1887  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1888  amb_index <<= 1;
1889  amb_index |=
1890  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1891  amb_index <<= 1;
1892  amb_index |=
1893  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
1894  switch (amb_index) {
1895  case 0:
1896  case 1:
1897  case 3:
1898  case 7:
1899  get_hex_rotation_info(0, &rot_info);
1900  break;
1901  case 2:
1902  case 6:
1903  get_hex_rotation_info(17, &rot_info);
1904  break;
1905  case 4:
1906  case 5:
1907  get_hex_rotation_info(21, &rot_info);
1908  break;
1909  }
1910  break;
1911  case 173:
1912  amb_index |=
1913  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1914  amb_index <<= 1;
1915  amb_index |=
1916  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
1917  amb_index <<= 1;
1918  amb_index |=
1919  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
1920  switch (amb_index) {
1921  case 0:
1922  case 1:
1923  case 3:
1924  case 7:
1925  get_hex_rotation_info(6, &rot_info);
1926  break;
1927  case 2:
1928  case 6:
1929  get_hex_rotation_info(1, &rot_info);
1930  break;
1931  case 4:
1932  case 5:
1933  get_hex_rotation_info(23, &rot_info);
1934  break;
1935  }
1936  break;
1937  case 167:
1938  amb_index |=
1939  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
1940  amb_index <<= 1;
1941  amb_index |=
1942  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
1943  amb_index <<= 1;
1944  amb_index |=
1945  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
1946  switch (amb_index) {
1947  case 0:
1948  case 1:
1949  case 3:
1950  case 7:
1951  get_hex_rotation_info(2, &rot_info);
1952  break;
1953  case 2:
1954  case 6:
1955  get_hex_rotation_info(8, &rot_info);
1956  break;
1957  case 4:
1958  case 5:
1959  get_hex_rotation_info(15, &rot_info);
1960  break;
1961  }
1962  break;
1963  case 122:
1964  amb_index |=
1965  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
1966  amb_index <<= 1;
1967  amb_index |=
1968  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
1969  amb_index <<= 1;
1970  amb_index |=
1971  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1972  switch (amb_index) {
1973  case 0:
1974  case 1:
1975  case 3:
1976  case 7:
1977  get_hex_rotation_info(14, &rot_info);
1978  break;
1979  case 2:
1980  case 6:
1981  get_hex_rotation_info(5, &rot_info);
1982  break;
1983  case 4:
1984  case 5:
1985  get_hex_rotation_info(19, &rot_info);
1986  break;
1987  }
1988  break;
1989  case 94:
1990  amb_index |=
1991  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
1992  amb_index <<= 1;
1993  amb_index |=
1994  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag);
1995  amb_index <<= 1;
1996  amb_index |=
1997  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
1998  switch (amb_index) {
1999  case 0:
2000  case 1:
2001  case 3:
2002  case 7:
2003  get_hex_rotation_info(4, &rot_info);
2004  break;
2005  case 2:
2006  case 6:
2007  get_hex_rotation_info(11, &rot_info);
2008  break;
2009  case 4:
2010  case 5:
2011  get_hex_rotation_info(20, &rot_info);
2012  break;
2013  }
2014  break;
2015  case 91:
2016  amb_index |=
2017  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag);
2018  amb_index <<= 1;
2019  amb_index |=
2020  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
2021  amb_index <<= 1;
2022  amb_index |=
2023  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag);
2024  switch (amb_index) {
2025  case 0:
2026  case 1:
2027  case 3:
2028  case 7:
2029  get_hex_rotation_info(9, &rot_info);
2030  break;
2031  case 2:
2032  case 6:
2033  get_hex_rotation_info(3, &rot_info);
2034  break;
2035  case 4:
2036  case 5:
2037  get_hex_rotation_info(13, &rot_info);
2038  break;
2039  }
2040  break;
2041  }
2042  }
2043 
2044  switch (amb_index) {
2045  case 0:
2046  cube_polys->verts_num = 14;
2047  for (i = 0; i < 14; i++) {
2048  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2049  }
2050  *cube_polys->isosurf = isosurf_A;
2051 
2052  break;
2053  case 1:
2054  case 2:
2055  case 4:
2056  cube_polys->verts_num = 14;
2057  for (i = 0; i < 14; i++) {
2058  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2059  }
2060  *cube_polys->isosurf = isosurf_B;
2061 
2062  break;
2063  case 3:
2064  case 5:
2065  case 6:
2066  cube_polys->verts_num = 15;
2067  for (i = 0; i < 15; i++) {
2068  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2069  }
2070  *cube_polys->isosurf = isosurf_C;
2071 
2072  break;
2073  case 7:
2074  cube_polys->verts_num = 14;
2075  for (i = 0; i < 14; i++) {
2076  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2077  }
2078  *cube_polys->isosurf = isosurf_D;
2079 
2080  break;
2081  }
2082 }
2083 
2084 void case8_tiler_hex(int index, Cube_polygons *cube_polys) {
2085  int i;
2086  Rotation_info rot_info;
2087  static int verts[8] = {1, 3, 5, 7, 200, 201, 204, 205};
2088  static int isosurf[7] = {0, 2, 1, 1, 2, 3, -1};
2089 
2090  switch (index) {
2091  case 15:
2092  get_hex_rotation_info(2, &rot_info);
2093  break;
2094  case 51:
2095  get_hex_rotation_info(0, &rot_info);
2096  break;
2097  case 102:
2098  get_hex_rotation_info(5, &rot_info);
2099  break;
2100  }
2101  cube_polys->verts_num = 8;
2102  for (i = 0; i < 8; i++) {
2103  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2104  }
2105 
2106  *cube_polys->isosurf = isosurf;
2107  for (i = 0; i < 6; i++) {
2108  }
2109 }
2110 
2111 void case8opp_tiler_hex(int index, Cube_polygons *cube_polys) {
2112  int i;
2113  Rotation_info rot_info;
2114  static int verts[8] = {1, 3, 5, 7, 202, 203, 206, 207};
2115  static int isosurf[7] = {0, 1, 2, 1, 3, 2, -1};
2116 
2117  switch (index) {
2118  case 240:
2119  get_hex_rotation_info(2, &rot_info);
2120  break;
2121  case 204:
2122  get_hex_rotation_info(0, &rot_info);
2123  break;
2124  case 153:
2125  get_hex_rotation_info(5, &rot_info);
2126  break;
2127  }
2128  cube_polys->verts_num = 8;
2129  for (i = 0; i < 8; i++) {
2130  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2131  }
2132 
2133  *cube_polys->isosurf = isosurf;
2134  for (i = 0; i < 6; i++) {
2135  }
2136 }
2137 
2138 void case9_tiler_hex(int index, Cube_polygons *cube_polys) {
2139  int i;
2140  Rotation_info rot_info;
2141  static int verts[10] = {0, 3, 5, 6, 9, 10, 200, 204, 205, 207};
2142  static int isosurf[13] = {1, 3, 5, 0, 3, 1, 0, 2, 3, 0, 4, 2, -1};
2143 
2144  switch (index) {
2145  case 141:
2146  get_hex_rotation_info(1, &rot_info);
2147  break;
2148  case 177:
2149  get_hex_rotation_info(0, &rot_info);
2150  break;
2151  case 216:
2152  get_hex_rotation_info(10, &rot_info);
2153  break;
2154  case 228:
2155  get_hex_rotation_info(7, &rot_info);
2156  break;
2157  }
2158  cube_polys->verts_num = 10;
2159  for (i = 0; i < 10; i++) {
2160  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2161  }
2162 
2163  *cube_polys->isosurf = isosurf;
2164  for (i = 0; i < 6; i++) {
2165  }
2166 }
2167 
2168 void case9opp_tiler_hex(int index, Cube_polygons *cube_polys) {
2169  int i;
2170  Rotation_info rot_info;
2171  static int verts[10] = {0, 3, 5, 6, 9, 10, 201, 202, 203, 206};
2172  static int isosurf[13] = {1, 5, 3, 0, 1, 3, 0, 3, 2, 0, 2, 4, -1};
2173 
2174  switch (index) {
2175  case 114:
2176  get_hex_rotation_info(1, &rot_info);
2177  break;
2178  case 78:
2179  get_hex_rotation_info(0, &rot_info);
2180  break;
2181  case 39:
2182  get_hex_rotation_info(10, &rot_info);
2183  break;
2184  case 27:
2185  get_hex_rotation_info(7, &rot_info);
2186  break;
2187  }
2188  cube_polys->verts_num = 10;
2189  for (i = 0; i < 10; i++) {
2190  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2191  }
2192 
2193  *cube_polys->isosurf = isosurf;
2194  for (i = 0; i < 6; i++) {
2195  }
2196 }
2197 
2198 void case10_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell,
2199  double fvalue, int CS_type, int index,
2200  Cube_polygons *cube_polys, int disamb_flag) {
2201  int i;
2202  int amb_index;
2203  Rotation_info rot_info;
2204  static int verts[13] = {0, 2, 4, 6, 8, 9, 10, 11, 200, 203, 205, 206, 106};
2205  static int isosurf_A[13] = {4, 1, 0, 1, 4, 6, 5, 7, 3, 3, 2, 5, -1};
2206  static int isosurf_B[25] = {1, 0, 12, 7, 1, 12, 5, 7, 12, 2, 5, 12, 3,
2207  2, 12, 6, 3, 12, 4, 6, 12, 0, 4, 12, -1};
2208  static int isosurf_C[13] = {6, 3, 2, 6, 2, 4, 7, 1, 0, 7, 0, 5, -1};
2209  static int isosurf_D[25] = {0, 5, 12, 5, 7, 12, 7, 3, 12, 3, 2, 12, 2,
2210  4, 12, 4, 6, 12, 6, 1, 12, 1, 0, 12, -1};
2211 
2212  if (disamb_flag == 0) { /* disambiguation : none */
2213  amb_index = 0;
2214  switch (index) {
2215  case 60:
2216  get_hex_rotation_info(10, &rot_info);
2217  break;
2218  case 85:
2219  get_hex_rotation_info(2, &rot_info);
2220  break;
2221  case 105:
2222  get_hex_rotation_info(0, &rot_info);
2223  break;
2224  }
2225  } else {
2226  amb_index = 0;
2227  switch (index) {
2228  case 60:
2229  amb_index |=
2230  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2231  amb_index <<= 1;
2232  amb_index |=
2233  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
2234  get_hex_rotation_info(10, &rot_info);
2235  break;
2236  case 85:
2237  amb_index |=
2238  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
2239  amb_index <<= 1;
2240  amb_index |=
2241  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2242  get_hex_rotation_info(2, &rot_info);
2243  break;
2244  case 105:
2245  amb_index |=
2246  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
2247  amb_index <<= 1;
2248  amb_index |=
2249  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2250  get_hex_rotation_info(0, &rot_info);
2251  break;
2252  }
2253  }
2254 
2255  switch (amb_index) {
2256  case 0:
2257  cube_polys->verts_num = 12;
2258  for (i = 0; i < 12; i++) {
2259  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2260  }
2261  *cube_polys->isosurf = isosurf_A;
2262 
2263  break;
2264  case 1:
2265  cube_polys->verts_num = 13;
2266  for (i = 0; i < 13; i++) {
2267  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2268  }
2269  *cube_polys->isosurf = isosurf_B;
2270 
2271  break;
2272  case 3:
2273  cube_polys->verts_num = 12;
2274  for (i = 0; i < 12; i++) {
2275  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2276  }
2277  *cube_polys->isosurf = isosurf_C;
2278 
2279  break;
2280  case 2:
2281  cube_polys->verts_num = 13;
2282  for (i = 0; i < 13; i++) {
2283  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2284  }
2285  *cube_polys->isosurf = isosurf_D;
2286 
2287  break;
2288  }
2289 }
2290 
2292  double fvalue, int CS_type, int index,
2293  Cube_polygons *cube_polys, int disamb_flag) {
2294  int i;
2295  int amb_index;
2296  Rotation_info rot_info;
2297  static int verts[13] = {0, 2, 4, 6, 8, 9, 10, 11, 201, 202, 204, 207, 106};
2298  static int isosurf_A[13] = {4, 0, 1, 1, 6, 4, 5, 3, 7, 3, 5, 2, -1};
2299  static int isosurf_B[25] = {0, 1, 12, 1, 7, 12, 7, 5, 12, 5, 2, 12, 2,
2300  3, 12, 3, 6, 12, 6, 4, 12, 4, 0, 12, -1};
2301  static int isosurf_C[13] = {6, 2, 3, 6, 4, 2, 7, 0, 1, 7, 5, 0, -1};
2302  static int isosurf_D[25] = {5, 0, 12, 7, 5, 12, 3, 7, 12, 2, 3, 12, 4,
2303  2, 12, 6, 4, 12, 1, 6, 12, 0, 1, 12, -1};
2304 
2305  if (disamb_flag == 0) { /* disambiguation : none */
2306  amb_index = 0;
2307  switch (index) {
2308  case 195:
2309  get_hex_rotation_info(10, &rot_info);
2310  break;
2311  case 170:
2312  get_hex_rotation_info(2, &rot_info);
2313  break;
2314  case 150:
2315  get_hex_rotation_info(0, &rot_info);
2316  break;
2317  }
2318  } else {
2319  amb_index = 0;
2320  switch (index) {
2321  case 195:
2322  amb_index |=
2323  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2324  amb_index <<= 1;
2325  amb_index |=
2326  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
2327  get_hex_rotation_info(10, &rot_info);
2328  break;
2329  case 170:
2330  amb_index |=
2331  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
2332  amb_index <<= 1;
2333  amb_index |=
2334  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2335  get_hex_rotation_info(2, &rot_info);
2336  break;
2337  case 150:
2338  amb_index |=
2339  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
2340  amb_index <<= 1;
2341  amb_index |=
2342  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2343  get_hex_rotation_info(0, &rot_info);
2344  break;
2345  }
2346  }
2347 
2348  switch (amb_index) {
2349  case 0:
2350  cube_polys->verts_num = 12;
2351  for (i = 0; i < 12; i++) {
2352  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2353  }
2354  *cube_polys->isosurf = isosurf_A;
2355 
2356  break;
2357  case 1:
2358  cube_polys->verts_num = 13;
2359  for (i = 0; i < 13; i++) {
2360  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2361  }
2362  *cube_polys->isosurf = isosurf_B;
2363 
2364  break;
2365  case 3:
2366  cube_polys->verts_num = 12;
2367  for (i = 0; i < 12; i++) {
2368  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2369  }
2370  *cube_polys->isosurf = isosurf_C;
2371 
2372  break;
2373  case 2:
2374  cube_polys->verts_num = 13;
2375  for (i = 0; i < 13; i++) {
2376  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2377  }
2378  *cube_polys->isosurf = isosurf_D;
2379 
2380  break;
2381  }
2382 }
2383 
2384 void case11_tiler_hex(int index, Cube_polygons *cube_polys) {
2385  int i;
2386  Rotation_info rot_info;
2387  static int verts[10] = {0, 3, 6, 7, 9, 11, 200, 204, 205, 206};
2388  static int isosurf[13] = {0, 3, 1, 4, 3, 0, 4, 2, 3, 4, 5, 2, -1};
2389 
2390  switch (index) {
2391  case 29:
2392  get_hex_rotation_info(13, &rot_info);
2393  break;
2394  case 43:
2395  get_hex_rotation_info(9, &rot_info);
2396  break;
2397  case 54:
2398  get_hex_rotation_info(8, &rot_info);
2399  break;
2400  case 71:
2401  get_hex_rotation_info(20, &rot_info);
2402  break;
2403  case 108:
2404  get_hex_rotation_info(11, &rot_info);
2405  break;
2406  case 113:
2407  get_hex_rotation_info(0, &rot_info);
2408  break;
2409  }
2410  cube_polys->verts_num = 10;
2411  for (i = 0; i < 10; i++) {
2412  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2413  }
2414 
2415  *cube_polys->isosurf = isosurf;
2416  for (i = 0; i < 6; i++) {
2417  }
2418 }
2419 
2420 void case11opp_tiler_hex(int index, Cube_polygons *cube_polys) {
2421  int i;
2422  Rotation_info rot_info;
2423  static int verts[10] = {0, 3, 6, 7, 9, 11, 201, 202, 203, 207};
2424  static int isosurf[13] = {0, 1, 3, 4, 0, 3, 4, 3, 2, 4, 2, 5, -1};
2425 
2426  switch (index) {
2427  case 226:
2428  get_hex_rotation_info(13, &rot_info);
2429  break;
2430  case 212:
2431  get_hex_rotation_info(9, &rot_info);
2432  break;
2433  case 201:
2434  get_hex_rotation_info(8, &rot_info);
2435  break;
2436  case 184:
2437  get_hex_rotation_info(20, &rot_info);
2438  break;
2439  case 147:
2440  get_hex_rotation_info(11, &rot_info);
2441  break;
2442  case 142:
2443  get_hex_rotation_info(0, &rot_info);
2444  break;
2445  }
2446  cube_polys->verts_num = 10;
2447  for (i = 0; i < 10; i++) {
2448  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2449  }
2450 
2451  *cube_polys->isosurf = isosurf;
2452  for (i = 0; i < 6; i++) {
2453  }
2454 }
2455 
2456 void case12_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell,
2457  double fvalue, int CS_type, int index,
2458  Cube_polygons *cube_polys, int disamb_flag) {
2459  int i;
2460  int amb_index;
2461  Rotation_info rot_info;
2462  static int verts[12] = {0, 1, 2, 3, 5, 7, 8, 10, 201, 203, 204, 205};
2463  static int isosurf_A[13] = {7, 2, 3, 0, 1, 6, 1, 5, 6, 1, 4, 5, -1};
2464  static int isosurf_B[19] = {4, 2, 1, 4, 7, 2, 4, 0, 7, 0,
2465  3, 7, 4, 6, 0, 4, 5, 6, -1};
2466  static int isosurf_C[13] = {0, 3, 6, 2, 5, 7, 1, 5, 2, 4, 5, 1, -1};
2467  static int isosurf_D[19] = {2, 3, 6, 4, 5, 7, 4, 7, 2, 4,
2468  2, 6, 4, 6, 0, 4, 0, 1, -1};
2469 
2470  if (disamb_flag == 0) { /* disambiguation : none */
2471  amb_index = 0; /* isosurf_A */
2472  switch (index) {
2473  case 30:
2474  get_hex_rotation_info(2, &rot_info);
2475  break;
2476  case 45:
2477  get_hex_rotation_info(4, &rot_info);
2478  break;
2479  case 53:
2480  get_hex_rotation_info(3, &rot_info);
2481  break;
2482  case 58:
2483  get_hex_rotation_info(0, &rot_info);
2484  break;
2485  case 75:
2486  get_hex_rotation_info(6, &rot_info);
2487  break;
2488  case 83:
2489  get_hex_rotation_info(15, &rot_info);
2490  break;
2491  case 86:
2492  get_hex_rotation_info(16, &rot_info);
2493  break;
2494  case 89:
2495  get_hex_rotation_info(21, &rot_info);
2496  break;
2497  case 92:
2498  get_hex_rotation_info(23, &rot_info);
2499  break;
2500  case 101:
2501  get_hex_rotation_info(5, &rot_info);
2502  break;
2503  case 106:
2504  get_hex_rotation_info(8, &rot_info);
2505  break;
2506  case 120:
2507  get_hex_rotation_info(22, &rot_info);
2508  break;
2509  }
2510  } else {
2511  amb_index = 0;
2512  switch (index) {
2513  case 30:
2514  amb_index |=
2515  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
2516  amb_index <<= 1;
2517  amb_index |=
2518  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2519  get_hex_rotation_info(2, &rot_info);
2520  break;
2521  case 45:
2522  amb_index |=
2523  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
2524  amb_index <<= 1;
2525  amb_index |=
2526  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
2527  get_hex_rotation_info(4, &rot_info);
2528  break;
2529  case 53:
2530  amb_index |=
2531  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
2532  amb_index <<= 1;
2533  amb_index |=
2534  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
2535  get_hex_rotation_info(3, &rot_info);
2536  break;
2537  case 58:
2538  amb_index |=
2539  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2540  amb_index <<= 1;
2541  amb_index |=
2542  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
2543  get_hex_rotation_info(0, &rot_info);
2544  break;
2545  case 75:
2546  amb_index |=
2547  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2548  amb_index <<= 1;
2549  amb_index |=
2550  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
2551  get_hex_rotation_info(6, &rot_info);
2552  break;
2553  case 83:
2554  amb_index |=
2555  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
2556  amb_index <<= 1;
2557  amb_index |=
2558  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2559  get_hex_rotation_info(15, &rot_info);
2560  break;
2561  case 86:
2562  amb_index |=
2563  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2564  amb_index <<= 1;
2565  amb_index |=
2566  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
2567  get_hex_rotation_info(16, &rot_info);
2568  break;
2569  case 89:
2570  amb_index |=
2571  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2572  amb_index <<= 1;
2573  amb_index |=
2574  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2575  get_hex_rotation_info(21, &rot_info);
2576  break;
2577  case 92:
2578  amb_index |=
2579  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2580  amb_index <<= 1;
2581  amb_index |=
2582  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2583  get_hex_rotation_info(23, &rot_info);
2584  break;
2585  case 101:
2586  amb_index |=
2587  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
2588  amb_index <<= 1;
2589  amb_index |=
2590  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
2591  get_hex_rotation_info(5, &rot_info);
2592  break;
2593  case 106:
2594  amb_index |=
2595  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
2596  amb_index <<= 1;
2597  amb_index |=
2598  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2599  get_hex_rotation_info(8, &rot_info);
2600  break;
2601  case 120:
2602  amb_index |=
2603  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2604  amb_index <<= 1;
2605  amb_index |=
2606  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2607  get_hex_rotation_info(22, &rot_info);
2608  break;
2609  }
2610  }
2611 
2612  cube_polys->verts_num = 12;
2613  for (i = 0; i < 12; i++) {
2614  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2615  }
2616 
2617  switch (amb_index) {
2618  case 0:
2619  *cube_polys->isosurf = isosurf_A;
2620 
2621  break;
2622  case 1:
2623  *cube_polys->isosurf = isosurf_B;
2624 
2625  break;
2626  case 3:
2627  *cube_polys->isosurf = isosurf_C;
2628 
2629  break;
2630  case 2:
2631  *cube_polys->isosurf = isosurf_D;
2632 
2633  break;
2634  }
2635 }
2636 
2638  double fvalue, int CS_type, int index,
2639  Cube_polygons *cube_polys, int disamb_flag) {
2640  int i;
2641  int amb_index;
2642  Rotation_info rot_info;
2643  static int verts[12] = {0, 1, 2, 3, 5, 7, 8, 10, 200, 202, 206, 207};
2644  static int isosurf_A[13] = {7, 3, 2, 0, 6, 1, 1, 6, 5, 1, 5, 4, -1};
2645  static int isosurf_B[19] = {4, 1, 2, 4, 2, 7, 4, 7, 0, 0,
2646  7, 3, 4, 0, 6, 4, 6, 5, -1};
2647  static int isosurf_C[13] = {0, 6, 3, 2, 7, 5, 1, 2, 5, 4, 1, 5, -1};
2648  static int isosurf_D[19] = {2, 6, 3, 4, 7, 5, 4, 2, 7, 4,
2649  6, 2, 4, 0, 6, 4, 1, 0, -1};
2650 
2651  if (disamb_flag == 0) { /* disambiguation : none */
2652  amb_index = 0;
2653  switch (index) {
2654  case 225:
2655  get_hex_rotation_info(2, &rot_info);
2656  break;
2657  case 210:
2658  get_hex_rotation_info(4, &rot_info);
2659  break;
2660  case 202:
2661  get_hex_rotation_info(3, &rot_info);
2662  break;
2663  case 197:
2664  get_hex_rotation_info(0, &rot_info);
2665  break;
2666  case 180:
2667  get_hex_rotation_info(6, &rot_info);
2668  break;
2669  case 172:
2670  get_hex_rotation_info(15, &rot_info);
2671  break;
2672  case 169:
2673  get_hex_rotation_info(16, &rot_info);
2674  break;
2675  case 166:
2676  get_hex_rotation_info(21, &rot_info);
2677  break;
2678  case 163:
2679  get_hex_rotation_info(23, &rot_info);
2680  break;
2681  case 154:
2682  get_hex_rotation_info(5, &rot_info);
2683  break;
2684  case 149:
2685  get_hex_rotation_info(8, &rot_info);
2686  break;
2687  case 135:
2688  get_hex_rotation_info(22, &rot_info);
2689  break;
2690  }
2691  } else {
2692  amb_index = 0;
2693  switch (index) {
2694  case 225:
2695  amb_index |=
2696  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
2697  amb_index <<= 1;
2698  amb_index |=
2699  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2700  get_hex_rotation_info(2, &rot_info);
2701  break;
2702  case 210:
2703  amb_index |=
2704  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
2705  amb_index <<= 1;
2706  amb_index |=
2707  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
2708  get_hex_rotation_info(4, &rot_info);
2709  break;
2710  case 202:
2711  amb_index |=
2712  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
2713  amb_index <<= 1;
2714  amb_index |=
2715  separation_test(mesh, cell, 3, fvalue, CS_type, disamb_flag);
2716  get_hex_rotation_info(3, &rot_info);
2717  break;
2718  case 197:
2719  amb_index |=
2720  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2721  amb_index <<= 1;
2722  amb_index |=
2723  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
2724  get_hex_rotation_info(0, &rot_info);
2725  break;
2726  case 180:
2727  amb_index |=
2728  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2729  amb_index <<= 1;
2730  amb_index |=
2731  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
2732  get_hex_rotation_info(6, &rot_info);
2733  break;
2734  case 172:
2735  amb_index |=
2736  separation_test(mesh, cell, 2, fvalue, CS_type, disamb_flag);
2737  amb_index <<= 1;
2738  amb_index |=
2739  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2740  get_hex_rotation_info(15, &rot_info);
2741  break;
2742  case 169:
2743  amb_index |=
2744  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2745  amb_index <<= 1;
2746  amb_index |=
2747  separation_test(mesh, cell, 10, fvalue, CS_type, disamb_flag);
2748  get_hex_rotation_info(16, &rot_info);
2749  break;
2750  case 166:
2751  amb_index |=
2752  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2753  amb_index <<= 1;
2754  amb_index |=
2755  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2756  get_hex_rotation_info(21, &rot_info);
2757  break;
2758  case 163:
2759  amb_index |=
2760  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2761  amb_index <<= 1;
2762  amb_index |=
2763  separation_test(mesh, cell, 5, fvalue, CS_type, disamb_flag);
2764  get_hex_rotation_info(23, &rot_info);
2765  break;
2766  case 154:
2767  amb_index |=
2768  separation_test(mesh, cell, 11, fvalue, CS_type, disamb_flag);
2769  amb_index <<= 1;
2770  amb_index |=
2771  separation_test(mesh, cell, 0, fvalue, CS_type, disamb_flag);
2772  get_hex_rotation_info(5, &rot_info);
2773  break;
2774  case 149:
2775  amb_index |=
2776  separation_test(mesh, cell, 1, fvalue, CS_type, disamb_flag);
2777  amb_index <<= 1;
2778  amb_index |=
2779  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2780  get_hex_rotation_info(8, &rot_info);
2781  break;
2782  case 135:
2783  amb_index |=
2784  separation_test(mesh, cell, 8, fvalue, CS_type, disamb_flag);
2785  amb_index <<= 1;
2786  amb_index |=
2787  separation_test(mesh, cell, 6, fvalue, CS_type, disamb_flag);
2788  get_hex_rotation_info(22, &rot_info);
2789  break;
2790  }
2791  }
2792 
2793  cube_polys->verts_num = 12;
2794  for (i = 0; i < 12; i++) {
2795  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2796  }
2797 
2798  switch (amb_index) {
2799  case 0:
2800  *cube_polys->isosurf = isosurf_A;
2801 
2802  break;
2803  case 1:
2804  *cube_polys->isosurf = isosurf_B;
2805 
2806  break;
2807  case 3:
2808  *cube_polys->isosurf = isosurf_C;
2809 
2810  break;
2811  case 2:
2812  *cube_polys->isosurf = isosurf_D;
2813 
2814  break;
2815  }
2816 }
2817 
2818 void case13_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell,
2819  double fvalue, int CS_type, int index,
2820  Cube_polygons *cube_polys, int disamb_flag) {
2821  int i;
2822  int amb_index;
2823  Rotation_info rot_info;
2824  static int verts[16] = {0, 1, 2, 3, 4, 5, 6, 7,
2825  8, 9, 10, 11, 200, 202, 205, 207};
2826  static int isosurf_A[13] = {2, 10, 3, 0, 9, 1, 8, 7, 4, 5, 6, 11, -1};
2827  static int isosurf_B[19] = {8, 7, 4, 5, 6, 11, 9, 1, 10, 1,
2828  2, 10, 9, 10, 3, 9, 3, 0, -1};
2829  static int isosurf_C[25] = {0, 9, 3, 9, 10, 3, 10, 9, 1, 1, 2, 10, 5,
2830  4, 11, 11, 4, 8, 11, 8, 6, 6, 8, 7, -1};
2831  static int isosurf_D[31] = {0, 9, 16, 9, 5, 16, 5, 6, 16, 6, 11,
2832  16, 11, 1, 16, 1, 2, 16, 2, 10, 16, 10,
2833  3, 16, 3, 0, 16, 4, 8, 7, -1};
2834  static int isosurf_E[37] = {
2835  0, 9, 16, 9, 5, 16, 5, 6, 16, 6, 11, 16, 11, 1, 16, 1, 2, 16, 2,
2836  10, 16, 10, 7, 16, 7, 4, 16, 4, 8, 16, 8, 3, 16, 3, 0, 16, -1};
2837  static int isosurf_F[37] = {0, 8, 16, 8, 7, 16, 7, 4, 16, 4, 9, 16, 9,
2838  5, 16, 5, 6, 16, 6, 11, 16, 11, 1, 16, 1, 2,
2839  16, 2, 10, 16, 10, 3, 16, 3, 0, 16, -1};
2840  static int isosurf_G[25] = {0, 8, 1, 1, 8, 11, 11, 8, 3, 3, 2, 11, 9,
2841  7, 4, 9, 10, 7, 9, 5, 10, 5, 6, 10, -1};
2842  static int isosurf_H[31] = {0, 8, 16, 8, 3, 16, 3, 2, 16, 2, 11,
2843  16, 11, 5, 16, 5, 4, 16, 4, 9, 16, 9,
2844  1, 16, 1, 0, 16, 6, 10, 7, -1};
2845  static int isosurf_I[19] = {8, 3, 2, 8, 2, 11, 8, 11, 0, 0,
2846  11, 1, 9, 5, 4, 10, 7, 6, -1};
2847  static int isosurf_J[13] = {0, 8, 3, 4, 9, 5, 2, 11, 1, 10, 7, 6, -1};
2848  static int isosurf_K[37] = {0, 8, 16, 8, 7, 16, 7, 4, 16, 4, 9, 16, 9,
2849  1, 16, 1, 2, 16, 2, 11, 16, 11, 5, 16, 5, 6,
2850  16, 6, 10, 16, 10, 3, 16, 3, 0, 16, -1};
2851  static int isosurf_L[19] = {2, 11, 1, 0, 10, 3, 0, 6, 10, 9,
2852  6, 0, 9, 5, 6, 8, 7, 4, -1};
2853  /*
2854 static int sep_bd[6][9] = {{3, 12,0,3, 3, 13,2,1, -1},
2855  {3, 14,5,9, 3, 13,1,11, -1},
2856  {3, 14,4,5, 3, 15,6,7, -1},
2857  {3, 12,3,8, 3, 15,7,10, -1},
2858  {3, 13,11,2, 3, 15,10,6, -1},
2859  {3, 14,9,4, 3, 12,8,0, -1}};
2860 static int not_sep_bd[6][8] = {{6, 12,0,1,13,2,3, -1},
2861  {6, 14,5,11,13,1,9, -1},
2862  {6, 14,4,7,15,6,5, -1},
2863  {6, 12,3,10,15,7,8, -1},
2864  {6, 13,11,6,15,10,2, -1},
2865  {6, 14,9,0,12,8,4, -1}};
2866  */
2867  static int cube_patch[64] = {
2868  9, 8, 8, 7, 8, 6, 7, 4, 8, 7, 6, 10, 7, 4, 10, 2, 8, 7, 7, 5, 7, 10,
2869  11, 3, 7, 11, 4, 3, 5, 3, 3, 1, 8, 7, 7, 11, 7, 10, 5, 3, 7, 5, 4, 3,
2870  11, 3, 3, 1, 6, 4, 10, 3, 4, 2, 3, 1, 10, 3, 2, 1, 3, 1, 1, 0};
2871  static int cube_rotation[64] = {
2872  0, 0, 6, 0, 15, 0, 23, 22, 2, 7, 6, 15, 15, 6, 0, 1,
2873  8, 21, 17, 15, 8, 1, 7, 22, 2, 23, 1, 1, 0, 6, 16, 1,
2874  16, 16, 6, 15, 1, 21, 7, 2, 22, 17, 8, 8, 0, 17, 21, 8,
2875  21, 15, 22, 15, 0, 6, 7, 22, 17, 23, 0, 15, 0, 6, 0, 0};
2876 
2877  if (disamb_flag == 0) { /* disambiguation : none */
2878  amb_index = 9; /* isosurf_J */
2879  } else {
2880  amb_index = 0;
2881  amb_index |= separation_test(mesh, cell, 11, fvalue, CS_type,
2882  disamb_flag); /* bottom */
2883  amb_index <<= 1;
2884  amb_index |=
2885  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag); /* top */
2886  amb_index <<= 1;
2887  amb_index |=
2888  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag); /* left */
2889  amb_index <<= 1;
2890  amb_index |=
2891  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag); /* back */
2892  amb_index <<= 1;
2893  amb_index |= separation_test(mesh, cell, 3, fvalue, CS_type,
2894  disamb_flag); /* right */
2895  amb_index <<= 1;
2896  amb_index |= separation_test(mesh, cell, 0, fvalue, CS_type,
2897  disamb_flag); /* front */
2898  }
2899  get_hex_rotation_info(cube_rotation[amb_index], &rot_info);
2900 
2901  switch (cube_patch[amb_index]) {
2902  case 0:
2903  cube_polys->verts_num = 16;
2904  for (i = 0; i < 16; i++) {
2905  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2906  }
2907  *cube_polys->isosurf = isosurf_A;
2908 
2909  break;
2910  case 1:
2911  cube_polys->verts_num = 16;
2912  for (i = 0; i < 16; i++) {
2913  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2914  }
2915  *cube_polys->isosurf = isosurf_B;
2916 
2917  break;
2918  case 2:
2919  cube_polys->verts_num = 16;
2920  for (i = 0; i < 16; i++) {
2921  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2922  }
2923  *cube_polys->isosurf = isosurf_C;
2924 
2925  break;
2926  case 3:
2927  cube_polys->verts_num = 17;
2928  for (i = 0; i < 16; i++) {
2929  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2930  }
2931  cube_polys->verts[16] = point_convert(101, &rot_info);
2932  *cube_polys->isosurf = isosurf_D;
2933 
2934  break;
2935  case 4:
2936  cube_polys->verts_num = 17;
2937  for (i = 0; i < 16; i++) {
2938  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2939  }
2940  cube_polys->verts[16] = point_convert(101, &rot_info);
2941  *cube_polys->isosurf = isosurf_E;
2942 
2943  break;
2944  case 5:
2945  cube_polys->verts_num = 17;
2946  for (i = 0; i < 16; i++) {
2947  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2948  }
2949  cube_polys->verts[16] = point_convert(101, &rot_info);
2950  *cube_polys->isosurf = isosurf_F;
2951 
2952  break;
2953  case 6:
2954  cube_polys->verts_num = 16;
2955  for (i = 0; i < 16; i++) {
2956  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2957  }
2958  *cube_polys->isosurf = isosurf_G;
2959 
2960  break;
2961  case 7:
2962  cube_polys->verts_num = 17;
2963  for (i = 0; i < 16; i++) {
2964  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2965  }
2966  cube_polys->verts[16] = point_convert(102, &rot_info);
2967  *cube_polys->isosurf = isosurf_H;
2968 
2969  break;
2970  case 8:
2971  cube_polys->verts_num = 16;
2972  for (i = 0; i < 16; i++) {
2973  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2974  }
2975  *cube_polys->isosurf = isosurf_I;
2976 
2977  break;
2978  case 9:
2979  cube_polys->verts_num = 16;
2980  for (i = 0; i < 16; i++) {
2981  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2982  }
2983  *cube_polys->isosurf = isosurf_J;
2984 
2985  break;
2986  case 10:
2987  cube_polys->verts_num = 17;
2988  for (i = 0; i < 16; i++) {
2989  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2990  }
2991  cube_polys->verts[16] = point_convert(101, &rot_info);
2992  *cube_polys->isosurf = isosurf_K;
2993 
2994  break;
2995  case 11:
2996  cube_polys->verts_num = 16;
2997  for (i = 0; i < 16; i++) {
2998  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
2999  }
3000  *cube_polys->isosurf = isosurf_L;
3001 
3002  break;
3003  }
3004 }
3005 
3007  double fvalue, int CS_type, int index,
3008  Cube_polygons *cube_polys, int disamb_flag) {
3009  int i;
3010  int amb_index;
3011  Rotation_info rot_info;
3012  static int verts[16] = {0, 1, 2, 3, 4, 5, 6, 7,
3013  8, 9, 10, 11, 201, 203, 204, 206};
3014  static int isosurf_A[13] = {2, 3, 10, 0, 1, 9, 8, 4, 7, 5, 11, 6, -1};
3015  static int isosurf_B[19] = {8, 4, 7, 5, 11, 6, 9, 10, 1, 1,
3016  10, 2, 9, 3, 10, 9, 0, 3, -1};
3017  static int isosurf_C[25] = {0, 3, 9, 9, 3, 10, 10, 1, 9, 1, 10, 2, 5,
3018  11, 4, 11, 8, 4, 11, 6, 8, 6, 7, 8, -1};
3019  static int isosurf_D[31] = {9, 0, 16, 5, 9, 16, 6, 5, 16, 11, 6,
3020  16, 1, 11, 16, 2, 1, 16, 10, 2, 16, 3,
3021  10, 16, 0, 3, 16, 4, 7, 8, -1};
3022  static int isosurf_E[37] = {9, 0, 16, 5, 9, 16, 6, 5, 16, 11, 6, 16, 1,
3023  11, 16, 2, 1, 16, 10, 2, 16, 7, 10, 16, 4, 7,
3024  16, 8, 4, 16, 3, 8, 16, 0, 3, 16, -1};
3025  static int isosurf_F[37] = {8, 0, 16, 7, 8, 16, 4, 7, 16, 9, 4, 16, 5,
3026  9, 16, 6, 5, 16, 11, 6, 16, 1, 11, 16, 2, 1,
3027  16, 10, 2, 16, 3, 10, 16, 0, 3, 16, -1};
3028  static int isosurf_G[25] = {0, 1, 8, 1, 11, 8, 11, 3, 8, 3, 11, 2, 9,
3029  4, 7, 9, 7, 10, 9, 10, 5, 5, 10, 6, -1};
3030  static int isosurf_H[31] = {8, 0, 16, 3, 8, 16, 2, 3, 16, 11, 2,
3031  16, 5, 11, 16, 4, 5, 16, 9, 4, 16, 1,
3032  9, 16, 0, 1, 16, 6, 7, 10, -1};
3033  static int isosurf_I[19] = {8, 2, 3, 8, 11, 2, 8, 0, 11, 0,
3034  1, 11, 9, 4, 5, 10, 6, 7, -1};
3035  static int isosurf_J[13] = {0, 3, 8, 4, 5, 9, 2, 1, 11, 10, 6, 7, -1};
3036  static int isosurf_K[37] = {8, 0, 16, 7, 8, 16, 4, 7, 16, 9, 4, 16, 1,
3037  9, 16, 2, 1, 16, 11, 2, 16, 5, 11, 16, 6, 5,
3038  16, 10, 6, 16, 3, 10, 16, 0, 3, 16, -1};
3039  static int isosurf_L[19] = {2, 1, 11, 0, 3, 10, 0, 10, 6, 9,
3040  0, 6, 9, 6, 5, 8, 4, 7, -1};
3041  /*
3042 static int sep_bd[6][9] = {{3, 12,1,0, 3, 13,3,2, -1},
3043  {3, 12,9,1, 3, 15,11,5, -1},
3044  {3, 14,7,4, 3, 15,5,6, -1},
3045  {3, 14,8,7, 3, 13,10,3, -1},
3046  {3, 13,2,10, 3, 15,6,11, -1},
3047  {3, 14,4,8, 3, 12,0,9, -1}};
3048 static int not_sep_bd[6][8] = {{6, 12,1,2,13,3,0, -1},
3049  {6, 12,9,5,15,11,1, -1},
3050  {6, 14,7,6,15,5,4, -1},
3051  {6, 14,8,3,13,10,7, -1},
3052  {6, 13,2,11,15,6,10, -1},
3053  {6, 14,4,9,12,0,8, -1}};
3054  */
3055  static int cube_patch[64] = {
3056  9, 8, 8, 7, 8, 6, 7, 4, 8, 7, 6, 10, 7, 4, 10, 2, 8, 7, 7, 5, 7, 10,
3057  11, 3, 7, 11, 4, 3, 5, 3, 3, 1, 8, 7, 7, 11, 7, 10, 5, 3, 7, 5, 4, 3,
3058  11, 3, 3, 1, 6, 4, 10, 3, 4, 2, 3, 1, 10, 3, 2, 1, 3, 1, 1, 0};
3059  static int cube_rotation[64] = {
3060  0, 0, 6, 0, 15, 0, 23, 22, 2, 7, 6, 15, 15, 6, 0, 1,
3061  8, 21, 17, 15, 8, 1, 7, 22, 2, 23, 1, 1, 0, 6, 16, 1,
3062  16, 16, 6, 15, 1, 21, 7, 2, 22, 17, 8, 8, 0, 17, 21, 8,
3063  21, 15, 22, 15, 0, 6, 7, 22, 17, 23, 0, 15, 0, 6, 0, 0};
3064 
3065  if (disamb_flag == 0) { /* disambiguation : none */
3066  amb_index = 9;
3067  } else {
3068  amb_index = 0;
3069  amb_index |= separation_test(mesh, cell, 11, fvalue, CS_type,
3070  disamb_flag); /* bottom */
3071  amb_index <<= 1;
3072  amb_index |=
3073  separation_test(mesh, cell, 9, fvalue, CS_type, disamb_flag); /* top */
3074  amb_index <<= 1;
3075  amb_index |=
3076  separation_test(mesh, cell, 7, fvalue, CS_type, disamb_flag); /* left */
3077  amb_index <<= 1;
3078  amb_index |=
3079  separation_test(mesh, cell, 4, fvalue, CS_type, disamb_flag); /* back */
3080  amb_index <<= 1;
3081  amb_index |= separation_test(mesh, cell, 3, fvalue, CS_type,
3082  disamb_flag); /* right */
3083  amb_index <<= 1;
3084  amb_index |= separation_test(mesh, cell, 0, fvalue, CS_type,
3085  disamb_flag); /* front */
3086  }
3087 
3088  get_hex_rotation_info(cube_rotation[amb_index], &rot_info);
3089 
3090  switch (cube_patch[amb_index]) {
3091  case 0:
3092  cube_polys->verts_num = 16;
3093  for (i = 0; i < 16; i++) {
3094  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3095  }
3096  *cube_polys->isosurf = isosurf_A;
3097 
3098  break;
3099  case 1:
3100  cube_polys->verts_num = 16;
3101  for (i = 0; i < 16; i++) {
3102  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3103  }
3104  *cube_polys->isosurf = isosurf_B;
3105 
3106  break;
3107  case 2:
3108  cube_polys->verts_num = 16;
3109  for (i = 0; i < 16; i++) {
3110  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3111  }
3112  *cube_polys->isosurf = isosurf_C;
3113 
3114  break;
3115  case 3:
3116  cube_polys->verts_num = 17;
3117  for (i = 0; i < 16; i++) {
3118  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3119  }
3120  cube_polys->verts[16] = point_convert(101, &rot_info);
3121  *cube_polys->isosurf = isosurf_D;
3122 
3123  break;
3124  case 4:
3125  cube_polys->verts_num = 17;
3126  for (i = 0; i < 16; i++) {
3127  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3128  }
3129  cube_polys->verts[16] = point_convert(101, &rot_info);
3130  *cube_polys->isosurf = isosurf_E;
3131 
3132  break;
3133  case 5:
3134  cube_polys->verts_num = 17;
3135  for (i = 0; i < 16; i++) {
3136  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3137  }
3138  cube_polys->verts[16] = point_convert(101, &rot_info);
3139  *cube_polys->isosurf = isosurf_F;
3140 
3141  break;
3142  case 6:
3143  cube_polys->verts_num = 16;
3144  for (i = 0; i < 16; i++) {
3145  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3146  }
3147  *cube_polys->isosurf = isosurf_G;
3148 
3149  break;
3150  case 7:
3151  cube_polys->verts_num = 17;
3152  for (i = 0; i < 16; i++) {
3153  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3154  }
3155  cube_polys->verts[16] = point_convert(102, &rot_info);
3156  *cube_polys->isosurf = isosurf_H;
3157 
3158  break;
3159  case 8:
3160  cube_polys->verts_num = 16;
3161  for (i = 0; i < 16; i++) {
3162  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3163  }
3164  *cube_polys->isosurf = isosurf_I;
3165 
3166  break;
3167  case 9:
3168  cube_polys->verts_num = 16;
3169  for (i = 0; i < 16; i++) {
3170  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3171  }
3172  *cube_polys->isosurf = isosurf_J;
3173 
3174  break;
3175  case 10:
3176  cube_polys->verts_num = 17;
3177  for (i = 0; i < 16; i++) {
3178  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3179  }
3180  cube_polys->verts[16] = point_convert(101, &rot_info);
3181  *cube_polys->isosurf = isosurf_K;
3182 
3183  break;
3184  case 11:
3185  cube_polys->verts_num = 16;
3186  for (i = 0; i < 16; i++) {
3187  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3188  }
3189  *cube_polys->isosurf = isosurf_L;
3190 
3191  break;
3192  }
3193 }
3194 
3195 void case14_tiler_hex(int index, Cube_polygons *cube_polys) {
3196  int i;
3197  Rotation_info rot_info;
3198  static int verts[10] = {0, 1, 5, 6, 8, 10, 201, 204, 205, 207};
3199  static int isosurf[13] = {1, 2, 0, 0, 2, 4, 4, 2, 3, 4, 3, 5, -1};
3200 
3201  switch (index) {
3202  case 139:
3203  get_hex_rotation_info(13, &rot_info);
3204  break;
3205  case 156:
3206  get_hex_rotation_info(18, &rot_info);
3207  break;
3208  case 178:
3209  get_hex_rotation_info(0, &rot_info);
3210  break;
3211  case 198:
3212  get_hex_rotation_info(11, &rot_info);
3213  break;
3214  case 209:
3215  get_hex_rotation_info(10, &rot_info);
3216  break;
3217  case 232:
3218  get_hex_rotation_info(7, &rot_info);
3219  break;
3220  }
3221  cube_polys->verts_num = 10;
3222  for (i = 0; i < 10; i++) {
3223  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3224  }
3225 
3226  *cube_polys->isosurf = isosurf;
3227  for (i = 0; i < 6; i++) {
3228  }
3229 }
3230 
3231 void case14opp_tiler_hex(int index, Cube_polygons *cube_polys) {
3232  int i;
3233  Rotation_info rot_info;
3234  static int verts[10] = {0, 1, 5, 6, 8, 10, 200, 202, 203, 206};
3235  static int isosurf[13] = {1, 0, 2, 0, 4, 2, 4, 3, 2, 4, 5, 3, -1};
3236 
3237  switch (index) {
3238  case 116:
3239  get_hex_rotation_info(13, &rot_info);
3240  break;
3241  case 99:
3242  get_hex_rotation_info(18, &rot_info);
3243  break;
3244  case 77:
3245  get_hex_rotation_info(0, &rot_info);
3246  break;
3247  case 57:
3248  get_hex_rotation_info(11, &rot_info);
3249  break;
3250  case 46:
3251  get_hex_rotation_info(10, &rot_info);
3252  break;
3253  case 23:
3254  get_hex_rotation_info(7, &rot_info);
3255  break;
3256  }
3257  cube_polys->verts_num = 10;
3258  for (i = 0; i < 10; i++) {
3259  cube_polys->verts[i] = point_convert(verts[i], &rot_info);
3260  }
3261 
3262  *cube_polys->isosurf = isosurf;
3263  for (i = 0; i < 6; i++) {
3264  }
3265 }
3266 
3267 int choice_disambiguation(int disamb_flag, double fvalue, int CS_type,
3268  double voxel0, double voxel1, double voxel2,
3269  double voxel3) {
3270  int sep;
3271  double field;
3272 
3273  switch (disamb_flag) {
3274  case 1: /* asymptotic decider */
3275  field = calc_cross_field(voxel0, voxel1, voxel2, voxel3);
3276  break;
3277  case 2: /* facial average */
3278  field = facial_average(voxel0, voxel1, voxel2, voxel3);
3279  break;
3280  }
3281 
3282  if (!CS_type) {
3283  /* when alpha volume */
3284  if (voxel0 >= fvalue) {
3285  sep = (field < fvalue) ? 0 : 1;
3286  } else {
3287  sep = (field >= fvalue) ? 0 : 1;
3288  }
3289  } else {
3290  /* when beta volume */
3291  if (voxel0 <= fvalue) {
3292  sep = (field > fvalue) ? 0 : 1;
3293  } else {
3294  sep = (field <= fvalue) ? 0 : 1;
3295  }
3296  }
3297 
3298  return sep;
3299 }
facial_average
double facial_average(double f00, double f10, double f11, double f01)
Definition: hecmw_vis_calc_attr.c:227
choice_disambiguation
int choice_disambiguation(int disamb_flag, double fvalue, int CS_type, double voxel0, double voxel1, double voxel2, double voxel3)
Definition: hecmw_vis_intersection_find.c:3267
case4_tiler_hex
void case4_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:723
calc_cross_field
double calc_cross_field(double f00, double f10, double f11, double f01)
Definition: hecmw_vis_calc_attr.c:218
_rotation_info_struct::grid_point
unsigned char grid_point[8]
Definition: hecmw_vis_SF_geom.h:247
case7_tiler_hex
void case7_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:1493
case2_tiler_hex
void case2_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:317
case5opp_tiler_hex
void case5opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:894
case11_tiler_hex
void case11_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:2384
_cube_polygons_struct::verts
int verts[VERTEX_KIND]
Definition: hecmw_vis_SF_geom.h:241
case4opp_tiler_hex
void case4opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:758
mesh
struct hecmwST_local_mesh * mesh
Definition: hecmw_repart.h:71
case12_tiler_hex
void case12_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:2456
_cell_struct::s_data
double s_data[8]
Definition: hecmw_vis_SF_geom.h:254
hecmwST_local_mesh
Definition: hecmw_struct.h:139
case8opp_tiler_hex
void case8opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:2111
case13opp_tiler_hex
void case13opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:3006
case9_tiler_hex
void case9_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:2138
get_hex_rotation_info
int get_hex_rotation_info(int rot_type, Rotation_info *rot_info)
Definition: hecmw_vis_intersection_find.c:11
case5_tiler_hex
void case5_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:793
case12opp_tiler_hex
void case12opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:2637
_cube_polygons_struct::verts_num
int verts_num
Definition: hecmw_vis_SF_geom.h:240
case14opp_tiler_hex
void case14opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:3231
case3_tiler_hex
void case3_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:437
_rotation_info_struct::edge
unsigned char edge[12]
Definition: hecmw_vis_SF_geom.h:248
case10opp_tiler_hex
void case10opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:2291
_rotation_info_struct
Definition: hecmw_vis_SF_geom.h:245
_cell_struct
Definition: hecmw_vis_SF_geom.h:252
case8_tiler_hex
void case8_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:2084
case10_tiler_hex
void case10_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:2198
case2opp_tiler_hex
void case2opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:377
hecmw_vis_intersection_find.h
hecmw_vis_calc_attr.h
case1opp_tiler_hex
void case1opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:269
case3opp_tiler_hex
void case3opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:580
case0opp_tiler_hex
void case0opp_tiler_hex(Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:202
case6opp_tiler_hex
void case6opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:1243
case13_tiler_hex
void case13_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:2818
separation_test
int separation_test(struct hecmwST_local_mesh *mesh, Cell *cell, int amb, double fvalue, int CS_type, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:131
_cube_polygons_struct
Definition: hecmw_vis_SF_geom.h:239
case7opp_tiler_hex
void case7opp_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:1788
case6_tiler_hex
void case6_tiler_hex(struct hecmwST_local_mesh *mesh, Cell *cell, double fvalue, int CS_type, int index, Cube_polygons *cube_polys, int disamb_flag)
Definition: hecmw_vis_intersection_find.c:993
case11opp_tiler_hex
void case11opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:2420
_cube_polygons_struct::isosurf
int ** isosurf
Definition: hecmw_vis_SF_geom.h:242
case9opp_tiler_hex
void case9opp_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:2168
point_convert
int point_convert(int point_index, Rotation_info *rot_info)
Definition: hecmw_vis_intersection_find.c:116
case14_tiler_hex
void case14_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:3195
_rotation_info_struct::inside
unsigned char inside[7]
Definition: hecmw_vis_SF_geom.h:249
case1_tiler_hex
void case1_tiler_hex(int index, Cube_polygons *cube_polys)
Definition: hecmw_vis_intersection_find.c:221