30 static void free_link_list(
struct link_list *r) {
33 for (p = r; p; p = q) {
41 if (boundary ==
NULL)
return;
68 if (boundary ==
NULL) {
85 boundary->
node->
n = 0;
93 boundary->
elem->
n = 0;
101 boundary->
surf->
n = 0;
116 static int check_group_name(
int n_grp_mesh,
char **grp_name_mesh,
117 const char *grp_name_ctrl) {
120 for (i = 0; i < n_grp_mesh; i++) {
121 if ((strcmp(grp_name_ctrl, grp_name_mesh[i])) == 0)
return i;
132 for (i = 0; i < group->
n_grp; i++) {
149 for (i = 0; i < group->
n_grp; i++) {
166 for (i = 0; i < group->
n_grp; i++) {
184 int node, index, n, i, j;
187 if (group->
n_grp == 0)
return 0;
199 for (i = 0; i < group->
n_grp; i++) {
205 j < mesh->node_group->grp_index[index + 1]; j++) {
215 boundary->
node->
n = n;
216 if (boundary->
node->
n == 0) {
244 int elem, index, n, i, j;
247 if (group->
n_grp == 0)
return 0;
259 for (i = 0; i < group->
n_grp; i++) {
265 j < mesh->elem_group->grp_index[index + 1]; j++) {
275 boundary->
elem->
n = n;
276 if (boundary->
elem->
n == 0) {
303 int elem, node, size, n, i;
316 for (n = 0, i = 0; i < boundary->
elem->
n; i++) {
321 if (mask[node - 1] < 0) {
322 mask[node - 1] = n++;
329 if (mask[i] >= 0) n++;
331 boundary->
node->
n = n;
332 if (boundary->
node->
n == 0) {
345 boundary->
node->
item[mask[i]] = i + 1;
356 for (i = 0; i < boundary->
elem->
n; i++) {
369 for (n = 0, i = 0; i < boundary->
elem->
n; i++) {
390 int size, index, elem, surf, is_exist,
n, i, j;
393 if (group->
n_grp == 0)
return 0;
407 for (
n = 0, i = 0; i < group->
n_grp; i++) {
413 j < mesh->surf_group->grp_index[index + 1]; j++) {
441 if (boundary->
surf->
n == 0) {
454 for (p = mask[i].
next; p; p = p->
next) {
462 free_link_list(mask[i].
next);
470 free_link_list(mask[i].
next);
480 int elem, surf, node, offset, size,
n, i, j;
481 long long node_index;
492 for (
n = 0, i = 0; i < boundary->
surf->
n; i++) {
494 surf = boundary->
surf->
item[2 * i + 1];
499 for (j = 0; j < 3; j++) {
500 offset = hecmw_surf_node_table_tet1[surf - 1][j];
502 if (mask[node - 1] < 0) {
503 mask[node - 1] =
n++;
508 for (j = 0; j < 4; j++) {
509 offset = hecmw_surf_node_table_hex1[surf - 1][j];
511 if (mask[node - 1] < 0) {
512 mask[node - 1] =
n++;
524 if (mask[i] >= 0)
n++;
527 if (boundary->
node->
n == 0) {
540 boundary->
node->
item[mask[i]] = i + 1;
551 for (i = 0; i < boundary->
surf->
n; i++) {
566 for (
n = 0, i = 0; i < boundary->
surf->
n; i++) {
568 surf = boundary->
surf->
item[2 * i + 1];
572 for (j = 0; j < 3; j++) {
573 offset = hecmw_surf_node_table_tet1[surf - 1][j];
579 for (j = 0; j < 4; j++) {
580 offset = hecmw_surf_node_table_hex1[surf - 1][j];
602 const char *boundary_id,
int unit_specifier,
607 if (boundary_id ==
NULL) {
609 "HECMW_couple_set_boundary_info(): 'boundary_id' is NULL");
614 "HECMW_couple_set_boundary_info(): 'mesh' is NULL");
627 "In current version, node group is not supported");
640 "In current version, element group is not supported");
655 if (check_surf_group_name(
mesh, group))
goto error;
656 if (set_boundary_surf_by_surf(
mesh, group, boundary))
goto error;
657 if (set_boundary_node_by_surf(
mesh, boundary))
goto error;
struct hecmw_couple_boundary * HECMW_couple_alloc_boundary_info(void)
void HECMW_couple_free_boundary_info(struct hecmw_couple_boundary *boundary)
struct hecmw_couple_boundary * HECMW_couple_set_boundary_info(const char *boundary_id, int unit_specifier, const struct hecmwST_local_mesh *mesh)
struct hecmw_couple_group * HECMW_couple_ctrl_get_group(const char *boundary_id, int unit_specifier)
void HECMW_couple_ctrl_free_group(struct hecmw_couple_group *grp_info)
#define HECMW_COUPLE_ELEMENT_GROUP
#define HECMW_COUPLE_TRUE
#define HECMWCPL_E_NONSUPPORT_GEOMTYPE
#define HECMW_COUPLE_NODE_GROUP
#define HECMWCPL_E_UNDEF_GRPNAME
#define HECMW_COUPLE_FALSE
#define HECMWCPL_E_NONSUPPORT_ETYPE
#define HECMW_COUPLE_GROUP_UNDEF
#define HECMWCPL_E_INVALID_ARG
#define HECMW_COUPLE_SURFACE_GROUP
#define HECMWCPL_E_INVALID_GEOMTYPE
struct hecmwST_local_mesh * mesh
int HECMW_set_error(int errorno, const char *fmt,...)
int HECMW_get_max_node(int etype)
#define HECMW_calloc(nmemb, size)
#define HECMW_malloc(size)
#define HECMW_assert(cond)
struct hecmw_couple_boundary_item * elem
struct hecmw_couple_boundary_item * node
struct hecmw_couple_boundary_item * surf
struct hecmwST_node_grp * node_group
struct hecmwST_surf_grp * surf_group
long long * elem_node_index
struct hecmwST_elem_grp * elem_group