YAC 3.7.1
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"
12#include "interp_weights.h"
13
15
16 // general field related information
17
18 char * name;
19
21
23
27 char* timestep;
28
29 char current_datetime[MAX_DATETIME_STR_LEN]; // updated only in yac_coupling_field_get_datetime
30
31 // data exchange
32
34
35 union {
36 struct {
37 struct {
38 struct event * event;
42 double *** send_field_acc;
45 } * puts;
46 unsigned num_puts;
47 int ** mask;
48 } put;
49 struct {
50 struct event * event;
51 struct yac_interpolation * interpolation;
52 struct yac_interpolation_exchange * interpolation_exchange; // for raw exchange
53 struct yac_interp_weights_data interp_weights_data; // for raw exchange
54 int * mask;
55 int use_raw_exchange;
56 } get;
58};
59
60struct coupling_field *
61yac_coupling_field_new(char const * field_name, char const * component_name,
63 unsigned num_interp_fields, size_t collection_size, const char* timestep) {
64
65 struct coupling_field * cpl_field = xmalloc(1 * sizeof(*cpl_field));
66
67 cpl_field->name = xmalloc((strlen(field_name) + 1));
68 strcpy(cpl_field->name, field_name);
69 cpl_field->component_name = component_name?strdup(component_name):NULL;
70 cpl_field->grid = grid;
71 cpl_field->interp_fields = NULL;
72 cpl_field->num_interp_fields = (size_t)num_interp_fields;
74 cpl_field->timestep = strdup(timestep);
75 cpl_field->exchange_type = NOTHING;
76
77 if (num_interp_fields != 0) {
78
80 interp_fields != NULL,
81 "ERROR: num_interp_fields > 0 but not interpolation field provided")
82
83 cpl_field->interp_fields =
84 xmalloc((size_t)num_interp_fields * sizeof(*(cpl_field->interp_fields)));
85 memcpy(cpl_field->interp_fields, interp_fields,
86 (size_t)num_interp_fields * sizeof(*(cpl_field->interp_fields)));
87
88 }
89
90 return cpl_field;
91}
92
94
95 return field->collection_size;
96}
97
99
100 return field->timestep;
101}
102
104
105 return field->num_interp_fields;
106}
107
108enum yac_location
110 struct coupling_field * field, size_t interp_field_idx) {
111
112 return field->interp_fields[interp_field_idx].location;
113}
114
115const char * yac_get_coupling_field_name(struct coupling_field * field) {
116
117 return field->name;
118}
119
121 struct coupling_field * field) {
122
123 return field->grid;
124}
125
127
128 return field->component_name;
129}
130
133
134 return field->exchange_type;
135}
136
138 struct yac_interp_field field, struct yac_basic_grid * grid) {
139
140 return yac_basic_grid_get_data_size(grid, field.location);
141}
142
144 struct coupling_field * field, enum yac_location location) {
145
146 return yac_basic_grid_get_data_size(field->grid, location);
147}
148
149static void init_put_op_acc(
150 struct coupling_field * field, double init_value, double *** acc) {
151
152 size_t num_interp_fields = field->num_interp_fields;
153 size_t collection_size = field->collection_size;
154
155 for (size_t h = 0; h < collection_size; ++h) {
156 for (size_t j = 0; j < num_interp_fields; j++) {
157 size_t num_points =
158 get_interp_field_size(field->interp_fields[j], field->grid);
160 {
162 for (size_t m = 0; m < num_points; m++ ) {
163 acc[h][j][m] = init_value;
164 }
165 }
166 }
167 }
168}
169
170static void get_put_op_acc(
171 struct coupling_field * field, unsigned put_idx,
172 char const * routine_name, double **** acc) {
173
175 field->exchange_type == SOURCE,
176 "ERROR(%s): wrong field exchange type", routine_name)
177
179 put_idx < field->exchange_data.put.num_puts,
180 "ERROR(%s): put_idx is invalid", routine_name)
181
182 if (*acc != NULL) return;
183
184 size_t num_interp_fields = field->num_interp_fields;
185 size_t collection_size = field->collection_size;
186
187 /* Allocate memory for the accumulation */
188
189 *acc = xmalloc(collection_size * sizeof(**acc));
190
191 for (size_t h = 0; h < collection_size; ++h) {
192
193 (*acc)[h] = xmalloc(num_interp_fields * sizeof(***acc));
194
195 for (size_t j = 0; j < num_interp_fields; j++)
196 (*acc)[h][j] =
197 xmalloc(
199 field->interp_fields[j], field->grid) * sizeof(****acc));
200 }
201
202 /* Initialise memory for the accumulation */
203 init_put_op_acc(field, 0.0, *acc);
204}
205
207 struct coupling_field * field, unsigned put_idx) {
208
210 field, put_idx, "yac_get_coupling_field_put_op_send_field_acc",
211 &(field->exchange_data.put.puts[put_idx].send_field_acc));
212
213 return field->exchange_data.put.puts[put_idx].send_field_acc;
214}
215
217 struct coupling_field * field, unsigned put_idx) {
218
220 field, put_idx, "yac_get_coupling_field_put_op_send_frac_mask_acc",
221 &(field->exchange_data.put.puts[put_idx].send_frac_mask_acc));
222
223 return field->exchange_data.put.puts[put_idx].send_frac_mask_acc;
224}
225
227 struct coupling_field * field, size_t field_idx) {
228
229 int const * core_mask =
231 field->grid, field->interp_fields[field_idx].location);
232
233 int flag = 0;
234
235 // if the core mask is defined
236 if (core_mask != NULL) {
237
238 size_t field_size =
239 get_interp_field_size(field->interp_fields[field_idx], field->grid);
240
241 // check if the core mask contains values other than 1
242 for (size_t i = 0; (i < field_size) && !flag; ++i)
243 flag = core_mask[i] != 1;
244 }
245
246 return flag;
247}
248
250 struct coupling_field * field, size_t field_idx) {
251
252 int const * field_mask =
254 field->grid, field->interp_fields[field_idx]);
255
256 int flag = 0;
257
258 // if a field mask is defined
259 if (field_mask != NULL) {
260
261 size_t field_size =
262 get_interp_field_size(field->interp_fields[field_idx], field->grid);
263
264 // check if the core mask contains values other than 1
265 for (size_t i = 0; (i < field_size) && !flag; ++i)
266 flag = field_mask[i] != 1;
267 }
268
269 return flag;
270}
271
273
275 field->exchange_type == SOURCE,
276 "ERROR(yac_get_coupling_field_put_mask): "
277 "wrong field exchange type")
278
279 if (field->exchange_data.put.mask != NULL)
280 return field->exchange_data.put.mask;
281
282 size_t num_interp_fields = field->num_interp_fields;
283
284 // check whether for this put operation a field or core mask has been defined
285 int has_mask = 0;
286 for (size_t i = 0; (i < num_interp_fields) && !has_mask; ++i)
287 has_mask = check_core_mask(field, i) || check_field_mask(field, i);
288
289 int ** mask = NULL;
290
291 if (has_mask) {
292
293 mask = xmalloc(num_interp_fields * sizeof(*mask));
294
295 // generate mask from core and field mask
296 for (size_t i = 0; i < num_interp_fields; ++i) {
297 int const * core_mask =
299 field->grid, field->interp_fields[i].location);
300 int const * field_mask =
302 field->grid, field->interp_fields[i]);
303 size_t field_size =
304 get_interp_field_size(field->interp_fields[i], field->grid);
305 mask[i] = xmalloc(field_size * sizeof(**mask));
306 for (size_t j = 0; j < field_size; ++j)
307 mask[i][j] = ((core_mask == NULL) || (core_mask[j] != 0)) &&
308 ((field_mask == NULL) || (field_mask[j] != 0));
309 }
310 }
311
312 field->exchange_data.put.mask = mask;
313
314 return mask;
315}
316
318
320 field->exchange_type == TARGET,
321 "ERROR(yac_get_coupling_field_put_mask): "
322 "wrong field exchange type")
323
324 if (field->exchange_data.get.mask != NULL)
325 return field->exchange_data.get.mask;
326
327 // check whether for this put operation a field or core mask has been defined
328 int has_mask = check_core_mask(field, 0) || check_field_mask(field, 0);
329
330 int * mask = NULL;
331
332 if (has_mask) {
333
334 // generate mask from core and field mask
335 int const * core_mask =
337 field->grid, field->interp_fields[0].location);
338 int const * field_mask =
340 field->grid, field->interp_fields[0]);
341 size_t field_size =
342 get_interp_field_size(field->interp_fields[0], field->grid);
343 mask = xmalloc(field_size * sizeof(*mask));
344 for (size_t i = 0; i < field_size; ++i)
345 mask[i] = ((core_mask == NULL) || (core_mask[i] != 0)) &&
346 ((field_mask == NULL) || (field_mask[i] != 0));
347 }
348
349 field->exchange_data.get.mask = mask;
350
351 return mask;
352}
353
355 struct coupling_field * field, unsigned put_idx, double init_value) {
356
358 field->exchange_type == SOURCE,
359 "ERROR(yac_init_coupling_field_put_op_send_field_acc): "
360 "wrong field exchange type")
361
363 put_idx < field->exchange_data.put.num_puts,
364 "ERROR(yac_init_coupling_field_put_op_send_field_acc): "
365 "put_idx is invalid")
366
367 double *** send_field_acc =
368 (field->exchange_data.put.puts[put_idx].send_field_acc == NULL)?
370 field->exchange_data.put.puts[put_idx].send_field_acc;
371
372 init_put_op_acc(field, init_value, send_field_acc);
373}
374
376 struct coupling_field * field, unsigned put_idx, double init_value) {
377
379 field->exchange_type == SOURCE,
380 "ERROR(yac_init_coupling_field_put_op_send_frac_mask_acc): "
381 "wrong field exchange type")
382
384 put_idx < field->exchange_data.put.num_puts,
385 "ERROR(yac_init_coupling_field_put_op_send_frac_mask_acc): "
386 "put_idx is invalid")
387
388 double *** send_frac_mask_acc =
389 (field->exchange_data.put.puts[put_idx].send_frac_mask_acc == NULL)?
391 field->exchange_data.put.puts[put_idx].send_frac_mask_acc;
392
393 init_put_op_acc(field, init_value, send_frac_mask_acc);
394}
395
397 struct coupling_field * field, unsigned put_idx) {
398
400 field->exchange_type == SOURCE,
401 "ERROR(yac_get_coupling_field_put_op_event): wrong field exchange type")
402
404 put_idx < field->exchange_data.put.num_puts,
405 "ERROR(yac_get_coupling_field_put_op_event): put_idx is invalid")
406
407 return field->exchange_data.put.puts[put_idx].event;
408}
409
411 struct coupling_field * field, unsigned put_idx) {
412
414 field->exchange_type == SOURCE,
415 "ERROR(yac_get_coupling_field_put_op_interpolation): "
416 "wrong field exchange type")
417
419 put_idx < field->exchange_data.put.num_puts,
420 "ERROR(yac_get_coupling_field_put_op_interpolation): "
421 "put_idx is invalid")
422
424 !field->exchange_data.put.puts[put_idx].use_raw_exchange,
425 "ERROR(yac_get_coupling_field_put_op_interpolation): "
426 "exchange is configured to use raw data exchange")
427
428 return field->exchange_data.put.puts[put_idx].interpolation;
429}
430
433 struct coupling_field * field, unsigned put_idx) {
434
436 field->exchange_type == SOURCE,
437 "ERROR(yac_get_coupling_field_put_op_interpolation_exchange): "
438 "wrong field exchange type")
439
441 put_idx < field->exchange_data.put.num_puts,
442 "ERROR(yac_get_coupling_field_put_op_interpolation_exchange): "
443 "put_idx is invalid")
444
446 field->exchange_data.put.puts[put_idx].use_raw_exchange,
447 "ERROR(yac_get_coupling_field_put_op_interpolation_exchange): "
448 "exchange is not configured to use raw data exchange")
449
450 return field->exchange_data.put.puts[put_idx].interpolation_exchange;
451}
452
454 struct coupling_field * field, unsigned put_idx) {
455
457 field->exchange_type == SOURCE,
458 "ERROR(yac_get_coupling_field_put_op_time_accumulation_count): "
459 "wrong field exchange type")
460
462 put_idx < field->exchange_data.put.num_puts,
463 "ERROR(yac_get_coupling_field_put_op_time_accumulation_count): "
464 "put_idx is invalid")
465
466 return field->exchange_data.put.puts[put_idx].time_accumulation_count;
467}
468
470 struct coupling_field * field, unsigned put_idx) {
471
473 field->exchange_type == SOURCE,
474 "ERROR(yac_get_coupling_field_put_op_use_raw_exchange): "
475 "wrong field exchange type")
476
478 put_idx < field->exchange_data.put.num_puts,
479 "ERROR(yac_get_coupling_field_put_op_use_raw_exchange): "
480 "put_idx is invalid")
481
482 return field->exchange_data.put.puts[put_idx].use_raw_exchange;
483}
484
486 struct coupling_field * field, unsigned put_idx, int count) {
487
489 field->exchange_type == SOURCE,
490 "ERROR(yac_set_coupling_field_put_op_time_accumulation_count): "
491 "wrong field exchange type")
492
494 put_idx < field->exchange_data.put.num_puts,
495 "ERROR(yac_set_coupling_field_put_op_time_accumulation_count): "
496 "put_idx is invalid")
497
498 field->exchange_data.put.puts[put_idx].time_accumulation_count = count;
499}
500
502
504 field->exchange_type == SOURCE,
505 "ERROR(yac_get_coupling_field_num_puts): wrong field exchange type")
506
507 return field->exchange_data.put.num_puts;
508}
509
511 struct coupling_field * field) {
512
514 field->exchange_type == TARGET,
515 "ERROR(yac_get_coupling_field_get_op_event): "
516 "wrong field exchange type")
517
518 return field->exchange_data.get.event;
519}
520
522 struct coupling_field * field) {
523
525 field->exchange_type == TARGET,
526 "ERROR(yac_get_coupling_field_get_op_use_raw_exchange): "
527 "wrong field exchange type")
528
529 return field->exchange_data.get.use_raw_exchange;
530}
531
533 struct coupling_field * field) {
534
536 field->exchange_type == TARGET,
537 "ERROR(yac_get_coupling_field_get_op_with_frac_mask): "
538 "wrong field exchange type")
539
541 field->exchange_data.get.interp_weights_data.frac_mask_fallback_value);
542}
543
545 struct coupling_field * field) {
546
548 field->exchange_type == TARGET,
549 "ERROR(yac_get_coupling_field_get_op_interpolation): "
550 "wrong field exchange type")
551
553 !field->exchange_data.get.use_raw_exchange,
554 "ERROR(yac_get_coupling_field_get_op_interpolation): "
555 "exchange is configured to use raw data exchange")
556
557 return field->exchange_data.get.interpolation;
558}
559
562 struct coupling_field * field) {
563
565 field->exchange_type == TARGET,
566 "ERROR(yac_get_coupling_field_get_op_interpolation_exchange): "
567 "wrong field exchange type")
568
570 field->exchange_data.get.use_raw_exchange,
571 "ERROR(yac_get_coupling_field_get_op_interpolation_exchange): "
572 "exchange is not configured to use raw data exchange")
573
574 return field->exchange_data.get.interpolation_exchange;
575}
576
579 struct coupling_field * field) {
580
582 field->exchange_type == TARGET,
583 "ERROR(yac_get_coupling_field_get_op_interp_weights_data): "
584 "wrong field exchange type")
585
587 field->exchange_data.get.use_raw_exchange,
588 "ERROR(yac_get_coupling_field_get_op_interp_weights_data): "
589 "exchange is not configured to use raw data exchange")
590
592 field->exchange_data.get.interp_weights_data;
593
594 yac_interp_weights_data_init(&field->exchange_data.get.interp_weights_data);
595
596 // we keep the source field buffer sizes
598 size_t * src_field_buffer_sizes = interp_weights_data.src_field_buffer_size;
599 field->exchange_data.get.interp_weights_data.frac_mask_fallback_value =
601 field->exchange_data.get.interp_weights_data.num_src_fields = num_src_fields;
602 field->exchange_data.get.interp_weights_data.src_field_buffer_size =
603 xmalloc(num_src_fields * sizeof(*src_field_buffer_sizes));
604 memcpy(
605 field->exchange_data.get.interp_weights_data.src_field_buffer_size,
606 src_field_buffer_sizes, num_src_fields * sizeof(*src_field_buffer_sizes));
607
608 return interp_weights_data;
609}
610
612 struct coupling_field * field, size_t * num_src_fields,
613 size_t const ** src_field_buffer_sizes) {
614
616 field->exchange_type == TARGET,
617 "ERROR(yac_get_coupling_field_get_op_interp_weights_data): "
618 "wrong field exchange type")
619
621 field->exchange_data.get.use_raw_exchange,
622 "ERROR(yac_get_coupling_field_get_op_interp_weights_data): "
623 "exchange is not configured to use raw data exchange")
624
626 field->exchange_data.get.interp_weights_data.num_src_fields;
627 if (src_field_buffer_sizes)
628 *src_field_buffer_sizes =
629 field->exchange_data.get.interp_weights_data.src_field_buffer_size;
630}
631
633 struct coupling_field * field, struct event * event,
634 struct yac_interpolation * interpolation,
635 struct yac_interpolation_exchange * interpolation_exchange,
636 int use_raw_exchange) {
637
639 field->exchange_type != TARGET,
640 "ERROR(yac_set_coupling_field_put_op_): "
641 "a get operation has already been set (field \"%s\")", field->name)
642
643 if (field->exchange_type == NOTHING) {
644 field->exchange_data.put.puts = NULL;
645 field->exchange_data.put.num_puts = 0;
646 field->exchange_type = SOURCE;
647 field->exchange_data.put.mask = NULL;
648 }
649
650 unsigned num_puts = field->exchange_data.put.num_puts;
651 field->exchange_data.put.num_puts++;
652
653 field->exchange_data.put.puts =
654 xrealloc(field->exchange_data.put.puts, (num_puts + 1) *
655 sizeof(*(field->exchange_data.put.puts)));
656
657 field->exchange_data.put.puts[num_puts].event = event;
658 field->exchange_data.put.puts[num_puts].interpolation = interpolation;
659 field->exchange_data.put.puts[num_puts].interpolation_exchange = interpolation_exchange;
660 field->exchange_data.put.puts[num_puts].time_accumulation_count = 0;
661 field->exchange_data.put.puts[num_puts].send_field_acc = NULL;
662 field->exchange_data.put.puts[num_puts].send_frac_mask_acc = NULL;
663 field->exchange_data.put.puts[num_puts].use_raw_exchange = use_raw_exchange;
664}
665
667 struct coupling_field * field, struct event * event,
668 struct yac_interpolation * interpolation) {
669
671 field, event, interpolation, NULL, 0);
672}
673
675 struct coupling_field * field, struct event * event,
676 struct yac_interpolation_exchange * interpolation_exchange) {
677
679 field, event, NULL, interpolation_exchange, 1);
680}
681
683 struct coupling_field * field, struct event * event,
684 struct yac_interpolation * interpolation,
685 struct yac_interpolation_exchange * interpolation_exchange,
687 int use_raw_exchange) {
688
690 field->exchange_type == NOTHING,
691 "ERROR(yac_set_coupling_field_get_op_): "
692 "a put or get operation has already been set (field \"%s\")", field->name)
693
694 field->exchange_type = TARGET;
695 field->exchange_data.get.event = event;
696 field->exchange_data.get.interpolation = interpolation;
697 field->exchange_data.get.interpolation_exchange = interpolation_exchange;
698 field->exchange_data.get.interp_weights_data = interp_weights_data;
699 field->exchange_data.get.mask = NULL;
700 field->exchange_data.get.use_raw_exchange = use_raw_exchange;
701}
702
704 struct coupling_field * field, struct event * event,
705 struct yac_interpolation * interpolation) {
706
707 struct yac_interp_weights_data dummy_interp_weights_data = {
709 .scaling_factor = 1.0,
710 .scaling_summand = 0.0,
711
712 .num_fixed_values = 0,
713 .fixed_values = NULL,
714 .num_tgt_per_fixed_value = NULL,
715 .tgt_idx_fixed = NULL,
716
717 .num_wgt_tgt = 0,
718 .wgt_tgt_idx = NULL,
719 .num_src_per_tgt = NULL,
720 .weights = NULL,
721 .src_field_idx = NULL,
722 .src_idx = NULL,
723 .num_src_fields = 0,
724 .src_field_buffer_size = NULL
725 };
726
728 field, event, interpolation, NULL, dummy_interp_weights_data, 0);
729}
730
732 struct coupling_field * field, struct event * event,
733 struct yac_interpolation_exchange * interpolation_exchange,
735
737 field, event, NULL, interpolation_exchange, interp_weights_data, 1);
738}
739
741 struct coupling_field * cpl_field) {
742
743 return cpl_field->interp_fields;
744}
745
747 struct coupling_field * cpl_field) {
749 (cpl_field->exchange_type == SOURCE) ||
750 (cpl_field->exchange_type == TARGET),
751 "ERROR(yac_coupling_field_get_datetime): "
752 "datetime is not defined for non-exchanged fields "
753 "(field \"%s\")", cpl_field->name);
754 struct event * event =
755 (cpl_field->exchange_type == SOURCE)?
756 cpl_field->exchange_data.put.puts[0].event:
757 cpl_field->exchange_data.get.event;
758 return
760 event, cpl_field->current_datetime);
761}
762
764
765 size_t collection_size = cpl_field->collection_size;
766 size_t num_interp_fields = cpl_field->num_interp_fields;
767
768 if (cpl_field->exchange_type == SOURCE) {
769
770 for (unsigned put_idx = 0; put_idx < cpl_field->exchange_data.put.num_puts;
771 ++put_idx) {
772
773 struct event * event = cpl_field->exchange_data.put.puts[put_idx].event;
774 struct yac_interpolation * interpolation =
775 cpl_field->exchange_data.put.puts[put_idx].interpolation;
776 struct yac_interpolation_exchange * interpolation_exchange =
777 cpl_field->exchange_data.put.puts[put_idx].interpolation_exchange;
778 double ***send_field_acc =
779 cpl_field->exchange_data.put.puts[put_idx].send_field_acc;
780 double ***send_frac_mask_acc =
781 cpl_field->exchange_data.put.puts[put_idx].send_frac_mask_acc;
782
783 if (send_field_acc != NULL) {
784 for (size_t h = 0; h < collection_size; ++h) {
785 for (size_t j = 0; j < num_interp_fields; ++j)
786 free(send_field_acc[h][j]);
787 free(send_field_acc[h]);
788 }
789 free(send_field_acc);
790 }
791
792 if (send_frac_mask_acc != NULL) {
793 for (size_t h = 0; h < collection_size; ++h) {
794 for (size_t j = 0; j < num_interp_fields; ++j)
795 free(send_frac_mask_acc[h][j]);
796 free(send_frac_mask_acc[h]);
797 }
798 free(send_frac_mask_acc);
799 }
800
802 yac_interpolation_delete(interpolation);
804 interpolation_exchange, "yac_coupling_field_delete");
805 }
806
807 free(cpl_field->exchange_data.put.puts);
808 if (cpl_field->exchange_data.put.mask) {
809 for (size_t i = 0; i < num_interp_fields; ++i)
810 free(cpl_field->exchange_data.put.mask[i]);
811 free(cpl_field->exchange_data.put.mask);
812 }
813
814 } else if (cpl_field->exchange_type == TARGET) {
815
820 "yac_coupling_field_delete");
823 if (cpl_field->exchange_data.get.mask)
824 free(cpl_field->exchange_data.get.mask);
825 }
826
827 free(cpl_field->name);
828 free(cpl_field->component_name);
829 free(cpl_field->interp_fields);
830 free(cpl_field->timestep);
831 free(cpl_field);
832}
#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:118
size_t yac_basic_grid_get_data_size(struct yac_basic_grid *grid, enum yac_location location)
Definition basic_grid.c:147
int const * yac_basic_grid_get_core_mask(struct yac_basic_grid *grid, enum yac_location location)
Definition basic_grid.c:101
void yac_event_delete(struct event *event)
Definition event.c:258
char * yac_get_event_current_datetime(struct event *event, char *datetime_str)
Definition event.c:314
struct yac_interpolation_exchange * yac_get_coupling_field_put_op_interpolation_exchange(struct coupling_field *field, unsigned put_idx)
Definition fields.c:432
void yac_set_coupling_field_put_op(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation)
Definition fields.c:666
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:682
unsigned yac_get_coupling_field_collection_size(struct coupling_field *field)
Definition fields.c:93
static int check_core_mask(struct coupling_field *field, size_t field_idx)
Definition fields.c:226
const char * yac_get_coupling_field_timestep(struct coupling_field *field)
Definition fields.c:98
unsigned yac_get_coupling_field_num_puts(struct coupling_field *field)
Definition fields.c:501
void yac_set_coupling_field_get_op(struct coupling_field *field, struct event *event, struct yac_interpolation *interpolation)
Definition fields.c:703
char const * yac_get_coupling_field_comp_name(struct coupling_field *field)
Definition fields.c:126
int yac_get_coupling_field_put_op_time_accumulation_count(struct coupling_field *field, unsigned put_idx)
Definition fields.c:453
double *** yac_get_coupling_field_put_op_send_frac_mask_acc(struct coupling_field *field, unsigned put_idx)
Definition fields.c:216
struct yac_basic_grid * yac_coupling_field_get_basic_grid(struct coupling_field *field)
Definition fields.c:120
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:632
size_t yac_coupling_field_get_num_interp_fields(struct coupling_field *field)
Definition fields.c:103
struct yac_interpolation * yac_get_coupling_field_put_op_interpolation(struct coupling_field *field, unsigned put_idx)
Definition fields.c:410
enum yac_location yac_get_coupling_field_get_interp_field_location(struct coupling_field *field, size_t interp_field_idx)
Definition fields.c:109
struct event * yac_get_coupling_field_get_op_event(struct coupling_field *field)
Definition fields.c:510
static size_t get_interp_field_size(struct yac_interp_field field, struct yac_basic_grid *grid)
Definition fields.c:137
void yac_set_coupling_field_put_op_raw(struct coupling_field *field, struct event *event, struct yac_interpolation_exchange *interpolation_exchange)
Definition fields.c:674
size_t yac_coupling_field_get_data_size(struct coupling_field *field, enum yac_location location)
Definition fields.c:143
struct yac_interp_field const * yac_coupling_field_get_interp_fields(struct coupling_field *cpl_field)
Definition fields.c:740
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:61
int * yac_get_coupling_field_get_mask(struct coupling_field *field)
Definition fields.c:317
static void init_put_op_acc(struct coupling_field *field, double init_value, double ***acc)
Definition fields.c:149
struct event * yac_get_coupling_field_put_op_event(struct coupling_field *field, unsigned put_idx)
Definition fields.c:396
char * yac_coupling_field_get_datetime(struct coupling_field *cpl_field)
Definition fields.c:746
void yac_init_coupling_field_put_op_send_field_acc(struct coupling_field *field, unsigned put_idx, double init_value)
Definition fields.c:354
struct yac_interpolation * yac_get_coupling_field_get_op_interpolation(struct coupling_field *field)
Definition fields.c:544
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:611
void yac_set_coupling_field_put_op_time_accumulation_count(struct coupling_field *field, unsigned put_idx, int count)
Definition fields.c:485
int yac_get_coupling_field_get_op_use_raw_exchange(struct coupling_field *field)
Definition fields.c:521
struct yac_interpolation_exchange * yac_get_coupling_field_get_op_interpolation_exchange(struct coupling_field *field)
Definition fields.c:561
int yac_get_coupling_field_get_op_with_frac_mask(struct coupling_field *field)
Definition fields.c:532
enum yac_field_exchange_type yac_get_coupling_field_exchange_type(struct coupling_field *field)
Definition fields.c:132
const char * yac_get_coupling_field_name(struct coupling_field *field)
Definition fields.c:115
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:731
static int check_field_mask(struct coupling_field *field, size_t field_idx)
Definition fields.c:249
void yac_coupling_field_delete(struct coupling_field *cpl_field)
Definition fields.c:763
int ** yac_get_coupling_field_put_mask(struct coupling_field *field)
Definition fields.c:272
struct yac_interp_weights_data yac_get_coupling_field_get_op_interp_weights_data(struct coupling_field *field)
Definition fields.c:578
void yac_init_coupling_field_put_op_send_frac_mask_acc(struct coupling_field *field, unsigned put_idx, double init_value)
Definition fields.c:375
static void get_put_op_acc(struct coupling_field *field, unsigned put_idx, char const *routine_name, double ****acc)
Definition fields.c:170
double *** yac_get_coupling_field_put_op_send_field_acc(struct coupling_field *field, unsigned put_idx)
Definition fields.c:206
int yac_get_coupling_field_put_op_use_raw_exchange(struct coupling_field *field, unsigned put_idx)
Definition fields.c:469
yac_field_exchange_type
Definition fields.h:12
@ SOURCE
Definition fields.h:14
@ TARGET
Definition fields.h:15
@ NOTHING
Definition fields.h:13
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)
double const YAC_FRAC_MASK_UNDEF
#define YAC_FRAC_MASK_VALUE_IS_VALID(value)
void yac_interpolation_exchange_delete(struct yac_interpolation_exchange *exchange, char const *routine_name)
yac_location
Definition location.h:12
#define xrealloc(ptr, size)
Definition ppm_xfuncs.h:67
#define xmalloc(size)
Definition ppm_xfuncs.h:66
double *** send_field_acc
Definition fields.c:42
int time_accumulation_count
Definition fields.c:41
int use_raw_exchange
Definition fields.c:44
double *** send_frac_mask_acc
Definition fields.c:43
struct yac_interpolation_exchange * interpolation_exchange
Definition fields.c:40
struct yac_basic_grid * grid
Definition fields.c:22
struct coupling_field::@69::@71 get
char current_datetime[MAX_DATETIME_STR_LEN]
Definition fields.c:29
struct coupling_field::@69::@70::@72 * puts
union coupling_field::@69 exchange_data
struct yac_interp_field * interp_fields
Definition fields.c:24
enum yac_field_exchange_type exchange_type
Definition fields.c:33
struct yac_interp_weights_data interp_weights_data
Definition fields.c:53
unsigned num_puts
Definition fields.c:46
struct coupling_field::@69::@70 put
size_t num_interp_fields
Definition fields.c:25
char * timestep
Definition fields.c:27
struct event * event
Definition fields.c:38
char * component_name
Definition fields.c:20
size_t collection_size
number of vertical levels or bundles
Definition fields.c:26
char * name
Definition fields.c:18
int * mask
Definition fields.c:54
int ** mask
Definition fields.c:47
struct yac_interpolation * interpolation
Definition fields.c:39
Definition event.c:18
int collection_size
struct @84 field[]
static int mask[16]
int const * location
#define YAC_OMP_PARALLEL
#define YAC_OMP_FOR
static size_t num_points
Definition yac.c:151
#define YAC_ASSERT_F(exp, format,...)
Definition yac_assert.h:19