60 cpl_field->
name =
xmalloc((strlen(field_name) + 1));
61 strcpy(cpl_field->
name, field_name);
74 "ERROR: num_interp_fields > 0 but not interpolation field provided")
143 struct coupling_field * field,
double init_value,
double *** acc) {
148 for (
size_t h = 0; h < collection_size; ++h) {
149 for (
size_t j = 0; j < num_interp_fields; j++) {
156 acc[h][j][m] = init_value;
165 char const * routine_name,
double **** acc) {
169 "ERROR(%s): wrong field exchange type", routine_name)
172 put_idx < field->exchange_data.put.num_puts,
173 "ERROR(%s): put_idx is invalid", routine_name)
175 if (*acc != NULL)
return;
182 *acc =
xmalloc(collection_size *
sizeof(**acc));
184 for (
size_t h = 0; h < collection_size; ++h) {
186 (*acc)[h] =
xmalloc(num_interp_fields *
sizeof(***acc));
188 for (
size_t j = 0; j < num_interp_fields; j++)
203 field, put_idx,
"yac_get_coupling_field_put_op_send_field_acc",
213 field, put_idx,
"yac_get_coupling_field_put_op_send_frac_mask_acc",
222 int const * core_mask =
229 if (core_mask != NULL) {
235 for (
size_t i = 0; (i < field_size) && !flag; ++i)
236 flag = core_mask[i] != 1;
245 int const * field_mask =
252 if (field_mask != NULL) {
258 for (
size_t i = 0; (i < field_size) && !flag; ++i)
259 flag = field_mask[i] != 1;
269 "ERROR(yac_get_coupling_field_put_mask): "
270 "wrong field exchange type")
279 for (
size_t i = 0; (i < num_interp_fields) && !has_mask; ++i)
286 mask =
xmalloc(num_interp_fields *
sizeof(*mask));
289 for (
size_t i = 0; i < num_interp_fields; ++i) {
290 int const * core_mask =
293 int const * field_mask =
298 mask[i] =
xmalloc(field_size *
sizeof(**mask));
299 for (
size_t j = 0; j < field_size; ++j)
300 mask[i][j] = ((core_mask == NULL) || (core_mask[j] != 0)) &&
301 ((field_mask == NULL) || (field_mask[j] != 0));
314 "ERROR(yac_get_coupling_field_put_mask): "
315 "wrong field exchange type")
328 int const * core_mask =
331 int const * field_mask =
336 mask =
xmalloc(field_size *
sizeof(*mask));
337 for (
size_t i = 0; i < field_size; ++i)
338 mask[i] = ((core_mask == NULL) || (core_mask[i] != 0)) &&
339 ((field_mask == NULL) || (field_mask[i] != 0));
348 struct coupling_field * field,
unsigned put_idx,
double init_value) {
352 "ERROR(yac_init_coupling_field_put_op_send_field_acc): "
353 "wrong field exchange type")
356 put_idx < field->exchange_data.put.num_puts,
357 "ERROR(yac_init_coupling_field_put_op_send_field_acc): "
358 "put_idx is invalid")
360 double *** send_field_acc =
369 struct coupling_field * field,
unsigned put_idx,
double init_value) {
373 "ERROR(yac_init_coupling_field_put_op_send_frac_mask_acc): "
374 "wrong field exchange type")
377 put_idx < field->exchange_data.put.num_puts,
378 "ERROR(yac_init_coupling_field_put_op_send_frac_mask_acc): "
379 "put_idx is invalid")
381 double *** send_frac_mask_acc =
396 put_idx < field->exchange_data.put.num_puts,
"ERROR: put_idx is invalid")
408 put_idx < field->exchange_data.put.num_puts,
"ERROR: put_idx is invalid")
420 put_idx < field->exchange_data.put.num_puts,
"ERROR: put_idx is invalid")
427 unsigned put_idx,
int count) {
433 put_idx < field->exchange_data.put.num_puts,
"ERROR: put_idx is invalid")
470 "ERROR: a get operation has already been set (field \"%s\")",
500 "ERROR: a put or get operation has already been set (field \"%s\")",
520 "ERROR(yac_coupling_field_get_datetime): "
521 "datetime is not defined for non-exchanged fields "
522 "(field \"%s\")", cpl_field->
name);
523 struct event *
event =
545 double ***send_field_acc =
547 double ***send_frac_mask_acc =
550 if (send_field_acc != NULL) {
552 for (
size_t j = 0; j < num_interp_fields; ++j)
553 free(send_field_acc[h][j]);
554 free(send_field_acc[h]);
556 free(send_field_acc);
559 if (send_frac_mask_acc != NULL) {
561 for (
size_t j = 0; j < num_interp_fields; ++j)
562 free(send_frac_mask_acc[h][j]);
563 free(send_frac_mask_acc[h]);
565 free(send_frac_mask_acc);
574 for (
size_t i = 0; i < num_interp_fields; ++i)
587 free(cpl_field->
name);
int const * yac_basic_grid_get_field_mask(struct yac_basic_grid *grid, struct yac_interp_field field)
size_t yac_basic_grid_get_data_size(struct yac_basic_grid *grid, enum yac_location location)
int const * yac_basic_grid_get_core_mask(struct yac_basic_grid *grid, enum yac_location location)
void yac_event_delete(struct event *event)
char * yac_get_event_current_datetime(struct event *event, char *datetime_str)
void yac_set_coupling_field_put_op(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation)
unsigned yac_get_coupling_field_collection_size(struct coupling_field *field)
static int check_core_mask(struct coupling_field *field, size_t field_idx)
const char * yac_get_coupling_field_timestep(struct coupling_field *field)
unsigned yac_get_coupling_field_num_puts(struct coupling_field *field)
void yac_set_coupling_field_get_op(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation)
char const * yac_get_coupling_field_comp_name(struct coupling_field *field)
int yac_get_coupling_field_put_op_time_accumulation_count(struct coupling_field *field, unsigned put_idx)
double *** yac_get_coupling_field_put_op_send_frac_mask_acc(struct coupling_field *field, unsigned put_idx)
struct yac_basic_grid * yac_coupling_field_get_basic_grid(struct coupling_field *field)
size_t yac_coupling_field_get_num_interp_fields(struct coupling_field *field)
struct yac_interpolation * yac_get_coupling_field_put_op_interpolation(struct coupling_field *field, unsigned put_idx)
enum yac_location yac_get_coupling_field_get_interp_field_location(struct coupling_field *field, size_t interp_field_idx)
struct event * yac_get_coupling_field_get_op_event(struct coupling_field *field)
static size_t get_interp_field_size(struct yac_interp_field field, struct yac_basic_grid *grid)
size_t yac_coupling_field_get_data_size(struct coupling_field *field, enum yac_location location)
struct yac_interp_field const * yac_coupling_field_get_interp_fields(struct coupling_field *cpl_field)
struct coupling_field * yac_coupling_field_new(char const *field_name, char const *component_name, struct yac_basic_grid *grid, struct yac_interp_field *interp_fields, unsigned num_interp_fields, size_t collection_size, const char *timestep)
int * yac_get_coupling_field_get_mask(struct coupling_field *field)
static void init_put_op_acc(struct coupling_field *field, double init_value, double ***acc)
struct event * yac_get_coupling_field_put_op_event(struct coupling_field *field, unsigned put_idx)
char * yac_coupling_field_get_datetime(struct coupling_field *cpl_field)
void yac_init_coupling_field_put_op_send_field_acc(struct coupling_field *field, unsigned put_idx, double init_value)
struct yac_interpolation * yac_get_coupling_field_get_op_interpolation(struct coupling_field *field)
void yac_set_coupling_field_put_op_time_accumulation_count(struct coupling_field *field, unsigned put_idx, int count)
enum yac_field_exchange_type yac_get_coupling_field_exchange_type(struct coupling_field *field)
const char * yac_get_coupling_field_name(struct coupling_field *field)
static int check_field_mask(struct coupling_field *field, size_t field_idx)
void yac_coupling_field_delete(struct coupling_field *cpl_field)
int ** yac_get_coupling_field_put_mask(struct coupling_field *field)
void yac_init_coupling_field_put_op_send_frac_mask_acc(struct coupling_field *field, unsigned put_idx, double init_value)
static void get_put_op_acc(struct coupling_field *field, unsigned put_idx, char const *routine_name, double ****acc)
double *** yac_get_coupling_field_put_op_send_field_acc(struct coupling_field *field, unsigned put_idx)
void yac_interpolation_delete(struct yac_interpolation *interp)
#define xrealloc(ptr, size)
double *** send_field_acc
int time_accumulation_count
struct coupling_field::@61::@63 get
double *** send_frac_mask_acc
struct coupling_field::@61::@62 put
struct yac_basic_grid * grid
char current_datetime[MAX_DATETIME_STR_LEN]
union coupling_field::@61 exchange_data
struct yac_interp_field * interp_fields
enum yac_field_exchange_type exchange_type
struct coupling_field::@61::@62::@64 * puts
size_t collection_size
number of vertical levels or bundles
struct yac_interpolation * interpolation
enum yac_location location
#define YAC_ASSERT_F(exp, format,...)
#define YAC_ASSERT(exp, msg)