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, 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];
2895 static int metis_partition_nb_ndweight(
2899 #ifdef HECMW_ARCH_FX64
2913 if (node_graph_index ==
NULL) {
2918 if (node_graph_item ==
NULL) {
2925 rtc = create_node_graph(global_mesh, edge_data, node_graph_index,
2933 if (node_weight ==
NULL) {
2938 for (i = 0; i < global_mesh->
n_node; i++) {
2941 for (i = 0; i < edge_data->
n_edge * 2; i++) {
2942 node_weight[node_graph_item[i]] += 1;
2946 if (belong_domain ==
NULL) {
2953 n_edgecut = pmetis_interface_with_weight(
2955 node_graph_item, node_weight, belong_domain);
2956 if (n_edgecut < 0)
goto error;
2960 n_edgecut = kmetis_interface_with_weight(
2962 node_graph_item, node_weight, belong_domain);
2963 if (n_edgecut < 0)
goto error;
2971 for (i = 0; i < global_mesh->
n_node; i++) {
2972 global_mesh->
node_ID[2 * i + 1] = (int)belong_domain[i];
3001 return metis_partition_nb_contact_agg(global_mesh,
cont_data,
3006 return metis_partition_nb_contact_dist(global_mesh,
cont_data,
3013 #ifdef HECMW_ARCH_FX64
3014 return metis_partition_nb_ndweight(global_mesh,
cont_data, edge_data);
3016 return metis_partition_nb_default(global_mesh,
cont_data, edge_data);
3023 idx_t *elem_graph_index,
idx_t *elem_graph_item) {
3029 if (belong_domain ==
NULL) {
3038 elem_graph_index, elem_graph_item, belong_domain);
3039 if (n_edgecut < 0)
goto error;
3045 elem_graph_index, elem_graph_item, belong_domain);
3046 if (n_edgecut < 0)
goto error;
3054 for (i = 0; i < global_mesh->
n_elem; i++) {
3055 global_mesh->
elem_ID[2 * i + 1] = (int)belong_domain[i];
3070 #define LINEBUF_SIZE 1023
3072 static int read_part_file(
3073 const char *part_file_name,
3079 int rtc, n_in, n_domain_in;
3083 fpart = fopen(part_file_name,
"r");
3084 if (fpart ==
NULL) {
3094 rtc = sscanf(linebuf,
"%d %d", &n_in, &n_domain_in);
3104 if (n_domain_in != n_domain) {
3109 count_dom = (
int *)
HECMW_calloc(n_domain,
sizeof(
int));
3110 if (count_dom ==
NULL) {
3116 for (i = 0; i < n; i++) {
3121 rtc = sscanf(linebuf,
"%d", &part);
3127 if (part < 0 || n_domain <= part) {
3138 for (i = 0; i < n_domain; i++) {
3139 if (count_dom[i] == 0) {
3153 static int write_part_file(
3154 const char *part_file_name,
3161 fpart = fopen(part_file_name,
"w");
3162 if (fpart ==
NULL) {
3167 fprintf(fpart,
"%d %d\n", n, n_domain);
3169 for (i = 0; i < n; i++) {
3170 fprintf(fpart,
"%d\n", wnum[2*i+1]);
3183 static int user_partition(
3187 const char *part_file_name) {
3190 rtc = read_part_file(part_file_name, n, n_domain, wnum);
3199 static int user_partition_nb(
3206 static int user_partition_eb(
3215 static int print_part(
3217 const char *part_file_name) {
3222 rtc = write_part_file(part_file_name, global_mesh->
n_node,
3229 rtc = write_part_file(part_file_name, global_mesh->
n_elem,
3248 static int count_edgecut(
3254 for (i = 0; i < edge_data->
n_edge; i++) {
3266 static int set_node_belong_domain_nb(
3275 if (edge_data ==
NULL) {
3285 #ifdef HECMW_ARCH_FX64
3290 if (rtc != 0)
goto error;
3296 rtc = rcb_partition(global_mesh->
n_node, global_mesh->
node,
3300 n_edgecut = count_edgecut(edge_data, global_mesh->
node_ID);
3306 n_edgecut = metis_partition_nb(global_mesh,
cont_data, edge_data);
3307 if (n_edgecut < 0)
goto error;
3312 rtc = user_partition_nb(global_mesh,
cont_data);
3315 n_edgecut = count_edgecut(edge_data, global_mesh->
node_ID);
3351 for (i = 0; i < global_mesh->
n_node; i++) {
3355 for (i = 0; i < global_mesh->
n_elem; i++) {
3357 j < global_mesh->elem_node_index[i + 1]; j++) {
3359 if (global_mesh->
elem_ID[2 * i + 1] <
3360 global_mesh->
node_ID[2 * (node - 1) + 1]) {
3361 global_mesh->
node_ID[2 * (node - 1) + 1] =
3362 global_mesh->
elem_ID[2 * i + 1];
3375 if (counter ==
NULL) {
3380 for (j = 0; j < global_mesh->
n_node; j++) {
3381 domain = global_mesh->
node_ID[2 * j + 1];
3382 global_mesh->
node_ID[2 * j] = ++counter[domain];
3405 for (i = 0; i < global_mesh->
n_node; i++) {
3406 global_mesh->
node_ID[2 * i] = i + 1;
3407 global_mesh->
node_ID[2 * i + 1] = 0;
3415 rtc = set_node_belong_domain_nb(global_mesh,
cont_data);
3420 rtc = set_node_belong_domain_eb(global_mesh);
3429 rtc = set_local_node_id(global_mesh);
3441 int node, node_domain, min_domain;
3445 for (i = 0; i < global_mesh->
n_elem; i++) {
3448 j < global_mesh->elem_node_index[i + 1]; j++) {
3450 node_domain = global_mesh->
node_ID[2 * (node - 1) + 1];
3451 if (node_domain < min_domain) {
3452 min_domain = node_domain;
3455 global_mesh->
elem_ID[2 * i + 1] = min_domain;
3463 idx_t *elem_graph_index,
idx_t *elem_graph_item) {
3472 for (i = 0; i < global_mesh->
n_elem; i++) {
3473 for (j = elem_graph_index[i]; j < elem_graph_index[i + 1]; j++) {
3475 if (eid < 0)
goto error;
3480 if (elem_data->
n_edge < 0)
goto error;
3495 static int set_elem_belong_domain_eb(
3506 if (elem_graph_index ==
NULL) {
3512 if (elem_data ==
NULL) {
3522 elem_graph_item = create_elem_graph(global_mesh, elem_graph_index);
3523 if (elem_graph_item ==
NULL)
goto error;
3527 rtc = count_edge_for_eb(global_mesh, elem_data, elem_graph_index,
3533 rtc = rcb_partition_eb(global_mesh,
cont_data);
3536 n_edgecut = count_edgecut(elem_data, global_mesh->
elem_ID);
3542 n_edgecut = metis_partition_eb(global_mesh,
cont_data, elem_graph_index,
3544 if (n_edgecut < 0)
goto error;
3549 rtc = user_partition_eb(global_mesh,
cont_data);
3552 n_edgecut = count_edgecut(elem_data, global_mesh->
elem_ID);
3587 if (counter ==
NULL) {
3592 for (j = 0; j < global_mesh->
n_elem; j++) {
3593 domain = global_mesh->
elem_ID[2 * j + 1];
3594 global_mesh->
elem_ID[2 * j] = ++counter[domain];
3617 for (i = 0; i < global_mesh->
n_elem; i++) {
3618 global_mesh->
elem_ID[2 * i] = i + 1;
3619 global_mesh->
elem_ID[2 * i + 1] = 0;
3627 rtc = set_elem_belong_domain_nb(global_mesh);
3633 rtc = set_elem_belong_domain_eb(global_mesh,
cont_data);
3643 rtc = set_local_elem_id(global_mesh);
3663 rtc = wnumbering_node(global_mesh,
cont_data);
3666 rtc = wnumbering_elem(global_mesh,
cont_data);
3673 rtc = wnumbering_elem(global_mesh,
cont_data);
3676 rtc = wnumbering_node(global_mesh,
cont_data);
3703 char *node_flag,
int current_domain) {
3706 for (i = 0; i < n_int_nlist[current_domain]; i++) {
3707 node = int_nlist[current_domain][i];
3715 char *elem_flag,
int current_domain) {
3718 for (i = 0; i < global_mesh->
n_elem; i++) {
3719 (global_mesh->
elem_ID[2 * i + 1] == current_domain)
3727 static int mask_elem_by_domain_mod(
char *elem_flag,
int current_domain) {
3730 for (i = 0; i < n_int_elist[current_domain]; i++) {
3731 elem = int_elist[current_domain][i];
3742 char *node_flag,
int current_domain) {
3745 for (i = 0; i < global_mesh->
mpc->
n_mpc; i++) {
3746 int j0, je, slave, master, j, evalsum;
3756 for (j = j0 + 1; j < je; j++) {
3774 static int mask_overlap_elem(
char *elem_flag,
int domain) {
3777 for (i = 0; i < n_bnd_elist[2 * domain + 1]; i++) {
3778 elem = bnd_elist[domain][i];
3787 char *node_flag,
const char *elem_flag) {
3792 for (i = 0; i < global_mesh->
n_elem; i++) {
3795 j < global_mesh->elem_node_index[i + 1]; j++) {
3807 char *node_flag,
char *elem_flag,
3811 for (i = 0; i < n_bnd_nlist[2 * domain + 1]; i++) {
3812 node = bnd_nlist[domain][i];
3823 static int mask_boundary_elem_with_slave(
3825 char *elem_flag,
int *added) {
3831 for (i = 0; i < global_mesh->
n_elem; i++) {
3838 j < global_mesh->elem_node_index[i + 1]; j++) {
3859 static int mask_boundary_link_elem_with_slave(
3861 char *elem_flag,
int *added) {
3867 for (i = 0; i < global_mesh->
n_elem; i++) {
3874 j < global_mesh->elem_node_index[i + 1]; j++) {
3894 static int mask_additional_overlap_elem(
3901 for (i = 0; i < global_mesh->
n_elem; i++) {
3904 j < global_mesh->elem_node_index[i + 1]; j++) {
3918 static int mask_contact_replicate_slave_to_master_owner(
3923 int elem, node, selem;
3924 int evalsum, evalsum2;
3925 int master_gid, slave_gid;
3937 for (i = 0; i < cp->
n_pair; i++) {
3938 switch (cp->
type[i]) {
3943 jstart = sgrp->
grp_index[master_gid - 1];
3945 for (j = jstart; j < jend; j++) {
3955 jstart = ngrp->
grp_index[slave_gid - 1];
3957 for (j = jstart; j < jend; j++) {
3967 jstart = sgrp->
grp_index[master_gid - 1];
3969 for (j = jstart; j < jend; j++) {
3979 jstart = ngrp->
grp_index[slave_gid - 1];
3981 for (j = jstart; j < jend; j++) {
3994 jstart = sgrp->
grp_index[master_gid - 1];
3996 for (j = jstart; j < jend; j++) {
4007 jstart = sgrp->
grp_index[slave_gid - 1];
4009 for (j = jstart; j < jend; j++) {
4014 k < global_mesh->elem_node_index[selem]; k++) {
4024 jstart = sgrp->
grp_index[master_gid - 1];
4026 for (j = jstart; j < jend; j++) {
4037 jstart = sgrp->
grp_index[slave_gid - 1];
4039 for (j = jstart; j < jend; j++) {
4043 k < global_mesh->elem_node_index[selem]; k++) {
4053 k < global_mesh->elem_node_index[selem]; k++) {
4066 jstart = egrp->
grp_index[master_gid - 1];
4068 for (j = jstart; j < jend; j++) {
4078 jstart = ngrp->
grp_index[slave_gid - 1];
4080 for (j = jstart; j < jend; j++) {
4090 jstart = egrp->
grp_index[master_gid - 1];
4092 for (j = jstart; j < jend; j++) {
4102 jstart = ngrp->
grp_index[slave_gid - 1];
4104 for (j = jstart; j < jend; j++) {
4124 static int classify_contact_slave_ownership(
4126 int pair_idx,
int *has_internal_slave,
int *has_external_slave) {
4127 int j, node, selem, slave_gid, jstart, jend;
4137 *has_internal_slave = 0;
4138 *has_external_slave = 0;
4142 switch (cp->
type[pair_idx]) {
4145 jstart = ngrp->
grp_index[slave_gid - 1];
4147 for (j = jstart; j < jend; j++) {
4150 *has_internal_slave = 1;
4152 *has_external_slave = 1;
4158 jstart = sgrp->
grp_index[slave_gid - 1];
4160 for (j = jstart; j < jend; j++) {
4163 k < global_mesh->elem_node_index[selem]; k++) {
4166 *has_internal_slave = 1;
4168 *has_external_slave = 1;
4181 static void mask_contact_master_elem(
4191 k < global_mesh->elem_node_index[elem]; k++) {
4205 static int mask_contact_replicate_master_to_slave_owner(
4210 int elem, node, master_gid, jstart, jend;
4211 int has_internal_slave, has_external_slave, owns_master_node;
4220 for (i = 0; i < cp->
n_pair; i++) {
4221 rtc = classify_contact_slave_ownership(global_mesh, node_flag, i,
4222 &has_internal_slave,
4223 &has_external_slave);
4226 if (!has_internal_slave && !has_external_slave)
continue;
4231 jstart = egrp->
grp_index[master_gid - 1];
4234 jstart = sgrp->
grp_index[master_gid - 1];
4238 for (j = jstart; j < jend; j++) {
4245 if (has_internal_slave) {
4246 mask_contact_master_elem(global_mesh, elem, elem_flag, node_flag);
4250 owns_master_node = 0;
4252 k < global_mesh->elem_node_index[elem]; k++) {
4255 owns_master_node = 1;
4259 if (owns_master_node) {
4260 mask_contact_master_elem(global_mesh, elem, elem_flag, node_flag);
4268 static int mask_contact_replicate_by_owner(
4273 return mask_contact_replicate_slave_to_master_owner(global_mesh, elem_flag,
4277 return mask_contact_replicate_master_to_slave_owner(global_mesh, elem_flag,
4282 "unknown CONTACT_OWNER in hecmw_flag_partcontact");
4288 char *node_flag,
char *elem_flag,
4289 int current_domain) {
4293 rtc = mask_node_by_domain(global_mesh, node_flag, current_domain);
4296 rtc = mask_elem_by_domain_mod(elem_flag, current_domain);
4299 rtc = mask_overlap_elem(elem_flag, current_domain);
4303 mask_boundary_node_mod(global_mesh, node_flag, elem_flag, current_domain);
4312 rtc = mask_slave_node(global_mesh, node_flag, current_domain);
4315 rtc = mask_boundary_elem_with_slave(global_mesh, node_flag, elem_flag,
4320 rtc = mask_boundary_node(global_mesh, node_flag, elem_flag);
4325 rtc = mask_boundary_link_elem_with_slave(global_mesh, node_flag, elem_flag,
4330 rtc = mask_boundary_node(global_mesh, node_flag, elem_flag);
4334 for (i = 0; i < global_mesh->
n_node; i++) {
4342 rtc = mask_additional_overlap_elem(global_mesh, node_flag, elem_flag);
4345 rtc = mask_boundary_node(global_mesh, node_flag, elem_flag);
4350 rtc = mask_contact_replicate_by_owner(global_mesh, elem_flag, node_flag);
4364 char *node_flag,
const char *elem_flag) {
4369 for (i = 0; i < global_mesh->
n_elem; i++) {
4372 j < global_mesh->elem_node_index[i + 1]; j++) {
4379 j < global_mesh->elem_node_index[i + 1]; j++) {
4393 for (i = 0; i < global_mesh->
n_node; i++) {
4404 char *node_flag,
const char *elem_flag) {
4408 rtc = mask_overlap_node_mark(global_mesh, node_flag, elem_flag);
4411 rtc = mask_overlap_node_inner(global_mesh, node_flag);
4414 for (i = 0; i < global_mesh->
n_node; i++) {
4426 const char *node_flag,
char *elem_flag) {
4431 for (i = 0; i < global_mesh->
n_elem; i++) {
4434 j < global_mesh->elem_node_index[i + 1]; j++) {
4449 char *node_flag,
char *elem_flag,
4450 int current_domain) {
4454 for (i = 0; i < global_mesh->
n_node; i++) {
4459 for (i = 0; i < global_mesh->
n_elem; i++) {
4465 rtc = mask_node_by_domain(global_mesh, node_flag, current_domain);
4468 rtc = mask_elem_by_domain(global_mesh, elem_flag, current_domain);
4471 rtc = mask_overlap_node(global_mesh, node_flag, elem_flag);
4474 rtc = mask_boundary_elem(global_mesh, node_flag, elem_flag);
4486 const char *node_flag,
char *domain_flag) {
4489 for (i = 0; i < global_mesh->
n_node; i++) {
4498 static int mask_neighbor_domain_nb_mod(
4500 char *domain_flag,
int domain) {
4503 for (i = n_bnd_nlist[2 * domain]; i < n_bnd_nlist[2 * domain + 1]; i++) {
4504 node = bnd_nlist[domain][i];
4511 static int mask_neighbor_domain_nb_contact_master_owner(
4513 const char *elem_flag,
char *domain_flag) {
4516 int elem, node, selem;
4518 int master_gid, slave_gid;
4530 for (i = 0; i < cp->
n_pair; i++) {
4533 switch (cp->
type[i]) {
4536 jstart = ngrp->
grp_index[slave_gid - 1];
4538 for (j = jstart; j < jend; j++) {
4548 jstart = sgrp->
grp_index[slave_gid - 1];
4550 for (j = jstart; j < jend; j++) {
4553 k < global_mesh->elem_node_index[selem]; k++) {
4565 jstart = ngrp->
grp_index[slave_gid - 1];
4567 for (j = jstart; j < jend; j++) {
4582 jstart = egrp->
grp_index[master_gid - 1];
4584 for (j = jstart; j < jend; j++) {
4591 jstart = sgrp->
grp_index[master_gid - 1];
4593 for (j = jstart; j < jend; j++) {
4611 static int mask_neighbor_domain_nb_contact_slave_owner(
4613 const char *elem_flag,
char *domain_flag) {
4616 int elem, node, selem, master_gid, slave_gid, jstart, jend;
4617 int has_internal_slave, has_external_slave, owns_master_node;
4628 for (i = 0; i < cp->
n_pair; i++) {
4629 rtc = classify_contact_slave_ownership(global_mesh, node_flag, i,
4630 &has_internal_slave,
4631 &has_external_slave);
4634 if (!has_external_slave)
continue;
4636 owns_master_node = 0;
4639 jstart = egrp->
grp_index[master_gid - 1];
4642 jstart = sgrp->
grp_index[master_gid - 1];
4645 for (j = jstart; j < jend && !owns_master_node; j++) {
4652 k < global_mesh->elem_node_index[elem]; k++) {
4655 owns_master_node = 1;
4660 if (!owns_master_node)
continue;
4663 switch (cp->
type[i]) {
4666 jstart = ngrp->
grp_index[slave_gid - 1];
4668 for (j = jstart; j < jend; j++) {
4678 jstart = sgrp->
grp_index[slave_gid - 1];
4680 for (j = jstart; j < jend; j++) {
4683 k < global_mesh->elem_node_index[selem]; k++) {
4701 static int mask_neighbor_domain_nb_contact_by_owner(
4703 const char *elem_flag,
char *domain_flag) {
4706 return mask_neighbor_domain_nb_contact_master_owner(
4707 global_mesh, node_flag, elem_flag, domain_flag);
4710 return mask_neighbor_domain_nb_contact_slave_owner(
4711 global_mesh, node_flag, elem_flag, domain_flag);
4715 "unknown CONTACT_OWNER in hecmw_flag_partcontact");
4721 const char *elem_flag,
char *domain_flag) {
4724 for (i = 0; i < global_mesh->
n_elem; i++) {
4734 const char *domain_flag) {
4738 for (counter = 0, i = 0; i < global_mesh->
n_subdomain; i++) {
4747 const char *domain_flag) {
4751 for (counter = 0, i = 0; i < global_mesh->
n_subdomain; i++) {
4762 char *node_flag,
char *elem_flag,
4763 int current_domain) {
4765 char *domain_flag =
NULL;
4773 "Starting creation of neighboring domain information...");
4779 if (domain_flag ==
NULL) {
4786 rtc = mask_mesh_status_nb(global_mesh, node_flag, elem_flag,
4790 if (is_spdup_available(global_mesh)) {
4791 rtc = mask_neighbor_domain_nb_mod(global_mesh, node_flag, domain_flag,
4794 rtc = mask_neighbor_domain_nb(global_mesh, node_flag, domain_flag);
4799 rtc = mask_neighbor_domain_nb_contact_by_owner(
4800 global_mesh, node_flag, elem_flag, domain_flag);
4807 rtc = mask_mesh_status_eb(global_mesh, node_flag, elem_flag,
4811 rtc = mask_neighbor_domain_eb(global_mesh, elem_flag, domain_flag);
4821 local_mesh->
n_neighbor_pe = count_neighbor_domain(global_mesh, domain_flag);
4839 rtc = set_neighbor_domain(global_mesh, local_mesh, domain_flag);
4860 char *node_flag_current,
char *node_flag_neighbor) {
4863 for (i = 0; i < global_mesh->
n_node; i++) {
4874 char *node_flag_current,
char *node_flag_neighbor,
4875 int current_domain) {
4878 for (i = 0; i < n_bnd_nlist[2 * current_domain + 1]; i++) {
4879 node = bnd_nlist[current_domain][i];
4889 char *elem_flag_current,
char *elem_flag_neighbor) {
4892 for (i = 0; i < global_mesh->
n_elem; i++) {
4903 char *elem_flag_current,
char *elem_flag_neighbor,
4904 int current_domain) {
4907 for (i = 0; i < n_bnd_elist[2 * current_domain + 1]; i++) {
4908 elem = bnd_elist[current_domain][i];
4918 const char *node_flag,
int domain) {
4922 for (counter = 0, i = 0; i < n_int_nlist[domain]; i++) {
4923 node = int_nlist[domain][i];
4931 const char *elem_flag,
int domain) {
4935 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
4937 global_mesh->
elem_ID[2 * i + 1] == domain)
4944 static int count_masked_shared_node(
4949 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
4956 static int count_masked_shared_elem(
4961 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
4968 static int count_masked_shared_elem_mod(
4974 for (counter = 0, i = 0; i < n_bnd_elist[2 * domain + 1]; i++) {
4975 elem = bnd_elist[domain][i];
4983 const char *node_flag,
int **comm_node,
4984 int neighbor_idx,
int domain) {
4988 for (counter = 0, i = 0; i < n_int_nlist[domain]; i++) {
4989 node = int_nlist[domain][i];
4991 comm_node[neighbor_idx][counter++] = node;
4999 const char *elem_flag,
int **comm_elem,
5000 int neighbor_idx,
int domain) {
5004 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
5006 global_mesh->
elem_ID[2 * i + 1] == domain) {
5007 comm_elem[neighbor_idx][counter++] = i + 1;
5015 const char *node_flag,
int **shared_node,
5020 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5022 shared_node[neighbor_idx][counter++] = i + 1;
5030 const char *elem_flag,
int **shared_elem,
5035 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
5037 shared_elem[neighbor_idx][counter++] = i + 1;
5044 static int create_shared_elem_pre_mod(
5046 int **shared_elem,
int neighbor_idx,
int neighbor_domain) {
5048 int i, idx1, idx2, elem1, elem2, n_bnd, n_out, maxe;
5050 n_bnd = n_bnd_elist[2 * neighbor_domain];
5052 n_bnd_elist[2 * neighbor_domain + 1] - n_bnd_elist[2 * neighbor_domain];
5053 maxe = global_mesh->
n_elem + 1;
5055 elem1 = (n_bnd == 0) ? maxe : bnd_elist[neighbor_domain][0];
5056 elem2 = (n_out == 0) ? maxe : bnd_elist[neighbor_domain][n_bnd];
5057 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_bnd + n_out; i++) {
5058 if (elem1 < elem2) {
5060 shared_elem[neighbor_idx][counter++] = elem1;
5063 elem1 = (idx1 == n_bnd) ? maxe : bnd_elist[neighbor_domain][idx1];
5066 shared_elem[neighbor_idx][counter++] = elem2;
5069 elem2 = (idx2 == n_out) ? maxe : bnd_elist[neighbor_domain][idx2 + n_bnd];
5076 static int create_comm_item(
int n_neighbor_pe,
int **comm_item_pre,
5077 int *comm_index,
int *comm_item) {
5080 for (i = 0; i < n_neighbor_pe; i++) {
5082 je = comm_index[i + 1];
5084 for (j = 0; j < je - js; j++) {
5085 comm_item[js + j] = comm_item_pre[i][j];
5096 const char *node_flag,
int **import_node,
5097 int neighbor_idx,
int neighbor_domain) {
5098 int n_import_node, rtc;
5101 count_masked_comm_node(global_mesh, node_flag, neighbor_domain);
5105 local_mesh->
import_index[neighbor_idx] + n_import_node;
5107 import_node[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_import_node);
5108 if (import_node[neighbor_idx] ==
NULL) {
5113 rtc = create_comm_node_pre(global_mesh, node_flag, import_node, neighbor_idx,
5125 const char *node_flag,
int **export_node,
5126 int neighbor_idx,
int current_domain,
5127 int neighbor_domain) {
5128 int n_export_node, rtc;
5131 count_masked_comm_node(global_mesh, node_flag, current_domain);
5135 local_mesh->
export_index[neighbor_idx] + n_export_node;
5137 export_node[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_export_node);
5138 if (export_node[neighbor_idx] ==
NULL) {
5143 rtc = create_comm_node_pre(global_mesh, node_flag, export_node, neighbor_idx,
5155 const char *elem_flag,
int **shared_elem,
5156 int neighbor_idx,
int neighbor_domain) {
5157 int n_shared_elem, rtc;
5159 if (is_spdup_available(global_mesh)) {
5161 count_masked_shared_elem_mod(global_mesh, elem_flag, neighbor_domain);
5163 n_shared_elem = count_masked_shared_elem(global_mesh, elem_flag);
5169 local_mesh->
shared_index[neighbor_idx] + n_shared_elem;
5171 shared_elem[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_shared_elem);
5172 if (shared_elem[neighbor_idx] ==
NULL) {
5177 if (is_spdup_available(global_mesh)) {
5178 rtc = create_shared_elem_pre_mod(global_mesh, elem_flag, shared_elem,
5179 neighbor_idx, neighbor_domain);
5181 rtc = create_shared_elem_pre(global_mesh, elem_flag, shared_elem,
5195 char *node_flag,
char *elem_flag,
5196 char *node_flag_neighbor,
5197 char *elem_flag_neighbor,
int current_domain) {
5198 int **import_node =
NULL;
5199 int **export_node =
NULL;
5200 int **shared_elem =
NULL;
5201 int neighbor_domain;
5214 if (import_node ==
NULL) {
5219 import_node[i] =
NULL;
5223 if (export_node ==
NULL) {
5228 export_node[i] =
NULL;
5232 if (shared_elem ==
NULL) {
5237 shared_elem[i] =
NULL;
5263 rtc = mask_mesh_status_nb(global_mesh, node_flag_neighbor,
5264 elem_flag_neighbor, neighbor_domain);
5267 if (is_spdup_available(global_mesh)) {
5268 rtc = mask_comm_node_mod(global_mesh, node_flag, node_flag_neighbor,
5271 rtc = mask_comm_node(global_mesh, node_flag, node_flag_neighbor);
5276 if (is_spdup_available(global_mesh)) {
5277 rtc = mask_comm_elem_mod(global_mesh, elem_flag, elem_flag_neighbor,
5280 rtc = mask_comm_elem(global_mesh, elem_flag, elem_flag_neighbor);
5285 rtc = create_import_info_nb(global_mesh, local_mesh, node_flag, import_node,
5286 i, neighbor_domain);
5289 rtc = create_export_info_nb(global_mesh, local_mesh, node_flag, export_node,
5290 i, current_domain, neighbor_domain);
5293 rtc = create_shared_info_nb(global_mesh, local_mesh, elem_flag, shared_elem,
5294 i, neighbor_domain);
5297 if (is_spdup_available(global_mesh)) {
5298 rtc = spdup_clear_IEB(node_flag_neighbor, elem_flag_neighbor,
5302 rtc = spdup_clear_MMbnd(node_flag_neighbor, elem_flag_neighbor,
5306 rtc = spdup_clear_MMbnd(node_flag, elem_flag, current_domain);
5309 for (j = 0; j < global_mesh->
n_node; j++) {
5312 for (j = 0; j < global_mesh->
n_elem; j++) {
5316 memset(node_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_node);
5317 memset(elem_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_elem);
5328 rtc = create_comm_item(local_mesh->
n_neighbor_pe, import_node,
5345 rtc = create_comm_item(local_mesh->
n_neighbor_pe, export_node,
5362 rtc = create_comm_item(local_mesh->
n_neighbor_pe, shared_elem,
5418 const char *elem_flag,
int **import_elem,
5419 int neighbor_idx,
int neighbor_domain) {
5420 int n_import_elem, rtc;
5423 count_masked_comm_elem(global_mesh, elem_flag, neighbor_domain);
5427 local_mesh->
import_index[neighbor_idx] + n_import_elem;
5429 import_elem[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_import_elem);
5430 if (import_elem[neighbor_idx] ==
NULL) {
5435 rtc = create_comm_elem_pre(global_mesh, elem_flag, import_elem, neighbor_idx,
5447 const char *elem_flag,
int **export_elem,
5448 int neighbor_idx,
int current_domain,
5449 int neighbor_domain) {
5450 int n_export_elem, rtc;
5453 count_masked_comm_elem(global_mesh, elem_flag, current_domain);
5457 local_mesh->
export_index[neighbor_idx] + n_export_elem;
5459 export_elem[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_export_elem);
5460 if (export_elem[neighbor_idx] ==
NULL) {
5465 rtc = create_comm_elem_pre(global_mesh, elem_flag, export_elem, neighbor_idx,
5477 const char *node_flag,
int **shared_node,
5478 int neighbor_idx,
int neighbor_domain) {
5479 int n_shared_node, rtc;
5481 n_shared_node = count_masked_shared_node(global_mesh, node_flag);
5485 local_mesh->
shared_index[neighbor_idx] + n_shared_node;
5487 shared_node[neighbor_idx] = (
int *)
HECMW_malloc(
sizeof(
int) * n_shared_node);
5488 if (shared_node[neighbor_idx] ==
NULL) {
5494 create_shared_node_pre(global_mesh, node_flag, shared_node, neighbor_idx);
5507 char *node_flag,
char *elem_flag,
5508 char *node_flag_neighbor,
5509 char *elem_flag_neighbor,
int current_domain) {
5510 int **import_elem =
NULL;
5511 int **export_elem =
NULL;
5512 int **shared_node =
NULL;
5513 int neighbor_domain;
5527 if (import_elem ==
NULL) {
5532 import_elem[i] =
NULL;
5536 if (export_elem ==
NULL) {
5541 export_elem[i] =
NULL;
5545 if (shared_node ==
NULL) {
5550 shared_node[i] =
NULL;
5577 for (j = 0; j < global_mesh->
n_node; j++) {
5581 for (j = 0; j < global_mesh->
n_elem; j++) {
5586 memset(node_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_node);
5587 memset(elem_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_elem);
5590 rtc = mask_mesh_status_eb(global_mesh, node_flag_neighbor,
5591 elem_flag_neighbor, neighbor_domain);
5594 rtc = mask_comm_node(global_mesh, node_flag, node_flag_neighbor);
5597 rtc = mask_comm_elem(global_mesh, elem_flag, elem_flag_neighbor);
5601 rtc = create_import_info_eb(global_mesh, local_mesh, elem_flag, import_elem,
5602 i, neighbor_domain);
5606 rtc = create_export_info_eb(global_mesh, local_mesh, elem_flag, export_elem,
5607 i, current_domain, neighbor_domain);
5611 rtc = create_shared_info_eb(global_mesh, local_mesh, node_flag, shared_node,
5612 i, neighbor_domain);
5624 rtc = create_comm_item(local_mesh->
n_neighbor_pe, import_elem,
5642 rtc = create_comm_item(local_mesh->
n_neighbor_pe, export_elem,
5660 rtc = create_comm_item(local_mesh->
n_neighbor_pe, shared_node,
5715 char *node_flag,
char *elem_flag,
5716 char *node_flag_neighbor,
char *elem_flag_neighbor,
5717 int current_domain) {
5729 rtc = create_comm_info_nb(global_mesh, local_mesh, node_flag, elem_flag,
5730 node_flag_neighbor, elem_flag_neighbor,
5737 rtc = create_comm_info_eb(global_mesh, local_mesh, node_flag, elem_flag,
5738 node_flag_neighbor, elem_flag_neighbor,
5763 static int set_node_global2local_internal(
5766 const char *node_flag,
int domain) {
5776 for (counter = 0, i = 0; i < n_int_nlist[domain]; i++) {
5777 node = int_nlist[domain][i];
5778 node_global2local[node - 1] = ++counter;
5785 static int set_node_global2local_external(
5788 const char *node_flag) {
5799 for (counter = local_mesh->
nn_internal, i = 0; i < global_mesh->n_node; i++) {
5802 node_global2local[i] = ++counter;
5809 for (i = 0; i < global_mesh->
n_node; i++) {
5812 node_global2local[i] = ++counter;
5815 local_mesh->
n_node = counter;
5823 static int set_node_global2local_external_mod(
5826 const char *node_flag,
int domain) {
5836 for (counter = local_mesh->
nn_internal, i = n_bnd_nlist[2 * domain];
5837 i < n_bnd_nlist[2 * domain + 1]; i++) {
5838 node = bnd_nlist[domain][i];
5839 node_global2local[node - 1] = ++counter;
5841 local_mesh->
n_node = counter;
5849 static int set_node_global2local_all(
5852 const char *node_flag) {
5862 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5864 node_global2local[i] = ++counter;
5867 local_mesh->
n_node = counter;
5877 const char *node_flag) {
5886 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5894 static int const_node_internal_list(
5897 const char *node_flag) {
5919 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
5934 int *node_global2local,
const char *node_flag,
5935 int current_domain) {
5946 rtc = set_node_global2local_internal(global_mesh, local_mesh,
5947 node_global2local, node_flag,
5951 if (is_spdup_available(global_mesh)) {
5952 rtc = set_node_global2local_external_mod(global_mesh, local_mesh,
5953 node_global2local, node_flag,
5956 rtc = set_node_global2local_external(global_mesh, local_mesh,
5957 node_global2local, node_flag);
5968 rtc = const_nn_internal(global_mesh, local_mesh, node_flag);
5971 rtc = set_node_global2local_all(global_mesh, local_mesh,
5972 node_global2local, node_flag);
5975 rtc = const_node_internal_list(global_mesh, local_mesh, node_global2local,
5995 int *node_global2local,
int domain) {
6002 if (is_spdup_available(global_mesh)) {
6003 for (i = 0; i < n_int_nlist[domain]; i++) {
6004 node = int_nlist[domain][i];
6005 node_global2local[node - 1] = 0;
6007 for (i = n_bnd_nlist[2 * domain]; i < n_bnd_nlist[2 * domain + 1]; i++) {
6008 node = bnd_nlist[domain][i];
6009 node_global2local[node - 1] = 0;
6012 for (i = 0; i < global_mesh->
n_node; i++) {
6013 node_global2local[i] = 0;
6024 const int *node_global2local,
6025 int *node_local2global) {
6035 for (counter = 0, i = 0; i < global_mesh->
n_node; i++) {
6036 if (node_global2local[i]) {
6037 node_local2global[node_global2local[i] - 1] = i + 1;
6046 static int set_node_local2global_mod(
6049 int *node_local2global,
int domain) {
6051 int i, idx1, idx2, node1, node2, n_int, n_bnd, n_out, maxn;
6059 n_int = n_int_nlist[domain];
6060 n_bnd = n_bnd_nlist[2 * domain];
6061 n_out = n_bnd_nlist[2 * domain + 1] - n_bnd_nlist[2 * domain];
6062 maxn = global_mesh->
n_node + 1;
6064 node1 = (n_int == 0) ? maxn : int_nlist[domain][0];
6065 node2 = (n_out == 0) ? maxn : bnd_nlist[domain][n_bnd];
6066 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_int + n_out; i++) {
6067 if (node1 < node2) {
6068 node_local2global[node_global2local[node1 - 1] - 1] = node1;
6070 node1 = (idx1 == n_int) ? maxn : int_nlist[domain][idx1];
6072 node_local2global[node_global2local[node2 - 1] - 1] = node2;
6074 node2 = (idx2 == n_out) ? maxn : bnd_nlist[domain][idx2 + n_bnd];
6086 static int set_elem_global2local_internal(
6089 const char *elem_flag) {
6099 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
6101 elem_global2local[i] = ++counter;
6109 static int set_elem_global2local_external(
6112 const char *elem_flag) {
6122 for (counter = local_mesh->
ne_internal, i = 0; i < global_mesh->n_elem; i++) {
6124 elem_global2local[i] = ++counter;
6127 local_mesh->
n_elem = counter;
6135 static int set_elem_global2local_all(
6138 const char *elem_flag) {
6148 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
6150 elem_global2local[i] = ++counter;
6153 local_mesh->
n_elem = counter;
6161 static int set_elem_global2local_all_mod(
6164 const char *elem_flag,
int domain) {
6166 int i, idx1, idx2, elem1, elem2, n_int, n_bnd, n_out, maxe;
6174 n_int = n_int_elist[domain];
6175 n_bnd = n_bnd_elist[2 * domain];
6176 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
6177 maxe = global_mesh->
n_elem + 1;
6179 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
6180 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
6181 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_int + n_out; i++) {
6182 if (elem1 < elem2) {
6183 elem_global2local[elem1 - 1] = ++counter;
6185 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
6187 elem_global2local[elem2 - 1] = ++counter;
6189 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
6193 local_mesh->
n_elem = counter;
6203 const char *elem_flag) {
6209 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
6217 static int const_elem_internal_list(
6220 const char *elem_flag,
int domain) {
6242 for (counter = 0, i = 0; i < n_int_elist[domain]; i++) {
6243 elem = int_elist[domain][i];
6257 int *elem_global2local,
const char *elem_flag,
6258 int current_domain) {
6269 local_mesh->
ne_internal = n_int_elist[current_domain];
6271 if (is_spdup_available(global_mesh)) {
6272 rtc = set_elem_global2local_all_mod(global_mesh, local_mesh,
6273 elem_global2local, elem_flag,
6276 rtc = set_elem_global2local_all(global_mesh, local_mesh,
6277 elem_global2local, elem_flag);
6282 rtc = const_elem_internal_list(global_mesh, local_mesh, elem_global2local,
6283 elem_flag, current_domain);
6291 rtc = set_elem_global2local_internal(global_mesh, local_mesh,
6292 elem_global2local, elem_flag);
6295 rtc = set_elem_global2local_external(global_mesh, local_mesh,
6296 elem_global2local, elem_flag);
6317 int *elem_global2local,
int domain) {
6324 if (is_spdup_available(global_mesh)) {
6325 for (i = 0; i < n_int_elist[domain]; i++) {
6326 elem = int_elist[domain][i];
6327 elem_global2local[elem - 1] = 0;
6329 for (i = n_bnd_elist[2 * domain]; i < n_bnd_elist[2 * domain + 1]; i++) {
6330 elem = bnd_elist[domain][i];
6331 elem_global2local[elem - 1] = 0;
6335 for (i = 0; i < global_mesh->
n_elem; i++) {
6336 elem_global2local[i] = 0;
6347 const int *elem_global2local,
6348 int *elem_local2global) {
6358 for (counter = 0, i = 0; i < global_mesh->
n_elem; i++) {
6359 if (elem_global2local[i]) {
6360 elem_local2global[elem_global2local[i] - 1] = i + 1;
6369 static int set_elem_local2global_mod(
6372 int *elem_local2global,
int domain) {
6374 int i, idx1, idx2, elem1, elem2, n_int, n_bnd, n_out, maxe;
6382 n_int = n_int_elist[domain];
6383 n_bnd = n_bnd_elist[2 * domain];
6384 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
6385 maxe = global_mesh->
n_elem + 1;
6387 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
6388 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
6389 for (counter = 0, idx1 = 0, idx2 = 0, i = 0; i < n_int + n_out; i++) {
6390 if (elem1 < elem2) {
6391 elem_local2global[elem_global2local[elem1 - 1] - 1] = elem1;
6393 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
6395 elem_local2global[elem_global2local[elem2 - 1] - 1] = elem2;
6397 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
6433 snprintf(local_mesh->
header,
sizeof(local_mesh->
header),
"%s",
6446 static int const_hecmw_flag_initcon(
6454 static int const_hecmw_flag_parttype(
6462 static int const_hecmw_flag_partdepth(
6470 static int const_hecmw_flag_version(
6478 static int const_hecmw_flag_partcontact(
6500 rtc = const_gridfile(global_mesh, local_mesh);
6503 rtc = const_hecmw_n_file(global_mesh, local_mesh);
6506 rtc = const_files(global_mesh, local_mesh);
6509 rtc = const_header(global_mesh, local_mesh);
6512 rtc = const_hecmw_flag_adapt(global_mesh, local_mesh);
6515 rtc = const_hecmw_flag_initcon(global_mesh, local_mesh);
6518 rtc = const_hecmw_flag_parttype(global_mesh, local_mesh);
6521 rtc = const_hecmw_flag_partdepth(global_mesh, local_mesh);
6524 rtc = const_hecmw_flag_version(global_mesh, local_mesh);
6527 rtc = const_hecmw_flag_partcontact(global_mesh, local_mesh);
6530 rtc = const_zero_temp(global_mesh, local_mesh);
6566 const char *node_flag) {
6580 for (counter = 0, i = 0; i < global_mesh->
n_dof_grp; i++) {
6582 j < global_mesh->node_dof_index[i + 1]; j++) {
6596 static int const_node_dof_index_mod(
6612 for (counter = 0, i = 0; i < global_mesh->
n_dof_grp; i++) {
6613 for (j = 0; j < n_int_nlist[domain]; j++) {
6614 node = int_nlist[domain][j];
6615 if (node <= global_mesh->node_dof_index[i])
continue;
6639 const int *node_local2global) {
6652 for (i = 0; i < local_mesh->
n_node; i++) {
6653 local_mesh->
node[3 * i] = global_mesh->
node[3 * (node_local2global[i] - 1)];
6654 local_mesh->
node[3 * i + 1] =
6655 global_mesh->
node[3 * (node_local2global[i] - 1) + 1];
6656 local_mesh->
node[3 * i + 2] =
6657 global_mesh->
node[3 * (node_local2global[i] - 1) + 2];
6668 const int *node_local2global) {
6681 for (i = 0; i < local_mesh->
n_node; i++) {
6683 global_mesh->
node_ID[2 * (node_local2global[i] - 1)];
6684 local_mesh->
node_ID[2 * i + 1] =
6685 global_mesh->
node_ID[2 * (node_local2global[i] - 1) + 1];
6696 const int *node_local2global) {
6709 for (i = 0; i < local_mesh->
n_node; i++) {
6720 static int const_node_init_val_index(
6737 for (i = 0; i < local_mesh->
n_node; i++) {
6738 old_idx = node_local2global[i] - 1;
6752 static int const_node_init_val_item(
6757 int i, j, gstart, gend, lstart, lend;
6776 for (counter = 0, i = 0; i < local_mesh->
n_node; i++) {
6784 for (j = 0; j < lend - lstart; j++) {
6800 const int *node_local2global,
const char *node_flag,
6801 int current_domain) {
6809 rtc = const_n_dof(global_mesh, local_mesh);
6812 rtc = const_n_dof_grp(global_mesh, local_mesh);
6817 rtc = const_node_dof_index_mod(global_mesh, local_mesh, node_flag,
6821 rtc = const_node_dof_index(global_mesh, local_mesh, node_flag);
6830 rtc = const_node_dof_item(global_mesh, local_mesh);
6833 rtc = const_node(global_mesh, local_mesh, node_local2global);
6836 rtc = const_node_id(global_mesh, local_mesh, node_local2global);
6839 rtc = const_global_node_id(global_mesh, local_mesh, node_local2global);
6843 rtc = const_node_init_val_index(global_mesh, local_mesh, node_local2global);
6846 rtc = const_node_init_val_item(global_mesh, local_mesh, node_local2global);
6872 const int *elem_local2global) {
6884 for (i = 0; i < local_mesh->
n_elem; i++) {
6896 const int *elem_global2local) {
6911 for (counter = 0, i = 0; i < global_mesh->
n_elem_type; i++) {
6913 j < global_mesh->elem_type_index[i + 1]; j++) {
6914 if (elem_global2local[j]) counter++;
6927 static int const_elem_type_index_mod(
6932 int i, j, idx1, idx2, elem_tmp, elem1, elem2, n_int, n_bnd, n_out, maxe;
6945 n_int = n_int_elist[domain];
6946 n_bnd = n_bnd_elist[2 * domain];
6947 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
6948 maxe = global_mesh->
n_elem + 1;
6950 for (counter = 0, i = 0; i < global_mesh->
n_elem_type; i++) {
6951 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
6952 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
6953 for (idx1 = 0, idx2 = 0, j = 0; j < n_int + n_out; j++) {
6954 if (elem1 < elem2) {
6955 elem_tmp = elem1 - 1;
6957 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
6959 elem_tmp = elem2 - 1;
6961 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
6964 elem_tmp < global_mesh->elem_type_index[i + 1]) {
6991 const int *elem_local2global) {
7005 for (i = 0; i < local_mesh->
n_elem; i++) {
7006 old_idx = elem_local2global[i] - 1;
7022 const int *node_global2local,
7023 const int *elem_local2global) {
7028 long long gstart, lstart, lend;
7042 for (counter = 0, i = 0; i < local_mesh->
n_elem; i++) {
7047 for (j = 0; j < lend - lstart; j++) {
7049 local_mesh->
elem_node_item[lstart + j] = node_global2local[node - 1];
7063 const int *elem_local2global) {
7076 for (i = 0; i < local_mesh->
n_elem; i++) {
7078 global_mesh->
elem_ID[2 * (elem_local2global[i] - 1)];
7079 local_mesh->
elem_ID[2 * i + 1] =
7080 global_mesh->
elem_ID[2 * (elem_local2global[i] - 1) + 1];
7091 const int *elem_local2global) {
7104 for (i = 0; i < local_mesh->
n_elem; i++) {
7117 const int *elem_local2global) {
7130 for (i = 0; i < local_mesh->
n_elem; i++) {
7132 global_mesh->
section_ID[elem_local2global[i] - 1];
7143 const int *elem_local2global) {
7157 for (i = 0; i < local_mesh->
n_elem; i++) {
7158 old_idx = elem_local2global[i] - 1;
7183 const int *elem_local2global) {
7186 int i, j, gstart, gend, lstart, lend;
7203 for (counter = 0, i = 0; i < local_mesh->
n_elem; i++) {
7211 for (j = 0; j < lend - lstart; j++) {
7228 const int *node_global2local,
7229 const int *elem_global2local,
7230 const int *elem_local2global,
int current_domain) {
7239 rtc = const_n_elem_type(global_mesh, local_mesh);
7242 rtc = const_elem_type(global_mesh, local_mesh, elem_local2global);
7245 if (is_spdup_available(global_mesh)) {
7246 rtc = const_elem_type_index_mod(global_mesh, local_mesh, elem_global2local,
7249 rtc = const_elem_type_index(global_mesh, local_mesh, elem_global2local);
7254 rtc = const_elem_type_item(global_mesh, local_mesh);
7257 rtc = const_elem_node_index(global_mesh, local_mesh, elem_local2global);
7260 rtc = const_elem_node_item(global_mesh, local_mesh, node_global2local,
7264 rtc = const_elem_id(global_mesh, local_mesh, elem_local2global);
7267 rtc = const_global_elem_id(global_mesh, local_mesh, elem_local2global);
7270 rtc = const_section_id(global_mesh, local_mesh, elem_local2global);
7273 rtc = const_elem_mat_id_index(global_mesh, local_mesh, elem_local2global);
7276 rtc = const_n_elem_mat_id(local_mesh);
7279 rtc = const_elem_mat_id_item(global_mesh, local_mesh, elem_local2global);
7299 int current_domain) {
7300 local_mesh->
zero = (current_domain == 0) ? 1 : 0;
7320 int current_domain) {
7321 local_mesh->
my_rank = current_domain;
7341 const int *global2local) {
7356 new_id = global2local[local_mesh->
import_item[i] - 1];
7364 const int *global2local) {
7379 new_id = global2local[local_mesh->
export_item[i] - 1];
7387 const int *global2local) {
7402 new_id = global2local[local_mesh->
shared_item[i] - 1];
7411 const int *node_global2local,
7412 const int *elem_global2local,
int current_domain) {
7420 rtc = const_hecmw_comm(global_mesh, local_mesh);
7423 rtc = const_zero(local_mesh, current_domain);
7426 rtc = const_petot(global_mesh, local_mesh);
7429 rtc = const_pesmptot(global_mesh, local_mesh);
7432 rtc = const_my_rank(local_mesh, current_domain);
7435 rtc = const_errnof(global_mesh, local_mesh);
7438 rtc = const_n_subdomain(global_mesh, local_mesh);
7443 rtc = const_import_item(local_mesh, node_global2local);
7446 rtc = const_export_item(local_mesh, node_global2local);
7449 rtc = const_shared_item(local_mesh, elem_global2local);
7455 rtc = const_import_item(local_mesh, elem_global2local);
7458 rtc = const_export_item(local_mesh, elem_global2local);
7461 rtc = const_shared_item(local_mesh, node_global2local);
7495 static int const_when_i_was_refined_node(
7503 static int const_when_i_was_refined_elem(
7539 static int const_adapt_children_index(
7547 static int const_adapt_children_item(
7562 rtc = const_n_adapt(global_mesh, local_mesh);
7565 rtc = const_coarse_grid_level(global_mesh, local_mesh);
7568 rtc = const_when_i_was_refined_node(global_mesh, local_mesh);
7571 rtc = const_when_i_was_refined_elem(global_mesh, local_mesh);
7574 rtc = const_adapt_parent_type(global_mesh, local_mesh);
7577 rtc = const_adapt_type(global_mesh, local_mesh);
7580 rtc = const_adapt_level(global_mesh, local_mesh);
7583 rtc = const_adapt_parent(global_mesh, local_mesh);
7586 rtc = const_adapt_children_index(global_mesh, local_mesh);
7589 rtc = const_adapt_children_item(global_mesh, local_mesh);
7675 rtc = const_n_sect(global_mesh, local_mesh);
7678 rtc = const_sect_type(global_mesh, local_mesh);
7681 rtc = const_sect_opt(global_mesh, local_mesh);
7684 rtc = const_sect_mat_id_index(global_mesh, local_mesh);
7687 rtc = const_sect_mat_id_item(global_mesh, local_mesh);
7690 rtc = const_sect_i_index(global_mesh, local_mesh);
7693 rtc = const_sect_i_item(global_mesh, local_mesh);
7696 rtc = const_sect_r_index(global_mesh, local_mesh);
7699 rtc = const_sect_r_item(global_mesh, local_mesh);
7792 rtc = const_n_mat(global_mesh, local_mesh);
7795 rtc = const_n_mat_item(global_mesh, local_mesh);
7798 rtc = const_n_mat_subitem(global_mesh, local_mesh);
7801 rtc = const_n_mat_table(global_mesh, local_mesh);
7804 rtc = const_mat_name(global_mesh, local_mesh);
7807 rtc = const_mat_item_index(global_mesh, local_mesh);
7810 rtc = const_mat_subitem_index(global_mesh, local_mesh);
7813 rtc = const_mat_table_index(global_mesh, local_mesh);
7816 rtc = const_mat_val(global_mesh, local_mesh);
7819 rtc = const_mat_temp(global_mesh, local_mesh);
7833 const int *node_global2local,
char *mpc_flag) {
7836 int node, diff, evalsum, counter;
7839 for (counter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7846 if (node_global2local[node - 1] > 0) evalsum++;
7849 if (evalsum == diff) {
7854 mpc_local->
n_mpc = counter;
7861 const char *mpc_flag) {
7873 for (counter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7891 const int *node_global2local,
const char *mpc_flag) {
7894 int mcounter, icounter;
7904 for (mcounter = 0, icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7909 node_global2local[mpc_global->
mpc_item[j] - 1];
7925 const char *mpc_flag) {
7928 int mcounter, icounter;
7938 for (mcounter = 0, icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7958 const char *mpc_flag) {
7962 int mcounter, icounter;
7972 for (mcounter = 0, icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
7992 const char *mpc_flag) {
7999 size =
sizeof(double) * mpc_local->
n_mpc;
8006 for (icounter = 0, i = 0; i < mpc_global->
n_mpc; i++) {
8022 const int *node_global2local) {
8023 char *mpc_flag =
NULL;
8032 if (global_mesh->
mpc->
n_mpc == 0) {
8033 init_struct_mpc(local_mesh);
8038 if (mpc_flag ==
NULL) {
8043 rtc = const_n_mpc(global_mesh, local_mesh, node_global2local, mpc_flag);
8047 init_struct_mpc(local_mesh);
8052 rtc = const_mpc_index(global_mesh, local_mesh, mpc_flag);
8055 rtc = const_mpc_item(global_mesh, local_mesh, node_global2local, mpc_flag);
8058 rtc = const_mpc_dof(global_mesh, local_mesh, mpc_flag);
8061 rtc = const_mpc_val(global_mesh, local_mesh, mpc_flag);
8064 rtc = const_mpc_const(global_mesh, local_mesh, mpc_flag);
8094 static int const_amp_type_definition(
8146 if (global_mesh->
amp->
n_amp == 0) {
8147 init_struct_amp(local_mesh);
8151 rtc = const_n_amp(global_mesh, local_mesh);
8154 rtc = const_amp_name(global_mesh, local_mesh);
8157 rtc = const_amp_type_definition(global_mesh, local_mesh);
8160 rtc = const_amp_type_time(global_mesh, local_mesh);
8163 rtc = const_amp_type_value(global_mesh, local_mesh);
8166 rtc = const_amp_index(global_mesh, local_mesh);
8169 rtc = const_amp_val(global_mesh, local_mesh);
8172 rtc = const_amp_table(global_mesh, local_mesh);
8184 static int *const_node_grp_mask_eqn(
8187 int eqn_block_idx) {
8189 int *n_eqn_item =
NULL;
8191 int i, j, is, ie, js;
8193 is = node_group_global->
grp_index[eqn_block_idx];
8194 ie = node_group_global->
grp_index[eqn_block_idx + 1];
8196 n_eqn_item = (
int *)
HECMW_malloc(
sizeof(
int) * (ie - is));
8197 if (n_eqn_item ==
NULL) {
8202 for (js = 0, i = 0; i < ie - is; i++) {
8203 diff = node_group_global->
grp_item[is + i] - js;
8204 for (evalsum = 0, j = js; j < node_group_global->
grp_item[is + i]; j++) {
8205 if (node_global2local[j] > 0 &&
8212 n_eqn_item[i] = diff;
8217 js = node_group_global->
grp_item[is + i];
8242 const int *node_global2local,
8243 const int *n_eqn_item,
int eqn_block_idx) {
8257 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8258 if (i != eqn_block_idx) {
8259 for (j = node_group_global->
grp_index[i];
8260 j < node_group_global->
grp_index[i + 1]; j++) {
8261 node = node_group_global->
grp_item[j];
8262 if (node_global2local[node - 1]) counter++;
8268 for (j = 0; j < diff; j++) {
8269 if (n_eqn_item[j] > 0) counter++;
8273 node_group_local->
grp_index[i + 1] = counter;
8282 static int const_node_grp_index_mod(
8285 const int *n_eqn_item,
int eqn_block_idx,
int domain) {
8298 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8299 if (i != eqn_block_idx) {
8300 if (node_group_global->
grp_index[i + 1] -
8303 counter += n_int_nlist[domain];
8304 counter += n_bnd_nlist[2 * domain + 1] - n_bnd_nlist[2 * domain];
8306 counter += ngrp_idx[domain][i + 1] - ngrp_idx[domain][i];
8312 for (j = 0; j < diff; j++) {
8313 if (n_eqn_item[j] > 0) counter++;
8317 node_group_local->
grp_index[i + 1] = counter;
8328 const int *node_global2local,
8329 const int *n_eqn_item,
int eqn_block_idx) {
8335 int i, j, k, js, je, ks, ls;
8337 size =
sizeof(int) * node_group_local->
grp_index[node_group_local->
n_grp];
8344 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8345 if (i != eqn_block_idx) {
8346 for (j = node_group_global->
grp_index[i];
8347 j < node_group_global->
grp_index[i + 1]; j++) {
8348 node = node_group_global->
grp_item[j];
8349 if (node_global2local[node - 1]) {
8350 node_group_local->
grp_item[counter++] = node_global2local[node - 1];
8356 je = node_group_global->
grp_index[i + 1];
8357 for (ks = 0, ls = 0, j = js; j < je; j++) {
8358 if (n_eqn_item[j - js]) {
8360 node_group_global->
grp_item[j] - ks);
8361 node_group_local->
grp_item[counter] = ls + n_eqn_item[j - js];
8363 for (k = ks; k < node_group_global->
grp_item[j]; k++) {
8365 node_global2local[k] <=
8366 node_group_local->
grp_item[counter]);
8368 ls = node_group_local->
grp_item[counter];
8371 ks = node_group_global->
grp_item[j];
8385 const int *node_global2local,
8386 const int *n_eqn_item,
int eqn_block_idx,
8393 int i, j, k, js, je, ks, ls;
8394 int idx1, idx2, node1, node2, n_int, n_bnd, n_out, maxn;
8396 size =
sizeof(int) * node_group_local->
grp_index[node_group_local->
n_grp];
8403 n_int = n_int_nlist[domain];
8404 n_bnd = n_bnd_nlist[2 * domain];
8405 n_out = n_bnd_nlist[2 * domain + 1] - n_bnd_nlist[2 * domain];
8406 maxn = global_mesh->
n_node + 1;
8408 for (counter = 0, i = 0; i < node_group_global->
n_grp; i++) {
8409 if (i != eqn_block_idx) {
8410 if (node_group_global->
grp_index[i + 1] -
8415 node1 = (n_int == 0) ? maxn : int_nlist[domain][0];
8416 node2 = (n_out == 0) ? maxn : bnd_nlist[domain][n_bnd];
8417 for (j = 0; j < n_int + n_out; j++) {
8418 if (node1 < node2) {
8419 node_group_local->
grp_item[counter++] =
8420 node_global2local[node1 - 1];
8422 node1 = (idx1 == n_int) ? maxn : int_nlist[domain][idx1];
8424 node_group_local->
grp_item[counter++] =
8425 node_global2local[node2 - 1];
8427 node2 = (idx2 == n_out) ? maxn : bnd_nlist[domain][idx2 + n_bnd];
8431 if (ngrp_idx[domain][i + 1] - ngrp_idx[domain][i] == 0)
continue;
8432 for (j = ngrp_idx[domain][i]; j < ngrp_idx[domain][i + 1]; j++) {
8433 node = ngrp_item[domain][j];
8434 node_group_local->
grp_item[counter++] = node_global2local[node - 1];
8439 je = node_group_global->
grp_index[i + 1];
8440 for (ks = 0, ls = 0, j = js; j < je; j++) {
8441 if (n_eqn_item[j - js]) {
8443 node_group_global->
grp_item[j] - ks);
8444 node_group_local->
grp_item[counter] = ls + n_eqn_item[j - js];
8446 for (k = ks; k < node_group_global->
grp_item[j]; k++) {
8448 node_global2local[k] <=
8449 node_group_local->
grp_item[counter]);
8451 ls = node_group_local->
grp_item[counter];
8454 ks = node_group_global->
grp_item[j];
8468 const int *node_global2local,
8469 int current_domain) {
8470 int *n_eqn_item =
NULL;
8481 init_struct_node_grp(local_mesh);
8485 eqn_block_idx = search_eqn_block_idx(global_mesh);
8487 if (eqn_block_idx >= 0) {
8488 n_eqn_item = const_node_grp_mask_eqn(global_mesh, local_mesh,
8489 node_global2local, eqn_block_idx);
8490 if (n_eqn_item ==
NULL)
goto error;
8493 rtc = const_node_n_grp(global_mesh, local_mesh);
8496 rtc = const_node_grp_name(global_mesh, local_mesh);
8499 if (is_spdup_available(global_mesh)) {
8500 rtc = const_node_grp_index_mod(global_mesh, local_mesh, node_global2local,
8501 n_eqn_item, eqn_block_idx, current_domain);
8503 rtc = const_node_grp_item_mod(global_mesh, local_mesh, node_global2local,
8504 n_eqn_item, eqn_block_idx, current_domain);
8508 rtc = const_node_grp_index(global_mesh, local_mesh, node_global2local,
8509 n_eqn_item, eqn_block_idx);
8511 rtc = const_node_grp_item(global_mesh, local_mesh, node_global2local,
8512 n_eqn_item, eqn_block_idx);
8545 const int *elem_global2local) {
8559 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8560 for (j = elem_group_global->
grp_index[i];
8561 j < elem_group_global->
grp_index[i + 1]; j++) {
8562 elem = elem_group_global->
grp_item[j];
8563 if (elem_global2local[elem - 1]) counter++;
8565 elem_group_local->
grp_index[i + 1] = counter;
8574 static int const_elem_grp_index_mod(
8590 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8593 counter += n_int_elist[domain];
8594 counter += n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
8596 counter += egrp_idx[domain][i + 1] - egrp_idx[domain][i];
8598 elem_group_local->
grp_index[i + 1] = counter;
8609 const int *elem_global2local) {
8617 size =
sizeof(int) * elem_group_local->
grp_index[elem_group_local->
n_grp];
8624 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8625 for (j = elem_group_global->
grp_index[i];
8626 j < elem_group_global->
grp_index[i + 1]; j++) {
8627 elem = elem_group_global->
grp_item[j];
8628 if (elem_global2local[elem - 1]) {
8629 elem_group_local->
grp_item[counter++] = elem_global2local[elem - 1];
8643 const int *elem_global2local,
int domain) {
8649 int i, j, idx1, idx2, elem1, elem2, n_int, n_bnd, n_out, maxe;
8651 size =
sizeof(int) * elem_group_local->
grp_index[elem_group_local->
n_grp];
8658 n_int = n_int_elist[domain];
8659 n_bnd = n_bnd_elist[2 * domain];
8660 n_out = n_bnd_elist[2 * domain + 1] - n_bnd_elist[2 * domain];
8661 maxe = global_mesh->
n_elem + 1;
8663 for (counter = 0, i = 0; i < elem_group_global->
n_grp; i++) {
8666 elem1 = (n_int == 0) ? maxe : int_elist[domain][0];
8667 elem2 = (n_out == 0) ? maxe : bnd_elist[domain][n_bnd];
8668 for (idx1 = 0, idx2 = 0, j = 0; j < n_int + n_out; j++) {
8669 if (elem1 < elem2) {
8670 elem_group_local->
grp_item[counter++] = elem_global2local[elem1 - 1];
8672 elem1 = (idx1 == n_int) ? maxe : int_elist[domain][idx1];
8674 elem_group_local->
grp_item[counter++] = elem_global2local[elem2 - 1];
8676 elem2 = (idx2 == n_out) ? maxe : bnd_elist[domain][idx2 + n_bnd];
8680 if (egrp_idx[domain][i + 1] - egrp_idx[domain][i] == 0)
continue;
8681 for (j = egrp_idx[domain][i]; j < egrp_idx[domain][i + 1]; j++) {
8682 elem = egrp_item[domain][j];
8683 elem_group_local->
grp_item[counter++] = elem_global2local[elem - 1];
8697 const int *elem_global2local,
8698 int current_domain) {
8708 init_struct_elem_grp(local_mesh);
8712 rtc = const_elem_n_grp(global_mesh, local_mesh);
8715 rtc = const_elem_grp_name(global_mesh, local_mesh);
8718 if (is_spdup_available(global_mesh)) {
8719 rtc = const_elem_grp_index_mod(global_mesh, local_mesh, elem_global2local,
8722 rtc = const_elem_grp_item_mod(global_mesh, local_mesh, elem_global2local,
8727 rtc = const_elem_grp_index(global_mesh, local_mesh, elem_global2local);
8729 rtc = const_elem_grp_item(global_mesh, local_mesh, elem_global2local);
8758 const int *elem_global2local) {
8772 for (counter = 0, i = 0; i < surf_group_global->
n_grp; i++) {
8773 for (j = surf_group_global->
grp_index[i];
8774 j < surf_group_global->
grp_index[i + 1]; j++) {
8775 elem = surf_group_global->
grp_item[2 * j];
8776 if (elem_global2local[elem - 1]) counter++;
8778 surf_group_local->
grp_index[i + 1] = counter;
8789 const int *elem_global2local) {
8797 size =
sizeof(int) * (
size_t)surf_group_local->
grp_index[surf_group_local->
n_grp] * 2;
8804 for (counter = 0, i = 0; i < surf_group_global->
n_grp; i++) {
8805 for (j = surf_group_global->
grp_index[i];
8806 j < surf_group_global->
grp_index[i + 1]; j++) {
8807 elem = surf_group_global->
grp_item[2 * j];
8808 surf = surf_group_global->
grp_item[2 * j + 1];
8809 if (elem_global2local[elem - 1]) {
8810 surf_group_local->
grp_item[2 * counter] = elem_global2local[elem - 1];
8811 surf_group_local->
grp_item[2 * counter + 1] = surf;
8826 const int *elem_global2local) {
8836 init_struct_surf_grp(local_mesh);
8840 rtc = const_surf_n_grp(global_mesh, local_mesh);
8843 rtc = const_surf_grp_name(global_mesh, local_mesh);
8846 rtc = const_surf_grp_index(global_mesh, local_mesh, elem_global2local);
8849 rtc = const_surf_grp_item(global_mesh, local_mesh, elem_global2local);
8861 static int const_contact_pair_n_pair(
8888 for (i = 0; i < cpair_global->
n_pair; i++) {
8889 cpair_local->
type[i] = cpair_global->
type[i];
8898 static int const_contact_pair_slave_grp_id(
8912 for (i = 0; i < cpair_global->
n_pair; i++) {
8922 static int const_contact_pair_slave_orisgrp_id(
8936 for (i = 0; i < cpair_global->
n_pair; i++) {
8946 static int const_contact_pair_master_grp_id(
8960 for (i = 0; i < cpair_global->
n_pair; i++) {
8980 init_struct_contact_pair(local_mesh);
8984 rtc = const_contact_pair_n_pair(global_mesh, local_mesh);
8987 rtc = const_contact_pair_name(global_mesh, local_mesh);
8990 rtc = const_contact_pair_type(global_mesh, local_mesh);
8993 rtc = const_contact_pair_slave_grp_id(global_mesh, local_mesh);
8996 rtc = const_contact_pair_slave_orisgrp_id(global_mesh, local_mesh);
8999 rtc = const_contact_pair_master_grp_id(global_mesh, local_mesh);
9014 const char *node_flag,
const char *elem_flag,
9015 int *node_global2local,
int *elem_global2local,
9016 int current_domain) {
9017 int *node_local2global =
NULL;
9018 int *elem_local2global =
NULL;
9023 rtc = set_node_global2local(global_mesh, local_mesh, node_global2local,
9024 node_flag, current_domain);
9028 if (node_local2global ==
NULL) {
9033 if (is_spdup_available(global_mesh)) {
9034 rtc = set_node_local2global_mod(global_mesh, local_mesh, node_global2local,
9035 node_local2global, current_domain);
9037 rtc = set_node_local2global(global_mesh, local_mesh, node_global2local,
9043 rtc = set_elem_global2local(global_mesh, local_mesh, elem_global2local,
9044 elem_flag, current_domain);
9049 if (elem_local2global ==
NULL) {
9054 if (is_spdup_available(global_mesh)) {
9055 rtc = set_elem_local2global_mod(global_mesh, local_mesh, elem_global2local,
9056 elem_local2global, current_domain);
9058 rtc = set_elem_local2global(global_mesh, local_mesh, elem_global2local,
9064 rtc = const_global_info(global_mesh, local_mesh);
9067 rtc = const_node_info(global_mesh, local_mesh, node_local2global, node_flag,
9071 rtc = const_elem_info(global_mesh, local_mesh, node_global2local,
9072 elem_global2local, elem_local2global, current_domain);
9075 rtc = const_comm_info(global_mesh, local_mesh, node_global2local,
9076 elem_global2local, current_domain);
9079 rtc = const_adapt_info(global_mesh, local_mesh);
9082 rtc = const_sect_info(global_mesh, local_mesh);
9085 rtc = const_mat_info(global_mesh, local_mesh);
9088 rtc = const_mpc_info(global_mesh, local_mesh, node_global2local);
9091 rtc = const_amp_info(global_mesh, local_mesh);
9094 rtc = const_node_grp_info(global_mesh, local_mesh, node_global2local,
9098 rtc = const_elem_grp_info(global_mesh, local_mesh, elem_global2local,
9102 rtc = const_surf_grp_info(global_mesh, local_mesh, elem_global2local);
9105 rtc = const_contact_pair_info(global_mesh, local_mesh);
9108 rtc = clear_node_global2local(global_mesh, local_mesh, node_global2local,
9110 rtc = clear_elem_global2local(global_mesh, local_mesh, elem_global2local,
9123 clean_struct_local_mesh(local_mesh);
9134 static int print_ucd_entire_set_node_data(
9150 result_data->
nn_dof[0] = 1;
9170 snprintf(result_data->
node_label[0], label_len,
"rank_of_node");
9172 for (nn_item = 0, i = 0; i < result_data->
nn_component; i++) {
9173 nn_item += result_data->
nn_dof[i];
9176 size =
sizeof(double) * nn_item * global_mesh->
n_node;
9185 for (i = 0; i < global_mesh->
n_node; i++) {
9191 for (i = 0; i < global_mesh->
n_node; i++) {
9197 (double)global_mesh->
node_ID[2 * i + 1];
9211 free_struct_result_data(result_data);
9219 static int print_ucd_entire_set_elem_data(
9235 result_data->
ne_dof[0] = 1;
9255 snprintf(result_data->
elem_label[0], label_len,
"partitioning_image");
9258 for (i = 0; i < global_mesh->
n_elem; i++) {
9279 for (ne_item = 0, i = 0; i < result_data->
ne_component; i++) {
9280 ne_item += result_data->
ne_dof[i];
9283 size =
sizeof(double) * ne_item * global_mesh->
n_elem;
9292 for (i = 0; i < global_mesh->
n_elem; i++) {
9298 (double)global_mesh->
elem_ID[2 * i + 1];
9304 for (i = 0; i < global_mesh->
n_elem; i++) {
9318 free_struct_result_data(result_data);
9326 const char *node_flag,
const char *elem_flag,
9327 const char *ofname) {
9332 if (result_data ==
NULL) {
9336 init_struct_result_data(result_data);
9339 if (print_ucd_entire_set_node_data(global_mesh, result_data, node_flag)) {
9343 if (print_ucd_entire_set_elem_data(global_mesh, result_data, elem_flag)) {
9351 free_struct_result_data(result_data);
9356 free_struct_result_data(result_data);
9428 "ELEMENT-BASED partitioning is not supported with contact "
9429 "pairs; use TYPE=NODE-BASED");
9453 char *node_flag =
NULL;
9454 char *elem_flag =
NULL;
9455 char *node_flag_neighbor =
NULL;
9456 char *elem_flag_neighbor =
NULL;
9457 int *node_global2local =
NULL;
9458 int *elem_global2local =
NULL;
9460 int *num_elem =
NULL, *num_node =
NULL, *num_ielem =
NULL, *num_inode =
NULL,
9462 int *sum_elem =
NULL, *sum_node =
NULL, *sum_ielem =
NULL, *sum_inode =
NULL,
9464 int current_domain, nrank, iS, iE;
9467 int error_in_ompsection = 0;
9469 if (global_mesh ==
NULL) {
9478 rtc = init_partition(global_mesh,
cont_data);
9484 if (global_mesh->
my_rank == 0) {
9503 if (global_mesh->
my_rank == 0) {
9508 "part_out", global_mesh->
n_subdomain, current_domain);
9509 if (ofheader ==
NULL) {
9511 error_in_ompsection = 1;
9514 if (ofheader->
n_mesh == 0) {
9516 error_in_ompsection = 1;
9521 ofname,
sizeof(ofname));
9525 "Starting writing local mesh for domain #%d...",
9539 if (rtc != 0)
goto error;
9541 if (rtc != 0)
goto error;
9543 if (rtc != 0)
goto error;
9545 if (rtc != 0)
goto error;
9548 if (rtc)
goto error;
9556 if (num_elem ==
NULL) {
9561 if (num_node ==
NULL) {
9566 if (num_ielem ==
NULL) {
9571 if (num_inode ==
NULL) {
9576 if (num_nbpe ==
NULL) {
9581 if (sum_elem ==
NULL) {
9586 if (sum_node ==
NULL) {
9591 if (sum_ielem ==
NULL) {
9596 if (sum_inode ==
NULL) {
9601 if (sum_nbpe ==
NULL) {
9606 rtc = wnumbering(global_mesh,
cont_data);
9610 if (global_mesh->
my_rank == 0) {
9611 print_part(global_mesh,
cont_data->part_file_name);
9615 rtc = spdup_makelist_main(global_mesh);
9619 #pragma omp parallel default(none), \
9620 private(node_flag, elem_flag, local_mesh, nrank, iS, iE, i, \
9621 current_domain, rtc, ofheader, ofname), \
9622 private(node_global2local, elem_global2local, \
9623 node_flag_neighbor, elem_flag_neighbor), \
9624 shared(global_mesh, cont_data, num_elem, num_node, \
9625 num_ielem, num_inode, num_nbpe, error_in_ompsection)
9630 if (node_flag ==
NULL) {
9632 error_in_ompsection = 1;
9636 if (elem_flag ==
NULL) {
9638 error_in_ompsection = 1;
9643 if (node_global2local ==
NULL) {
9645 error_in_ompsection = 1;
9649 if (elem_global2local ==
NULL) {
9651 error_in_ompsection = 1;
9654 node_flag_neighbor =
9656 if (node_flag_neighbor ==
NULL) {
9658 error_in_ompsection = 1;
9661 elem_flag_neighbor =
9663 if (elem_flag_neighbor ==
NULL) {
9665 error_in_ompsection = 1;
9668 memset(node_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_node);
9669 memset(elem_flag_neighbor, 0,
sizeof(
char) * global_mesh->
n_elem);
9672 if (local_mesh ==
NULL) {
9673 error_in_ompsection = 1;
9684 #pragma omp for schedule(dynamic, 1), reduction(+ : error_in_ompsection)
9686 for (i = iS; i < iE; i++) {
9687 if (error_in_ompsection)
continue;
9694 rtc = create_neighbor_info(global_mesh, local_mesh, node_flag, elem_flag,
9697 error_in_ompsection = 1;
9702 rtc = create_comm_info(global_mesh, local_mesh, node_flag, elem_flag,
9703 node_flag_neighbor, elem_flag_neighbor,
9706 error_in_ompsection = 1;
9711 rtc = const_local_data(global_mesh, local_mesh,
cont_data, node_flag,
9712 elem_flag, node_global2local, elem_global2local,
9715 error_in_ompsection = 1;
9719 num_elem[i] = local_mesh->
n_elem;
9720 num_node[i] = local_mesh->
n_node;
9726 "part_out", global_mesh->
n_subdomain, current_domain);
9727 if (ofheader ==
NULL) {
9729 error_in_ompsection = 1;
9732 if (ofheader->
n_mesh == 0) {
9734 error_in_ompsection = 1;
9739 ofname,
sizeof(ofname));
9743 "Starting writing local mesh for domain #%d...",
9750 error_in_ompsection = 1;
9756 clean_struct_local_mesh(local_mesh);
9761 if (is_spdup_available(global_mesh)) {
9762 spdup_clear_IEB(node_flag, elem_flag, current_domain);
9765 for (j = 0; j < global_mesh->
n_node; j++) {
9768 for (j = 0; j < global_mesh->
n_elem; j++) {
9774 if (error_in_ompsection)
goto error_omp;
9779 if (global_mesh->
my_rank == 0) {
9780 print_ucd_entire(global_mesh, node_flag, elem_flag,
9796 if (error_in_ompsection)
goto error;
9801 if (rtc != 0)
goto error;
9804 if (rtc != 0)
goto error;
9807 if (rtc != 0)
goto error;
9810 if (rtc != 0)
goto error;
9813 if (rtc != 0)
goto error;
9815 if (global_mesh->
my_rank == 0) {
9818 if (rtc != 0)
goto error;
9820 if (rtc != 0)
goto error;
9822 if (rtc != 0)
goto error;
9824 if (rtc != 0)
goto error;
9826 if (rtc != 0)
goto error;
9829 if (rtc)
goto error;
9844 spdup_freelist(global_mesh);
9877 if (global_mesh ==
NULL) {
9886 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