FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_couple_interpolate_info.c
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <errno.h>
10 #include <assert.h>
11 
12 #include "hecmw_struct.h"
13 #include "hecmw_couple_define.h"
14 #include "hecmw_couple_struct.h"
18 #include "hecmw_couple_weight.h"
26 
28  const struct hecmwST_local_mesh *mesh_src,
29  const struct hecmw_couple_boundary *boundary_src,
30  const struct hecmw_couple_comm *comm_src,
31  const struct hecmw_couple_intra_iftable *intra_tbl_src) {
32  struct hecmw_couple_weight_list *weight_list = NULL, *p;
33 
34  if (mesh_src == NULL) {
36  "HECMW_couple_make_pre_ip_list(): 'mesh_src' is NULL");
37  return NULL;
38  }
39  if (boundary_src == NULL) {
41  "HECMW_couple_make_pre_ip_list(): 'boundary_src' is NULL");
42  return NULL;
43  }
44  if (comm_src == NULL) {
46  "HECMW_couple_make_pre_ip_list(): 'comm_src' is NULL");
47  return NULL;
48  }
49 
50  if ((weight_list = HECMW_couple_alloc_weight_list()) == NULL) goto error;
51  p = weight_list;
52 
53  if (boundary_src->data_type ==
54  HECMW_COUPLE_NODE_GROUP) { /* node group */
55  p->next = NULL;
56 
57  } else if (boundary_src->data_type ==
58  HECMW_COUPLE_SURFACE_GROUP) { /* surface group */
59  p->next = HECMW_couple_s2n_average(mesh_src, boundary_src);
60  /* p->next = HECMW_couple_s2n_with_area(mesh_src, boundary_src);
61  */
62  if (p->next == NULL) goto error;
63 
64 #if 0
65  } else if(boundary_src->data_type == HECMW_COUPLE_ELEMENT_GROUP) { /* element group */
66  p->next = HECMW_couple_e2n_by_average(mesh_src, boundary_src);
67  if(p->next == NULL) goto error;
68 #endif
69 
70  } else {
72  goto error;
73  }
74 
75  return weight_list;
76 
77 error:
78  return NULL;
79 }
80 
82  const struct hecmwST_local_mesh *mesh_src,
83  const struct hecmwST_local_mesh *mesh_dst,
84  const struct hecmw_couple_boundary *boundary_src,
85  const struct hecmw_couple_boundary *boundary_dst,
86  const struct hecmw_couple_mapped_point *mapped_point,
87  const struct hecmw_couple_comm *comm_src,
88  const struct hecmw_couple_comm *comm_dst,
89  const struct hecmw_couple_comm *intercomm,
90  const struct hecmw_couple_inter_iftable *inter_tbl) {
91  struct hecmw_couple_weight_list *weight_list = NULL, *p;
92 
93  if (comm_src == NULL) {
95  "HECMW_couple_make_main_ip_list(): 'comm_src' is NULL");
96  goto error;
97  }
98  if (comm_dst == NULL) {
100  "HECMW_couple_make_main_ip_list(): 'comm_dst' is NULL");
101  goto error;
102  }
103  if (intercomm == NULL) {
105  "HECMW_couple_make_main_ip_list(): 'intercomm' is NULL");
106  goto error;
107  }
108  if (inter_tbl == NULL) {
110  "HECMW_couple_make_main_ip_list(): 'inter_tbl' is NULL");
111  goto error;
112  }
113  if (comm_src->is_member) {
114  if (mesh_src == NULL) {
116  "HECMW_couple_make_main_ip_list(): 'mesh_src' is NULL");
117  goto error;
118  }
119  if (boundary_src == NULL) {
122  "HECMW_couple_make_main_ip_list(): 'boundary_src' is NULL");
123  goto error;
124  }
125  }
126  if (comm_dst->is_member) {
127  if (mesh_dst == NULL) {
129  "HECMW_couple_make_main_ip_list(): 'mesh_dst' is NULL");
130  goto error;
131  }
132  if (boundary_dst == NULL) {
135  "HECMW_couple_make_main_ip_list(): 'boundary_dst' is NULL");
136  goto error;
137  }
138  if (mapped_point == NULL) {
141  "HECMW_couple_make_main_ip_list(): 'mapped_point' is NULL");
142  goto error;
143  }
144  }
145 
146  if ((weight_list = HECMW_couple_alloc_weight_list()) == NULL) goto error;
147  p = weight_list;
148 
149  if (boundary_src->data_type == HECMW_COUPLE_NODE_GROUP) {
150  p->next = HECMW_couple_s2n_dist_node(mesh_src, mesh_dst, comm_src, comm_dst,
151  intercomm, boundary_src, boundary_dst,
152  mapped_point, inter_tbl);
153  if (p->next == NULL) goto error;
154 
155  } else if (boundary_src->data_type == HECMW_COUPLE_SURFACE_GROUP) {
156  p->next = HECMW_couple_s2n_dist_surf(mesh_src, mesh_dst, comm_src, comm_dst,
157  intercomm, boundary_src, boundary_dst,
158  mapped_point, inter_tbl);
159  if (p->next == NULL) goto error;
160 
161 #if 0
162  } else if(boundary_src->data_type == HECMW_COUPLE_ELEMENT_GROUP) {
163 #endif
164 
165  } else {
167  goto error;
168  }
169 
170  return weight_list;
171 
172 error:
173  return NULL;
174 }
175 
177  const struct hecmwST_local_mesh *mesh_dst,
178  const struct hecmw_couple_boundary *boundary_dst,
179  const struct hecmw_couple_mapped_point *mapped_point,
180  const struct hecmw_couple_comm *comm_dst,
181  const struct hecmw_couple_intra_iftable *intra_tbl_dst) {
182  struct hecmw_couple_weight_list *weight_list = NULL, *p;
183 
184  if (mesh_dst == NULL) {
186  "HECMW_couple_make_post_ip_list(): 'mesh_dst' is NULL");
187  return NULL;
188  }
189  if (boundary_dst == NULL) {
191  "HECMW_couple_make_post_ip_list(): 'boundary_dst' is NULL");
192  return NULL;
193  }
194  if (mapped_point == NULL) {
196  "HECMW_couple_make_post_ip_list(): 'mapped_point' is NULL");
197  return NULL;
198  }
199  if (comm_dst == NULL) {
201  "HECMW_couple_make_post_ip_list(): 'comm_dst' is NULL");
202  return NULL;
203  }
204 
205  if ((weight_list = HECMW_couple_alloc_weight_list()) == NULL) goto error;
206  p = weight_list;
207 
208  if (boundary_dst->data_type ==
209  HECMW_COUPLE_NODE_GROUP) { /* node group */
210  p->next = NULL;
211 
212  } else if (boundary_dst->data_type ==
213  HECMW_COUPLE_SURFACE_GROUP) { /* surface group */
214  p->next = HECMW_couple_n2s_average(mesh_dst, boundary_dst, comm_dst,
215  intra_tbl_dst);
216  /* p->next = HECMW_couple_n2s_with_area(mesh_dst, boundary_dst);
217  */
218  if (p->next == NULL) goto error;
219 
220 #if 0
221  } else if(boundary_dst->data_type == HECMW_COUPLE_ELEMENT_GROUP) { /* element group */
222 #endif
223 
224  } else {
226  goto error;
227  }
228 
229  return weight_list;
230 
231 error:
232  return NULL;
233 }
hecmw_couple_boundary::data_type
int data_type
Definition: hecmw_couple_boundary_info.h:20
hecmw_couple_mapped_point.h
hecmw_couple_weight_list::next
struct hecmw_couple_weight_list * next
Definition: hecmw_couple_weight.h:19
HECMW_couple_s2n_dist_node
struct hecmw_couple_weight_list * HECMW_couple_s2n_dist_node(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_boundary *boundary_dst, const struct hecmw_couple_mapped_point *mapped_point, const struct hecmw_couple_inter_iftable *inter_tbl)
Definition: hecmw_couple_s2n_dist_node.c:324
HECMW_couple_s2n_average
struct hecmw_couple_weight_list * HECMW_couple_s2n_average(const struct hecmwST_local_mesh *mesh, const struct hecmw_couple_boundary *boundary)
Definition: hecmw_couple_s2n_average.c:184
hecmw_couple_weight.h
hecmw_couple_s2n_with_area.h
hecmwST_local_mesh
Definition: hecmw_struct.h:139
hecmw_couple_boundary
Definition: hecmw_couple_boundary_info.h:18
HECMW_COUPLE_ELEMENT_GROUP
#define HECMW_COUPLE_ELEMENT_GROUP
Definition: hecmw_couple_define.h:37
hecmw_couple_weight_list
Definition: hecmw_couple_weight.h:17
HECMWCPL_E_INVALID_DATATYPE
#define HECMWCPL_E_INVALID_DATATYPE
Definition: hecmw_couple_define.h:169
hecmw_couple_n2s_average.h
hecmw_couple_intra_iftable
Definition: hecmw_couple_intra_iftable.h:13
HECMW_couple_s2n_dist_surf
struct hecmw_couple_weight_list * HECMW_couple_s2n_dist_surf(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_boundary *boundary_dst, const struct hecmw_couple_mapped_point *mapped_point, const struct hecmw_couple_inter_iftable *inter_tbl)
Definition: hecmw_couple_s2n_dist_surf.c:418
hecmw_struct.h
HECMW_couple_make_main_ip_list
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)
Definition: hecmw_couple_interpolate_info.c:81
hecmw_couple_comm::is_member
int is_member
Definition: hecmw_couple_struct.h:23
hecmw_couple_comm
Definition: hecmw_couple_struct.h:12
hecmw_couple_s2n_dist_node.h
HECMW_couple_n2s_average
struct hecmw_couple_weight_list * HECMW_couple_n2s_average(const struct hecmwST_local_mesh *mesh, const struct hecmw_couple_boundary *boundary, const struct hecmw_couple_comm *intracomm, const struct hecmw_couple_intra_iftable *intra_tbl)
Definition: hecmw_couple_n2s_average.c:270
HECMW_COUPLE_NODE_GROUP
#define HECMW_COUPLE_NODE_GROUP
Definition: hecmw_couple_define.h:35
HECMW_COUPLE_SURFACE_GROUP
#define HECMW_COUPLE_SURFACE_GROUP
Definition: hecmw_couple_define.h:39
HECMW_couple_make_pre_ip_list
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)
Definition: hecmw_couple_interpolate_info.c:27
hecmw_couple_inter_iftable
Definition: hecmw_couple_inter_iftable.h:16
hecmw_couple_struct.h
hecmw_couple_interpolate_info.h
hecmw_couple_boundary_info.h
hecmw_couple_mapped_point
Definition: hecmw_couple_mapped_point.h:12
HECMW_couple_make_post_ip_list
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)
Definition: hecmw_couple_interpolate_info.c:176
HECMW_set_error
int HECMW_set_error(int errorno, const char *fmt,...)
Definition: hecmw_error.c:37
hecmw_couple_s2n_average.h
NULL
#define NULL
Definition: hecmw_io_nastran.c:30
HECMWCPL_E_INVALID_ARG
#define HECMWCPL_E_INVALID_ARG
Definition: hecmw_couple_define.h:91
hecmw_couple_inter_iftable.h
HECMW_couple_alloc_weight_list
struct hecmw_couple_weight_list * HECMW_couple_alloc_weight_list(void)
Definition: hecmw_couple_weight.c:44
hecmw_couple_n2s_with_area.h
hecmw_couple_s2n_dist_surf.h
hecmw_couple_define.h