43 double * cell_point_data,
double * corner_point_data,
50 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
52 MPI_Barrier(MPI_COMM_WORLD);
57 char const ** comp_names = malloc((
size_t)nbr_comps *
sizeof(*comp_names));
59 size_t local_comp_idx = SIZE_MAX;
60 for (
int i = 0; i < nbr_comps; ++i) comp_names[i] = strdup(comp_names[i]);
65 for (
int comp_idx = 0, i = 0; comp_idx < nbr_comps; ++comp_idx) {
66 if (!strcmp(comp_name, comp_names[comp_idx]))
67 local_comp_idx = (size_t)comp_idx;
73 comp_names[comp_idx]);
82 point_id_ptr = &corner_point_id;
84 field_name,
comp_id, point_id_ptr, 1, 1,
"2",
97 if (!strcmp(interp_name,
"conserv")) {
100 }
else if (!strcmp(interp_name,
"2nd_conserv")) {
103 }
else if (!strcmp(interp_name,
"avg")) {
106 }
else if (!strcmp(interp_name,
"hcsbb")) {
108 }
else if (!strcmp(interp_name,
"rbf")) {
114 stderr,
"unsupported interpolation type: \"%s\"\n", interp_name);
119 for (
int src_comp_idx = 0; src_comp_idx < nbr_comps; ++src_comp_idx) {
124 for (
int tgt_comp_idx = 0; tgt_comp_idx < nbr_comps; ++tgt_comp_idx) {
126 if (src_comp_idx == tgt_comp_idx)
continue;
131 char field_name[256];
133 field_name,
"%s_%s_field_out", interp_name,
134 comp_names[src_comp_idx]);
140 interp_config, 0, 0);
148 MPI_Barrier(MPI_COMM_WORLD);
151 "toy_multi_common(%s): Time for field/interpolation definition %f\n",
152 comp_name, MPI_Wtime()-tic);
156 MPI_Barrier(MPI_COMM_WORLD);
161 MPI_Barrier(MPI_COMM_WORLD);
164 "toy_multi_common(%s): Time for search %f\n",
165 comp_name, MPI_Wtime()-tic);
169 double ** field_buffers =
171 for (
int comp_idx = 0, i = 0; comp_idx < nbr_comps; ++comp_idx) {
175 if ((
size_t)comp_idx == local_comp_idx) {
178 cell_point_data:corner_point_data;
184 field_buffers[i] = malloc(data_size *
sizeof(**field_buffers));
185 for (
size_t j = 0; j < data_size; ++j)
186 field_buffers[i][j] = -10.0;
193 MPI_Barrier(MPI_COMM_WORLD);
199 double *point_set_data[1] = {field_buffers[offset + interp_idx]};
200 double **collection_data[1] = {point_set_data};
202 yac_cput(field_ids[offset + interp_idx], 1, collection_data, &info, &err);
205 for (
int comp_idx = 0, i = 0; comp_idx < nbr_comps; ++comp_idx) {
209 if ((
size_t)comp_idx == local_comp_idx)
continue;
211 double *collection_data[1];
213 collection_data[0] = field_buffers[i];
214 yac_cget(field_ids[i], 1, collection_data, &info, &err);
218 MPI_Barrier(MPI_COMM_WORLD);
221 "toy_multi_common(%s): Time for exchange %f\n",
222 comp_name, MPI_Wtime()-tic);
227 vtk_file, cell_point_data,
230 vtk_file, corner_point_data,
233 for (
int comp_idx = 0, i = 0; comp_idx < nbr_comps; ++comp_idx) {
237 if ((
size_t)comp_idx != local_comp_idx) {
239 char field_name[256];
242 comp_names[comp_idx]);
246 vtk_file, field_buffers[i],
251 vtk_file, field_buffers[i],
266 for (
int comp_idx = 0, i = 0; comp_idx < nbr_comps; ++comp_idx)
269 if ((
size_t)comp_idx != local_comp_idx) free(field_buffers[i]);
void yac_cdef_field(char const *name, int const comp_id, int const *point_ids, int const num_pointsets, int collection_size, const char *timestep, int time_unit, int *field_id)
void yac_cdef_couple(char const *src_comp_name, char const *src_grid_name, char const *src_field_name, char const *tgt_comp_name, char const *tgt_grid_name, char const *tgt_field_name, char const *coupling_timestep, int time_unit, int time_reduction, int interp_stack_config_id, int src_lag, int tgt_lag)