6 #define INAGAKI_PARTITIONER
49 #define NEIGHBOR_DOMAIN 2
61 #define QSORT_LOWER 50
63 #define MASK_BIT(map, bit) ((map) |= (bit))
65 #define EVAL_BIT(map, bit) ((map) & (bit))
67 #define INV_BIT(map, bit) ((map) ^= (bit))
69 #define CLEAR_BIT(map, bit) \
73 #define CLEAR_IEB(map) \
77 #define CLEAR_MM(map) \
81 #define DSWAP(a, aa) \
86 #define ISWAP(b, bb) \
93 #define RTC_ERROR (-1)
97 #define MAX_NODE_SIZE 20
114 static int *n_int_nlist =
NULL;
115 static int *n_bnd_nlist =
NULL;
116 static int *n_int_elist =
NULL;
117 static int *n_bnd_elist =
NULL;
118 static int **int_nlist =
NULL;
119 static int **bnd_nlist =
NULL;
120 static int **int_elist =
NULL;
121 static int **bnd_elist =
NULL;
122 static int **ngrp_idx =
NULL;
123 static int **ngrp_item =
NULL;
124 static int **egrp_idx =
NULL;
125 static int **egrp_item =
NULL;
127 static int spdup_clear_MMbnd(
char *node_flag,
char *elem_flag,
128 int current_domain) {
131 for (i = 0; i < n_bnd_nlist[2 * current_domain + 1]; i++) {
132 node = bnd_nlist[current_domain][i];
135 for (i = 0; i < n_bnd_elist[2 * current_domain + 1]; i++) {
136 elem = bnd_elist[current_domain][i];
142 static int spdup_clear_IEB(
char *node_flag,
char *elem_flag,
143 int current_domain) {
146 for (i = 0; i < n_int_nlist[current_domain]; i++) {
147 node = int_nlist[current_domain][i];
150 for (i = 0; i < n_bnd_nlist[2 * current_domain + 1]; i++) {
151 node = bnd_nlist[current_domain][i];
154 for (i = 0; i < n_int_elist[current_domain]; i++) {
155 elem = int_elist[current_domain][i];
158 for (i = 0; i < n_bnd_elist[2 * current_domain + 1]; i++) {
159 elem = bnd_elist[current_domain][i];
170 int node, n_domain, domain[20], flag;
174 if (n_int_nlist ==
NULL) {
179 if (n_bnd_nlist ==
NULL) {
184 if (n_int_elist ==
NULL) {
189 if (n_bnd_elist ==
NULL) {
194 if (int_nlist ==
NULL) {
199 if (bnd_nlist ==
NULL) {
204 if (int_elist ==
NULL) {
209 if (bnd_elist ==
NULL) {
215 for (i = 0; i < global_mesh->
n_node; i++) {
216 n_int_nlist[global_mesh->
node_ID[2 * i + 1]]++;
220 for (i = 0; i < global_mesh->
n_elem; i++) {
221 n_int_elist[global_mesh->
elem_ID[2 * i + 1]]++;
225 for (i = 0; i < global_mesh->
n_elem; i++) {
230 domain[0] = global_mesh->
node_ID[2 * node - 1];
231 for (j = js + 1; j < je; j++) {
233 for (flag = 0, k = 0; k < n_domain; k++) {
234 if (global_mesh->
node_ID[2 * node - 1] == domain[k]) {
240 domain[n_domain] = global_mesh->
node_ID[2 * node - 1];
246 for (j = 0; j < n_domain; j++) {
247 n_bnd_elist[domain[j]]++;
248 n_bnd_nlist[domain[j]] += (int)(je - js);
255 int_nlist[i] = (
int *)
HECMW_calloc(n_int_nlist[i],
sizeof(
int));
256 if (int_nlist[i] ==
NULL) {
260 bnd_nlist[i] = (
int *)
HECMW_calloc(n_bnd_nlist[i],
sizeof(
int));
261 if (bnd_nlist[i] ==
NULL) {
265 int_elist[i] = (
int *)
HECMW_calloc(n_int_elist[i],
sizeof(
int));
266 if (int_elist[i] ==
NULL) {
270 bnd_elist[i] = (
int *)
HECMW_calloc(n_bnd_elist[i],
sizeof(
int));
271 if (bnd_elist[i] ==
NULL) {
283 static int int_cmp(
const void *v1,
const void *v2) {
286 i1 = (
const int *)v1;
287 i2 = (
const int *)v2;
289 if (*i1 < *i2)
return -1;
290 if (*i1 > *i2)
return 1;
298 int node, elem, counter;
301 for (counter = 0, j = 0; j < n_bnd_elist[2 * domain + 1]; j++) {
302 elem = bnd_elist[domain][j];
305 for (k = ks; k < ke; k++) {
307 bnd_nlist[domain][counter] = node;
312 qsort(bnd_nlist[domain], counter,
sizeof(
int), int_cmp);
316 for (j = 1; j < counter; j++) {
317 if (bnd_nlist[domain][j - 1] != bnd_nlist[domain][j]) {
318 bnd_nlist[domain][i] = bnd_nlist[domain][j];
326 n_bnd_nlist[2 * domain + 1] = i;
335 int bnd_and_int, bnd_not_int;
336 int n_nlist, n_elist;
339 n_nlist = n_bnd_nlist[2 * domain + 1];
349 for (i = 0; i < n_nlist; i++) {
350 node = bnd_nlist[domain][i];
351 if (global_mesh->
node_ID[2 * node - 1] == domain) {
352 work[bnd_and_int] = node;
356 for (i = 0; i < n_nlist; i++) {
357 node = bnd_nlist[domain][i];
358 if (global_mesh->
node_ID[2 * node - 1] != domain) {
359 work[bnd_and_int + bnd_not_int] = node;
363 n_bnd_nlist[2 * domain] = bnd_and_int;
364 n_bnd_nlist[2 * domain + 1] = bnd_and_int + bnd_not_int;
369 bnd_nlist[domain] = (
int *)
HECMW_calloc(n_nlist,
sizeof(
int));
370 if (bnd_nlist[domain] ==
NULL) {
374 for (i = 0; i < n_nlist; i++) {
375 bnd_nlist[domain][i] = work[i];
380 n_elist = n_bnd_elist[2 * domain + 1];
390 for (i = 0; i < n_elist; i++) {
391 elem = bnd_elist[domain][i];
392 if (global_mesh->
elem_ID[2 * elem - 1] == domain) {
393 work[bnd_and_int] = elem;
397 for (i = 0; i < n_elist; i++) {
398 elem = bnd_elist[domain][i];
399 if (global_mesh->
elem_ID[2 * elem - 1] != domain) {
400 work[bnd_and_int + bnd_not_int] = elem;
404 n_bnd_elist[2 * domain] = bnd_and_int;
405 n_bnd_elist[2 * domain + 1] = bnd_and_int + bnd_not_int;
406 for (i = 0; i < n_elist; i++) {
407 bnd_elist[domain][i] = work[i];
422 int node, elem, n_domain, domain[20], flag;
429 n_bnd_nlist[2 * i] = 0;
430 n_bnd_nlist[2 * i + 1] = 0;
432 n_bnd_elist[2 * i] = 0;
433 n_bnd_elist[2 * i + 1] = 0;
437 for (i = 0; i < global_mesh->
n_node; i++) {
438 current_domain = global_mesh->
node_ID[2 * i + 1];
439 int_nlist[current_domain][n_int_nlist[current_domain]] = i + 1;
440 n_int_nlist[current_domain]++;
444 for (i = 0; i < global_mesh->
n_elem; i++) {
445 current_domain = global_mesh->
elem_ID[2 * i + 1];
446 int_elist[current_domain][n_int_elist[current_domain]] = i + 1;
447 n_int_elist[current_domain]++;
451 for (i = 0; i < global_mesh->
n_elem; i++) {
456 domain[0] = global_mesh->
node_ID[2 * node - 1];
457 for (j = js + 1; j < je; j++) {
459 for (flag = 0, k = 0; k < n_domain; k++) {
460 if (global_mesh->
node_ID[2 * node - 1] == domain[k]) {
466 domain[n_domain] = global_mesh->
node_ID[2 * node - 1];
472 for (j = 0; j < n_domain; j++) {
473 bnd_elist[domain[j]][n_bnd_elist[2 * domain[j] + 1]] = i + 1;
474 n_bnd_elist[2 * domain[j] + 1]++;
481 rtc = get_boundary_nodelist(global_mesh, i);
486 rtc = sort_and_resize_bndlist(global_mesh, i);
496 static int spdup_make_node_grouplist(
499 int i, j, k, node, n_bnd, n_out;
500 int *n_domain =
NULL;
507 if (n_domain ==
NULL) {
513 n_bnd = n_bnd_nlist[2 * i];
514 n_out = n_bnd_nlist[2 * i + 1] - n_bnd_nlist[2 * i];
515 if (n_out == 0)
continue;
516 for (j = 0; j < n_out; j++) {
517 node = bnd_nlist[i][n_bnd + j];
518 n_domain[node - 1]++;
523 if (domain ==
NULL) {
527 for (i = 0; i < global_mesh->
n_node; i++) {
530 if (domain[i] ==
NULL) {
534 domain[i][0] = global_mesh->
node_ID[2 * i + 1];
538 n_bnd = n_bnd_nlist[2 * i];
539 n_out = n_bnd_nlist[2 * i + 1] - n_bnd_nlist[2 * i];
540 if (n_out == 0)
continue;
541 for (j = 0; j < n_out; j++) {
542 node = bnd_nlist[i][n_bnd + j];
543 domain[node - 1][n_domain[node - 1]] = i;
544 n_domain[node - 1]++;
550 if (ngrp_idx ==
NULL) {
557 if (ngrp_idx[i] ==
NULL) {
562 for (i = 0; i < node_group_global->
n_grp; i++) {
564 ngrp_idx[j][i + 1] = ngrp_idx[j][i];
570 for (j = node_group_global->
grp_index[i];
571 j < node_group_global->
grp_index[i + 1]; j++) {
572 node = node_group_global->
grp_item[j];
573 for (k = 0; k < n_domain[node - 1]; k++) {
574 current_domain = domain[node - 1][k];
575 ngrp_idx[current_domain][i + 1]++;
582 if (ngrp_item ==
NULL) {
589 if (ngrp_item[i] ==
NULL) {
595 for (i = 0; i < node_group_global->
n_grp; i++) {
600 for (j = node_group_global->
grp_index[i];
601 j < node_group_global->
grp_index[i + 1]; j++) {
602 node = node_group_global->
grp_item[j];
603 for (k = 0; k < n_domain[node - 1]; k++) {
604 current_domain = domain[node - 1][k];
605 ngrp_item[current_domain][counter[current_domain]] = node;
606 counter[current_domain]++;
611 for (i = 0; i < global_mesh->
n_node; i++) {
622 static int spdup_make_element_grouplist(
625 int i, j, k, elem, n_bnd, n_out;
626 int *n_domain =
NULL;
633 if (n_domain ==
NULL) {
639 n_bnd = n_bnd_elist[2 * i];
640 n_out = n_bnd_elist[2 * i + 1] - n_bnd_elist[2 * i];
641 if (n_out == 0)
continue;
642 for (j = 0; j < n_out; j++) {
643 elem = bnd_elist[i][n_bnd + j];
644 n_domain[elem - 1]++;
649 if (domain ==
NULL) {
653 for (i = 0; i < global_mesh->
n_elem; i++) {
656 if (domain[i] ==
NULL) {
660 domain[i][0] = global_mesh->
elem_ID[2 * i + 1];
664 n_bnd = n_bnd_elist[2 * i];
665 n_out = n_bnd_elist[2 * i + 1] - n_bnd_elist[2 * i];
666 if (n_out == 0)
continue;
667 for (j = 0; j < n_out; j++) {
668 elem = bnd_elist[i][n_bnd + j];
669 domain[elem - 1][n_domain[elem - 1]] = i;
670 n_domain[elem - 1]++;
676 if (egrp_idx ==
NULL) {
683 if (egrp_idx[i] ==
NULL) {
688 for (i = 0; i < elem_group_global->
n_grp; i++) {
690 egrp_idx[j][i + 1] = egrp_idx[j][i];
696 for (j = elem_group_global->
grp_index[i];
697 j < elem_group_global->
grp_index[i + 1]; j++) {
698 elem = elem_group_global->
grp_item[j];
699 for (k = 0; k < n_domain[elem - 1]; k++) {
700 current_domain = domain[elem - 1][k];
701 egrp_idx[current_domain][i + 1]++;
708 if (egrp_item ==
NULL) {
715 if (egrp_item[i] ==
NULL) {
721 for (i = 0; i < elem_group_global->
n_grp; i++) {
726 for (j = elem_group_global->
grp_index[i];
727 j < elem_group_global->
grp_index[i + 1]; j++) {
728 elem = elem_group_global->
grp_item[j];
729 for (k = 0; k < n_domain[elem - 1]; k++) {
730 current_domain = domain[elem - 1][k];
731 egrp_item[current_domain][counter[current_domain]] = elem;
732 counter[current_domain]++;
737 for (i = 0; i < global_mesh->
n_elem; i++) {
751 rtc = spdup_init_list(global_mesh);
754 rtc = spdup_make_list(global_mesh);
757 rtc = spdup_make_node_grouplist(global_mesh);
760 rtc = spdup_make_element_grouplist(global_mesh);
806 static char *get_dist_file_name(
char *header,
int domain,
char *fname,
808 snprintf(fname, fname_size,
"%s.%d", header, domain);
812 static void free_link_list(
struct link_unit *llist) {
815 for (p = llist; p; p = q) {
825 if (local_mesh ==
NULL) {
851 if (local_mesh ==
NULL) {
865 local_mesh->
n_dof = 0;
883 if (local_mesh ==
NULL) {
923 if (local_mesh ==
NULL) {
928 local_mesh->
zero = 0;
929 local_mesh->
PETOT = 0;
952 if (local_mesh ==
NULL) {
975 if (local_mesh ==
NULL) {
1001 if (local_mesh ==
NULL) {
1028 if (local_mesh ==
NULL) {
1032 if (local_mesh->
mpc ==
NULL) {
1051 if (local_mesh ==
NULL) {
1056 if (local_mesh->
amp ==
NULL) {
1077 if (local_mesh ==
NULL) {
1106 if (local_mesh ==
NULL) {
1134 if (local_mesh ==
NULL) {
1162 if (local_mesh ==
NULL) {
1169 "\'local_mesh->contact_pair\' is NULL");
1189 if (local_mesh ==
NULL)
return;
1191 init_struct_global(local_mesh);
1195 if (local_mesh ==
NULL)
return;
1200 if (local_mesh->
node) {
1219 init_struct_node(local_mesh);
1223 if (local_mesh ==
NULL)
return;
1256 init_struct_elem(local_mesh);
1260 if (local_mesh ==
NULL)
return;
1284 init_struct_comm(local_mesh);
1288 if (local_mesh ==
NULL)
return;
1290 init_struct_adapt(local_mesh);
1294 if (local_mesh ==
NULL)
return;
1297 init_struct_sect(local_mesh);
1301 if (local_mesh ==
NULL)
return;
1304 init_struct_mat(local_mesh);
1308 if (local_mesh ==
NULL)
return;
1309 if (local_mesh->
mpc ==
NULL)
return;
1317 init_struct_mpc(local_mesh);
1321 if (local_mesh ==
NULL)
return;
1322 if (local_mesh->
amp ==
NULL)
return;
1324 init_struct_amp(local_mesh);
1328 if (local_mesh ==
NULL)
return;
1338 init_struct_node_grp(local_mesh);
1342 if (local_mesh ==
NULL)
return;
1352 init_struct_elem_grp(local_mesh);
1356 if (local_mesh ==
NULL)
return;
1366 init_struct_surf_grp(local_mesh);
1370 if (local_mesh ==
NULL)
return;
1386 init_struct_contact_pair(local_mesh);
1390 if (local_mesh ==
NULL)
return;
1392 clean_struct_global(local_mesh);
1393 clean_struct_node(local_mesh);
1394 clean_struct_elem(local_mesh);
1395 clean_struct_comm(local_mesh);
1396 clean_struct_adapt(local_mesh);
1397 clean_struct_sect(local_mesh);
1398 clean_struct_mat(local_mesh);
1399 clean_struct_mpc(local_mesh);
1400 clean_struct_amp(local_mesh);
1401 clean_struct_node_grp(local_mesh);
1402 clean_struct_elem_grp(local_mesh);
1403 clean_struct_surf_grp(local_mesh);
1404 clean_struct_contact_pair(local_mesh);
1411 if (result_data ==
NULL) {
1433 if (result_data ==
NULL)
return;
1473 static int quick_sort(
int no,
int n,
double *arr,
int *brr,
int *istack) {
1486 for (j = l + 1; j <= ir; j++) {
1489 for (i = j - 1; i >= l; i--) {
1490 if (arr[i] <= a)
break;
1491 arr[i + 1] = arr[i];
1492 brr[i + 1] = brr[i];
1498 if (!jstack)
return 0;
1500 ir = istack[jstack];
1501 l = istack[jstack - 1];
1507 DSWAP(arr[k], arr[l + 1])
1508 ISWAP(brr[k], brr[l + 1])
1510 if (arr[l] > arr[ir]) {
1511 DSWAP(arr[l], arr[ir])
1512 ISWAP(brr[l], brr[ir])
1515 if (arr[l + 1] > arr[ir]) {
1516 DSWAP(arr[l + 1], arr[ir])
1517 ISWAP(brr[l + 1], brr[ir])
1520 if (arr[l] > arr[l + 1]) {
1521 DSWAP(arr[l], arr[l + 1])
1522 ISWAP(brr[l], brr[l + 1])
1540 DSWAP(arr[i], arr[j])
1541 ISWAP(brr[i], brr[j])
1544 arr[l + 1] = arr[j];
1546 brr[l + 1] = brr[j];
1551 if (jstack > nstack) {
1556 if (ir - i + 1 >= j - l) {
1557 istack[jstack] = ir;
1558 istack[jstack - 1] = i;
1561 istack[jstack] = j - 1;
1562 istack[jstack - 1] = l;
1572 static int rcb_partition(
int n,
const double *coord,
int *wnum,
1586 if (stack ==
NULL) {
1591 if (value ==
NULL) {
1596 for (i = 0; i <
cont_data->n_rcb_div; i++) {
1597 for (j = 0; j < pow(2, i); j++) {
1602 for (k = 0; k < n; k++) {
1603 if (wnum[2 * k + 1] == j) {
1605 value[counter] = coord[3 * k];
1612 for (k = 0; k < n; k++) {
1613 if (wnum[2 * k + 1] == j) {
1615 value[counter] = coord[3 * k + 1];
1622 for (k = 0; k < n; k++) {
1623 if (wnum[2 * k + 1] == j) {
1625 value[counter] = coord[3 * k + 2];
1637 rtc = quick_sort(n, counter, value,
id, stack);
1641 for (k = 0; k < counter *
F_1_2; k++) {
1642 wnum[2 *
id[k] + 1] = j + (int)pow(2, i);
1665 double coord_x, coord_y, coord_z;
1670 for (i = 0; i < global_mesh->
n_elem; i++) {
1674 for (coord_x = 0.0, coord_y = 0.0, coord_z = 0.0, j = js; j < je; j++) {
1677 coord_x += global_mesh->
node[3 * (node - 1)];
1678 coord_y += global_mesh->
node[3 * (node - 1) + 1];
1679 coord_z += global_mesh->
node[3 * (node - 1) + 2];
1682 coord[3 * i] = coord_x / (je - js);
1683 coord[3 * i + 1] = coord_y / (je - js);
1684 coord[3 * i + 2] = coord_z / (je - js);
1692 double *coord =
NULL;
1696 if (coord ==
NULL) {
1701 rtc = calc_gravity(global_mesh, coord);
1704 rtc = rcb_partition(global_mesh->
n_elem, coord, global_mesh->
elem_ID,
1720 static int create_node_graph_link_list(
1726 for (i = 0; i < edge_data->
n_edge; i++) {
1733 if (graph[node1 - 1]->last->next ==
NULL) {
1738 graph[node1 - 1]->
n += 1;
1746 if (graph[node2 - 1]->last->next ==
NULL) {
1751 graph[node2 - 1]->
n += 1;
1763 static int create_node_graph_compress(
1765 idx_t *node_graph_index,
idx_t *node_graph_item) {
1766 long long int counter;
1770 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
1771 node_graph_index[i + 1] = node_graph_index[i] + graph[i]->
n;
1773 for (p = graph[i]->list, j = 0; j < graph[i]->
n; j++) {
1775 node_graph_item[counter++] = p->
id - 1;
1784 idx_t *node_graph_index,
idx_t *node_graph_item) {
1790 (size_t)global_mesh->
n_node);
1791 if (graph ==
NULL) {
1795 for (i = 0; i < global_mesh->
n_node; i++) {
1799 for (i = 0; i < global_mesh->
n_node; i++) {
1801 if (graph[i] ==
NULL) {
1808 for (i = 0; i < global_mesh->
n_node; i++) {
1810 if (graph[i]->list ==
NULL) {
1820 rtc = create_node_graph_link_list(global_mesh, edge_data, graph);
1823 rtc = create_node_graph_compress(global_mesh, graph, node_graph_index,
1827 for (i = 0; i < global_mesh->
n_node; i++) {
1828 free_link_list(graph[i]->list);
1837 for (i = 0; i < global_mesh->
n_node; i++) {
1839 free_link_list(graph[i]->list);
1864 (size_t)global_mesh->
n_node);
1865 if (node_list ==
NULL) {
1869 for (i = 0; i < global_mesh->
n_node; i++) {
1870 node_list[i] =
NULL;
1873 for (i = 0; i < global_mesh->
n_node; i++) {
1875 if (node_list[i] ==
NULL) {
1882 for (i = 0; i < global_mesh->
n_node; i++) {
1883 node_list[i]->
list =
1885 if (node_list[i]->list ==
NULL) {
1889 node_list[i]->
n = 0;
1891 node_list[i]->
last = node_list[i]->
list;
1895 for (i = 0; i < global_mesh->
n_elem; i++) {
1897 j < global_mesh->elem_node_index[i + 1]; j++) {
1902 if (node_list[node - 1]->last->next ==
NULL) {
1907 node_list[node - 1]->
last = node_list[node - 1]->
last->
next;
1908 node_list[node - 1]->
last->
id = i + 1;
1910 node_list[node - 1]->
n += 1;
1920 for (i = 0; i < global_mesh->
n_node; i++) {
1931 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
1932 for (p = node_list[i]->list, j = 0; j < node_list[i]->
n; j++) {
1939 for (i = 0; i < global_mesh->
n_node; i++) {
1940 free_link_list(node_list[i]->list);
1949 for (i = 0; i < global_mesh->
n_node; i++) {
1951 free_link_list(node_list[i]->list);
1966 static long long create_elem_graph_link_list(
1969 char *elem_flag =
NULL;
1977 if (elem_flag ==
NULL) {
1982 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
1983 memset(elem_flag, 0,
sizeof(
char) * global_mesh->
n_elem);
1987 j < global_mesh->elem_node_index[i + 1]; j++) {
1991 k < node_data->node_elem_index[node]; k++) {
1999 if (graph[i]->last->next ==
NULL) {
2024 static int create_elem_graph_compress(
2026 idx_t *elem_graph_index,
idx_t *elem_graph_item) {
2028 long long int counter;
2031 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
2032 elem_graph_index[i + 1] = elem_graph_index[i] + graph[i]->
n;
2034 for (p = graph[i]->list, j = 0; j < graph[i]->
n; j++) {
2036 elem_graph_item[counter++] = p->
id - 1;
2045 idx_t *elem_graph_index) {
2055 if (node_data ==
NULL) {
2063 rtc = set_node_belong_elem(global_mesh, node_data);
2067 (size_t)global_mesh->
n_elem);
2068 if (graph ==
NULL) {
2072 for (i = 0; i < global_mesh->
n_elem; i++) {
2076 for (i = 0; i < global_mesh->
n_elem; i++) {
2078 if (graph[i] ==
NULL) {
2085 for (i = 0; i < global_mesh->
n_elem; i++) {
2087 if (graph[i]->list ==
NULL) {
2097 n_graph = create_elem_graph_link_list(global_mesh, node_data, graph);
2098 if (n_graph < 0)
goto error;
2101 if (elem_graph_item ==
NULL) {
2106 rtc = create_elem_graph_compress(global_mesh, graph, elem_graph_index,
2113 for (i = 0; i < global_mesh->
n_elem; i++) {
2114 free_link_list(graph[i]->list);
2119 return elem_graph_item;
2128 for (i = 0; i < global_mesh->
n_elem; i++) {
2130 free_link_list(graph[i]->list);
2144 static int pmetis_interface(
const int n_vertex,
const int n_domain,
idx_t *xadj,
2147 #ifdef HECMW_PART_WITH_METIS
2154 real_t *tpwgts =
NULL;
2155 real_t *ubvec =
NULL;
2159 METIS_PartGraphRecursive(&n, &ncon, xadj, adjncy, vwgt, vsize,
NULL,
2160 &nparts, tpwgts, ubvec,
options, &edgecut, part);
2164 return (
int)edgecut;
2167 static int kmetis_interface(
const int n_vertex,
const int n_domain,
idx_t *xadj,
2170 #ifdef HECMW_PART_WITH_METIS
2177 real_t *tpwgts =
NULL;
2178 real_t *ubvec =
NULL;
2182 METIS_PartGraphKway(&n, &ncon, xadj, adjncy, vwgt, vsize,
NULL, &nparts,
2183 tpwgts, ubvec,
options, &edgecut, part);
2187 return (
int)edgecut;
2190 static int pmetis_interface_with_weight(
int n_vertex,
int n_con,
int n_domain,
2194 #ifdef HECMW_PART_WITH_METIS
2201 real_t *tpwgts =
NULL;
2202 real_t *ubvec =
NULL;
2206 METIS_PartGraphRecursive(&n, &ncon, xadj, adjncy, vwgt, vsize, adjwgt,
2207 &nparts, tpwgts, ubvec,
options, &edgecut, part);
2211 return (
int)edgecut;
2214 static int kmetis_interface_with_weight(
int n_vertex,
int n_con,
int n_domain,
2218 #ifdef HECMW_PART_WITH_METIS
2225 real_t *tpwgts =
NULL;
2226 real_t *ubvec =
NULL;
2230 METIS_PartGraphKway(&n, &ncon, xadj, adjncy, vwgt, vsize, adjwgt, &nparts,
2231 tpwgts, ubvec,
options, &edgecut, part);
2235 return (
int)edgecut;
2238 static int contact_agg_mark_node_group(
int *mark,
2240 int gid,
int agg_id,
int *agg_dup) {
2242 int istart, iend, i;
2248 for (i = istart; i < iend; i++) {
2251 if (0 <= mark[nid] && mark[nid] < agg_id) {
2253 if (*agg_dup == -1) {
2254 *agg_dup = mark[nid];
2255 }
else if (mark[nid] != *agg_dup) {
2257 "ERROR: node included in multiple node groups in different "
2259 " which is not supported by CONTACT=AGGREGATE\n");
2268 static int HECMW_get_num_surf_node(
int etype,
int sid) {
2283 if (1 <= sid && sid <= 3)
return 4;
2284 if (4 <= sid && sid <= 5)
return 3;
2286 if (1 <= sid && sid <= 3)
return 8;
2287 if (4 <= sid && sid <= 5)
return 6;
2291 "ERROR: parallel contact analysis of elem type %d not supported\n",
2298 static const int *HECMW_get_surf_node(
int etype,
int sid) {
2301 static const int elem_surf_tet1[4][3] = {
2302 {1, 2, 3}, {0, 3, 2}, {0, 1, 3}, {0, 2, 1}};
2303 static const int elem_surf_tet2[4][6] = {{1, 4, 2, 9, 3, 8},
2306 {0, 5, 2, 4, 1, 6}};
2307 static const int elem_surf_hex1[6][4] = {{3, 0, 4, 7}, {1, 2, 6, 5},
2308 {0, 1, 5, 4}, {2, 3, 7, 6},
2309 {3, 2, 1, 0}, {4, 5, 6, 7}};
2310 static const int elem_surf_hex2[6][8] = {
2311 {3, 11, 0, 16, 4, 15, 7, 19}, {1, 9, 2, 18, 6, 13, 5, 17},
2312 {0, 8, 1, 17, 5, 12, 4, 16}, {2, 10, 3, 19, 7, 14, 6, 18},
2313 {3, 10, 2, 9, 1, 8, 0, 11}, {4, 12, 5, 13, 6, 14, 7, 15}};
2314 static const int elem_surf_pri1[5][4] = {
2315 {1, 2, 5, 4}, {2, 0, 3, 5}, {0, 1, 4, 3}, {2, 1, 0, -1}, {3, 4, 5, -1}};
2316 static const int elem_surf_pri2[5][8] = {{1, 6, 2, 14, 5, 9, 4, 13},
2317 {2, 7, 0, 12, 3, 10, 5, 14},
2318 {0, 8, 1, 13, 4, 11, 3, 12},
2319 {2, 6, 1, 8, 0, 7, -1, -1},
2320 {3, 11, 4, 9, 5, 10, -1, -1}};
2321 static const int elem_surf_ptt1[3] = {0, 1, 2};
2322 static const int elem_surf_ptt2[6] = {0, 1, 2, 3, 4, 5};
2323 static const int elem_surf_ptq1[4] = {0, 1, 2, 3};
2324 static const int elem_surf_ptq2[8] = {0, 1, 2, 3, 4, 5, 6, 7};
2327 return elem_surf_tet1[sid - 1];
2329 return elem_surf_tet2[sid - 1];
2331 return elem_surf_hex1[sid - 1];
2333 return elem_surf_hex2[sid - 1];
2335 return elem_surf_pri1[sid - 1];
2337 return elem_surf_pri2[sid - 1];
2339 return elem_surf_ptt1;
2341 return elem_surf_ptt2;
2343 return elem_surf_ptq1;
2345 return elem_surf_ptq2;
2348 "ERROR: parallel contact analysis of element type %d not supported\n",
2353 static int HECMW_fistr_get_num_surf_node(
int etype,
int sid) {
2368 if (1 <= sid && sid <= 2)
return 3;
2369 if (3 <= sid && sid <= 5)
return 4;
2371 if (1 <= sid && sid <= 2)
return 6;
2372 if (3 <= sid && sid <= 5)
return 8;
2376 "ERROR: parallel contact analysis of elem type %d not supported\n",
2383 static const int *HECMW_fistr_get_surf_node(
int etype,
int sid) {
2386 static const int elem_surf_tet1[4][3] = {
2387 {0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {2, 0, 3}};
2388 static const int elem_surf_tet2[4][6] = {{0, 6, 1, 4, 2, 5},
2391 {2, 5, 0, 9, 3, 7}};
2392 static const int elem_surf_hex1[6][4] = {{0, 1, 2, 3}, {4, 5, 6, 7},
2393 {0, 1, 5, 4}, {1, 2, 6, 5},
2394 {2, 3, 7, 6}, {3, 0, 4, 7}};
2395 static const int elem_surf_hex2[6][8] = {
2396 {0, 8, 1, 9, 2, 10, 3, 11}, {4, 12, 5, 13, 6, 14, 7, 15},
2397 {0, 8, 1, 17, 5, 12, 4, 16}, {1, 9, 2, 18, 6, 13, 5, 17},
2398 {2, 10, 3, 19, 7, 14, 6, 18}, {3, 11, 0, 16, 4, 15, 7, 19}};
2399 static const int elem_surf_pri1[5][4] = {
2400 {0, 1, 2, -1}, {3, 4, 5, -1}, {0, 1, 4, 3}, {1, 2, 5, 4}, {2, 0, 3, 5}};
2401 static const int elem_surf_pri2[5][8] = {{0, 8, 1, 6, 2, 7, -1, -1},
2402 {3, 11, 4, 9, 5, 10, -1, -1},
2403 {0, 8, 1, 13, 4, 11, 3, 12},
2404 {1, 6, 2, 14, 5, 9, 4, 13},
2405 {2, 7, 0, 12, 3, 10, 5, 14}};
2406 static const int elem_surf_ptt1[3] = {0, 1, 2};
2407 static const int elem_surf_ptt2[6] = {0, 1, 2, 3, 4, 5};
2408 static const int elem_surf_ptq1[4] = {0, 1, 2, 3};
2409 static const int elem_surf_ptq2[8] = {0, 1, 2, 3, 4, 5, 6, 7};
2412 return elem_surf_tet1[sid - 1];
2414 return elem_surf_tet2[sid - 1];
2416 return elem_surf_hex1[sid - 1];
2418 return elem_surf_hex2[sid - 1];
2420 return elem_surf_pri1[sid - 1];
2422 return elem_surf_pri2[sid - 1];
2424 return elem_surf_ptt1;
2426 return elem_surf_ptt2;
2428 return elem_surf_ptq1;
2430 return elem_surf_ptq2;
2433 "ERROR: parallel contact analysis of element type %d not supported\n",
2444 for (i = 0; i < global_mesh->
n_node; i++) {
2448 for (i = 0; i < cp->
n_pair; i++) {
2452 for (j = jstart; j < jend; j++) {
2453 int eid = sgrp->
grp_item[j * 2] - 1;
2454 int sid = sgrp->
grp_item[j * 2 + 1];
2457 int etype = global_mesh->
elem_type[eid];
2463 int num_snode = HECMW_fistr_get_num_surf_node(etype, sid);
2464 const int *snode = HECMW_fistr_get_surf_node(etype, sid);
2468 for (k = 0; k < num_snode; k++) {
2469 int nid = nop[snode[k]] - 1;
2478 static int contact_agg_mark_surf_group(
int *mark,
2480 int gid,
int agg_id,
int *agg_dup) {
2482 int istart, iend, i, j;
2489 for (i = istart; i < iend; i++) {
2490 int eid = sgrp->
grp_item[i * 2] - 1;
2491 int sid = sgrp->
grp_item[i * 2 + 1];
2493 int etype = global_mesh->
elem_type[eid];
2498 int num_snode = HECMW_fistr_get_num_surf_node(etype, sid);
2499 const int *snode = HECMW_fistr_get_surf_node(etype, sid);
2502 for (j = 0; j < num_snode; j++) {
2503 int nid = nop[snode[j]] - 1;
2505 if (0 <= mark[nid] && mark[nid] < agg_id) {
2507 if (*agg_dup == -1) {
2508 *agg_dup = mark[nid];
2509 }
else if (mark[nid] != *agg_dup) {
2511 "ERROR: node included in multiple surface groups in "
2512 "different contact pairs,\n"
2513 " which is not supported by CONTACT=AGGREGATE\n");
2523 static int metis_partition_nb_contact_agg(
2535 int agg_id, agg_dup, gid;
2537 const idx_t *node_graph_index2;
2538 const idx_t *node_graph_item2;
2539 idx_t *node_weight2;
2547 if (node_graph_index ==
NULL) {
2552 if (node_graph_item ==
NULL) {
2559 rtc = create_node_graph(global_mesh, edge_data, node_graph_index,
2576 for (i = 0; i < global_mesh->
n_node; i++) {
2581 for (i = 0; i < cp->
n_pair; i++) {
2587 contact_agg_mark_node_group(mark, global_mesh, gid, agg_id, &agg_dup);
2592 contact_agg_mark_surf_group(mark, global_mesh, gid, agg_id, &agg_dup);
2597 contact_agg_mark_surf_group(mark, global_mesh, gid, agg_id, &agg_dup);
2602 rtc = contact_agg_mark_surf_group(mark, global_mesh, gid, agg_id, &agg_dup);
2606 for (i = 0; i < global_mesh->
n_node; i++) {
2607 if (mark[i] == agg_id) {
2616 for (i = 0; i < global_mesh->
n_node; i++) {
2625 node_graph_index, node_graph_item);
2636 if (node_weight2 ==
NULL) {
2640 for (i = 0; i < global_mesh->
n_node; i++) {
2641 node_weight2[mark[i]] += 1;
2647 if (belong_domain ==
NULL) {
2654 n_edgecut = pmetis_interface_with_weight(
2656 (
idx_t *)node_graph_item2, node_weight2, belong_domain);
2657 if (n_edgecut < 0)
goto error;
2661 n_edgecut = kmetis_interface_with_weight(
2663 (
idx_t *)node_graph_item2, node_weight2, belong_domain);
2664 if (n_edgecut < 0)
goto error;
2672 for (i = 0; i < global_mesh->
n_node; i++) {
2673 global_mesh->
node_ID[2 * i + 1] = (int)belong_domain[mark[i]];
2695 static int metis_partition_nb_contact_dist(
2716 if (node_graph_index ==
NULL) {
2721 if (node_graph_item ==
NULL) {
2728 rtc = create_node_graph(global_mesh, edge_data, node_graph_index,
2752 rtc = mark_contact_master_nodes(global_mesh, mark);
2757 if (node_weight ==
NULL) {
2762 for (i = 0; i < global_mesh->
n_node; i++) {
2764 node_weight[i * ncon] = 1;
2766 node_weight[i * ncon + 1] = mark[i];
2773 if (belong_domain ==
NULL) {
2780 n_edgecut = pmetis_interface_with_weight(
2782 node_graph_item, node_weight, belong_domain);
2783 if (n_edgecut < 0)
goto error;
2787 n_edgecut = kmetis_interface_with_weight(
2789 node_graph_item, node_weight, belong_domain);
2790 if (n_edgecut < 0)
goto error;
2798 for (i = 0; i < global_mesh->
n_node; i++) {
2799 global_mesh->
node_ID[2 * i + 1] = (int)belong_domain[i];
2819 static int metis_partition_nb_default(
2831 if (node_graph_index ==
NULL) {
2836 if (node_graph_item ==
NULL) {
2843 rtc = create_node_graph(global_mesh, edge_data, node_graph_index,
2850 if (belong_domain ==
NULL) {
2861 node_graph_index, node_graph_item, belong_domain);
2862 if (n_edgecut < 0)
goto error;
2868 node_graph_index, node_graph_item, belong_domain);
2869 if (n_edgecut < 0)
goto error;
2877 for (i = 0; i < global_mesh->
n_node; i++) {
2878 global_mesh->
node_ID[2 * i + 1] = (int)belong_domain[i];
2901 return metis_partition_nb_contact_agg(global_mesh,
cont_data,
2906 return metis_partition_nb_contact_dist(global_mesh,
cont_data,
2913 return metis_partition_nb_default(global_mesh,
cont_data, edge_data);
2919 idx_t *elem_graph_index,
idx_t *elem_graph_item) {
2925 if (belong_domain ==
NULL) {
2934 elem_graph_index, elem_graph_item, belong_domain);
2935 if (n_edgecut < 0)
goto error;
2941 elem_graph_index, elem_graph_item, belong_domain);
2942 if (n_edgecut < 0)
goto error;
2950 for (i = 0; i < global_mesh->
n_elem; i++) {
2951 global_mesh->
elem_ID[2 * i + 1] = (int)belong_domain[i];
2966 #define LINEBUF_SIZE 1023
2968 static int read_part_file(
2969 const char *part_file_name,
2975 int rtc, n_in, n_domain_in;
2979 fpart = fopen(part_file_name,
"r");
2980 if (fpart ==
NULL) {
2990 rtc = sscanf(linebuf,
"%d %d", &n_in, &n_domain_in);
3000 if (n_domain_in != n_domain) {
3005 count_dom = (
int *)
HECMW_calloc(n_domain,
sizeof(
int));
3006 if (count_dom ==
NULL) {
3012 for (i = 0; i < n; i++) {
3017 rtc = sscanf(linebuf,
"%d", &part);
3023 if (part < 0 || n_domain <= part) {
3034 for (i = 0; i < n_domain; i++) {
3035 if (count_dom[i] == 0) {
3049 static int write_part_file(
3050 const char *part_file_name,
3057 fpart = fopen(part_file_name,
"w");
3058 if (fpart ==
NULL) {
3063 fprintf(fpart,
"%d %d\n", n, n_domain);
3065 for (i = 0; i < n; i++) {
3066 fprintf(fpart,
"%d\n", wnum[2*i+1]);
3079 static int user_partition(
3083 const char *part_file_name) {
3086 rtc = read_part_file(part_file_name, n, n_domain, wnum);
3095 static int user_partition_nb(
3102 static int user_partition_eb(
3111 static int print_part(
3113 const char *part_file_name) {
3118 rtc = write_part_file(part_file_name, global_mesh->
n_node,
3125 rtc = write_part_file(part_file_name, global_mesh->
n_elem,
3144 static int count_edgecut(
3150 for (i = 0; i < edge_data->
n_edge; i++) {
3162 static int set_node_belong_domain_nb(
3172 if (edge_data ==
NULL) {
3183 if (rtc != 0)
goto error;
3189 rtc = rcb_partition(global_mesh->
n_node, global_mesh->
node,
3193 n_edgecut = count_edgecut(edge_data, global_mesh->
node_ID);
3199 n_edgecut = metis_partition_nb(global_mesh,
cont_data, edge_data);
3200 if (n_edgecut < 0)
goto error;
3205 rtc = user_partition_nb(global_mesh,
cont_data);
3208 n_edgecut = count_edgecut(edge_data, global_mesh->
node_ID);
3244 for (i = 0; i < global_mesh->
n_node; i++) {
3248 for (i = 0; i < global_mesh->
n_elem; i++) {
3250 j < global_mesh->elem_node_index[i + 1]; j++) {
3252 if (global_mesh->
elem_ID[2 * i + 1] <
3253 global_mesh->
node_ID[2 * (node - 1) + 1]) {
3254 global_mesh->
node_ID[2 * (node - 1) + 1] =
3255 global_mesh->
elem_ID[2 * i + 1];
3268 if (counter ==
NULL) {
3273 for (j = 0; j < global_mesh->
n_node; j++) {
3274 domain = global_mesh->
node_ID[2 * j + 1];
3275 global_mesh->
node_ID[2 * j] = ++counter[domain];
3298 for (i = 0; i < global_mesh->
n_node; i++) {
3299 global_mesh->
node_ID[2 * i] = i + 1;
3300 global_mesh->
node_ID[2 * i + 1] = 0;
3308 rtc = set_node_belong_domain_nb(global_mesh,
cont_data);
3313 rtc = set_node_belong_domain_eb(global_mesh);
3322 rtc = set_local_node_id(global_mesh);
3334 int node, node_domain, min_domain;
3338 for (i = 0; i < global_mesh->
n_elem; i++) {
3341 j < global_mesh->elem_node_index[i + 1]; j++) {
3343 node_domain = global_mesh->
node_ID[2 * (node - 1) + 1];
3344 if (node_domain < min_domain) {
3345 min_domain = node_domain;
3348 global_mesh->
elem_ID[2 * i + 1] = min_domain;
3356 idx_t *elem_graph_index,
idx_t *elem_graph_item) {
3365 for (i = 0; i < global_mesh->
n_elem; i++) {
3366 for (j = elem_graph_index[i]; j < elem_graph_index[i + 1]; j++) {
3368 if (eid < 0)
goto error;
3373 if (elem_data->
n_edge < 0)
goto error;
3388 static int set_elem_belong_domain_eb(
3400 if (elem_graph_index ==
NULL) {
3406 if (elem_data ==
NULL) {
3416 elem_graph_item = create_elem_graph(global_mesh, elem_graph_index);
3417 if (elem_graph_item ==
NULL)
goto error;
3421 rtc = count_edge_for_eb(global_mesh, elem_data, elem_graph_index,
3427 rtc = rcb_partition_eb(global_mesh,
cont_data);
3430 n_edgecut = count_edgecut(elem_data, global_mesh->
elem_ID);
3436 n_edgecut = metis_partition_eb(global_mesh,
cont_data, elem_graph_index,
3438 if (n_edgecut < 0)
goto error;
3443 rtc = user_partition_eb(global_mesh,
cont_data);
3446 n_edgecut = count_edgecut(elem_data, global_mesh->
elem_ID);
3481 if (counter ==
NULL) {
3486 for (j = 0; j < global_mesh->
n_elem; j++) {
3487 domain = global_mesh->
elem_ID[2 * j + 1];
3488 global_mesh->
elem_ID[2 * j] = ++counter[domain];
3511 for (i = 0; i < global_mesh->
n_elem; i++) {
3512 global_mesh->
elem_ID[2 * i] = i + 1;
3513 global_mesh->
elem_ID[2 * i + 1] = 0;
3521 rtc = set_elem_belong_domain_nb(global_mesh);
3527 rtc = set_elem_belong_domain_eb(global_mesh,
cont_data);
3537 rtc = set_local_elem_id(global_mesh);
3557 rtc = wnumbering_node(global_mesh,
cont_data);
3560 rtc = wnumbering_elem(global_mesh,
cont_data);
3567 rtc = wnumbering_elem(global_mesh,
cont_data);
3570 rtc = wnumbering_node(global_mesh,
cont_data);
3597 char *node_flag,
int current_domain) {
3600 for (i = 0; i < n_int_nlist[current_domain]; i++) {
3601 node = int_nlist[current_domain][i];
3609 char *elem_flag,
int current_domain) {
3612 for (i = 0; i < global_mesh->
n_elem; i++) {
3613 (global_mesh->
elem_ID[2 * i + 1] == current_domain)
3621 static int mask_elem_by_domain_mod(
char *elem_flag,
int current_domain) {
3624 for (i = 0; i < n_int_elist[current_domain]; i++) {
3625 elem = int_elist[current_domain][i];
3636 char *node_flag,
int current_domain) {
3639 for (i = 0; i < global_mesh->
mpc->
n_mpc; i++) {
3640 int j0, je, slave, master, j, evalsum;
3650 for (j = j0 + 1; j < je; j++) {
3668 static int mask_overlap_elem(
char *elem_flag,
int domain) {
3671 for (i = 0; i < n_bnd_elist[2 * domain + 1]; i++) {
3672 elem = bnd_elist[domain][i];
3681 char *node_flag,
const char *elem_flag) {
3686 for (i = 0; i < global_mesh->
n_elem; i++) {
3689 j < global_mesh->elem_node_index[i + 1]; j++) {
3701 char *node_flag,
char *elem_flag,
3705 for (i = 0; i < n_bnd_nlist[2 * domain + 1]; i++) {
3706 node = bnd_nlist[domain][i];
3717 static int mask_boundary_elem_with_slave(
3719 char *elem_flag,
int *added) {
3725 for (i = 0; i < global_mesh->
n_elem; i++) {
3732 j < global_mesh->elem_node_index[i + 1]; j++) {
3753 static int mask_boundary_link_elem_with_slave(
3755 char *elem_flag,
int *added) {
3761 for (i = 0; i < global_mesh->
n_elem; i++) {
3768 j < global_mesh->elem_node_index[i + 1]; j++) {
3788 static int mask_additional_overlap_elem(
3795 for (i = 0; i < global_mesh->
n_elem; i++) {
3798 j < global_mesh->elem_node_index[i + 1]; j++) {
3812 static int mask_contact_replicate_slave_to_master_owner(
3817 int elem, node, selem;
3818 int evalsum, evalsum2;
3819 int master_gid, slave_gid;
3831 for (i = 0; i < cp->
n_pair; i++) {
3832 switch (cp->
type[i]) {
3837 jstart = sgrp->
grp_index[master_gid - 1];
3839 for (j = jstart; j < jend; j++) {
3849 jstart = ngrp->
grp_index[slave_gid - 1];
3851 for (j = jstart; j < jend; j++) {
3861 jstart = sgrp->
grp_index[master_gid - 1];
3863 for (j = jstart; j < jend; j++) {
3873 jstart = ngrp->
grp_index[slave_gid - 1];
3875 for (j = jstart; j < jend; j++) {
3888 jstart = sgrp->
grp_index[master_gid - 1];
3890 for (j = jstart; j < jend; j++) {
3901 jstart = sgrp->
grp_index[slave_gid - 1];
3903 for (j = jstart; j < jend; j++) {
3908 k < global_mesh->elem_node_index[selem]; k++) {
3918 jstart = sgrp->
grp_index[master_gid - 1];
3920 for (j = jstart; j < jend; j++) {
3931 jstart = sgrp->
grp_index[slave_gid - 1];
3933 for (j = jstart; j < jend; j++) {
3937 k < global_mesh->elem_node_index[selem]; k++) {
3947 k < global_mesh->elem_node_index[selem]; k++) {
3960 jstart = egrp->
grp_index[master_gid - 1];
3962 for (j = jstart; j < jend; j++) {
3972 jstart = ngrp->
grp_index[slave_gid - 1];
3974 for (j = jstart; j < jend; j++) {
3984 jstart = egrp->
grp_index[master_gid - 1];
3986 for (j = jstart; j < jend; j++) {
3996 jstart = ngrp->
grp_index[slave_gid - 1];
3998 for (j = jstart; j < jend; j++) {
4018 static int classify_contact_slave_ownership(
4020 int pair_idx,
int *has_internal_slave,
int *has_external_slave) {
4021 int j, node, selem, slave_gid, jstart, jend;
4031 *has_internal_slave = 0;
4032 *has_external_slave = 0;
4036 switch (cp->
type[pair_idx]) {
4039 jstart = ngrp->
grp_index[slave_gid - 1];
4041 for (j = jstart; j < jend; j++) {
4044 *has_internal_slave = 1;
4046 *has_external_slave = 1;
4052 jstart = sgrp->
grp_index[slave_gid - 1];
4054 for (j = jstart; j < jend; j++) {
4057 k < global_mesh->elem_node_index[selem]; k++) {
4060 *has_internal_slave = 1;
4062 *has_external_slave = 1;
4075 static void mask_contact_master_elem(
4085 k < global_mesh->elem_node_index[elem]; k++) {
4099 static int mask_contact_replicate_master_to_slave_owner(
4104 int elem, node, master_gid, jstart, jend;
4105 int has_internal_slave, has_external_slave, owns_master_node;
4114 for (i = 0; i < cp->
n_pair; i++) {
4115 rtc = classify_contact_slave_ownership(global_mesh, node_flag, i,
4116 &has_internal_slave,
4117 &has_external_slave);
4120 if (!has_internal_slave && !has_external_slave)
continue;
4125 jstart = egrp->
grp_index[master_gid - 1];
4128 jstart = sgrp->
grp_index[master_gid - 1];
4132 for (j = jstart; j < jend; j++) {
4139 if (has_internal_slave) {
4140 mask_contact_master_elem(global_mesh, elem, elem_flag, node_flag);
4144 owns_master_node = 0;
4146 k < global_mesh->elem_node_index[elem]; k++) {
4149 owns_master_node = 1;
4153 if (owns_master_node) {
4154 mask_contact_master_elem(global_mesh, elem, elem_flag, node_flag);
4162 static int mask_contact_replicate_by_owner(
4167 return mask_contact_replicate_slave_to_master_owner(global_mesh, elem_flag,
4171 return mask_contact_replicate_master_to_slave_owner(global_mesh, elem_flag,
4176 "unknown CONTACT_OWNER in hecmw_flag_partcontact");
4182 char *node_flag,
char *elem_flag,
4183 int current_domain) {
4187 rtc = mask_node_by_domain(global_mesh, node_flag, current_domain);
4190 rtc = mask_elem_by_domain_mod(elem_flag, current_domain);
4193 rtc = mask_overlap_elem(elem_flag, current_domain);
4197 mask_boundary_node_mod(global_mesh, node_flag, elem_flag, current_domain);
4206 rtc = mask_slave_node(global_mesh, node_flag, current_domain);
4209 rtc = mask_boundary_elem_with_slave(global_mesh, node_flag, elem_flag,
4214 rtc = mask_boundary_node(global_mesh, node_flag, elem_flag);
4219 rtc = mask_boundary_link_elem_with_slave(global_mesh, node_flag, elem_flag,
4224 rtc = mask_boundary_node(global_mesh, node_flag, elem_flag);
4228 for (i = 0; i < global_mesh->
n_node; i++) {
4236 rtc = mask_additional_overlap_elem(global_mesh, node_flag, elem_flag);
4239 rtc = mask_boundary_node(global_mesh, node_flag, elem_flag);
4244 rtc = mask_contact_replicate_by_owner(global_mesh, elem_flag, node_flag);
4258 char *node_flag,
const char *elem_flag) {
4263 for (i = 0; i < global_mesh->
n_elem; i++) {
4266 j < global_mesh->elem_node_index[i + 1]; j++) {
4273 j < global_mesh->elem_node_index[i + 1]; j++) {
4287 for (i = 0; i < global_mesh->
n_node; i++) {
4298 char *node_flag,
const char *elem_flag) {
4302 rtc = mask_overlap_node_mark(global_mesh, node_flag, elem_flag);
4305 rtc = mask_overlap_node_inner(global_mesh, node_flag);
4308 for (i = 0; i < global_mesh->
n_node; i++) {
4320 const char *node_flag,
char *elem_flag) {
4325 for (i = 0; i < global_mesh->
n_elem; i++) {
4328 j < global_mesh->elem_node_index[i + 1]; j++) {
4343 char *node_flag,
char *elem_flag,
4344 int current_domain) {
4348 for (i = 0; i < global_mesh->
n_node; i++) {
4353 for (i = 0; i < global_mesh->
n_elem; i++) {
4359 rtc = mask_node_by_domain(global_mesh, node_flag, current_domain);
4362 rtc = mask_elem_by_domain(global_mesh, elem_flag, current_domain);
4365 rtc = mask_overlap_node(global_mesh, node_flag, elem_flag);
4368 rtc = mask_boundary_elem(global_mesh, node_flag, elem_flag);
4380 const char *node_flag,
char *domain_flag) {
4383 for (i = 0; i < global_mesh->
n_node; i++) {
4392 static int mask_neighbor_domain_nb_mod(
4394 char *domain_flag,
int domain) {
4397 for (i = n_bnd_nlist[2 * domain]; i < n_bnd_nlist[2 * domain + 1]; i++) {
4398 node = bnd_nlist[domain][i];
4405 static int mask_neighbor_domain_nb_contact_master_owner(
4407 const char *elem_flag,
char *domain_flag) {
4410 int elem, node, selem;
4412 int master_gid, slave_gid;
4424 for (i = 0; i < cp->
n_pair; i++) {
4427 switch (cp->
type[i]) {
4430 jstart = ngrp->
grp_index[slave_gid - 1];
4432 for (j = jstart; j < jend; j++) {
4442 jstart = sgrp->
grp_index[slave_gid - 1];
4444 for (j = jstart; j < jend; j++) {
4447 k < global_mesh->elem_node_index[selem]; k++) {
4459 jstart = ngrp->
grp_index[slave_gid - 1];
4461 for (j = jstart; j < jend; j++) {
4476 jstart = egrp->
grp_index[master_gid - 1];
4478 for (j = jstart; j < jend; j++) {
4485 jstart = sgrp->
grp_index[master_gid - 1];
4487 for (j = jstart; j < jend; j++) {
4505 static int mask_neighbor_domain_nb_contact_slave_owner(
4507 const char *elem_flag,
char *domain_flag) {
4510 int elem, node, selem, master_gid, slave_gid, jstart, jend;
4511 int has_internal_slave, has_external_slave, owns_master_node;
4522 for (i = 0; i < cp->
n_pair; i++) {
4523 rtc = classify_contact_slave_ownership(global_mesh, node_flag, i,
4524 &has_internal_slave,
4525 &has_external_slave);
4528 if (!has_external_slave)
continue;
4530 owns_master_node = 0;
4533 jstart = egrp->
grp_index[master_gid - 1];
4536 jstart = sgrp->
grp_index[master_gid - 1];
4539 for (j = jstart; j < jend && !owns_master_node; j++) {
4546 k < global_mesh->elem_node_index[elem]; k++) {
4549 owns_master_node = 1;
4554 if (!owns_master_node)
continue;
4557 switch (cp->
type[i]) {
4560 jstart = ngrp->
grp_index[slave_gid - 1];
4562 for (j = jstart; j < jend; j++) {
4572 jstart = sgrp->
grp_index[slave_gid - 1];
4574 for (j = jstart; j < jend; j++) {
4577 k < global_mesh->elem_node_index[selem]; k++) {
4595 static int mask_neighbor_domain_nb_contact_by_owner(
4597 const char *elem_flag,
char *domain_flag) {
4600 return mask_neighbor_domain_nb_contact_master_owner(
4601 global_mesh, node_flag, elem_flag, domain_flag);
4604 return mask_neighbor_domain_nb_contact_slave_owner(
4605 global_mesh, node_flag, elem_flag, domain_flag);
4609 "unknown CONTACT_OWNER in hecmw_flag_partcontact");
4615 const char *elem_flag,
char *domain_flag) {
4618 for (i = 0; i < global_mesh->
n_elem; i++) {
4628 const char *domain_flag) {
4632 for (counter = 0, i = 0; i < global_mesh->
n_subdomain; i++) {
4641 const char *domain_flag) {
4645 for (counter = 0, i = 0; i < global_mesh->
n_subdomain; i++) {
4656 char *node_flag,
char *elem_flag,
4657 int current_domain) {
4659 char *domain_flag =
NULL;
4667 "Starting creation of neighboring domain information...");
4673 if (domain_flag ==
NULL) {
4680 rtc = mask_mesh_status_nb(global_mesh, node_flag, elem_flag,
4684 if (is_spdup_available(global_mesh)) {
4685 rtc = mask_neighbor_domain_nb_mod(global_mesh, node_flag, domain_flag,
4688 rtc = mask_neighbor_domain_nb(global_mesh, node_flag, domain_flag);
4693 rtc = mask_neighbor_domain_nb_contact_by_owner(
4694 global_mesh, node_flag, elem_flag, domain_flag);
4701 rtc = mask_mesh_status_eb(global_mesh, node_flag, elem_flag,
4705 rtc = mask_neighbor_domain_eb(global_mesh, elem_flag, domain_flag);
4715 local_mesh->
n_neighbor_pe = count_neighbor_domain(global_mesh, domain_flag);
4733 rtc = set_neighbor_domain(global_mesh, local_mesh, domain_flag);
4754 char *node_flag_current,
char *node_flag_neighbor) {
4757 for (i = 0; i < global_mesh->
n_node; i++) {
4768 char *node_flag_current,
char *node_flag_neighbor,
4769 int current_domain) {
4772 for (i = 0; i < n_bnd_nlist[2 * current_domain + 1]; i++) {
4773 node = bnd_nlist[current_domain][i];
4783 char *elem_flag_current,
char *elem_flag_neighbor) {
4786 for (i = 0; i < global_mesh->
n_elem; i++) {
4797 char *elem_flag_current,
char *elem_flag_neighbor,
4798 int current_domain) {
4801 for (i = 0; i < n_bnd_elist[2 * current_domain + 1]; i++) {
4802 elem = bnd_elist[current_domain][i];
4812 const char *node_flag,
int domain) {
4816 for (counter = 0, i = 0; i < n_int_nlist[domain]; i++) {
4817 node = int_nlist[domain][i];
4825 const char *elem_flag,
int domain) {
4829 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
4831 global_mesh->
elem_ID[2 * i + 1] == domain)
4838 static int count_masked_shared_node(
4843 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
4850 static int count_masked_shared_elem(
4855 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
4862 static int count_masked_shared_elem_mod(
4868 for (counter = 0, i = 0; i < n_bnd_elist[2 * domain + 1]; i++) {
4869 elem = bnd_elist[domain][i];
4877 const char *node_flag,
int **comm_node,
4878 int neighbor_idx,
int domain) {
4882 for (counter = 0, i = 0; i < n_int_nlist[domain]; i++) {
4883 node = int_nlist[domain][i];
4885 comm_node[neighbor_idx][counter++] = node;
4893 const char *elem_flag,
int **comm_elem,
4894 int neighbor_idx,
int domain) {
4898 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
4900 global_mesh->
elem_ID[2 * i + 1] == domain) {
4901 comm_elem[neighbor_idx][counter++] = i + 1;
4909 const char *node_flag,
int **shared_node,
4914 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
4916 shared_node[neighbor_idx][counter++] = i + 1;
4924 const char *elem_flag,
int **shared_elem,
4929 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
4931 shared_elem[neighbor_idx][counter++] = i + 1;
4938 static int create_shared_elem_pre_mod(
4940 int **shared_elem,
int neighbor_idx,
int neighbor_domain) {
4942 int i, idx1, idx2, elem1, elem2, n_bnd, n_out, maxe;
4944 n_bnd = n_bnd_elist[2 * neighbor_domain];
4946 n_bnd_elist[2 * neighbor_domain + 1] - n_bnd_elist[2 * neighbor_domain];
4947 maxe = global_mesh->
n_elem + 1;
4949 elem1 = (n_bnd == 0) ? maxe : bnd_elist[neighbor_domain][0];
4950 elem2 = (n_out == 0) ? maxe : bnd_elist[neighbor_domain][n_bnd];
4951 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_bnd + n_out; i++) {
4952 if (elem1 < elem2) {
4954 shared_elem[neighbor_idx][counter++] = elem1;
4957 elem1 = (idx1 == n_bnd) ? maxe : bnd_elist[neighbor_domain][idx1];
4960 shared_elem[neighbor_idx][counter++] = elem2;
4963 elem2 = (idx2 == n_out) ? maxe : bnd_elist[neighbor_domain][idx2 + n_bnd];
4970 static int create_comm_item(
int n_neighbor_pe,
int **comm_item_pre,
4971 int *comm_index,
int *comm_item) {
4974 for (i = 0; i < n_neighbor_pe; i++) {
4976 je = comm_index[i + 1];
4978 for (j = 0; j < je - js; j++) {
4979 comm_item[js + j] = comm_item_pre[i][j];
4990 const char *node_flag,
int **import_node,
4991 int neighbor_idx,
int neighbor_domain) {
4992 int n_import_node, rtc;
4995 count_masked_comm_node(global_mesh, node_flag, neighbor_domain);
4999 local_mesh->
import_index[neighbor_idx] + n_import_node;
5001 import_node[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_import_node);
5002 if (import_node[neighbor_idx] ==
NULL) {
5007 rtc = create_comm_node_pre(global_mesh, node_flag, import_node, neighbor_idx,
5019 const char *node_flag,
int **export_node,
5020 int neighbor_idx,
int current_domain,
5021 int neighbor_domain) {
5022 int n_export_node, rtc;
5025 count_masked_comm_node(global_mesh, node_flag, current_domain);
5029 local_mesh->
export_index[neighbor_idx] + n_export_node;
5031 export_node[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_export_node);
5032 if (export_node[neighbor_idx] ==
NULL) {
5037 rtc = create_comm_node_pre(global_mesh, node_flag, export_node, neighbor_idx,
5049 const char *elem_flag,
int **shared_elem,
5050 int neighbor_idx,
int neighbor_domain) {
5051 int n_shared_elem, rtc;
5053 if (is_spdup_available(global_mesh)) {
5055 count_masked_shared_elem_mod(global_mesh, elem_flag, neighbor_domain);
5057 n_shared_elem = count_masked_shared_elem(global_mesh, elem_flag);
5063 local_mesh->
shared_index[neighbor_idx] + n_shared_elem;
5065 shared_elem[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_shared_elem);
5066 if (shared_elem[neighbor_idx] ==
NULL) {
5071 if (is_spdup_available(global_mesh)) {
5072 rtc = create_shared_elem_pre_mod(global_mesh, elem_flag, shared_elem,
5073 neighbor_idx, neighbor_domain);
5075 rtc = create_shared_elem_pre(global_mesh, elem_flag, shared_elem,
5089 char *node_flag,
char *elem_flag,
5090 char *node_flag_neighbor,
5091 char *elem_flag_neighbor,
int current_domain) {
5092 int **import_node =
NULL;
5093 int **export_node =
NULL;
5094 int **shared_elem =
NULL;
5095 int neighbor_domain;
5108 if (import_node ==
NULL) {
5113 import_node[i] =
NULL;
5117 if (export_node ==
NULL) {
5122 export_node[i] =
NULL;
5126 if (shared_elem ==
NULL) {
5131 shared_elem[i] =
NULL;
5157 rtc = mask_mesh_status_nb(global_mesh, node_flag_neighbor,
5158 elem_flag_neighbor, neighbor_domain);
5161 if (is_spdup_available(global_mesh)) {
5162 rtc = mask_comm_node_mod(global_mesh, node_flag, node_flag_neighbor,
5165 rtc = mask_comm_node(global_mesh, node_flag, node_flag_neighbor);
5170 if (is_spdup_available(global_mesh)) {
5171 rtc = mask_comm_elem_mod(global_mesh, elem_flag, elem_flag_neighbor,
5174 rtc = mask_comm_elem(global_mesh, elem_flag, elem_flag_neighbor);
5179 rtc = create_import_info_nb(global_mesh, local_mesh, node_flag, import_node,
5180 i, neighbor_domain);
5183 rtc = create_export_info_nb(global_mesh, local_mesh, node_flag, export_node,
5184 i, current_domain, neighbor_domain);
5187 rtc = create_shared_info_nb(global_mesh, local_mesh, elem_flag, shared_elem,
5188 i, neighbor_domain);
5191 if (is_spdup_available(global_mesh)) {
5192 rtc = spdup_clear_IEB(node_flag_neighbor, elem_flag_neighbor,
5196 rtc = spdup_clear_MMbnd(node_flag_neighbor, elem_flag_neighbor,
5200 rtc = spdup_clear_MMbnd(node_flag, elem_flag, current_domain);
5203 for (j = 0; j < global_mesh->
n_node; j++) {
5206 for (j = 0; j < global_mesh->
n_elem; j++) {
5210 memset(node_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_node);
5211 memset(elem_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_elem);
5222 rtc = create_comm_item(local_mesh->
n_neighbor_pe, import_node,
5239 rtc = create_comm_item(local_mesh->
n_neighbor_pe, export_node,
5256 rtc = create_comm_item(local_mesh->
n_neighbor_pe, shared_elem,
5312 const char *elem_flag,
int **import_elem,
5313 int neighbor_idx,
int neighbor_domain) {
5314 int n_import_elem, rtc;
5317 count_masked_comm_elem(global_mesh, elem_flag, neighbor_domain);
5321 local_mesh->
import_index[neighbor_idx] + n_import_elem;
5323 import_elem[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_import_elem);
5324 if (import_elem[neighbor_idx] ==
NULL) {
5329 rtc = create_comm_elem_pre(global_mesh, elem_flag, import_elem, neighbor_idx,
5341 const char *elem_flag,
int **export_elem,
5342 int neighbor_idx,
int current_domain,
5343 int neighbor_domain) {
5344 int n_export_elem, rtc;
5347 count_masked_comm_elem(global_mesh, elem_flag, current_domain);
5351 local_mesh->
export_index[neighbor_idx] + n_export_elem;
5353 export_elem[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_export_elem);
5354 if (export_elem[neighbor_idx] ==
NULL) {
5359 rtc = create_comm_elem_pre(global_mesh, elem_flag, export_elem, neighbor_idx,
5371 const char *node_flag,
int **shared_node,
5372 int neighbor_idx,
int neighbor_domain) {
5373 int n_shared_node, rtc;
5375 n_shared_node = count_masked_shared_node(global_mesh, node_flag);
5379 local_mesh->
shared_index[neighbor_idx] + n_shared_node;
5381 shared_node[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_shared_node);
5382 if (shared_node[neighbor_idx] ==
NULL) {
5388 create_shared_node_pre(global_mesh, node_flag, shared_node, neighbor_idx);
5401 char *node_flag,
char *elem_flag,
5402 char *node_flag_neighbor,
5403 char *elem_flag_neighbor,
int current_domain) {
5404 int **import_elem =
NULL;
5405 int **export_elem =
NULL;
5406 int **shared_node =
NULL;
5407 int neighbor_domain;
5421 if (import_elem ==
NULL) {
5426 import_elem[i] =
NULL;
5430 if (export_elem ==
NULL) {
5435 export_elem[i] =
NULL;
5439 if (shared_node ==
NULL) {
5444 shared_node[i] =
NULL;
5471 for (j = 0; j < global_mesh->
n_node; j++) {
5475 for (j = 0; j < global_mesh->
n_elem; j++) {
5480 memset(node_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_node);
5481 memset(elem_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_elem);
5484 rtc = mask_mesh_status_eb(global_mesh, node_flag_neighbor,
5485 elem_flag_neighbor, neighbor_domain);
5488 rtc = mask_comm_node(global_mesh, node_flag, node_flag_neighbor);
5491 rtc = mask_comm_elem(global_mesh, elem_flag, elem_flag_neighbor);
5495 rtc = create_import_info_eb(global_mesh, local_mesh, elem_flag, import_elem,
5496 i, neighbor_domain);
5500 rtc = create_export_info_eb(global_mesh, local_mesh, elem_flag, export_elem,
5501 i, current_domain, neighbor_domain);
5505 rtc = create_shared_info_eb(global_mesh, local_mesh, node_flag, shared_node,
5506 i, neighbor_domain);
5518 rtc = create_comm_item(local_mesh->
n_neighbor_pe, import_elem,
5536 rtc = create_comm_item(local_mesh->
n_neighbor_pe, export_elem,
5554 rtc = create_comm_item(local_mesh->
n_neighbor_pe, shared_node,
5609 char *node_flag,
char *elem_flag,
5610 char *node_flag_neighbor,
char *elem_flag_neighbor,
5611 int current_domain) {
5623 rtc = create_comm_info_nb(global_mesh, local_mesh, node_flag, elem_flag,
5624 node_flag_neighbor, elem_flag_neighbor,
5631 rtc = create_comm_info_eb(global_mesh, local_mesh, node_flag, elem_flag,
5632 node_flag_neighbor, elem_flag_neighbor,
5657 static int set_node_global2local_internal(
5660 const char *node_flag,
int domain) {
5670 for (counter = 0, i = 0; i < n_int_nlist[domain]; i++) {
5671 node = int_nlist[domain][i];
5672 node_global2local[node - 1] = ++counter;
5679 static int set_node_global2local_external(
5682 const char *node_flag) {
5693 for (counter = local_mesh->
nn_internal, i = 0; i < global_mesh->n_node; i++) {
5696 node_global2local[i] = ++counter;
5703 for (i = 0; i < global_mesh->
n_node; i++) {
5706 node_global2local[i] = ++counter;
5709 local_mesh->
n_node = counter;
5717 static int set_node_global2local_external_mod(
5720 const char *node_flag,
int domain) {
5730 for (counter = local_mesh->
nn_internal, i = n_bnd_nlist[2 * domain];
5731 i < n_bnd_nlist[2 * domain + 1]; i++) {
5732 node = bnd_nlist[domain][i];
5733 node_global2local[node - 1] = ++counter;
5735 local_mesh->
n_node = counter;
5743 static int set_node_global2local_all(
5746 const char *node_flag) {
5756 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5758 node_global2local[i] = ++counter;
5761 local_mesh->
n_node = counter;
5771 const char *node_flag) {
5780 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5788 static int const_node_internal_list(
5791 const char *node_flag) {
5813 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5828 int *node_global2local,
const char *node_flag,
5829 int current_domain) {
5840 rtc = set_node_global2local_internal(global_mesh, local_mesh,
5841 node_global2local, node_flag,
5845 if (is_spdup_available(global_mesh)) {
5846 rtc = set_node_global2local_external_mod(global_mesh, local_mesh,
5847 node_global2local, node_flag,
5850 rtc = set_node_global2local_external(global_mesh, local_mesh,
5851 node_global2local, node_flag);
5862 rtc = const_nn_internal(global_mesh, local_mesh, node_flag);
5865 rtc = set_node_global2local_all(global_mesh, local_mesh,
5866 node_global2local, node_flag);
5869 rtc = const_node_internal_list(global_mesh, local_mesh, node_global2local,
5889 int *node_global2local,
int domain) {
5897 if (is_spdup_available(global_mesh)) {
5898 for (i = 0; i < n_int_nlist[domain]; i++) {
5899 node = int_nlist[domain][i];
5900 node_global2local[node - 1] = 0;
5902 for (i = n_bnd_nlist[2 * domain]; i < n_bnd_nlist[2 * domain + 1]; i++) {
5903 node = bnd_nlist[domain][i];
5904 node_global2local[node - 1] = 0;
5907 for (i = 0; i < global_mesh->
n_node; i++) {
5908 node_global2local[i] = 0;
5919 const int *node_global2local,
5920 int *node_local2global) {
5930 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5931 if (node_global2local[i]) {
5932 node_local2global[node_global2local[i] - 1] = i + 1;
5941 static int set_node_local2global_mod(
5944 int *node_local2global,
int domain) {
5946 int i, idx1, idx2, node1, node2, n_int, n_bnd, n_out, maxn;
5954 n_int = n_int_nlist[domain];
5955 n_bnd = n_bnd_nlist[2 * domain];
5956 n_out = n_bnd_nlist[2 * domain + 1] - n_bnd_nlist[2 * domain];
5957 maxn = global_mesh->
n_node + 1;
5959 node1 = (n_int == 0) ? maxn : int_nlist[domain][0];
5960 node2 = (n_out == 0) ? maxn : bnd_nlist[domain][n_bnd];
5961 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_int + n_out; i++) {
5962 if (node1 < node2) {
5963 node_local2global[node_global2local[node1 - 1] - 1] = node1;
5965 node1 = (idx1 == n_int) ? maxn : int_nlist[domain][idx1];
5967 node_local2global[node_global2local[node2 - 1] - 1] = node2;
5969 node2 = (idx2 == n_out) ? maxn : bnd_nlist[domain][idx2 + n_bnd];
5981 static int set_elem_global2local_internal(
5984 const char *elem_flag) {
5994 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
5996 elem_global2local[i] = ++counter;
6004 static int set_elem_global2local_external(
6007 const char *elem_flag) {
6017 for (counter = local_mesh->
ne_internal, i = 0; i < global_mesh->n_elem; i++) {
6019 elem_global2local[i] = ++counter;
6022 local_mesh->
n_elem = counter;
6030 static int set_elem_global2local_all(
6033 const char *elem_flag) {
6043 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
6045 elem_global2local[i] = ++counter;
6048 local_mesh->
n_elem = counter;
6056 static int set_elem_global2local_all_mod(
6059 const char *elem_flag,
int domain) {
6061 int i, idx1, idx2, elem1, elem2, n_int, n_bnd, n_out, maxe;
6069 n_int = n_int_elist[domain];
6070 n_bnd = n_bnd_elist[2 * domain];
6071 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
6072 maxe = global_mesh->
n_elem + 1;
6074 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
6075 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
6076 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_int + n_out; i++) {
6077 if (elem1 < elem2) {
6078 elem_global2local[elem1 - 1] = ++counter;
6080 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
6082 elem_global2local[elem2 - 1] = ++counter;
6084 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
6088 local_mesh->
n_elem = counter;
6098 const char *elem_flag) {
6104 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
6112 static int const_elem_internal_list(
6115 const char *elem_flag,
int domain) {
6137 for (counter = 0, i = 0; i < n_int_elist[domain]; i++) {
6138 elem = int_elist[domain][i];
6152 int *elem_global2local,
const char *elem_flag,
6153 int current_domain) {
6164 local_mesh->
ne_internal = n_int_elist[current_domain];
6166 if (is_spdup_available(global_mesh)) {
6167 rtc = set_elem_global2local_all_mod(global_mesh, local_mesh,
6168 elem_global2local, elem_flag,
6171 rtc = set_elem_global2local_all(global_mesh, local_mesh,
6172 elem_global2local, elem_flag);
6177 rtc = const_elem_internal_list(global_mesh, local_mesh, elem_global2local,
6178 elem_flag, current_domain);
6186 rtc = set_elem_global2local_internal(global_mesh, local_mesh,
6187 elem_global2local, elem_flag);
6190 rtc = set_elem_global2local_external(global_mesh, local_mesh,
6191 elem_global2local, elem_flag);
6212 int *elem_global2local,
int domain) {
6220 if (is_spdup_available(global_mesh)) {
6221 for (i = 0; i < n_int_elist[domain]; i++) {
6222 elem = int_elist[domain][i];
6223 elem_global2local[elem - 1] = 0;
6225 for (i = n_bnd_elist[2 * domain]; i < n_bnd_elist[2 * domain + 1]; i++) {
6226 elem = bnd_elist[domain][i];
6227 elem_global2local[elem - 1] = 0;
6231 for (i = 0; i < global_mesh->
n_elem; i++) {
6232 elem_global2local[i] = 0;
6243 const int *elem_global2local,
6244 int *elem_local2global) {
6254 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
6255 if (elem_global2local[i]) {
6256 elem_local2global[elem_global2local[i] - 1] = i + 1;
6265 static int set_elem_local2global_mod(
6268 int *elem_local2global,
int domain) {
6270 int i, idx1, idx2, elem1, elem2, n_int, n_bnd, n_out, maxe;
6278 n_int = n_int_elist[domain];
6279 n_bnd = n_bnd_elist[2 * domain];
6280 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
6281 maxe = global_mesh->
n_elem + 1;
6283 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
6284 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
6285 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_int + n_out; i++) {
6286 if (elem1 < elem2) {
6287 elem_local2global[elem_global2local[elem1 - 1] - 1] = elem1;
6289 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
6291 elem_local2global[elem_global2local[elem2 - 1] - 1] = elem2;
6293 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
6329 snprintf(local_mesh->
header,
sizeof(local_mesh->
header),
"%s",
6342 static int const_hecmw_flag_initcon(
6350 static int const_hecmw_flag_parttype(
6358 static int const_hecmw_flag_partdepth(
6366 static int const_hecmw_flag_version(
6374 static int const_hecmw_flag_partcontact(
6396 rtc = const_gridfile(global_mesh, local_mesh);
6399 rtc = const_hecmw_n_file(global_mesh, local_mesh);
6402 rtc = const_files(global_mesh, local_mesh);
6405 rtc = const_header(global_mesh, local_mesh);
6408 rtc = const_hecmw_flag_adapt(global_mesh, local_mesh);
6411 rtc = const_hecmw_flag_initcon(global_mesh, local_mesh);
6414 rtc = const_hecmw_flag_parttype(global_mesh, local_mesh);
6417 rtc = const_hecmw_flag_partdepth(global_mesh, local_mesh);
6420 rtc = const_hecmw_flag_version(global_mesh, local_mesh);
6423 rtc = const_hecmw_flag_partcontact(global_mesh, local_mesh);
6426 rtc = const_zero_temp(global_mesh, local_mesh);
6462 const char *node_flag) {
6476 for (counter = 0, i = 0; i < global_mesh->
n_dof_grp; i++) {
6478 j < global_mesh->node_dof_index[i + 1]; j++) {
6492 static int const_node_dof_index_mod(
6508 for (counter = 0, i = 0; i < global_mesh->
n_dof_grp; i++) {
6509 for (j = 0; j < n_int_nlist[domain]; j++) {
6510 node = int_nlist[domain][j];
6511 if (node <= global_mesh->node_dof_index[i])
continue;
6535 const int *node_local2global) {
6548 for (i = 0; i < local_mesh->
n_node; i++) {
6549 local_mesh->
node[3 * i] = global_mesh->
node[3 * (node_local2global[i] - 1)];
6550 local_mesh->
node[3 * i + 1] =
6551 global_mesh->
node[3 * (node_local2global[i] - 1) + 1];
6552 local_mesh->
node[3 * i + 2] =
6553 global_mesh->
node[3 * (node_local2global[i] - 1) + 2];
6564 const int *node_local2global) {
6577 for (i = 0; i < local_mesh->
n_node; i++) {
6579 global_mesh->
node_ID[2 * (node_local2global[i] - 1)];
6580 local_mesh->
node_ID[2 * i + 1] =
6581 global_mesh->
node_ID[2 * (node_local2global[i] - 1) + 1];
6592 const int *node_local2global) {
6605 for (i = 0; i < local_mesh->
n_node; i++) {
6616 static int const_node_init_val_index(
6633 for (i = 0; i < local_mesh->
n_node; i++) {
6634 old_idx = node_local2global[i] - 1;
6648 static int const_node_init_val_item(
6653 int i, j, gstart, gend, lstart, lend;
6672 for (counter = 0, i = 0; i < local_mesh->
n_node; i++) {
6680 for (j = 0; j < lend - lstart; j++) {
6696 const int *node_local2global,
const char *node_flag,
6697 int current_domain) {
6705 rtc = const_n_dof(global_mesh, local_mesh);
6708 rtc = const_n_dof_grp(global_mesh, local_mesh);
6713 rtc = const_node_dof_index_mod(global_mesh, local_mesh, node_flag,
6717 rtc = const_node_dof_index(global_mesh, local_mesh, node_flag);
6726 rtc = const_node_dof_item(global_mesh, local_mesh);
6729 rtc = const_node(global_mesh, local_mesh, node_local2global);
6732 rtc = const_node_id(global_mesh, local_mesh, node_local2global);
6735 rtc = const_global_node_id(global_mesh, local_mesh, node_local2global);
6739 rtc = const_node_init_val_index(global_mesh, local_mesh, node_local2global);
6742 rtc = const_node_init_val_item(global_mesh, local_mesh, node_local2global);
6768 const int *elem_local2global) {
6780 for (i = 0; i < local_mesh->
n_elem; i++) {
6792 const int *elem_global2local) {
6807 for (counter = 0, i = 0; i < global_mesh->
n_elem_type; i++) {
6809 j < global_mesh->elem_type_index[i + 1]; j++) {
6810 if (elem_global2local[j]) counter++;
6823 static int const_elem_type_index_mod(
6828 int i, j, idx1, idx2, elem_tmp, elem1, elem2, n_int, n_bnd, n_out, maxe;
6841 n_int = n_int_elist[domain];
6842 n_bnd = n_bnd_elist[2 * domain];
6843 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
6844 maxe = global_mesh->
n_elem + 1;
6846 for (counter = 0, i = 0; i < global_mesh->
n_elem_type; i++) {
6847 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
6848 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
6849 for (idx1 = 0, idx2 = 0, j = 0; j < n_int + n_out; j++) {
6850 if (elem1 < elem2) {
6851 elem_tmp = elem1 - 1;
6853 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
6855 elem_tmp = elem2 - 1;
6857 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
6860 elem_tmp < global_mesh->elem_type_index[i + 1]) {
6887 const int *elem_local2global) {
6901 for (i = 0; i < local_mesh->
n_elem; i++) {
6902 old_idx = elem_local2global[i] - 1;
6918 const int *node_global2local,
6919 const int *elem_local2global) {
6924 long long gstart, gend, lstart, lend;
6938 for (counter = 0, i = 0; i < local_mesh->
n_elem; i++) {
6944 for (j = 0; j < lend - lstart; j++) {
6946 local_mesh->
elem_node_item[lstart + j] = node_global2local[node - 1];
6960 const int *elem_local2global) {
6973 for (i = 0; i < local_mesh->
n_elem; i++) {
6975 global_mesh->
elem_ID[2 * (elem_local2global[i] - 1)];
6976 local_mesh->
elem_ID[2 * i + 1] =
6977 global_mesh->
elem_ID[2 * (elem_local2global[i] - 1) + 1];
6988 const int *elem_local2global) {
7001 for (i = 0; i < local_mesh->
n_elem; i++) {
7014 const int *elem_local2global) {
7027 for (i = 0; i < local_mesh->
n_elem; i++) {
7029 global_mesh->
section_ID[elem_local2global[i] - 1];
7040 const int *elem_local2global) {
7054 for (i = 0; i < local_mesh->
n_elem; i++) {
7055 old_idx = elem_local2global[i] - 1;
7080 const int *elem_local2global) {
7083 int i, j, gstart, gend, lstart, lend;
7100 for (counter = 0, i = 0; i < local_mesh->
n_elem; i++) {
7108 for (j = 0; j < lend - lstart; j++) {
7125 const int *node_global2local,
7126 const int *elem_global2local,
7127 const int *elem_local2global,
int current_domain) {
7136 rtc = const_n_elem_type(global_mesh, local_mesh);
7139 rtc = const_elem_type(global_mesh, local_mesh, elem_local2global);
7142 if (is_spdup_available(global_mesh)) {
7143 rtc = const_elem_type_index_mod(global_mesh, local_mesh, elem_global2local,
7146 rtc = const_elem_type_index(global_mesh, local_mesh, elem_global2local);
7151 rtc = const_elem_type_item(global_mesh, local_mesh);
7154 rtc = const_elem_node_index(global_mesh, local_mesh, elem_local2global);
7157 rtc = const_elem_node_item(global_mesh, local_mesh, node_global2local,
7161 rtc = const_elem_id(global_mesh, local_mesh, elem_local2global);
7164 rtc = const_global_elem_id(global_mesh, local_mesh, elem_local2global);
7167 rtc = const_section_id(global_mesh, local_mesh, elem_local2global);
7170 rtc = const_elem_mat_id_index(global_mesh, local_mesh, elem_local2global);
7173 rtc = const_n_elem_mat_id(local_mesh);
7176 rtc = const_elem_mat_id_item(global_mesh, local_mesh, elem_local2global);
7196 int current_domain) {
7197 local_mesh->
zero = (current_domain == 0) ? 1 : 0;
7217 int current_domain) {
7218 local_mesh->
my_rank = current_domain;
7238 const int *global2local) {
7253 new_id = global2local[local_mesh->
import_item[i] - 1];
7261 const int *global2local) {
7276 new_id = global2local[local_mesh->
export_item[i] - 1];
7284 const int *global2local) {
7299 new_id = global2local[local_mesh->
shared_item[i] - 1];
7308 const int *node_global2local,
7309 const int *elem_global2local,
int current_domain) {
7317 rtc = const_hecmw_comm(global_mesh, local_mesh);
7320 rtc = const_zero(local_mesh, current_domain);
7323 rtc = const_petot(global_mesh, local_mesh);
7326 rtc = const_pesmptot(global_mesh, local_mesh);
7329 rtc = const_my_rank(local_mesh, current_domain);
7332 rtc = const_errnof(global_mesh, local_mesh);
7335 rtc = const_n_subdomain(global_mesh, local_mesh);
7340 rtc = const_import_item(local_mesh, node_global2local);
7343 rtc = const_export_item(local_mesh, node_global2local);
7346 rtc = const_shared_item(local_mesh, elem_global2local);
7352 rtc = const_import_item(local_mesh, elem_global2local);
7355 rtc = const_export_item(local_mesh, elem_global2local);
7358 rtc = const_shared_item(local_mesh, node_global2local);
7392 static int const_when_i_was_refined_node(
7400 static int const_when_i_was_refined_elem(
7436 static int const_adapt_children_index(
7444 static int const_adapt_children_item(
7459 rtc = const_n_adapt(global_mesh, local_mesh);
7462 rtc = const_coarse_grid_level(global_mesh, local_mesh);
7465 rtc = const_when_i_was_refined_node(global_mesh, local_mesh);
7468 rtc = const_when_i_was_refined_elem(global_mesh, local_mesh);
7471 rtc = const_adapt_parent_type(global_mesh, local_mesh);
7474 rtc = const_adapt_type(global_mesh, local_mesh);
7477 rtc = const_adapt_level(global_mesh, local_mesh);
7480 rtc = const_adapt_parent(global_mesh, local_mesh);
7483 rtc = const_adapt_children_index(global_mesh, local_mesh);
7486 rtc = const_adapt_children_item(global_mesh, local_mesh);
7572 rtc = const_n_sect(global_mesh, local_mesh);
7575 rtc = const_sect_type(global_mesh, local_mesh);
7578 rtc = const_sect_opt(global_mesh, local_mesh);
7581 rtc = const_sect_mat_id_index(global_mesh, local_mesh);
7584 rtc = const_sect_mat_id_item(global_mesh, local_mesh);
7587 rtc = const_sect_i_index(global_mesh, local_mesh);
7590 rtc = const_sect_i_item(global_mesh, local_mesh);
7593 rtc = const_sect_r_index(global_mesh, local_mesh);
7596 rtc = const_sect_r_item(global_mesh, local_mesh);
7689 rtc = const_n_mat(global_mesh, local_mesh);
7692 rtc = const_n_mat_item(global_mesh, local_mesh);
7695 rtc = const_n_mat_subitem(global_mesh, local_mesh);
7698 rtc = const_n_mat_table(global_mesh, local_mesh);
7701 rtc = const_mat_name(global_mesh, local_mesh);
7704 rtc = const_mat_item_index(global_mesh, local_mesh);
7707 rtc = const_mat_subitem_index(global_mesh, local_mesh);
7710 rtc = const_mat_table_index(global_mesh, local_mesh);
7713 rtc = const_mat_val(global_mesh, local_mesh);
7716 rtc = const_mat_temp(global_mesh, local_mesh);
7730 const int *node_global2local,
char *mpc_flag) {
7733 int node, diff, evalsum, counter;
7736 for (counter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7743 if (node_global2local[node - 1] > 0) evalsum++;
7746 if (evalsum == diff) {
7751 mpc_local->
n_mpc = counter;
7758 const char *mpc_flag) {
7770 for (counter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7788 const int *node_global2local,
const char *mpc_flag) {
7791 int mcounter, icounter;
7801 for (mcounter = 0, icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7806 node_global2local[mpc_global->
mpc_item[j] - 1];
7822 const char *mpc_flag) {
7825 int mcounter, icounter;
7835 for (mcounter = 0, icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7855 const char *mpc_flag) {
7859 int mcounter, icounter;
7869 for (mcounter = 0, icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7889 const char *mpc_flag) {
7896 size =
sizeof(double) * mpc_local->
n_mpc;
7903 for (icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7919 const int *node_global2local) {
7920 char *mpc_flag =
NULL;
7929 if (global_mesh->
mpc->
n_mpc == 0) {
7930 init_struct_mpc(local_mesh);
7935 if (mpc_flag ==
NULL) {
7940 rtc = const_n_mpc(global_mesh, local_mesh, node_global2local, mpc_flag);
7944 init_struct_mpc(local_mesh);
7949 rtc = const_mpc_index(global_mesh, local_mesh, mpc_flag);
7952 rtc = const_mpc_item(global_mesh, local_mesh, node_global2local, mpc_flag);
7955 rtc = const_mpc_dof(global_mesh, local_mesh, mpc_flag);
7958 rtc = const_mpc_val(global_mesh, local_mesh, mpc_flag);
7961 rtc = const_mpc_const(global_mesh, local_mesh, mpc_flag);
7991 static int const_amp_type_definition(
8043 if (global_mesh->
amp->
n_amp == 0) {
8044 init_struct_amp(local_mesh);
8048 rtc = const_n_amp(global_mesh, local_mesh);
8051 rtc = const_amp_name(global_mesh, local_mesh);
8054 rtc = const_amp_type_definition(global_mesh, local_mesh);
8057 rtc = const_amp_type_time(global_mesh, local_mesh);
8060 rtc = const_amp_type_value(global_mesh, local_mesh);
8063 rtc = const_amp_index(global_mesh, local_mesh);
8066 rtc = const_amp_val(global_mesh, local_mesh);
8069 rtc = const_amp_table(global_mesh, local_mesh);
8081 static int *const_node_grp_mask_eqn(
8084 int eqn_block_idx) {
8086 int *n_eqn_item =
NULL;
8088 int i, j, is, ie, js;
8090 is = node_group_global->
grp_index[eqn_block_idx];
8091 ie = node_group_global->
grp_index[eqn_block_idx + 1];
8093 n_eqn_item = (
int *)
HECMW_malloc(
sizeof(
int) * (ie - is));
8094 if (n_eqn_item ==
NULL) {
8099 for (js = 0, i = 0; i < ie - is; i++) {
8100 diff = node_group_global->
grp_item[is + i] - js;
8101 for (evalsum = 0, j = js; j < node_group_global->
grp_item[is + i]; j++) {
8102 if (node_global2local[j] > 0 &&
8109 n_eqn_item[i] = diff;
8114 js = node_group_global->
grp_item[is + i];
8139 const int *node_global2local,
8140 const int *n_eqn_item,
int eqn_block_idx) {
8154 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8155 if (i != eqn_block_idx) {
8156 for (j = node_group_global->
grp_index[i];
8157 j < node_group_global->
grp_index[i + 1]; j++) {
8158 node = node_group_global->
grp_item[j];
8159 if (node_global2local[node - 1]) counter++;
8165 for (j = 0; j < diff; j++) {
8166 if (n_eqn_item[j] > 0) counter++;
8170 node_group_local->
grp_index[i + 1] = counter;
8179 static int const_node_grp_index_mod(
8182 const int *n_eqn_item,
int eqn_block_idx,
int domain) {
8196 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8197 if (i != eqn_block_idx) {
8198 if (node_group_global->
grp_index[i + 1] -
8201 counter += n_int_nlist[domain];
8202 counter += n_bnd_nlist[2 * domain + 1] - n_bnd_nlist[2 * domain];
8204 counter += ngrp_idx[domain][i + 1] - ngrp_idx[domain][i];
8217 for (j = 0; j < diff; j++) {
8218 if (n_eqn_item[j] > 0) counter++;
8222 node_group_local->
grp_index[i + 1] = counter;
8233 const int *node_global2local,
8234 const int *n_eqn_item,
int eqn_block_idx) {
8240 int i, j, k, js, je, ks, ls;
8242 size =
sizeof(int) * node_group_local->
grp_index[node_group_local->
n_grp];
8249 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8250 if (i != eqn_block_idx) {
8251 for (j = node_group_global->
grp_index[i];
8252 j < node_group_global->
grp_index[i + 1]; j++) {
8253 node = node_group_global->
grp_item[j];
8254 if (node_global2local[node - 1]) {
8255 node_group_local->
grp_item[counter++] = node_global2local[node - 1];
8261 je = node_group_global->
grp_index[i + 1];
8262 for (ks = 0, ls = 0, j = js; j < je; j++) {
8263 if (n_eqn_item[j - js]) {
8265 node_group_global->
grp_item[j] - ks);
8266 node_group_local->
grp_item[counter] = ls + n_eqn_item[j - js];
8268 for (k = ks; k < node_group_global->
grp_item[j]; k++) {
8270 node_global2local[k] <=
8271 node_group_local->
grp_item[counter]);
8273 ls = node_group_local->
grp_item[counter];
8276 ks = node_group_global->
grp_item[j];
8290 const int *node_global2local,
8291 const int *n_eqn_item,
int eqn_block_idx,
8298 int i, j, k, js, je, ks, ls;
8299 int idx1, idx2, node1, node2, n_int, n_bnd, n_out, maxn;
8301 size =
sizeof(int) * node_group_local->
grp_index[node_group_local->
n_grp];
8308 n_int = n_int_nlist[domain];
8309 n_bnd = n_bnd_nlist[2 * domain];
8310 n_out = n_bnd_nlist[2 * domain + 1] - n_bnd_nlist[2 * domain];
8311 maxn = global_mesh->
n_node + 1;
8313 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8314 if (i != eqn_block_idx) {
8315 if (node_group_global->
grp_index[i + 1] -
8320 node1 = (n_int == 0) ? maxn : int_nlist[domain][0];
8321 node2 = (n_out == 0) ? maxn : bnd_nlist[domain][n_bnd];
8322 for (j = 0; j < n_int + n_out; j++) {
8323 if (node1 < node2) {
8324 node_group_local->
grp_item[counter++] =
8325 node_global2local[node1 - 1];
8327 node1 = (idx1 == n_int) ? maxn : int_nlist[domain][idx1];
8329 node_group_local->
grp_item[counter++] =
8330 node_global2local[node2 - 1];
8332 node2 = (idx2 == n_out) ? maxn : bnd_nlist[domain][idx2 + n_bnd];
8336 if (ngrp_idx[domain][i + 1] - ngrp_idx[domain][i] == 0)
continue;
8337 for (j = ngrp_idx[domain][i]; j < ngrp_idx[domain][i + 1]; j++) {
8338 node = ngrp_item[domain][j];
8339 node_group_local->
grp_item[counter++] = node_global2local[node - 1];
8344 je = node_group_global->
grp_index[i + 1];
8345 for (ks = 0, ls = 0, j = js; j < je; j++) {
8346 if (n_eqn_item[j - js]) {
8348 node_group_global->
grp_item[j] - ks);
8349 node_group_local->
grp_item[counter] = ls + n_eqn_item[j - js];
8351 for (k = ks; k < node_group_global->
grp_item[j]; k++) {
8353 node_global2local[k] <=
8354 node_group_local->
grp_item[counter]);
8356 ls = node_group_local->
grp_item[counter];
8359 ks = node_group_global->
grp_item[j];
8373 const int *node_global2local,
8374 int current_domain) {
8375 int *n_eqn_item =
NULL;
8386 init_struct_node_grp(local_mesh);
8390 eqn_block_idx = search_eqn_block_idx(global_mesh);
8392 if (eqn_block_idx >= 0) {
8393 n_eqn_item = const_node_grp_mask_eqn(global_mesh, local_mesh,
8394 node_global2local, eqn_block_idx);
8395 if (n_eqn_item ==
NULL)
goto error;
8398 rtc = const_node_n_grp(global_mesh, local_mesh);
8401 rtc = const_node_grp_name(global_mesh, local_mesh);
8404 if (is_spdup_available(global_mesh)) {
8405 rtc = const_node_grp_index_mod(global_mesh, local_mesh, node_global2local,
8406 n_eqn_item, eqn_block_idx, current_domain);
8408 rtc = const_node_grp_item_mod(global_mesh, local_mesh, node_global2local,
8409 n_eqn_item, eqn_block_idx, current_domain);
8413 rtc = const_node_grp_index(global_mesh, local_mesh, node_global2local,
8414 n_eqn_item, eqn_block_idx);
8416 rtc = const_node_grp_item(global_mesh, local_mesh, node_global2local,
8417 n_eqn_item, eqn_block_idx);
8450 const int *elem_global2local) {
8464 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8465 for (j = elem_group_global->
grp_index[i];
8466 j < elem_group_global->
grp_index[i + 1]; j++) {
8467 elem = elem_group_global->
grp_item[j];
8468 if (elem_global2local[elem - 1]) counter++;
8470 elem_group_local->
grp_index[i + 1] = counter;
8479 static int const_elem_grp_index_mod(
8487 int i, j, idx1, idx2, elem1, elem2;
8496 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8499 counter += n_int_elist[domain];
8500 counter += n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
8502 counter += egrp_idx[domain][i + 1] - egrp_idx[domain][i];
8504 elem_group_local->
grp_index[i + 1] = counter;
8515 const int *elem_global2local) {
8523 size =
sizeof(int) * elem_group_local->
grp_index[elem_group_local->
n_grp];
8530 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8531 for (j = elem_group_global->
grp_index[i];
8532 j < elem_group_global->
grp_index[i + 1]; j++) {
8533 elem = elem_group_global->
grp_item[j];
8534 if (elem_global2local[elem - 1]) {
8535 elem_group_local->
grp_item[counter++] = elem_global2local[elem - 1];
8549 const int *elem_global2local,
int domain) {
8555 int i, j, idx1, idx2, elem1, elem2, n_int, n_bnd, n_out, maxe;
8557 size =
sizeof(int) * elem_group_local->
grp_index[elem_group_local->
n_grp];
8564 n_int = n_int_elist[domain];
8565 n_bnd = n_bnd_elist[2 * domain];
8566 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
8567 maxe = global_mesh->
n_elem + 1;
8569 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8572 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
8573 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
8574 for (idx1 = 0, idx2 = 0, j = 0; j < n_int + n_out; j++) {
8575 if (elem1 < elem2) {
8576 elem_group_local->
grp_item[counter++] = elem_global2local[elem1 - 1];
8578 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
8580 elem_group_local->
grp_item[counter++] = elem_global2local[elem2 - 1];
8582 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
8586 if (egrp_idx[domain][i + 1] - egrp_idx[domain][i] == 0)
continue;
8587 for (j = egrp_idx[domain][i]; j < egrp_idx[domain][i + 1]; j++) {
8588 elem = egrp_item[domain][j];
8589 elem_group_local->
grp_item[counter++] = elem_global2local[elem - 1];
8603 const int *elem_global2local,
8604 int current_domain) {
8614 init_struct_elem_grp(local_mesh);
8618 rtc = const_elem_n_grp(global_mesh, local_mesh);
8621 rtc = const_elem_grp_name(global_mesh, local_mesh);
8624 if (is_spdup_available(global_mesh)) {
8625 rtc = const_elem_grp_index_mod(global_mesh, local_mesh, elem_global2local,
8628 rtc = const_elem_grp_item_mod(global_mesh, local_mesh, elem_global2local,
8633 rtc = const_elem_grp_index(global_mesh, local_mesh, elem_global2local);
8635 rtc = const_elem_grp_item(global_mesh, local_mesh, elem_global2local);
8664 const int *elem_global2local) {
8678 for (counter = 0, i = 0; i < surf_group_global->
n_grp; i++) {
8679 for (j = surf_group_global->
grp_index[i];
8680 j < surf_group_global->
grp_index[i + 1]; j++) {
8681 elem = surf_group_global->
grp_item[2 * j];
8682 if (elem_global2local[elem - 1]) counter++;
8684 surf_group_local->
grp_index[i + 1] = counter;
8695 const int *elem_global2local) {
8703 size =
sizeof(int) * (
size_t)surf_group_local->
grp_index[surf_group_local->
n_grp] * 2;
8710 for (counter = 0, i = 0; i < surf_group_global->
n_grp; i++) {
8711 for (j = surf_group_global->
grp_index[i];
8712 j < surf_group_global->
grp_index[i + 1]; j++) {
8713 elem = surf_group_global->
grp_item[2 * j];
8714 surf = surf_group_global->
grp_item[2 * j + 1];
8715 if (elem_global2local[elem - 1]) {
8716 surf_group_local->
grp_item[2 * counter] = elem_global2local[elem - 1];
8717 surf_group_local->
grp_item[2 * counter + 1] = surf;
8732 const int *elem_global2local) {
8742 init_struct_surf_grp(local_mesh);
8746 rtc = const_surf_n_grp(global_mesh, local_mesh);
8749 rtc = const_surf_grp_name(global_mesh, local_mesh);
8752 rtc = const_surf_grp_index(global_mesh, local_mesh, elem_global2local);
8755 rtc = const_surf_grp_item(global_mesh, local_mesh, elem_global2local);
8767 static int const_contact_pair_n_pair(
8794 for (i = 0; i < cpair_global->
n_pair; i++) {
8795 cpair_local->
type[i] = cpair_global->
type[i];
8804 static int const_contact_pair_slave_grp_id(
8818 for (i = 0; i < cpair_global->
n_pair; i++) {
8828 static int const_contact_pair_slave_orisgrp_id(
8842 for (i = 0; i < cpair_global->
n_pair; i++) {
8852 static int const_contact_pair_master_grp_id(
8866 for (i = 0; i < cpair_global->
n_pair; i++) {
8886 init_struct_contact_pair(local_mesh);
8890 rtc = const_contact_pair_n_pair(global_mesh, local_mesh);
8893 rtc = const_contact_pair_name(global_mesh, local_mesh);
8896 rtc = const_contact_pair_type(global_mesh, local_mesh);
8899 rtc = const_contact_pair_slave_grp_id(global_mesh, local_mesh);
8902 rtc = const_contact_pair_slave_orisgrp_id(global_mesh, local_mesh);
8905 rtc = const_contact_pair_master_grp_id(global_mesh, local_mesh);
8920 const char *node_flag,
const char *elem_flag,
8921 int *node_global2local,
int *elem_global2local,
8922 int current_domain) {
8923 int *node_local2global =
NULL;
8924 int *elem_local2global =
NULL;
8929 rtc = set_node_global2local(global_mesh, local_mesh, node_global2local,
8930 node_flag, current_domain);
8934 if (node_local2global ==
NULL) {
8939 if (is_spdup_available(global_mesh)) {
8940 rtc = set_node_local2global_mod(global_mesh, local_mesh, node_global2local,
8941 node_local2global, current_domain);
8943 rtc = set_node_local2global(global_mesh, local_mesh, node_global2local,
8949 rtc = set_elem_global2local(global_mesh, local_mesh, elem_global2local,
8950 elem_flag, current_domain);
8955 if (elem_local2global ==
NULL) {
8960 if (is_spdup_available(global_mesh)) {
8961 rtc = set_elem_local2global_mod(global_mesh, local_mesh, elem_global2local,
8962 elem_local2global, current_domain);
8964 rtc = set_elem_local2global(global_mesh, local_mesh, elem_global2local,
8970 rtc = const_global_info(global_mesh, local_mesh);
8973 rtc = const_node_info(global_mesh, local_mesh, node_local2global, node_flag,
8977 rtc = const_elem_info(global_mesh, local_mesh, node_global2local,
8978 elem_global2local, elem_local2global, current_domain);
8981 rtc = const_comm_info(global_mesh, local_mesh, node_global2local,
8982 elem_global2local, current_domain);
8985 rtc = const_adapt_info(global_mesh, local_mesh);
8988 rtc = const_sect_info(global_mesh, local_mesh);
8991 rtc = const_mat_info(global_mesh, local_mesh);
8994 rtc = const_mpc_info(global_mesh, local_mesh, node_global2local);
8997 rtc = const_amp_info(global_mesh, local_mesh);
9000 rtc = const_node_grp_info(global_mesh, local_mesh, node_global2local,
9004 rtc = const_elem_grp_info(global_mesh, local_mesh, elem_global2local,
9008 rtc = const_surf_grp_info(global_mesh, local_mesh, elem_global2local);
9011 rtc = const_contact_pair_info(global_mesh, local_mesh);
9014 rtc = clear_node_global2local(global_mesh, local_mesh, node_global2local,
9016 rtc = clear_elem_global2local(global_mesh, local_mesh, elem_global2local,
9029 clean_struct_local_mesh(local_mesh);
9040 static int print_ucd_entire_set_node_data(
9056 result_data->
nn_dof[0] = 1;
9076 snprintf(result_data->
node_label[0], label_len,
"rank_of_node");
9078 for (nn_item = 0, i = 0; i < result_data->
nn_component; i++) {
9079 nn_item += result_data->
nn_dof[i];
9082 size =
sizeof(double) * nn_item * global_mesh->
n_node;
9091 for (i = 0; i < global_mesh->
n_node; i++) {
9097 for (i = 0; i < global_mesh->
n_node; i++) {
9103 (double)global_mesh->
node_ID[2 * i + 1];
9117 free_struct_result_data(result_data);
9125 static int print_ucd_entire_set_elem_data(
9141 result_data->
ne_dof[0] = 1;
9161 snprintf(result_data->
elem_label[0], label_len,
"partitioning_image");
9164 for (i = 0; i < global_mesh->
n_elem; i++) {
9185 for (ne_item = 0, i = 0; i < result_data->
ne_component; i++) {
9186 ne_item += result_data->
ne_dof[i];
9189 size =
sizeof(double) * ne_item * global_mesh->
n_elem;
9198 for (i = 0; i < global_mesh->
n_elem; i++) {
9204 (double)global_mesh->
elem_ID[2 * i + 1];
9210 for (i = 0; i < global_mesh->
n_elem; i++) {
9224 free_struct_result_data(result_data);
9232 const char *node_flag,
const char *elem_flag,
9233 const char *ofname) {
9238 if (result_data ==
NULL) {
9242 init_struct_result_data(result_data);
9245 if (print_ucd_entire_set_node_data(global_mesh, result_data, node_flag)) {
9249 if (print_ucd_entire_set_elem_data(global_mesh, result_data, elem_flag)) {
9257 free_struct_result_data(result_data);
9262 free_struct_result_data(result_data);
9348 char *node_flag =
NULL;
9349 char *elem_flag =
NULL;
9350 char *node_flag_neighbor =
NULL;
9351 char *elem_flag_neighbor =
NULL;
9352 int *node_global2local =
NULL;
9353 int *elem_global2local =
NULL;
9355 int *num_elem, *num_node, *num_ielem, *num_inode, *num_nbpe;
9356 int *sum_elem, *sum_node, *sum_ielem, *sum_inode, *sum_nbpe;
9357 int current_domain, nrank, iS, iE;
9360 int error_in_ompsection = 0;
9362 if (global_mesh ==
NULL) {
9371 rtc = init_partition(global_mesh,
cont_data);
9377 if (global_mesh->
my_rank == 0) {
9396 if (global_mesh->
my_rank == 0) {
9401 "part_out", global_mesh->
n_subdomain, current_domain);
9402 if (ofheader ==
NULL) {
9404 error_in_ompsection = 1;
9407 if (ofheader->
n_mesh == 0) {
9409 error_in_ompsection = 1;
9414 ofname,
sizeof(ofname));
9418 "Starting writing local mesh for domain #%d...",
9432 if (rtc != 0)
goto error;
9434 if (rtc != 0)
goto error;
9436 if (rtc != 0)
goto error;
9438 if (rtc != 0)
goto error;
9441 if (rtc)
goto error;
9449 if (num_elem ==
NULL) {
9454 if (num_node ==
NULL) {
9459 if (num_ielem ==
NULL) {
9464 if (num_inode ==
NULL) {
9469 if (num_nbpe ==
NULL) {
9474 if (sum_elem ==
NULL) {
9479 if (sum_node ==
NULL) {
9484 if (sum_ielem ==
NULL) {
9489 if (sum_inode ==
NULL) {
9494 if (sum_nbpe ==
NULL) {
9499 rtc = wnumbering(global_mesh,
cont_data);
9503 if (global_mesh->
my_rank == 0) {
9504 print_part(global_mesh,
cont_data->part_file_name);
9508 rtc = spdup_makelist_main(global_mesh);
9512 #pragma omp parallel default(none), \
9513 private(node_flag, elem_flag, local_mesh, nrank, iS, iE, i, \
9514 current_domain, rtc, ofheader, ofname), \
9515 private(node_global2local, elem_global2local, \
9516 node_flag_neighbor, elem_flag_neighbor), \
9517 shared(global_mesh, cont_data, num_elem, num_node, \
9518 num_ielem, num_inode, num_nbpe, error_in_ompsection)
9523 if (node_flag ==
NULL) {
9525 error_in_ompsection = 1;
9529 if (elem_flag ==
NULL) {
9531 error_in_ompsection = 1;
9536 if (node_global2local ==
NULL) {
9538 error_in_ompsection = 1;
9542 if (elem_global2local ==
NULL) {
9544 error_in_ompsection = 1;
9547 node_flag_neighbor =
9549 if (node_flag_neighbor ==
NULL) {
9551 error_in_ompsection = 1;
9554 elem_flag_neighbor =
9556 if (elem_flag_neighbor ==
NULL) {
9558 error_in_ompsection = 1;
9561 memset(node_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_node);
9562 memset(elem_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_elem);
9565 if (local_mesh ==
NULL) {
9566 error_in_ompsection = 1;
9577 #pragma omp for schedule(dynamic, 1), reduction(+ : error_in_ompsection)
9579 for (i = iS; i < iE; i++) {
9580 if (error_in_ompsection)
continue;
9587 rtc = create_neighbor_info(global_mesh, local_mesh, node_flag, elem_flag,
9590 error_in_ompsection = 1;
9595 rtc = create_comm_info(global_mesh, local_mesh, node_flag, elem_flag,
9596 node_flag_neighbor, elem_flag_neighbor,
9599 error_in_ompsection = 1;
9604 rtc = const_local_data(global_mesh, local_mesh,
cont_data, node_flag,
9605 elem_flag, node_global2local, elem_global2local,
9608 error_in_ompsection = 1;
9612 num_elem[i] = local_mesh->
n_elem;
9613 num_node[i] = local_mesh->
n_node;
9619 "part_out", global_mesh->
n_subdomain, current_domain);
9620 if (ofheader ==
NULL) {
9622 error_in_ompsection = 1;
9625 if (ofheader->
n_mesh == 0) {
9627 error_in_ompsection = 1;
9632 ofname,
sizeof(ofname));
9636 "Starting writing local mesh for domain #%d...",
9643 error_in_ompsection = 1;
9649 clean_struct_local_mesh(local_mesh);
9654 if (is_spdup_available(global_mesh)) {
9655 spdup_clear_IEB(node_flag, elem_flag, current_domain);
9658 for (j = 0; j < global_mesh->
n_node; j++) {
9661 for (j = 0; j < global_mesh->
n_elem; j++) {
9667 if (error_in_ompsection)
goto error_omp;
9672 if (global_mesh->
my_rank == 0) {
9673 print_ucd_entire(global_mesh, node_flag, elem_flag,
9689 if (error_in_ompsection)
goto error;
9694 if (rtc != 0)
goto error;
9697 if (rtc != 0)
goto error;
9700 if (rtc != 0)
goto error;
9703 if (rtc != 0)
goto error;
9706 if (rtc != 0)
goto error;
9708 if (global_mesh->
my_rank == 0) {
9711 if (rtc != 0)
goto error;
9713 if (rtc != 0)
goto error;
9715 if (rtc != 0)
goto error;
9717 if (rtc != 0)
goto error;
9719 if (rtc != 0)
goto error;
9722 if (rtc)
goto error;
9737 spdup_freelist(global_mesh);
9770 if (global_mesh ==
NULL) {
9779 if (local_mesh ==
NULL)
goto error;
HECMW_Comm HECMW_comm_get_comm(void)
int HECMW_Allreduce(void *sendbuf, void *recvbuf, int count, HECMW_Datatype datatype, HECMW_Op op, HECMW_Comm comm)
int HECMW_comm_get_rank(void)
int HECMW_comm_get_size(void)
#define HECMW_ETYPE_SPGDPT1
#define HECMW_ETYPE_ROD31
#define HECMW_FILENAME_LEN
void HECMW_ctrl_free_meshfiles(struct hecmw_ctrl_meshfiles *meshfiles)
struct hecmw_ctrl_meshfiles * HECMW_ctrl_get_meshfiles_header_sub(char *name_ID, int n_rank, int i_rank)
int HECMW_partcontact_get_mode(int flag_partcontact)
int HECMW_partcontact_get_owner(int flag_partcontact)
struct hecmwST_local_mesh * HECMW_dist_alloc()
void HECMW_dist_free(struct hecmwST_local_mesh *mesh)
struct hecmwST_local_mesh * mesh
int HECMW_set_error(int errorno, const char *fmt,...)
int HECMW_is_etype_link(int etype)
int HECMW_graph_degeneGraph(struct hecmw_graph *graph, const struct hecmw_graph *refgraph, int num_part, const int *parttab)
const idx_t * HECMW_graph_getEdgeItem(const struct hecmw_graph *graph)
const idx_t * HECMW_graph_getEdgeIndex(const struct hecmw_graph *graph)
int HECMW_graph_init_with_arrays(struct hecmw_graph *graph, int num_vertex, idx_t *edge_index, idx_t *edge_item)
void HECMW_graph_finalize(struct hecmw_graph *graph)
int HECMW_graph_init(struct hecmw_graph *graph)
int HECMW_put_dist_mesh(const struct hecmwST_local_mesh *mesh, char *fname)
int HECMW_log(int loglv, const char *fmt,...)
#define HECMW_calloc(nmemb, size)
#define HECMW_malloc(size)
int HECMW_mesh_edge_info(struct hecmwST_local_mesh *local_mesh, struct hecmw_part_edge_data *edge_data)
long long int HECMW_mesh_hsort_edge(int node1, int node2)
long long int HECMW_mesh_hsort_edge_get_n(void)
void HECMW_mesh_hsort_edge_final(void)
int HECMW_mesh_hsort_edge_init(int n_node, int n_elem)
int * HECMW_mesh_hsort_edge_get_v(void)
#define HECMW_PART_METHOD_PMETIS
#define HECMW_PART_RCB_Z_AXIS
#define HECMW_PART_E_STACK_OVERFLOW
#define HECMW_PART_E_INVALID_RCB_DIR
#define HECMW_PART_RCB_Y_AXIS
#define HECMW_PART_CONTACT_OWNER_MASTER
#define HECMW_PART_E_PART_N
#define HECMW_PART_E_INVALID_PMETHOD
#define HECMW_PART_E_INVALID_PTYPE
#define HECMW_PART_RCB_X_AXIS
#define HECMW_PART_E_PART_NDOMAIN
#define HECMW_PART_E_NO_SUCH_FILE
#define HECMW_PART_E_PART_EOF
#define HECMW_PART_METHOD_RCB
#define HECMW_PART_CONTACT_DEFAULT
#define HECMW_PART_E_INV_ARG
#define HECMW_PART_E_PART_EMPTY_DOMAIN
#define HECMW_PART_EQUATION_BLOCK_NAME
#define HECMW_PART_TYPE_NODE_BASED
#define HECMW_PART_METHOD_KMETIS
#define HECMW_PART_CONTACT_DISTRIBUTE
#define HECMW_PART_CONTACT_SIMPLE
#define HECMW_PART_CONTACT_AGGREGATE
#define HECMW_PART_E_NNEIGHBORPE_LOWER
#define HECMW_PART_E_PART_INVALID_FORMAT
#define HECMW_PART_METHOD_USER
#define HECMW_PART_E_PART_INVALID_PART
#define HECMW_PART_CONTACT_OWNER_SLAVE
#define HECMW_PART_TYPE_ELEMENT_BASED
void HECMW_part_free_control(struct hecmw_part_cont_data *cont_data)
struct hecmw_part_cont_data * HECMW_part_get_control(void)
int HECMW_part_set_log_n_neighbor_pe(int domain, int _n_neighbor_pe)
int HECMW_part_set_log_part_contact(int _part_contact)
int HECMW_part_set_log_part_type(int _part_type)
void HECMW_part_finalize_log(void)
int HECMW_part_set_log_n_node_g(int _n_node_g)
int HECMW_part_set_log_part_depth(int _depth)
int HECMW_part_set_log_n_node(int domain, int _n_node)
int HECMW_part_set_log_n_elem(int domain, int _n_elem)
int HECMW_part_init_log(int _n_domain)
int HECMW_part_print_log(void)
int HECMW_part_set_log_n_edgecut(long long int _n_edge, int _n_edgecut)
int HECMW_part_set_log_nn_internal(int domain, int _nn_internal)
int HECMW_part_set_log_n_elem_g(int _n_elem_g)
int HECMW_part_set_log_part_method(int _part_method)
int HECMW_part_set_log_ne_internal(int domain, int _ne_internal)
struct hecmwST_local_mesh * HECMW_partition(struct hecmwST_local_mesh *global_mesh)
#define CLEAR_BIT(map, bit)
#define EVAL_BIT(map, bit)
#define MASK_BIT(map, bit)
struct hecmwST_local_mesh * HECMW_partition_inner(struct hecmwST_local_mesh *global_mesh, struct hecmw_part_cont_data *cont_data)
#define HECMW_FLAG_PARTCONTACT_SIMPLE
#define HECMW_CONTACT_TYPE_NODE_SURF
#define HECMW_FLAG_PARTCONTACT_AGGREGATE
#define HECMW_CONTACT_TYPE_NODE_ELEM
#define HECMW_FLAG_PARTCONTACT_OWNER_SLAVE
#define HECMW_FLAG_PARTCONTACT_DISTRIBUTE
#define HECMW_FLAG_PARTCONTACT_OWNER_MASTER
#define HECMW_CONTACT_TYPE_SURF_SURF
#define HECMW_FLAG_PARTTYPE_NODEBASED
#define HECMW_FLAG_PARTTYPE_ELEMBASED
int HECMW_ucd_legacy_print(const struct hecmwST_local_mesh *mesh, const struct hecmwST_result_data *result, const char *ofname)
void HECMW_abort(HECMW_Comm comm)
#define HECMW_assert(cond)
struct option_rec options[]
specify command line option name and executing function name.
struct hecmw_ctrl_meshfile * meshfiles
int * amp_type_definition
struct hecmwST_section * section
int * adapt_children_item
double * elem_mat_int_val
int * adapt_children_index
struct hecmwST_amplitude * amp
struct hecmwST_material * material
struct hecmwST_node_grp * node_group
double * node_init_val_item
struct hecmwST_contact_pair * contact_pair
struct hecmwST_surf_grp * surf_group
long long * elem_node_index
char gridfile[HECMW_FILENAME_LEN+1]
char header[HECMW_HEADER_LEN+1]
int hecmw_flag_partcontact
struct hecmwST_elem_grp * elem_group
int * node_init_val_index
int * when_i_was_refined_node
int * when_i_was_refined_elem