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))
struct hecmw_couple_background_cell * HECMW_couple_set_background_cell(const char *boundary_id, const struct hecmwST_local_mesh *mesh, const struct hecmw_couple_bounding_box *bbox, const struct hecmw_couple_boundary *boundary)
void HECMW_couple_free_background_cell(struct hecmw_couple_background_cell *bgcell)
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_bounding_box * HECMW_couple_set_bounding_box(const char *boundary_id, const struct hecmwST_local_mesh *mesh, const struct hecmw_couple_boundary *boundary)
void HECMW_couple_free_bounding_box(struct hecmw_couple_bounding_box *bbox)
int HECMW_couple_ctrl_get_direction(const char *boundary_id, int *direction)
#define HECMW_COUPLE_UNIT1
#define HECMW_COUPLE_UNIT_UNDEF
#define HECMW_COUPLE_UNIT2_TO_UNIT1
#define HECMWCPL_E_INVALID_ARG
#define HECMW_COUPLE_UNIT1_TO_UNIT2
#define HECMW_COUPLE_UNIT2
#define HECMWCPL_E_INVALID_DIRECTION
int HECMW_couple_is_unit_member(const char *boundary_id, int unit_specifier)
char * HECMW_couple_get_unit_id(const char *boundary_id, int unit_specifier, char *buf, int bufsize)
void HECMW_couple_free_comm(struct hecmw_couple_comm *comm)
struct hecmw_couple_comm * HECMW_couple_get_intracomm(const char *boundary_id, int unit_specifier)
struct hecmw_couple_comm * HECMW_couple_get_intercomm(const char *boundary_id)
struct couple_info couple_list
int HECMW_couple_init(const char *boundary_id, struct hecmwST_local_mesh *mesh_unit1, struct hecmwST_local_mesh *mesh_unit2)
struct hecmw_couple_info * HECMW_couple_get_info(const char *boundary_id)
void HECMW_couple_free_init(const char *boundary_id)
void HECMW_couple_free_inter_iftable(struct hecmw_couple_inter_iftable *p)
struct hecmw_couple_inter_iftable * HECMW_couple_set_map_data(const struct hecmwST_local_mesh *mesh_src, const struct hecmwST_local_mesh *mesh_dst, const struct hecmw_couple_comm *comm_src, const struct hecmw_couple_comm *comm_dst, const struct hecmw_couple_comm *intercomm, const struct hecmw_couple_boundary *boundary_src, const struct hecmw_couple_bounding_box *bbox_src, const struct hecmw_couple_bounding_box *bbox_dst, const struct hecmw_couple_background_cell *bgcell_src, const struct hecmw_couple_mapped_point *mapped_point)
struct hecmw_couple_weight_list * HECMW_couple_make_main_ip_list(const struct hecmwST_local_mesh *mesh_src, const struct hecmwST_local_mesh *mesh_dst, const struct hecmw_couple_boundary *boundary_src, const struct hecmw_couple_boundary *boundary_dst, const struct hecmw_couple_mapped_point *mapped_point, const struct hecmw_couple_comm *comm_src, const struct hecmw_couple_comm *comm_dst, const struct hecmw_couple_comm *intercomm, const struct hecmw_couple_inter_iftable *inter_tbl)
struct hecmw_couple_weight_list * HECMW_couple_make_post_ip_list(const struct hecmwST_local_mesh *mesh_dst, const struct hecmw_couple_boundary *boundary_dst, const struct hecmw_couple_mapped_point *mapped_point, const struct hecmw_couple_comm *comm_dst, const struct hecmw_couple_intra_iftable *intra_tbl_dst)
struct hecmw_couple_weight_list * HECMW_couple_make_pre_ip_list(const struct hecmwST_local_mesh *mesh_src, const struct hecmw_couple_boundary *boundary_src, const struct hecmw_couple_comm *comm_src, const struct hecmw_couple_intra_iftable *intra_tbl_src)
void HECMW_couple_free_intra_iftable(struct hecmw_couple_intra_iftable *p)
struct hecmw_couple_intra_iftable * HECMW_couple_make_intra_iftable(const struct hecmwST_local_mesh *mesh, const struct hecmw_couple_boundary *boundary, const struct hecmw_couple_comm *intracomm)
struct hecmw_couple_mapped_point * HECMW_couple_set_mapped_point(const char *boundary_id, const struct hecmwST_local_mesh *mesh_dst, const struct hecmw_couple_boundary *boundary_dst)
void HECMW_couple_free_mapped_point(struct hecmw_couple_mapped_point *p)
void HECMW_couple_free_weight_list(struct hecmw_couple_weight_list *r)
int HECMW_set_error(int errorno, const char *fmt,...)
#define HECMW_malloc(size)
struct hecmw_couple_intra_iftable * intra_tbl_dst
struct hecmw_couple_mapped_point * mapped_point
struct hecmw_couple_weight_list * ip_list_pre
struct hecmw_couple_comm * comm_src
struct hecmw_couple_comm * comm_dst
struct hecmw_couple_comm * intercomm
struct hecmw_couple_boundary * boundary_dst
struct hecmw_couple_weight_list * ip_list_post
struct hecmw_couple_weight_list * ip_list_main
struct hecmw_couple_boundary * boundary_src
struct hecmw_couple_intra_iftable * intra_tbl_src
struct hecmw_couple_inter_iftable * inter_tbl
struct hecmw_couple_weight_list * next