33 struct couple_info *next;
43 if (p ==
NULL)
return;
74 static void free_couple_list(
struct couple_info *p) {
75 if (p ==
NULL)
return;
77 free_couple_info(p->couple_info);
108 static struct couple_info *alloc_couple_list(
void) {
109 struct couple_info *p =
NULL;
111 p = (
struct couple_info *)
HECMW_malloc(
sizeof(
struct couple_info));
116 p->boundary_id =
NULL;
117 p->couple_info =
NULL;
120 if ((p->couple_info = alloc_couple_info()) ==
NULL) {
128 static struct couple_info *cmp_couple_list(
const char *boundary_id) {
129 struct couple_info *p;
132 if (strcmp(p->boundary_id, boundary_id) == 0)
return p;
138 static void del_couple_list(
const char *boundary_id) {
139 struct couple_info *p, *q;
142 if (strcmp(p->boundary_id, boundary_id) == 0) {
150 static int add_couple_list(
const char *boundary_id,
int unit_specifier_src,
151 int unit_specifier_dst,
164 struct couple_info *p =
NULL;
166 if ((p = cmp_couple_list(boundary_id)) !=
NULL) {
171 if ((p = alloc_couple_list()) ==
NULL)
return -1;
174 if (p->boundary_id ==
NULL) {
179 p->couple_info->unit_specifier_src = unit_specifier_src;
180 p->couple_info->unit_specifier_dst = unit_specifier_dst;
182 p->couple_info->comm_src = comm_src;
183 p->couple_info->comm_dst = comm_dst;
184 p->couple_info->intercomm = intercomm;
185 p->couple_info->boundary_src = boundary_src;
186 p->couple_info->boundary_dst = boundary_dst;
187 p->couple_info->intra_tbl_src = intra_tbl_src;
188 p->couple_info->intra_tbl_dst = intra_tbl_dst;
189 p->couple_info->inter_tbl = inter_tbl;
190 p->couple_info->mapped_point = mapped_point;
191 p->couple_info->ip_list_pre = ip_list_pre;
192 p->couple_info->ip_list_main = ip_list_main;
193 p->couple_info->ip_list_post = ip_list_post;
205 const char *boundary_id) {
206 struct couple_info *p;
208 if (boundary_id ==
NULL) {
210 "HECMW_couple_get_info(): 'boundary_id' is NULL");
214 if ((p = cmp_couple_list(boundary_id)) ==
NULL) {
219 return p->couple_info;
225 del_couple_list(boundary_id);
238 *intra_tbl_dst =
NULL;
245 int is_unit1_memb, is_unit2_memb, is_src_memb, is_dst_memb;
246 int unit_specifier_src, unit_specifier_dst;
250 if (boundary_id ==
NULL) {
252 "HECMW_couple_init(): 'boundary_id' is NULL");
261 if (is_unit1_memb && mesh_unit1 ==
NULL) {
263 "HECMW_couple_init(): 'mesh_unit1' is NULL");
266 if (is_unit2_memb && mesh_unit2 ==
NULL) {
268 "HECMW_couple_init(): 'mesh_unit2' is NULL");
277 is_src_memb = is_unit1_memb;
278 is_dst_memb = is_unit2_memb;
279 mesh_src = mesh_unit1;
280 mesh_dst = mesh_unit2;
282 }
else if (direction ==
286 is_src_memb = is_unit2_memb;
287 is_dst_memb = is_unit1_memb;
288 mesh_src = mesh_unit2;
289 mesh_dst = mesh_unit1;
312 unit_specifier_src, mesh_src);
313 if (boundary_src ==
NULL)
goto error;
317 if (bbox_src ==
NULL)
goto error;
320 bbox_src, boundary_src);
321 if (bgcell_src ==
NULL)
goto error;
325 if (intra_tbl_src ==
NULL)
goto error;
330 unit_specifier_dst, mesh_dst);
331 if (boundary_dst ==
NULL)
goto error;
335 if (bbox_dst ==
NULL)
goto error;
338 bbox_dst, boundary_dst);
339 if (bgcell_dst ==
NULL)
goto error;
343 if (mapped_point_dst ==
NULL)
goto error;
347 if (intra_tbl_dst ==
NULL)
goto error;
352 intercomm, boundary_src, bbox_src,
353 bbox_dst, bgcell_src, mapped_point_dst);
354 if (inter_tbl ==
NULL)
goto error;
359 comm_src, intra_tbl_src);
360 if (ip_list_pre ==
NULL)
goto error;
364 mesh_src, mesh_dst, boundary_src, boundary_dst, mapped_point_dst,
365 comm_src, comm_dst, intercomm, inter_tbl);
366 if (ip_list_main ==
NULL)
goto error;
368 if (comm_dst->is_member) {
370 mesh_dst, boundary_dst, mapped_point_dst, comm_dst, intra_tbl_dst);
371 if (ip_list_post ==
NULL)
goto error;
374 if (add_couple_list(boundary_id, unit_specifier_src, unit_specifier_dst,
375 comm_src, comm_dst, intercomm, boundary_src, boundary_dst,
376 intra_tbl_src, intra_tbl_dst, inter_tbl, mapped_point_dst,
377 ip_list_pre, ip_list_main, ip_list_post))