YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
fields.c
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#include <stdlib.h>
6#include <string.h>
7#include "event.h"
8#include "utils_mci.h"
9#include "utils_common.h"
10#include "fields.h"
11#include "yac_pak.h"
15
17
18 // general field related information
19
20 char * name;
21
23
25
29 char* timestep;
30
31 char current_datetime[MAX_DATETIME_STR_LEN];
32 char prev_datetime[MAX_DATETIME_STR_LEN];
33
34 // data exchange
35
37
38 union {
39 struct {
40 struct {
41 struct event * event;
45 double *** send_field_acc;
48 } * puts;
49 unsigned num_puts;
50 int ** mask;
51 } put;
52 struct {
53 struct event * event;
54 struct yac_interpolation * interpolation;
55 struct yac_interpolation_exchange * interpolation_exchange; // for raw exchange
56 struct yac_interp_weights_data interp_weights_data; // for raw exchange
57 int * mask;
58 int use_raw_exchange;
59 } get;
61
63 struct yac_pak * pak;
64};
65
66struct coupling_field *
67yac_coupling_field_new(char const * field_name, char const * component_name,
69 unsigned num_interp_fields, size_t collection_size, const char* timestep) {
70
71 struct coupling_field * cpl_field = xmalloc(1 * sizeof(*cpl_field));
72
73 cpl_field->name = xmalloc((strlen(field_name) + 1));
74 strcpy(cpl_field->name, field_name);
76 cpl_field->grid = grid;
77 cpl_field->interp_fields = NULL;
78 cpl_field->num_interp_fields = (size_t)num_interp_fields;
80 cpl_field->timestep = xstrdup(timestep);
81 cpl_field->exchange_type = NOTHING;
82 cpl_field->pak = NULL;
83
84 if (num_interp_fields != 0) {
85
87 interp_fields != NULL,
88 "num_interp_fields > 0 but no interpolation field provided")
89
90 cpl_field->interp_fields =
91 xmalloc((size_t)num_interp_fields * sizeof(*(cpl_field->interp_fields)));
92 memcpy(cpl_field->interp_fields, interp_fields,
93 (size_t)num_interp_fields * sizeof(*(cpl_field->interp_fields)));
94
95 }
96
97 return cpl_field;
98}
99
101
102 return field->collection_size;
103}
104
106
107 return field->timestep;
108}
109
111
112 return field->num_interp_fields;
113}
114
115enum yac_location
117 struct coupling_field * field, size_t interp_field_idx) {
118
119 return field->interp_fields[interp_field_idx].location;
120}
121
122const char * yac_get_coupling_field_name(struct coupling_field * field) {
123
124 return field->name;
125}
126
128 struct coupling_field * field) {
129
130 return field->grid;
131}
132
134
135 YAC_ASSERT(field->component_name, "component name undefined")
136
137 return field->component_name;
138}
139
142
143 return field->exchange_type;
144}
145
147 struct yac_interp_field field, struct yac_basic_grid * grid) {
148
149 return yac_basic_grid_get_data_size(grid, field.location);
150}
151
153 struct coupling_field * field, enum yac_location location) {
154
155 return yac_basic_grid_get_data_size(field->grid, location);
156}
157
158static void init_put_op_acc(
159 struct coupling_field * field, double init_value, double *** acc) {
160
161 size_t num_interp_fields = field->num_interp_fields;
162 size_t collection_size = field->collection_size;
163
164 for (size_t h = 0; h < collection_size; ++h) {
165 for (size_t j = 0; j < num_interp_fields; j++) {
166 size_t num_points =
167 get_interp_field_size(field->interp_fields[j], field->grid);
169 {
171 for (size_t m = 0; m < num_points; m++ ) {
172 acc[h][j][m] = init_value;
173 }
174 }
175 }
176 }
177}
178
179static void get_put_op_acc(
180 struct coupling_field * field, unsigned put_idx,
181 char const * routine_name, double **** acc) {
182
184 field->exchange_type == SOURCE, routine_name, "wrong field exchange type")
185
187 put_idx < field->exchange_data.put.num_puts, routine_name,
188 "put_idx is invalid")
189
190 if (*acc != NULL) return;
191
192 size_t num_interp_fields = field->num_interp_fields;
193 size_t collection_size = field->collection_size;
194
195 /* Allocate memory for the accumulation */
196
197 *acc = xmalloc(collection_size * sizeof(**acc));
198
199 for (size_t h = 0; h < collection_size; ++h) {
200
201 (*acc)[h] = xmalloc(num_interp_fields * sizeof(***acc));
202
203 for (size_t j = 0; j < num_interp_fields; j++)
204 (*acc)[h][j] =
205 xmalloc(
207 field->interp_fields[j], field->grid) * sizeof(****acc));
208 }
209
210 /* Initialise memory for the accumulation */
211 init_put_op_acc(field, 0.0, *acc);
212}
213
215 struct coupling_field * field, unsigned put_idx) {
216
218 field, put_idx, __func__,
219 &(field->exchange_data.put.puts[put_idx].send_field_acc));
220
221 return field->exchange_data.put.puts[put_idx].send_field_acc;
222}
223
225 struct coupling_field * field, unsigned put_idx) {
226
228 field, put_idx, __func__,
229 &(field->exchange_data.put.puts[put_idx].send_frac_mask_acc));
230
231 return field->exchange_data.put.puts[put_idx].send_frac_mask_acc;
232}
233
235 struct coupling_field * field, size_t field_idx) {
236
237 int const * core_mask =
239 field->grid, field->interp_fields[field_idx].location);
240
241 int flag = 0;
242
243 // if the core mask is defined
244 if (core_mask != NULL) {
245
246 size_t field_size =
247 get_interp_field_size(field->interp_fields[field_idx], field->grid);
248
249 // check if the core mask contains values other than 1
250 for (size_t i = 0; (i < field_size) && !flag; ++i)
251 flag = core_mask[i] != 1;
252 }
253
254 return flag;
255}
256
258 struct coupling_field * field, size_t field_idx) {
259
260 int const * field_mask =
262 field->grid, field->interp_fields[field_idx]);
263
264 int flag = 0;
265
266 // if a field mask is defined
267 if (field_mask != NULL) {
268
269 size_t field_size =
270 get_interp_field_size(field->interp_fields[field_idx], field->grid);
271
272 // check if the core mask contains values other than 1
273 for (size_t i = 0; (i < field_size) && !flag; ++i)
274 flag = field_mask[i] != 1;
275 }
276
277 return flag;
278}
279
281
282 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
283
284 if (field->exchange_data.put.mask != NULL)
285 return field->exchange_data.put.mask;
286
287 size_t num_interp_fields = field->num_interp_fields;
288
289 // check whether for this put operation a field or core mask has been defined
290 int has_mask = 0;
291 for (size_t i = 0; (i < num_interp_fields) && !has_mask; ++i)
292 has_mask = check_core_mask(field, i) || check_field_mask(field, i);
293
294 int ** mask = NULL;
295
296 if (has_mask) {
297
298 mask = xmalloc(num_interp_fields * sizeof(*mask));
299
300 // generate mask from core and field mask
301 for (size_t i = 0; i < num_interp_fields; ++i) {
302 int const * core_mask =
304 field->grid, field->interp_fields[i].location);
305 int const * field_mask =
307 field->grid, field->interp_fields[i]);
308 size_t field_size =
309 get_interp_field_size(field->interp_fields[i], field->grid);
310 mask[i] = xmalloc(field_size * sizeof(**mask));
311 for (size_t j = 0; j < field_size; ++j)
312 mask[i][j] = ((core_mask == NULL) || (core_mask[j] != 0)) &&
313 ((field_mask == NULL) || (field_mask[j] != 0));
314 }
315 }
316
317 field->exchange_data.put.mask = mask;
318
319 return mask;
320}
321
323
324 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
325
326 if (field->exchange_data.get.mask != NULL)
327 return field->exchange_data.get.mask;
328
329 // check whether for this put operation a field or core mask has been defined
330 int has_mask = check_core_mask(field, 0) || check_field_mask(field, 0);
331
332 int * mask = NULL;
333
334 if (has_mask) {
335
336 // generate mask from core and field mask
337 int const * core_mask =
339 field->grid, field->interp_fields[0].location);
340 int const * field_mask =
342 field->grid, field->interp_fields[0]);
343 size_t field_size =
344 get_interp_field_size(field->interp_fields[0], field->grid);
345 mask = xmalloc(field_size * sizeof(*mask));
346 for (size_t i = 0; i < field_size; ++i)
347 mask[i] = ((core_mask == NULL) || (core_mask[i] != 0)) &&
348 ((field_mask == NULL) || (field_mask[i] != 0));
349 }
350
351 field->exchange_data.get.mask = mask;
352
353 return mask;
354}
355
357 struct coupling_field * field, unsigned put_idx, double init_value) {
358
359 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
360
361 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
362
363 double *** send_field_acc =
364 (field->exchange_data.put.puts[put_idx].send_field_acc == NULL)?
366 field->exchange_data.put.puts[put_idx].send_field_acc;
367
368 init_put_op_acc(field, init_value, send_field_acc);
369}
370
372 struct coupling_field * field, unsigned put_idx, double init_value) {
373
374 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
375
376 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
377
378 double *** send_frac_mask_acc =
379 (field->exchange_data.put.puts[put_idx].send_frac_mask_acc == NULL)?
381 field->exchange_data.put.puts[put_idx].send_frac_mask_acc;
382
383 init_put_op_acc(field, init_value, send_frac_mask_acc);
384}
385
387 struct coupling_field * field, unsigned put_idx) {
388
389 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
390
391 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
392
393 return field->exchange_data.put.puts[put_idx].event;
394}
395
397 struct coupling_field * field, unsigned put_idx) {
398
399 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
400 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
402 !field->exchange_data.put.puts[put_idx].use_raw_exchange,
403 "exchange is configured to use raw data exchange")
404
405 return field->exchange_data.put.puts[put_idx].interpolation;
406}
407
410 struct coupling_field * field, unsigned put_idx) {
411
412 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
413 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
415 field->exchange_data.put.puts[put_idx].use_raw_exchange,
416 "exchange is not configured to use raw data exchange")
417
418 return field->exchange_data.put.puts[put_idx].interpolation_exchange;
419}
420
422 struct coupling_field * field, unsigned put_idx) {
423
424 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
425 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
426
427 return field->exchange_data.put.puts[put_idx].time_accumulation_count;
428}
429
431 struct coupling_field * field, unsigned put_idx) {
432
433 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
434 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
435
436 return field->exchange_data.put.puts[put_idx].use_raw_exchange;
437}
438
440 struct coupling_field * field, unsigned put_idx, int count) {
441
442 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
443 YAC_ASSERT(put_idx < field->exchange_data.put.num_puts, "put_idx is invalid")
444
445 field->exchange_data.put.puts[put_idx].time_accumulation_count = count;
446}
447
449
450 YAC_ASSERT(field->exchange_type == SOURCE, "wrong field exchange type")
451
452 return field->exchange_data.put.num_puts;
453}
454
456 struct coupling_field * field) {
457
458 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
459
460 return field->exchange_data.get.event;
461}
462
464 struct coupling_field * field) {
465
466 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
467
468 return field->exchange_data.get.use_raw_exchange;
469}
470
472 struct coupling_field * field) {
473
474 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
475
477 field->exchange_data.get.interp_weights_data.frac_mask_fallback_value);
478}
479
481 struct coupling_field * field) {
482
483 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
485 !field->exchange_data.get.use_raw_exchange,
486 "exchange is configured to use raw data exchange")
487
488 return field->exchange_data.get.interpolation;
489}
490
493 struct coupling_field * field) {
494
495 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
497 field->exchange_data.get.use_raw_exchange,
498 "exchange is not configured to use raw data exchange")
499
500 return field->exchange_data.get.interpolation_exchange;
501}
502
505 struct coupling_field * field) {
506
507 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
509 field->exchange_data.get.use_raw_exchange,
510 "exchange is not configured to use raw data exchange")
511
513 field->exchange_data.get.interp_weights_data;
514
515 yac_interp_weights_data_init(&field->exchange_data.get.interp_weights_data);
516
517 // we keep the source field buffer sizes
519 size_t * src_field_buffer_sizes = interp_weights_data.src_field_buffer_size;
520 field->exchange_data.get.interp_weights_data.frac_mask_fallback_value =
522 field->exchange_data.get.interp_weights_data.num_src_fields = num_src_fields;
523 field->exchange_data.get.interp_weights_data.src_field_buffer_size =
524 xmalloc(num_src_fields * sizeof(*src_field_buffer_sizes));
525 memcpy(
526 field->exchange_data.get.interp_weights_data.src_field_buffer_size,
527 src_field_buffer_sizes, num_src_fields * sizeof(*src_field_buffer_sizes));
528
529 return interp_weights_data;
530}
531
533 struct coupling_field * field, size_t * num_src_fields,
534 size_t const ** src_field_buffer_sizes) {
535
536 YAC_ASSERT(field->exchange_type == TARGET, "wrong field exchange type")
538 field->exchange_data.get.use_raw_exchange,
539 "exchange is not configured to use raw data exchange")
540
542 field->exchange_data.get.interp_weights_data.num_src_fields;
543 if (src_field_buffer_sizes)
544 *src_field_buffer_sizes =
545 field->exchange_data.get.interp_weights_data.src_field_buffer_size;
546}
547
549 struct coupling_field * field, struct event * event,
550 struct yac_interpolation * interpolation,
551 struct yac_interpolation_exchange * interpolation_exchange,
552 int use_raw_exchange) {
553
555 field->exchange_type != TARGET,
556 "a get operation has already been set (field \"%s\")", field->name)
557
558 if (field->exchange_type == NOTHING) {
559 field->exchange_data.put.puts = NULL;
560 field->exchange_data.put.num_puts = 0;
561 field->exchange_type = SOURCE;
562 field->exchange_data.put.mask = NULL;
563 }
564
565 unsigned num_puts = field->exchange_data.put.num_puts;
566 field->exchange_data.put.num_puts++;
567
568 field->exchange_data.put.puts =
569 xrealloc(field->exchange_data.put.puts, (num_puts + 1) *
570 sizeof(*(field->exchange_data.put.puts)));
571
572 field->exchange_data.put.puts[num_puts].event = event;
573 field->exchange_data.put.puts[num_puts].interpolation = interpolation;
574 field->exchange_data.put.puts[num_puts].interpolation_exchange = interpolation_exchange;
575 field->exchange_data.put.puts[num_puts].time_accumulation_count = 0;
576 field->exchange_data.put.puts[num_puts].send_field_acc = NULL;
577 field->exchange_data.put.puts[num_puts].send_frac_mask_acc = NULL;
578 field->exchange_data.put.puts[num_puts].use_raw_exchange = use_raw_exchange;
579}
580
582 struct coupling_field * field, struct event * event,
583 struct yac_interpolation * interpolation) {
584
586 field, event, interpolation, NULL, 0);
587}
588
590 struct coupling_field * field, struct event * event,
591 struct yac_interpolation_exchange * interpolation_exchange) {
592
594 field, event, NULL, interpolation_exchange, 1);
595}
596
598 struct coupling_field * field, struct event * event,
599 struct yac_interpolation * interpolation,
600 struct yac_interpolation_exchange * interpolation_exchange,
602 int use_raw_exchange) {
603
605 field->exchange_type == NOTHING,
606 "a put or get operation has already been set (field \"%s\")", field->name)
607
608 field->exchange_type = TARGET;
609 field->exchange_data.get.event = event;
610 field->exchange_data.get.interpolation = interpolation;
611 field->exchange_data.get.interpolation_exchange = interpolation_exchange;
612 field->exchange_data.get.interp_weights_data = interp_weights_data;
613 field->exchange_data.get.mask = NULL;
614 field->exchange_data.get.use_raw_exchange = use_raw_exchange;
615}
616
618 struct coupling_field * field, struct event * event,
619 struct yac_interpolation * interpolation) {
620
621 struct yac_interp_weights_data dummy_interp_weights_data = {
623 .scaling_factor = 1.0,
624 .scaling_summand = 0.0,
625
626 .num_fixed_values = 0,
627 .fixed_values = NULL,
628 .num_tgt_per_fixed_value = NULL,
629 .tgt_idx_fixed = NULL,
630
631 .num_wgt_tgt = 0,
632 .wgt_tgt_idx = NULL,
633 .num_src_per_tgt = NULL,
634 .weights = NULL,
635 .src_field_idx = NULL,
636 .src_idx = NULL,
637 .num_src_fields = 0,
638 .src_field_buffer_size = NULL
639 };
640
642 field, event, interpolation, NULL, dummy_interp_weights_data, 0);
643}
644
646 struct coupling_field * field, struct event * event,
647 struct yac_interpolation_exchange * interpolation_exchange,
649
651 field, event, NULL, interpolation_exchange, interp_weights_data, 1);
652}
653
655 struct coupling_field * cpl_field) {
656
657 return cpl_field->interp_fields;
658}
659
660static struct event * get_exchange_event(struct coupling_field * cpl_field) {
661
663 (cpl_field->exchange_type == SOURCE) ||
664 (cpl_field->exchange_type == TARGET),
665 "datetime is not defined for non-exchanged fields (field \"%s\")",
666 cpl_field->name);
667 return
668 (cpl_field->exchange_type == SOURCE)?
669 cpl_field->exchange_data.put.puts[0].event:
670 cpl_field->exchange_data.get.event;
671}
672
674 struct coupling_field * cpl_field) {
675
676 return
678 get_exchange_event(cpl_field), cpl_field->current_datetime);
679}
680
682 struct coupling_field * cpl_field) {
683
684 return
686 get_exchange_event(cpl_field), cpl_field->prev_datetime);
687}
688
690
691 return (int)yac_event_check(get_exchange_event(cpl_field));
692}
693
695
696 size_t collection_size = cpl_field->collection_size;
697 size_t num_interp_fields = cpl_field->num_interp_fields;
698
699 if (cpl_field->exchange_type == SOURCE) {
700
701 for (unsigned put_idx = 0; put_idx < cpl_field->exchange_data.put.num_puts;
702 ++put_idx) {
703
704 struct event * event = cpl_field->exchange_data.put.puts[put_idx].event;
705 struct yac_interpolation * interpolation =
706 cpl_field->exchange_data.put.puts[put_idx].interpolation;
707 struct yac_interpolation_exchange * interpolation_exchange =
708 cpl_field->exchange_data.put.puts[put_idx].interpolation_exchange;
709 double ***send_field_acc =
710 cpl_field->exchange_data.put.puts[put_idx].send_field_acc;
711 double ***send_frac_mask_acc =
712 cpl_field->exchange_data.put.puts[put_idx].send_frac_mask_acc;
713
714 if (send_field_acc != NULL) {
715 for (size_t h = 0; h < collection_size; ++h) {
716 for (size_t j = 0; j < num_interp_fields; ++j)
717 free(send_field_acc[h][j]);
718 free(send_field_acc[h]);
719 }
720 free(send_field_acc);
721 }
722
723 if (send_frac_mask_acc != NULL) {
724 for (size_t h = 0; h < collection_size; ++h) {
725 for (size_t j = 0; j < num_interp_fields; ++j)
726 free(send_frac_mask_acc[h][j]);
727 free(send_frac_mask_acc[h]);
728 }
729 free(send_frac_mask_acc);
730 }
731
733 yac_interpolation_delete(interpolation);
735 interpolation_exchange, "yac_coupling_field_delete");
736 }
737
738 free(cpl_field->exchange_data.put.puts);
739 if (cpl_field->exchange_data.put.mask) {
740 for (size_t i = 0; i < num_interp_fields; ++i)
741 free(cpl_field->exchange_data.put.mask[i]);
742 free(cpl_field->exchange_data.put.mask);
743 }
744
745 } else if (cpl_field->exchange_type == TARGET) {
746
751 "yac_coupling_field_delete");
754 if (cpl_field->exchange_data.get.mask)
755 free(cpl_field->exchange_data.get.mask);
756 }
757
758 free(cpl_field->name);
759 free(cpl_field->component_name);
760 free(cpl_field->interp_fields);
761 free(cpl_field->timestep);
762 free(cpl_field);
763}
764
766 struct coupling_field * cpl_field) {
767
768 return cpl_field ? cpl_field->pak : NULL;
769}
770
772 struct coupling_field * cpl_field, struct yac_pak * pak) {
773
774 if (cpl_field) {
775 cpl_field->pak = pak;
776 }
777}
#define YAC_ASSERT(exp, msg)
int const * yac_basic_grid_get_field_mask(struct yac_basic_grid *grid, struct yac_interp_field field)
Definition basic_grid.c:120
size_t yac_basic_grid_get_data_size(struct yac_basic_grid *grid, enum yac_location location)
Definition basic_grid.c:145
int const * yac_basic_grid_get_core_mask(struct yac_basic_grid *grid, enum yac_location location)
Definition basic_grid.c:104
void yac_event_delete(struct event *event)
Definition event.c:265
char * yac_get_event_current_datetime(struct event *event, char *datetime_str)
Definition event.c:321
char * yac_get_event_previous_datetime(struct event *event, char *datetime_str)
Definition event.c:327
enum yac_action_type yac_event_check(struct event *event)
Definition event.c:183
struct yac_interpolation_exchange * yac_get_coupling_field_put_op_interpolation_exchange(struct coupling_field *field, unsigned put_idx)
Definition fields.c:409
void yac_set_coupling_field_put_op(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation)
Definition fields.c:581
static void yac_set_coupling_field_get_op_(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation, struct yac_interpolation_exchange *interpolation_exchange, struct yac_interp_weights_data interp_weights_data, int use_raw_exchange)
Definition fields.c:597
unsigned yac_get_coupling_field_collection_size(struct coupling_field *field)
Definition fields.c:100
static int check_core_mask(struct coupling_field *field, size_t field_idx)
Definition fields.c:234
static struct event * get_exchange_event(struct coupling_field *cpl_field)
Definition fields.c:660
const char * yac_get_coupling_field_timestep(struct coupling_field *field)
Definition fields.c:105
unsigned yac_get_coupling_field_num_puts(struct coupling_field *field)
Definition fields.c:448
void yac_set_coupling_field_get_op(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation)
Definition fields.c:617
char const * yac_get_coupling_field_comp_name(struct coupling_field *field)
Definition fields.c:133
int yac_get_coupling_field_put_op_time_accumulation_count(struct coupling_field *field, unsigned put_idx)
Definition fields.c:421
struct yac_pak * yac_coupling_field_get_pak(struct coupling_field *cpl_field)
Definition fields.c:765
int yac_coupling_field_get_action(struct coupling_field *cpl_field)
Definition fields.c:689
double *** yac_get_coupling_field_put_op_send_frac_mask_acc(struct coupling_field *field, unsigned put_idx)
Definition fields.c:224
struct yac_basic_grid * yac_coupling_field_get_basic_grid(struct coupling_field *field)
Definition fields.c:127
static void yac_set_coupling_field_put_op_(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation, struct yac_interpolation_exchange *interpolation_exchange, int use_raw_exchange)
Definition fields.c:548
size_t yac_coupling_field_get_num_interp_fields(struct coupling_field *field)
Definition fields.c:110
struct yac_interpolation * yac_get_coupling_field_put_op_interpolation(struct coupling_field *field, unsigned put_idx)
Definition fields.c:396
enum yac_location yac_get_coupling_field_get_interp_field_location(struct coupling_field *field, size_t interp_field_idx)
Definition fields.c:116
struct event * yac_get_coupling_field_get_op_event(struct coupling_field *field)
Definition fields.c:455
static size_t get_interp_field_size(struct yac_interp_field field, struct yac_basic_grid *grid)
Definition fields.c:146
void yac_set_coupling_field_put_op_raw(struct coupling_field *field, struct event *event, struct yac_interpolation_exchange *interpolation_exchange)
Definition fields.c:589
size_t yac_coupling_field_get_data_size(struct coupling_field *field, enum yac_location location)
Definition fields.c:152
struct yac_interp_field const * yac_coupling_field_get_interp_fields(struct coupling_field *cpl_field)
Definition fields.c:654
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)
Definition fields.c:67
int * yac_get_coupling_field_get_mask(struct coupling_field *field)
Definition fields.c:322
static void init_put_op_acc(struct coupling_field *field, double init_value, double ***acc)
Definition fields.c:158
struct event * yac_get_coupling_field_put_op_event(struct coupling_field *field, unsigned put_idx)
Definition fields.c:386
char * yac_coupling_field_get_datetime(struct coupling_field *cpl_field)
Definition fields.c:673
void yac_init_coupling_field_put_op_send_field_acc(struct coupling_field *field, unsigned put_idx, double init_value)
Definition fields.c:356
struct yac_interpolation * yac_get_coupling_field_get_op_interpolation(struct coupling_field *field)
Definition fields.c:480
void yac_coupling_field_get_src_field_buffer_sizes(struct coupling_field *field, size_t *num_src_fields, size_t const **src_field_buffer_sizes)
Definition fields.c:532
void yac_set_coupling_field_put_op_time_accumulation_count(struct coupling_field *field, unsigned put_idx, int count)
Definition fields.c:439
int yac_get_coupling_field_get_op_use_raw_exchange(struct coupling_field *field)
Definition fields.c:463
char * yac_coupling_field_get_prev_datetime(struct coupling_field *cpl_field)
Definition fields.c:681
struct yac_interpolation_exchange * yac_get_coupling_field_get_op_interpolation_exchange(struct coupling_field *field)
Definition fields.c:492
int yac_get_coupling_field_get_op_with_frac_mask(struct coupling_field *field)
Definition fields.c:471
enum yac_field_exchange_type yac_get_coupling_field_exchange_type(struct coupling_field *field)
Definition fields.c:141
void yac_coupling_field_set_pak(struct coupling_field *cpl_field, struct yac_pak *pak)
Definition fields.c:771
const char * yac_get_coupling_field_name(struct coupling_field *field)
Definition fields.c:122
void yac_set_coupling_field_get_op_raw(struct coupling_field *field, struct event *event, struct yac_interpolation_exchange *interpolation_exchange, struct yac_interp_weights_data interp_weights_data)
Definition fields.c:645
static int check_field_mask(struct coupling_field *field, size_t field_idx)
Definition fields.c:257
void yac_coupling_field_delete(struct coupling_field *cpl_field)
Definition fields.c:694
int ** yac_get_coupling_field_put_mask(struct coupling_field *field)
Definition fields.c:280
struct yac_interp_weights_data yac_get_coupling_field_get_op_interp_weights_data(struct coupling_field *field)
Definition fields.c:504
void yac_init_coupling_field_put_op_send_frac_mask_acc(struct coupling_field *field, unsigned put_idx, double init_value)
Definition fields.c:371
static void get_put_op_acc(struct coupling_field *field, unsigned put_idx, char const *routine_name, double ****acc)
Definition fields.c:179
double *** yac_get_coupling_field_put_op_send_field_acc(struct coupling_field *field, unsigned put_idx)
Definition fields.c:214
int yac_get_coupling_field_put_op_use_raw_exchange(struct coupling_field *field, unsigned put_idx)
Definition fields.c:430
yac_field_exchange_type
Definition fields.h:12
@ SOURCE
Definition fields.h:15
@ TARGET
Definition fields.h:16
@ NOTHING
Definition fields.h:14
void yac_interp_weights_data_init(struct yac_interp_weights_data *interp_weights_data)
void yac_interp_weights_data_free(struct yac_interp_weights_data interp_weights_data)
void yac_interpolation_delete(struct yac_interpolation *interp)
Free an interpolation object and release all resources.
double const YAC_FRAC_MASK_UNDEF
void yac_interpolation_exchange_delete(struct yac_interpolation_exchange *exchange, char const *routine)
Delete an interpolation exchange and release resources.
Interpolation exchange object for temporary buffers and MPI exchanges.
Defines internal basic interpolation definitions.
#define YAC_FRAC_MASK_VALUE_IS_VALID(value)
Test whether a fractional mask value is valid.
yac_location
Definition location.h:12
#define xstrdup(s)
Definition ppm_xfuncs.h:84
#define xrealloc(ptr, size)
Definition ppm_xfuncs.h:67
#define xmalloc(size)
Definition ppm_xfuncs.h:66
double *** send_field_acc
Definition fields.c:45
struct coupling_field::@63::@64::@66 * puts
struct coupling_field::@63::@64 put
char prev_datetime[MAX_DATETIME_STR_LEN]
Definition fields.c:32
int time_accumulation_count
Definition fields.c:44
int use_raw_exchange
Definition fields.c:47
double *** send_frac_mask_acc
Definition fields.c:46
struct yac_interpolation_exchange * interpolation_exchange
Definition fields.c:43
struct yac_basic_grid * grid
Definition fields.c:24
struct coupling_field::@63::@65 get
char current_datetime[MAX_DATETIME_STR_LEN]
Definition fields.c:31
struct yac_interp_field * interp_fields
Definition fields.c:26
enum yac_field_exchange_type exchange_type
Definition fields.c:36
struct yac_interp_weights_data interp_weights_data
Definition fields.c:56
unsigned num_puts
Definition fields.c:49
size_t num_interp_fields
Definition fields.c:27
char * timestep
Definition fields.c:29
struct event * event
Definition fields.c:41
char * component_name
Definition fields.c:22
size_t collection_size
number of vertical levels or bundles
Definition fields.c:28
char * name
Definition fields.c:20
int * mask
Definition fields.c:57
int ** mask
Definition fields.c:50
struct yac_interpolation * interpolation
Definition fields.c:42
union coupling_field::@63 exchange_data
struct yac_pak * pak
Borrowed pointer to the YAC PAK object from the owning instance (may be NULL)
Definition fields.c:63
Definition event.c:18
int collection_size
struct @98 field[]
static int mask[16]
int const * location
#define YAC_OMP_PARALLEL
#define YAC_OMP_FOR
#define YAC_ASSERT_F(exp, format,...)
Definition yac_assert.h:39
#define YAC_ASSERT_FUNC(exp, func, msg)
Definition yac_assert.h:36