YAC 3.18.0
Yet Another Coupler
Loading...
Searching...
No Matches
interp_stack_config.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#ifdef HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <math.h>
10#include <string.h>
11#include <limits.h>
12
13#include "geometry.h"
14#include "yac_mpi_internal.h"
15#include "interp_stack_config.h"
29#include "parameter/param.h"
30
35
36// The union type is used here for compatiblity reasons.
38 struct {
40 /*
41 * Temporary compatibility solution: keep one layzily-built SPMAP ext cache.
42 */
45};
46
51
53 struct yac_spmap_ext_cache_entry * entry) {
54
55 if (entry == NULL) return;
58 entry->default_config = NULL;
59 entry->overwrite_configs = NULL;
60 free(entry);
61}
62
64 struct yac_interp_stack_config * interp_stack) {
65
66 struct yac_interp_stack_config * interp_stack_copy =
67 xmalloc(1 * sizeof(*interp_stack_copy));
68 interp_stack_copy->size = interp_stack->size;
69 interp_stack_copy->entries =
70 xmalloc(interp_stack_copy->size * sizeof(*(interp_stack_copy->entries)));
71 for (size_t i = 0; i < interp_stack_copy->size; ++i) {
72 interp_stack_copy->entries[i].data.config =
73 yac_interp_method_config_copy(interp_stack->entries[i].data.config);
74 interp_stack_copy->entries[i].data.spmap_ext_cache = NULL;
75 }
76 return interp_stack_copy;
77}
78
79int yac_interp_stack_config_compare(void const * a_, void const * b_) {
80
81 struct yac_interp_stack_config const * a =
82 (struct yac_interp_stack_config const *)a_;
83 struct yac_interp_stack_config const * b =
84 (struct yac_interp_stack_config const *)b_;
85
86 int ret;
87 if ((ret = (a->size > b->size) - (a->size < b->size))) return ret;
88
89 size_t stack_size = a->size;
90 for (size_t method_idx = 0; method_idx < stack_size; ++method_idx)
92 a->entries[method_idx].data.config,
93 b->entries[method_idx].data.config)))
94 return ret;
95 return 0;
96}
97
99 struct yac_interp_stack_config * interp_stack) {
100
101 size_t interp_stack_size = interp_stack->size;
102 struct interp_method ** method_stack =
103 xmalloc((interp_stack_size + 1) * sizeof(*method_stack));
104 method_stack[interp_stack_size] = NULL;
105
106 for (size_t i = 0; i < interp_stack_size; ++i) {
107 method_stack[i] =
108 yac_interp_method_config_generate(interp_stack->entries[i].data.config);
109 }
110 return method_stack;
111}
112
114 struct yac_interp_stack_config * interp_stack, MPI_Comm comm) {
115
116 int size_pack_size;
117 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &size_pack_size), comm);
118
119 size_t config_pack_size = 0;
120
121 for (size_t i = 0; i < interp_stack->size; ++i)
122 config_pack_size +=
124 interp_stack->entries[i].data.config, comm);
125 return (size_t)size_pack_size + config_pack_size;
126}
127
129 struct yac_interp_stack_config * interp_stack,
130 void * buffer, int buffer_size, int * position, MPI_Comm comm) {
131
132 int stack_size = (int)(interp_stack->size);
134 MPI_Pack(
135 &stack_size, 1, MPI_INT,
136 buffer, buffer_size, position, comm), comm);
137
138 for (size_t i = 0; i < interp_stack->size; ++i)
140 interp_stack->entries[i].data.config,
141 buffer, buffer_size, position, comm);
142}
143
145 void * buffer, int buffer_size, int * position, MPI_Comm comm) {
146
147 int stack_size;
149 MPI_Unpack(
150 buffer, buffer_size, position, &stack_size, 1, MPI_INT, comm), comm);
151
153 stack_size >= 0,
154 "ERROR(yac_interp_stack_config_unpack_interp_stack): invalid stack size")
155
156 struct yac_interp_stack_config * interp_stack =
158
159 interp_stack->size = (size_t)stack_size;
160 interp_stack->entries =
161 xmalloc((size_t)stack_size * sizeof(*interp_stack->entries));
162
163 for (int i = 0; i < stack_size; ++i) {
164 interp_stack->entries[i].data.config =
165 yac_interp_method_config_unpack(buffer, buffer_size, position, comm);
166 interp_stack->entries[i].data.spmap_ext_cache = NULL;
167 }
168 return interp_stack;
169}
170
172
173 struct yac_interp_stack_config * interp_stack_config =
174 xmalloc(1 * sizeof(*interp_stack_config));
175 interp_stack_config->entries = NULL;
176 interp_stack_config->size = 0;
177
178 return interp_stack_config;
179}
180
182 struct yac_interp_stack_config * interp_stack_config) {
183 for (size_t i = 0; i < interp_stack_config->size; ++i) {
185 interp_stack_config->entries[i].data.config);
187 interp_stack_config->entries[i].data.spmap_ext_cache);
188 }
189 free(interp_stack_config->entries);
190 free(interp_stack_config);
191}
192
194 struct yac_interp_stack_config * interp_stack_config,
195 struct yac_interp_method_config * method_config) {
196 interp_stack_config->size++;
197 interp_stack_config->entries =
198 xrealloc(
199 interp_stack_config->entries,
200 interp_stack_config->size * sizeof(*(interp_stack_config->entries)));
201 interp_stack_config->entries[interp_stack_config->size - 1].data.config =
202 method_config;
203 interp_stack_config->entries[interp_stack_config->size - 1].data.
204 spmap_ext_cache = NULL;
205}
206
208 struct yac_interp_method_config * method_config,
209 char const * routine) {
210
211 struct yac_param * param =
214 param != NULL,
215 "ERROR(%s): failed to get method configuration parameters", routine);
216 return param;
217}
218
219static struct yac_param * get_sub_param(
220 struct yac_param * param,
221 char const * name,
222 char const * routine) {
223
224 struct yac_param * sub_param = NULL;
225 int ierr =
226 yac_param_get_sub_by_name(param, name, &sub_param);
228 ierr == 0,
229 "ERROR(%s): failed to access parameter \"%s\": %s",
230 routine, name, yac_param_get_last_error());
231 return sub_param;
232}
233
235 struct yac_param * param,
236 size_t idx,
237 char const * name,
238 char const * routine) {
239
240 struct yac_param * sub_param = NULL;
241 int ierr =
242 yac_param_get_sub_by_index(param, idx, &sub_param);
244 ierr == 0,
245 "ERROR(%s): failed to access parameter \"%s\" (idx=%zu): %s",
246 routine, name, idx, yac_param_get_last_error());
247 return sub_param;
248}
249
250static size_t get_sub_count(
251 struct yac_param * param,
252 char const * name,
253 char const * routine) {
254
255 size_t count = SIZE_MAX;
256 int ierr = yac_param_get_sub_count(param, &count);
258 ierr == 0,
259 "ERROR(%s): failed to read sub-parameter count of \"%s\": %s",
260 routine, name, yac_param_get_last_error());
261 return count;
262}
263
264static int get_param_int(
265 struct yac_param * param,
266 char const * name,
267 char const * routine) {
268
269 int value = INT_MAX;
270 int ierr =
273 ierr == 0,
274 "ERROR(%s): failed to read parameter \"%s\": %s",
275 routine, name, yac_param_get_last_error());
276 return value;
277}
278
279static double get_param_dble(
280 struct yac_param * param,
281 char const * name,
282 char const * routine) {
283
284 double value = NAN;
285 int ierr =
288 ierr == 0,
289 "ERROR(%s): failed to read parameter \"%s\": %s",
290 routine, name, yac_param_get_last_error());
291 return value;
292}
293
294static char * get_param_str_dup(
295 struct yac_param * param,
296 char const * name,
297 char const * routine) {
298
300 int ierr =
301 yac_param_get_scalar(param, value, sizeof(value));
303 ierr == 0,
304 "ERROR(%s): failed to read parameter \"%s\": %s",
305 routine, name, yac_param_get_last_error());
306 return xstrdup(value);
307}
308
310 struct yac_param * cell_area_oneof_param,
311 char const * name, char const * routine) {
312
313 struct yac_param * cell_area_param =
314 get_sub_param_by_index(cell_area_oneof_param, 0, name, routine);
315 char const * cell_area_type_name = yac_param_get_name(cell_area_param);
317 cell_area_type_name != NULL,
318 "ERROR(%s): invalid %s configuration", routine, name);
319
321 type_table,
328
329 int type =
331 type_table, type_table_size, cell_area_type_name);
332
333 struct yac_spmap_cell_area_config * cell_area_config = NULL;
334
335 switch(type) {
337 "ERROR(%s): invalid cell area configuration type \"%s\"",
338 routine, cell_area_type_name);
340
341 char * filename =
343 get_sub_param(cell_area_param, "filename", routine),
344 "filename", routine);
345 char * varname =
347 get_sub_param(cell_area_param, "varname", routine),
348 "varname", routine);
349 int min_global_id =
351 get_sub_param(cell_area_param, "min_global_id", routine),
352 "min_global_id", routine);
353 cell_area_config =
355 free(filename);
356 free(varname);
357 break;
358 }
360
361 cell_area_config =
364 get_sub_param(cell_area_param, "sphere_radius", routine),
365 "sphere_radius", routine));
366 break;
367 }
368 }
369 return cell_area_config;
370}
371
373 struct yac_param * root_param,
374 char const * routine) {
375
376 struct yac_spmap_ext_cache_entry * entry = xmalloc(1 * sizeof(*entry));
377
378 struct yac_spmap_cell_area_config * src_cell_area_config =
380 get_sub_param(root_param, "src_cell_area", routine),
381 "src_cell_area", routine);
382 struct yac_spmap_cell_area_config * tgt_cell_area_config =
384 get_sub_param(root_param, "tgt_cell_area", routine),
385 "tgt_cell_area", routine);
386 struct yac_spmap_scale_config * scale_config =
389 get_sub_param(root_param, "scale", routine),
390 "scale", routine),
391 src_cell_area_config, tgt_cell_area_config);
392
393 yac_spmap_cell_area_config_delete(src_cell_area_config);
394 yac_spmap_cell_area_config_delete(tgt_cell_area_config);
395
396 entry->default_config =
399 get_sub_param(root_param, "spread_distance", routine),
400 "spread_distance", routine),
402 get_sub_param(root_param, "max_search_distance", routine),
403 "max_search_distance", routine),
405 get_sub_param(root_param, "weighted", routine),
406 "weighted", routine),
407 scale_config);
408 yac_spmap_scale_config_delete(scale_config);
409
410 struct yac_param * overwrite_param =
411 get_sub_param(root_param, "overwrite", routine);
412 size_t overwrite_count = get_sub_count(overwrite_param, "overwrite", routine);
413
414 entry->overwrite_configs =
415 (overwrite_count > 0)?
416 xcalloc(overwrite_count + 1, sizeof(*(entry->overwrite_configs))):NULL;
417
418 for (size_t i = 0; i < overwrite_count; ++i) {
419 struct yac_param * overwrite_entry_param =
420 get_sub_param_by_index(overwrite_param, i, "overwrite", routine);
421
422 struct yac_param * condition_oneof_param =
423 get_sub_param(overwrite_entry_param, "condition", routine);
424 struct yac_param * condition_param =
426 condition_oneof_param, 0, "condition", routine);
427 char const * condition_type =
428 yac_param_get_name(condition_param);
430 (condition_type != NULL) &&
431 (!strcmp(condition_type, "bnd_circle") ||
432 !strcmp(condition_type, "bounding_circle")),
433 "ERROR(%s): unsupported overwrite condition type",
434 routine);
435
436 struct yac_param * center_param =
437 get_sub_param(condition_param, "center", routine);
438
439 struct yac_point_selection * src_point_selection =
442 get_sub_param(center_param, "lon", routine),
443 "lon", routine),
445 get_sub_param(center_param, "lat", routine),
446 "lat", routine),
448 get_sub_param(condition_param, "radius", routine),
449 "radius", routine));
450
451 struct yac_interp_spmap_config * overwrite_config =
454 get_sub_param(overwrite_entry_param, "spread_distance", routine),
455 "spread_distance", routine),
458 overwrite_entry_param, "max_search_distance", routine),
459 "max_search_distance", routine),
461 get_sub_param(overwrite_entry_param, "weighted", routine),
462 "weighted", routine),
464
465 entry->overwrite_configs[i] =
466 yac_spmap_overwrite_config_new(src_point_selection, overwrite_config);
467
468 yac_point_selection_delete(src_point_selection);
469 yac_interp_spmap_config_delete(overwrite_config);
470 }
471
472 return entry;
473}
474
476 union yac_interp_stack_config_entry * interp_stack_entry,
477 struct yac_param * root_param,
478 char const * routine) {
479
480 if (interp_stack_entry->data.spmap_ext_cache == NULL) {
481
482 interp_stack_entry->data.spmap_ext_cache =
483 yac_spmap_ext_cache_entry_new(root_param, routine);
484 }
485
486 return interp_stack_entry->data.spmap_ext_cache;
487}
488
490 union yac_interp_stack_config_entry const * interp_stack_entry) {
491
492 return interp_stack_entry->data.config;
493}
494
496 union yac_interp_stack_config_entry const * interp_stack_entry,
497 char const * routine) {
498
499 return get_method_param(get_entry_method_config(interp_stack_entry), routine);
500}
501
503 struct yac_param * param, char const * name,
504 int value, char const * routine) {
505
506 int ierr =
509 ierr == 0,
510 "ERROR(%s): failed to set parameter \"%s\": %s",
511 routine, name, yac_param_get_last_error());
512}
513
515 struct yac_param * param, char const * name,
516 double value, char const * routine) {
517
518 int ierr =
521 ierr == 0,
522 "ERROR(%s): failed to set parameter \"%s\": %s",
523 routine, name, yac_param_get_last_error());
524}
525
527 struct yac_param * param, char const * name,
528 char const * value, char const * routine) {
529
530 int ierr =
531 yac_param_set_scalar(get_sub_param(param, name, routine), value);
533 ierr == 0,
534 "ERROR(%s): failed to set parameter \"%s\": %s",
535 routine, name, yac_param_get_last_error());
536}
537
539 struct yac_interp_stack_config * interp_stack_config,
540 enum yac_interp_avg_weight_type reduction_type, int partial_coverage) {
541
542 char const * routine = "yac_interp_stack_config_add_average";
543
544 struct yac_interp_method_config * method_config =
546 struct yac_param * root_param =
547 get_method_param(method_config, routine);
548
549 set_sub_param_int(root_param, "weighted", (int)reduction_type, routine);
550 set_sub_param_int(root_param, "partial_coverage", partial_coverage, routine);
551
552 yac_param_delete(root_param);
553 yac_interp_stack_config_add(interp_stack_config, method_config);
554}
555
557 struct yac_interp_stack_config * interp_stack_config,
558 int reduction_type, int partial_coverage) {
559
561 (reduction_type == YAC_INTERP_AVG_ARITHMETIC) ||
562 (reduction_type == YAC_INTERP_AVG_DIST) ||
563 (reduction_type == YAC_INTERP_AVG_BARY),
564 "ERROR(yac_interp_stack_config_add_average_f2c): "
565 "reduction_type must be one of "
566 "YAC_INTERP_AVG_ARITHMETIC/YAC_INTERP_AVG_DIST/YAC_INTERP_AVG_BARY");
567
569 interp_stack_config, (enum yac_interp_avg_weight_type)reduction_type,
570 partial_coverage);
571}
572
574 struct yac_interp_stack_config * interp_stack_config,
575 enum yac_interp_ncc_weight_type weight_type, int partial_coverage) {
576
577 char const * routine = "yac_interp_stack_config_add_ncc";
578
579 struct yac_interp_method_config * method_config =
581 struct yac_param * root_param =
582 get_method_param(method_config, routine);
583
584 set_sub_param_int(root_param, "weighted", (int)weight_type, routine);
585 set_sub_param_int(root_param, "partial_coverage", partial_coverage, routine);
586
587 yac_param_delete(root_param);
588 yac_interp_stack_config_add(interp_stack_config, method_config);
589}
590
592 struct yac_interp_stack_config * interp_stack_config,
593 int weight_type, int partial_coverage) {
594
598 "ERROR(yac_interp_stack_config_add_ncc_f2c): "
599 "weight_type must be one of "
600 "YAC_INTERP_NCC_AVG/YAC_INTERP_NCC_DIST");
601
603 interp_stack_config, (enum yac_interp_ncc_weight_type)weight_type,
604 partial_coverage);
605}
606
608 struct yac_interp_stack_config * interp_stack_config,
610 enum yac_interp_dnn_search_distance_type search_distance_type,
611 double search_distance, double scale) {
612
613 char const * routine = "yac_interp_stack_config_add_dnn";
614
615 struct yac_interp_method_config * method_config =
617 struct yac_param * root_param = get_method_param(method_config, routine);
618
619 set_sub_param_int(root_param, "weighted", (int)type, routine);
620
621 struct yac_param * search_distance_param =
622 get_sub_param( root_param, "search_distance", routine);
623 switch (search_distance_type) {
625 "ERROR(%s): invalid search distance type", routine);
628 search_distance_param, "fixed", search_distance, routine);
629 break;
632 search_distance_param, "cell_area", search_distance, routine);
633 break;
634 }
635 switch (type) {
637 "ERROR(%s): invalid weight type", routine);
638 case YAC_INTERP_DNN_WEIGHT_AVG: {__attribute__((fallthrough));}
641 root_param, "rbf_scale", YAC_INTERP_DNN_DUMMY_SCALE, routine);
642 break;
645 root_param, "rbf_scale", scale, routine);
646 break;
648 set_sub_param_dble(root_param, "gauss_scale", scale, routine);
649 break;
650 }
651
652 yac_param_delete(root_param);
653 yac_interp_stack_config_add(interp_stack_config, method_config);
654}
655
657 struct yac_interp_stack_config * interp_stack_config,
658 int type, int search_distance_type, double search_distance, double scale) {
659
665 "ERROR(yac_interp_stack_config_add_dnn_f2c): "
666 "type must be one of YAC_INTERP_DNN_WEIGHT_AVG/YAC_INTERP_DNN_WEIGHT_DIST/"
667 "YAC_INTERP_DNN_WEIGHT_GAUSS/YAC_INTERP_DNN_WEIGHT_RBF.")
668
670 (search_distance_type == YAC_INTERP_DNN_SEARCH_DISTANCE_FIXED) ||
671 (search_distance_type == YAC_INTERP_DNN_SEARCH_DISTANCE_CELL_AREA),
672 "ERROR(yac_interp_stack_config_add_dnn_f2c): "
673 "search_distance_type must be one of "
674 "YAC_INTERP_DNN_SEARCH_DISTANCE_FIXED/"
675 "YAC_INTERP_DNN_SEARCH_DISTANCE_CELL_AREA.")
676
678 interp_stack_config, (enum yac_interp_dnn_weight_type)type,
679 (enum yac_interp_dnn_search_distance_type)search_distance_type,
680 search_distance, scale);
681}
682
684 struct yac_interp_stack_config * interp_stack_config,
685 enum yac_interp_nnn_weight_type type, size_t n,
686 double max_search_distance, double scale) {
687
688 char const * method_name = (type == YAC_INTERP_NNN_RBF)?"rbf":"nnn";
689 char const * routine = "yac_interp_stack_config_add_nnn";
690
691 struct yac_interp_method_config * method_config =
693 struct yac_param * root_param =
694 get_method_param(method_config, routine);
695
697 set_sub_param_int(root_param, "weighted", (int)type, routine);
698
699 set_sub_param_int(root_param, "n", (int)n, routine);
701 root_param, "max_search_distance", max_search_distance, routine);
702
704 set_sub_param_dble(root_param, "rbf_scale", scale, routine);
705 else
706 set_sub_param_dble(root_param, "gauss_scale", scale, routine);
707
708 yac_param_delete(root_param);
709 yac_interp_stack_config_add(interp_stack_config, method_config);
710}
711
713 struct yac_interp_stack_config * interp_stack_config,
714 size_t n, double max_search_distance, double scale) {
715
717 interp_stack_config, YAC_INTERP_NNN_RBF, n, max_search_distance, scale);
718}
720 struct yac_interp_stack_config * interp_stack_config,
721 int type, size_t n, double max_search_distance, double scale) {
722
729 "ERROR(yac_interp_stack_config_add_nnn_f2c): "
730 "type must be one of YAC_INTERP_NNN_AVG/YAC_INTERP_NNN_DIST/"
731 "YAC_INTERP_NNN_GAUSS/YAC_INTERP_NNN_RBF/YAC_INTERP_NNN_ZERO.")
732
734 interp_stack_config, (enum yac_interp_nnn_weight_type)type, n,
735 max_search_distance, scale);
736}
737
739 struct yac_interp_stack_config * interp_stack_config,
740 int order, int enforced_conserv, int partial_coverage,
741 enum yac_interp_method_conserv_normalisation normalisation) {
742
743 char const * routine = "yac_interp_stack_config_add_conservative";
744
746 (order == 1) || (order == 2),
747 "ERROR(%s): order must be 1 (first order) or 2 (second order), got %d",
748 routine, order)
749
750 struct yac_interp_method_config * method_config =
752 struct yac_param * root_param =
753 get_method_param(method_config, routine);
754
756 root_param, "order", order, routine);
758 root_param, "enforced_conservation", enforced_conserv, routine);
760 root_param, "partial_coverage", partial_coverage, routine);
762 root_param, "normalisation", (int)normalisation, routine);
763
764 yac_param_delete(root_param);
765 yac_interp_stack_config_add(interp_stack_config, method_config);
766}
767
769 struct yac_interp_stack_config * interp_stack_config,
770 int order, int enforced_conserv, int partial_coverage,
771 int normalisation) {
772
774 (normalisation == YAC_INTERP_CONSERV_DESTAREA) ||
775 (normalisation == YAC_INTERP_CONSERV_FRACAREA),
776 "ERROR(yac_interp_stack_config_add_conservative_f2c): "
777 "type must be one of "
778 "YAC_INTERP_CONSERV_DESTAREA/YAC_INTERP_CONSERV_FRACAREA.")
779
781 interp_stack_config, order, enforced_conserv, partial_coverage,
782 (enum yac_interp_method_conserv_normalisation)normalisation);
783}
784
786 double sphere_radius, char const * filename,
787 char const * varname, int min_global_id, char const * type) {
788
789 char const * routine = "generate_spmap_cell_area_config";
790
792 (sphere_radius == 0.0) ||
793 ((sphere_radius != 0.0) &&
794 ((filename == NULL) && (varname == NULL))),
795 "ERROR(%s): %s sphere_radius != 0.0, but filename and varname are not NULL",
796 routine, type);
798 (sphere_radius != 0.0) ||
799 ((sphere_radius == 0.0) &&
800 ((filename != NULL) && (strlen(filename) > 0) && (filename[0] != '\0') &&
801 (varname != NULL) && (strlen(varname) > 0) && (varname[0] != '\0'))),
802 "ERROR(%s): %s sphere_radius == 0.0, "
803 "but filename and/or varname are invalid", routine, type);
804
805 return
806 (sphere_radius != 0.0)?
809}
810
812 struct yac_param * cell_area_param,
813 struct yac_spmap_cell_area_config const * cell_area_config,
814 char const * name, char const * routine) {
815
817 yac_spmap_cell_area_config_get_type(cell_area_config);
818
819 switch (type) {
821 "ERROR(%s): invalid %s type",
822 routine, name);
825 get_sub_param(cell_area_param, "yac", routine),
826 "sphere_radius",
828 routine);
829 break;
830 }
832 struct yac_param * file_param =
833 get_sub_param(cell_area_param, "file", routine);
835 file_param, "filename",
836 yac_spmap_cell_area_config_get_filename(cell_area_config), routine);
838 file_param, "varname",
839 yac_spmap_cell_area_config_get_varname(cell_area_config), routine);
841 file_param, "min_global_id",
843 routine);
844 break;
845 }
846 }
847}
848
850 struct yac_param * param,
851 struct yac_interp_spmap_config const * config,
852 int include_scale,
853 char const * routine) {
854
856 param, "spread_distance",
859 param, "max_search_distance",
862 param, "weighted",
864
865 if (!include_scale) return;
866
867 struct yac_spmap_scale_config const * scale_config =
870 param, "scale",
871 (int)yac_spmap_scale_config_get_type(scale_config), routine);
872
874 get_sub_param(param, "src_cell_area", routine),
876 "src_cell_area", routine);
878 get_sub_param(param, "tgt_cell_area", routine),
880 "tgt_cell_area", routine);
881}
882
884 struct yac_interp_stack_config * interp_stack_config,
885 struct yac_interp_spmap_config * default_config,
886 struct yac_spmap_overwrite_config ** overwrite_configs) {
887
888 char const * routine = "yac_interp_stack_config_add_spmap_ext";
889
890 struct yac_interp_method_config * method_config =
892 struct yac_param * root_param =
893 get_method_param(method_config, routine);
894
895 set_spmap_config_param(root_param, default_config, 1, routine);
896
897 struct yac_param * overwrite_param =
898 get_sub_param(root_param, "overwrite", routine);
899 for (size_t i = 0;
900 (overwrite_configs != NULL) && (overwrite_configs[i] != NULL);
901 ++i) {
902
903 struct yac_param * overwrite_entry_param = NULL;
904 int ierr =
906 overwrite_param, &overwrite_entry_param);
908 ierr == 0,
909 "ERROR(%s): failed to append overwrite config: %s",
910 routine, yac_param_get_last_error());
911
912 struct yac_point_selection const * src_point_selection =
915 yac_point_selection_get_type(src_point_selection) ==
917 "ERROR(%s): unsupported overwrite source point selection type", routine);
918
921 src_point_selection, &center_lon, &center_lat, &inc_angle);
922 struct yac_param * condition_oneof_param =
923 get_sub_param(overwrite_entry_param, "condition", routine);
924 struct yac_param * condition_param =
925 get_sub_param(condition_oneof_param, "bounding_circle", routine);
926 struct yac_param * center_param =
927 get_sub_param(condition_param, "center", routine);
928 set_sub_param_dble(center_param, "lon", center_lon, routine);
929 set_sub_param_dble(center_param, "lat", center_lat, routine);
930 set_sub_param_dble(condition_param, "radius", inc_angle, routine);
931
933 overwrite_entry_param,
935 0, routine);
936 }
937
938 yac_param_delete(root_param);
939 yac_interp_stack_config_add(interp_stack_config, method_config);
940}
941
943 struct yac_interp_stack_config * interp_stack_config,
944 double spread_distance, double max_search_distance,
946 enum yac_interp_spmap_scale_type scale_type,
947 double src_sphere_radius, char const * src_filename,
948 char const * src_varname, int src_min_global_id,
949 double tgt_sphere_radius, char const * tgt_filename,
950 char const * tgt_varname, int tgt_min_global_id) {
951
952 struct yac_spmap_cell_area_config * src_cell_area_config =
954 src_sphere_radius, src_filename, src_varname,
955 src_min_global_id, "source");
956 struct yac_spmap_cell_area_config * tgt_cell_area_config =
958 tgt_sphere_radius, tgt_filename, tgt_varname,
959 tgt_min_global_id, "target");
960 struct yac_spmap_scale_config * scale_config =
962 scale_type, src_cell_area_config, tgt_cell_area_config);
963 struct yac_interp_spmap_config * default_config =
965 spread_distance, max_search_distance, weight_type, scale_config);
966
968 yac_spmap_cell_area_config_delete(src_cell_area_config);
969 yac_spmap_cell_area_config_delete(tgt_cell_area_config);
970
971 struct yac_spmap_overwrite_config ** overwrite_configs = NULL;
972
974 interp_stack_config, default_config, overwrite_configs);
975 yac_interp_spmap_config_delete(default_config);
976}
977
979 struct yac_interp_stack_config * interp_stack_config,
980 double spread_distance, double max_search_distance,
981 int weight_type, int scale_type,
982 double src_sphere_radius, char const * src_filename,
983 char const * src_varname, int src_min_global_id,
984 double tgt_sphere_radius, char const * tgt_filename,
985 char const * tgt_varname, int tgt_min_global_id) {
986
987 char const * routine = "yac_interp_stack_config_add_spmap_f2c";
988
992 "ERROR(%s): weight_type must be one of "
993 "YAC_INTERP_SPMAP_AVG/YAC_INTERP_SPMAP_DIST.", routine)
994
996 (scale_type == YAC_INTERP_SPMAP_NONE) ||
997 (scale_type == YAC_INTERP_SPMAP_SRCAREA) ||
998 (scale_type == YAC_INTERP_SPMAP_INVTGTAREA) ||
999 (scale_type == YAC_INTERP_SPMAP_FRACAREA),
1000 "ERROR(%s): scale_type must be one of "
1001 "YAC_INTERP_SPMAP_NONE/YAC_INTERP_SPMAP_SRCAREA/"
1002 "YAC_INTERP_SPMAP_INVTGTAREA/YAC_INTERP_SPMAP_FRACAREA.", routine)
1003
1004 if (src_filename && (src_filename[0] == '\0')) src_filename = NULL;
1005 if (src_varname && (src_varname[0] == '\0')) src_varname = NULL;
1006 if (tgt_filename && (tgt_filename[0] == '\0')) tgt_filename = NULL;
1007 if (tgt_varname && (tgt_varname[0] == '\0')) tgt_varname = NULL;
1008
1010 interp_stack_config, spread_distance, max_search_distance,
1012 (enum yac_interp_spmap_scale_type)scale_type,
1013 src_sphere_radius, src_filename, src_varname, src_min_global_id,
1014 tgt_sphere_radius, tgt_filename, tgt_varname, tgt_min_global_id);
1015}
1016
1018 struct yac_interp_stack_config * interp_stack_config) {
1019
1020 struct yac_interp_method_config * method_config =
1022
1023 yac_interp_stack_config_add(interp_stack_config, method_config);
1024}
1025
1026static void check_string(
1027 char const * string, char const * file, int line, char const * routine,
1028 char const * variable) {
1029
1031 string != NULL, "ERROR(%s:%d:%s): %s is NULL",
1032 file, line, routine, variable)
1034 strlen(string) < YAC_MAX_FILE_NAME_LENGTH,
1035 "ERROR(%s:%d:%s): %s is too long", file, line, routine, variable)
1036}
1037
1039 struct yac_interp_stack_config * interp_stack_config,
1040 char const * filename,
1041 enum yac_interp_file_on_missing_file on_missing_file,
1042 enum yac_interp_file_on_success on_success) {
1043
1044 char const * routine = "yac_interp_stack_config_add_user_file";
1045
1046 check_string(filename, __FILE__, __LINE__, routine, "filename");
1047
1048 struct yac_interp_method_config * method_config =
1050 struct yac_param * root_param =
1051 get_method_param(method_config, routine);
1052
1054 root_param, "filename", filename, routine);
1056 root_param, "on_missing_file", (int)on_missing_file, routine);
1058 root_param, "on_success", (int)on_success, routine);
1059
1060 yac_param_delete(root_param);
1061 yac_interp_stack_config_add(interp_stack_config, method_config);
1062}
1063
1065 struct yac_interp_stack_config * interp_stack_config,
1066 char const * filename, int on_missing_file, int on_success) {
1067
1068 char const * routine = "yac_interp_stack_config_add_user_file_f2c";
1069
1070 if (filename && (filename[0] == '\0')) filename = NULL;
1072 (on_missing_file == YAC_INTERP_FILE_MISSING_ERROR) ||
1073 (on_missing_file == YAC_INTERP_FILE_MISSING_CONT),
1074 "ERROR(%s): on_missing_file must be one of "
1075 "YAC_INTERP_FILE_MISSING_ERROR/YAC_INTERP_FILE_MISSING_CONT.", routine)
1077 (on_success == YAC_INTERP_FILE_SUCCESS_STOP) ||
1078 (on_success == YAC_INTERP_FILE_SUCCESS_CONT),
1079 "ERROR(%s): on_success must be one of "
1080 "YAC_INTERP_FILE_SUCCESS_STOP/YAC_INTERP_FILE_SUCCESS_CONT.", routine)
1081
1083 interp_stack_config, filename,
1084 (enum yac_interp_file_on_missing_file)on_missing_file,
1085 (enum yac_interp_file_on_success)on_success);
1086}
1087
1089 struct yac_interp_stack_config * interp_stack_config, double value) {
1090
1091 char const * routine = "yac_interp_stack_config_add_fixed";
1092
1093 struct yac_interp_method_config * method_config =
1095 struct yac_param * root_param = get_method_param(method_config, routine);
1096
1097 set_sub_param_dble(root_param, "user_value", value, routine);
1098
1099 yac_param_delete(root_param);
1100 yac_interp_stack_config_add(interp_stack_config, method_config);
1101}
1102
1104 struct yac_interp_stack_config * interp_stack_config,
1105 char const * constructor_key, char const * do_search_key) {
1106
1107 char const * routine = "yac_interp_stack_config_add_check";
1108
1110 !constructor_key || strlen(constructor_key) < YAC_MAX_ROUTINE_NAME_LENGTH,
1111 "ERROR(%s): constructor_key name \"%s\" is too long "
1112 "(has to be smaller than %d)",
1113 routine, constructor_key, YAC_MAX_ROUTINE_NAME_LENGTH);
1115 !do_search_key || strlen(do_search_key) < YAC_MAX_ROUTINE_NAME_LENGTH,
1116 "ERROR(%s): do_search_key name \"%s\" is too long "
1117 "(has to be smaller than %d)",
1118 routine, do_search_key, YAC_MAX_ROUTINE_NAME_LENGTH);
1119
1120 struct yac_interp_method_config * method_config =
1122 struct yac_param * root_param =
1123 get_method_param(method_config, routine);
1124
1126 root_param, "constructor_key", constructor_key?constructor_key:"", routine);
1128 root_param, "do_search_key", do_search_key?do_search_key:"", routine);
1129
1130 yac_param_delete(root_param);
1131 yac_interp_stack_config_add(interp_stack_config, method_config);
1132}
1133
1135 struct yac_interp_stack_config * interp_stack_config, int creep_distance) {
1136
1137 char const * routine = "yac_interp_stack_config_add_creep";
1138
1139 struct yac_interp_method_config * method_config =
1141 struct yac_param * root_param = get_method_param(method_config, routine);
1142
1143 set_sub_param_int(root_param, "creep_distance", creep_distance, routine);
1144
1145 yac_param_delete(root_param);
1146 yac_interp_stack_config_add(interp_stack_config, method_config);
1147}
1148
1150 struct yac_interp_stack_config * interp_stack_config,
1151 char const * func_compute_weights_key) {
1152
1153 char const * routine = "yac_interp_stack_config_add_user_callback";
1154
1156 func_compute_weights_key, __FILE__, __LINE__,
1157 routine, "func_compute_weights_key");
1158
1159 struct yac_interp_method_config * method_config =
1161 struct yac_param * root_param = get_method_param(method_config, routine);
1162
1164 root_param, "func_compute_weights", func_compute_weights_key, routine);
1165
1166 yac_param_delete(root_param);
1167 yac_interp_stack_config_add(interp_stack_config, method_config);
1168}
1169
1171 struct yac_interp_stack_config * interp_stack) {
1172
1173 return interp_stack->size;
1174}
1175
1177 struct yac_interp_stack_config * interp_stack,
1178 size_t interp_stack_idx) {
1179
1180 YAC_ASSERT(
1181 interp_stack_idx < interp_stack->size,
1182 "ERROR(yac_interp_stack_config_get): invalid interpolation stack index");
1183
1184 return interp_stack->entries[interp_stack_idx].data.config;
1185}
1186
1189 struct yac_interp_stack_config * interp_stack,
1190 size_t interp_stack_idx) {
1191
1192 YAC_ASSERT(
1193 interp_stack_idx < interp_stack->size,
1194 "ERROR(yac_interp_stack_config_get_entry): "
1195 "invalid interpolation stack index");
1196
1197 return &interp_stack->entries[interp_stack_idx];
1198}
1199
1201 union yac_interp_stack_config_entry const * interp_stack_entry) {
1202
1203 struct yac_interp_method_config const * config =
1204 interp_stack_entry->data.config;
1206}
1207
1209 union yac_interp_stack_config_entry const * interp_stack_entry,
1210 enum yac_interp_avg_weight_type * reduction_type,
1211 int * partial_coverage) {
1212
1213 const struct yac_interp_method_config *config =
1214 interp_stack_entry->data.config;
1215 char const * routine = "yac_interp_stack_config_entry_get_average";
1216 YAC_ASSERT(
1218 "ERROR(yac_interp_stack_config_entry_get_average): "
1219 "wrong interpolation stack entry type");
1220
1221 struct yac_param * root_param =
1222 get_entry_param(interp_stack_entry, routine);
1223
1224 *reduction_type =
1226 get_sub_param(root_param, "weighted", routine), "weighted", routine);
1227 *partial_coverage =
1229 get_sub_param(root_param, "partial_coverage", routine),
1230 "partial_coverage", routine);
1231
1232 yac_param_delete(root_param);
1233}
1234
1236 union yac_interp_stack_config_entry const * interp_stack_entry,
1237 enum yac_interp_ncc_weight_type * type, int * partial_coverage) {
1238
1239 const struct yac_interp_method_config *config =
1240 interp_stack_entry->data.config;
1241 char const * routine = "yac_interp_stack_config_entry_get_ncc";
1242 YAC_ASSERT(
1244 "ERROR(yac_interp_stack_config_entry_get_ncc): "
1245 "wrong interpolation stack entry type");
1246
1247 struct yac_param * root_param =
1248 get_entry_param(interp_stack_entry, routine);
1249
1250 *type =
1252 get_sub_param(root_param, "weighted", routine), "weighted", routine);
1253 *partial_coverage =
1255 get_sub_param(root_param, "partial_coverage", routine),
1256 "partial_coverage", routine);
1257
1258 yac_param_delete(root_param);
1259}
1260
1262 union yac_interp_stack_config_entry const * interp_stack_entry,
1264 enum yac_interp_dnn_search_distance_type * search_distance_type,
1265 double * search_distance, double * scale) {
1266
1267 const struct yac_interp_method_config *config =
1268 interp_stack_entry->data.config;
1269 char const * routine = "yac_interp_stack_config_entry_get_dnn";
1270
1273 "ERROR(%s): wrong interpolation stack entry type", routine);
1274
1275 struct yac_param * root_param =
1276 get_entry_param(interp_stack_entry, routine);
1277
1278 *type =
1280 get_sub_param(root_param, "weighted", routine), "weighted", routine);
1281
1282 struct yac_param * search_distance_oneof_param =
1283 get_sub_param(root_param, "search_distance", routine);
1284 struct yac_param * search_distance_param =
1286 search_distance_oneof_param, 0, "search_distance", routine);
1287 char const * search_distance_name =
1288 yac_param_get_name(search_distance_param);
1290 search_distance_name != NULL,
1291 "ERROR(%s): invalid search_distance parameter", routine);
1292
1293 if (!strcmp(search_distance_name, "fixed")) {
1294 *search_distance_type = YAC_INTERP_DNN_SEARCH_DISTANCE_FIXED;
1295 } else if (!strcmp(search_distance_name, "cell_area")) {
1296 *search_distance_type = YAC_INTERP_DNN_SEARCH_DISTANCE_CELL_AREA;
1297 } else {
1299 "ERROR(%s): invalid search distance type \"%s\"",
1300 routine, search_distance_name);
1301 }
1302
1303 *search_distance =
1304 get_param_dble(search_distance_param, "search_distance", routine);
1305
1306 switch (*search_distance_type) {
1308 "ERROR(%s): invalid search distance type", routine);
1311 break;
1312 }
1313
1314 switch (*type) {
1315 YAC_UNREACHABLE_DEFAULT_F("ERROR(%s): invalid weight type", routine);
1316 case YAC_INTERP_DNN_WEIGHT_AVG: {__attribute__((fallthrough));}
1319 break;
1321 *scale =
1323 get_sub_param(root_param, "rbf_scale", routine),
1324 "rbf_scale", routine);
1325 break;
1327 *scale =
1329 get_sub_param(root_param, "gauss_scale", routine),
1330 "gauss_scale", routine);
1331 break;
1332 }
1333
1334 yac_param_delete(root_param);
1335}
1336
1338 union yac_interp_stack_config_entry const * interp_stack_entry,
1339 enum yac_interp_nnn_weight_type * type, size_t * n,
1340 double * max_search_distance, double * scale) {
1341
1342 const struct yac_interp_method_config *config =
1343 interp_stack_entry->data.config;
1344 char const * routine = "yac_interp_stack_config_entry_get_nnn";
1345
1346 enum yac_interpolation_list method_type =
1348
1350 method_type == YAC_N_NEAREST_NEIGHBOR ||
1351 method_type == YAC_RADIAL_BASIS_FUNCTION,
1352 "ERROR(%s): wrong interpolation stack entry type", routine);
1353
1354 struct yac_param * root_param =
1355 get_entry_param(interp_stack_entry, routine);
1356
1357 *type = (method_type == YAC_RADIAL_BASIS_FUNCTION)?
1360 get_sub_param(root_param, "weighted", routine), "weighted", routine);
1361
1362 *n = (size_t)get_param_int(
1363 get_sub_param(root_param, "n", routine), "n", routine);
1364 *max_search_distance =
1366 get_sub_param(root_param, "max_search_distance", routine),
1367 "max_search_distance", routine);
1368 if (*type == YAC_INTERP_NNN_RBF)
1369 *scale =
1371 get_sub_param(root_param, "rbf_scale", routine),
1372 "rbf_scale", routine);
1373 else
1374 *scale =
1376 get_sub_param(root_param, "gauss_scale", routine),
1377 "gauss_scale", routine);
1378
1379 yac_param_delete(root_param);
1380}
1381
1383 union yac_interp_stack_config_entry const * interp_stack_entry,
1384 size_t * n, double * max_search_distance, double * scale) {
1385
1386 const struct yac_interp_method_config *config =
1387 interp_stack_entry->data.config;
1388 char const * routine = "yac_interp_stack_config_entry_get_rbf";
1391 "ERROR(%s): wrong interpolation stack entry type", routine);
1392
1393 struct yac_param * root_param =
1394 get_entry_param(interp_stack_entry, routine);
1395
1396 *n = (size_t)get_param_int(
1397 get_sub_param(root_param, "n", routine), "n", routine);
1398 *max_search_distance =
1400 get_sub_param(root_param, "max_search_distance", routine),
1401 "max_search_distance", routine);
1402 *scale =
1404 get_sub_param(root_param, "rbf_scale", routine),
1405 "rbf_scale", routine);
1406
1407 yac_param_delete(root_param);
1408}
1409
1411 union yac_interp_stack_config_entry const * interp_stack_entry,
1412 int * order, int * enforced_conserv, int * partial_coverage,
1413 enum yac_interp_method_conserv_normalisation * normalisation) {
1414
1415 const struct yac_interp_method_config *config =
1416 interp_stack_entry->data.config;
1417 char const * routine = "yac_interp_stack_config_entry_get_conservative";
1420 "ERROR(%s): wrong interpolation stack entry type", routine);
1421
1422 struct yac_param * root_param =
1423 get_entry_param(interp_stack_entry, routine);
1424
1425 *order =
1426 get_param_int(get_sub_param(root_param, "order", routine), "order", routine);
1427 *enforced_conserv =
1429 get_sub_param(root_param, "enforced_conservation", routine),
1430 "enforced_conservation", routine);
1431 *partial_coverage =
1433 get_sub_param(root_param, "partial_coverage", routine),
1434 "partial_coverage", routine);
1435 *normalisation =
1437 get_sub_param(root_param, "normalisation", routine),
1438 "normalisation", routine);
1439
1440 yac_param_delete(root_param);
1441}
1442
1444 union yac_interp_stack_config_entry const * interp_stack_entry,
1445 struct yac_interp_spmap_config const ** default_config,
1446 struct yac_spmap_overwrite_config const *** overwrite_configs) {
1447
1448 const struct yac_interp_method_config *config =
1449 interp_stack_entry->data.config;
1450 char const * routine = "yac_interp_stack_config_entry_get_spmap_ext";
1453 "ERROR(%s): wrong interpolation stack entry type", routine);
1454
1455 struct yac_param * root_param =
1456 get_entry_param(interp_stack_entry, routine);
1457 size_t overwrite_count =
1459 get_sub_param(root_param, "overwrite", routine),
1460 "overwrite", routine);
1461
1462 struct yac_spmap_ext_cache_entry * cache_entry =
1464 (union yac_interp_stack_config_entry *)interp_stack_entry,
1465 root_param, routine);
1466
1467 size_t cache_overwrite_count = 0;
1468 for (; (cache_entry->overwrite_configs != NULL) &&
1469 (cache_entry->overwrite_configs[cache_overwrite_count] != NULL);
1470 ++cache_overwrite_count)
1471 ;
1473 cache_overwrite_count == overwrite_count,
1474 "ERROR(%s): inconsistent overwrite configuration count", routine);
1475
1476 *default_config = cache_entry->default_config;
1478 (struct yac_spmap_overwrite_config const **)cache_entry->overwrite_configs;
1479
1480 yac_param_delete(root_param);
1481}
1482
1484 struct yac_param * cell_area_oneof_param,
1485 char const * routine,
1486 char const * name,
1487 double * sphere_radius,
1488 char const ** filename, char const ** varname, int * min_global_id) {
1489
1490 struct yac_spmap_cell_area_config * cell_area_config =
1491 make_spmap_cell_area_config(cell_area_oneof_param, name, routine);
1492
1493 switch (yac_spmap_cell_area_config_get_type(cell_area_config)) {
1495 "ERROR(%s): invalid %s cell area configuration type",
1496 routine, name);
1499 *filename =
1501 *varname =
1503 *min_global_id =
1505 break;
1506 }
1508 *sphere_radius =
1513 break;
1514 }
1515 }
1516 yac_spmap_cell_area_config_delete(cell_area_config);
1517}
1518
1520 union yac_interp_stack_config_entry const * interp_stack_entry,
1521 double * spread_distance, double * max_search_distance,
1523 enum yac_interp_spmap_scale_type * scale_type,
1524 double * src_sphere_radius, char const ** src_filename,
1525 char const ** src_varname, int * src_min_global_id,
1526 double * tgt_sphere_radius, char const ** tgt_filename,
1527 char const ** tgt_varname, int * tgt_min_global_id) {
1528
1529 const struct yac_interp_method_config *config =
1530 interp_stack_entry->data.config;
1531 char const * routine = "yac_interp_stack_config_entry_get_spmap";
1532
1535 "ERROR(%s): wrong interpolation stack entry type", routine);
1536
1537 struct yac_param * root_param =
1538 get_entry_param(interp_stack_entry, routine);
1539
1540 size_t overwrite_count =
1541 get_sub_count(get_sub_param(root_param, "overwrite", routine),
1542 "overwrite", routine);
1543
1545 overwrite_count == 0,
1546 "ERROR(%s): contains overwrite configurations, use "
1547 "yac_interp_stack_config_entry_get_spmap_ext instead", routine);
1548
1549 *spread_distance =
1551 get_sub_param(root_param, "spread_distance", routine),
1552 "spread_distance", routine);
1553 *max_search_distance =
1555 get_sub_param(root_param, "max_search_distance", routine),
1556 "max_search_distance", routine);
1557 *weight_type =
1559 get_sub_param(root_param, "weighted", routine), "weighted", routine);
1560
1561 *scale_type =
1563 get_sub_param(root_param, "scale", routine), "scale", routine);
1564
1566 get_sub_param(root_param, "src_cell_area", routine),
1567 routine, "src_cell_area",
1568 src_sphere_radius, src_filename, src_varname, src_min_global_id);
1570 get_sub_param(root_param, "tgt_cell_area", routine),
1571 routine, "tgt_cell_area",
1572 tgt_sphere_radius, tgt_filename, tgt_varname, tgt_min_global_id);
1573
1574 yac_param_delete(root_param);
1575}
1576
1578 union yac_interp_stack_config_entry const * interp_stack_entry,
1579 char const ** filename,
1580 enum yac_interp_file_on_missing_file * on_missing_file,
1581 enum yac_interp_file_on_success * on_success) {
1582
1583 const struct yac_interp_method_config *config =
1584 interp_stack_entry->data.config;
1585 char const * routine = "yac_interp_stack_config_entry_get_user_file";
1588 "ERROR(%s): wrong interpolation stack entry type", routine);
1589
1590 struct yac_param * root_param =
1591 get_entry_param(interp_stack_entry, routine);
1592
1593 *filename =
1595 get_sub_param(root_param, "filename", routine),
1596 "filename", routine);
1597 *on_missing_file =
1599 get_sub_param(root_param, "on_missing_file", routine),
1600 "on_missing_file", routine);
1601 *on_success =
1603 get_sub_param(root_param, "on_success", routine),
1604 "on_success", routine);
1605
1606 yac_param_delete(root_param);
1607}
1608
1610 union yac_interp_stack_config_entry const * interp_stack_entry,
1611 double * value) {
1612
1613 const struct yac_interp_method_config *config =
1614 interp_stack_entry->data.config;
1615 char const * routine = "yac_interp_stack_config_entry_get_fixed";
1618 "ERROR(%s): wrong interpolation stack entry type", routine);
1619
1620 struct yac_param * root_param =
1621 get_entry_param(interp_stack_entry, routine);
1622
1623 *value =
1625 get_sub_param(root_param, "user_value", routine), "user_value", routine);
1626
1627 yac_param_delete(root_param);
1628}
1629
1631 union yac_interp_stack_config_entry const * interp_stack_entry,
1632 char const ** constructor_key, char const ** do_search_key) {
1633
1634 const struct yac_interp_method_config *config =
1635 interp_stack_entry->data.config;
1636 char const * routine = "yac_interp_stack_config_entry_get_check";
1639 "ERROR(%s): wrong interpolation stack entry type", routine);
1640
1641 struct yac_param * root_param =
1642 get_entry_param(interp_stack_entry, routine);
1643
1644 *constructor_key =
1646 get_sub_param(root_param, "constructor_key", routine),
1647 "constructor_key", routine);
1648 *do_search_key =
1650 get_sub_param(root_param, "do_search_key", routine),
1651 "do_search_key", routine);
1652
1653 yac_param_delete(root_param);
1654}
1655
1657 union yac_interp_stack_config_entry const * interp_stack_entry,
1658 int * creep_distance) {
1659
1660 const struct yac_interp_method_config *config =
1661 interp_stack_entry->data.config;
1662 char const * routine = "yac_interp_stack_config_entry_get_creep";
1665 "ERROR(%s): wrong interpolation stack entry type", routine);
1666
1667 struct yac_param * root_param =
1668 get_entry_param(interp_stack_entry, routine);
1669
1670 *creep_distance =
1672 get_sub_param(root_param, "creep_distance", routine),
1673 "creep_distance", routine);
1674
1675 yac_param_delete(root_param);
1676}
1677
1679 union yac_interp_stack_config_entry const * interp_stack_entry,
1680 char const ** func_compute_weights_key) {
1681
1682 const struct yac_interp_method_config *config =
1683 interp_stack_entry->data.config;
1684 char const * routine = "yac_interp_stack_config_entry_get_user_callback";
1687 "ERROR(%s): wrong interpolation stack entry type", routine);
1688
1689 struct yac_param * root_param =
1690 get_entry_param(interp_stack_entry, routine);
1691
1692 *func_compute_weights_key =
1694 get_sub_param(root_param, "func_compute_weights", routine),
1695 "func_compute_weights", routine);
1696
1697 yac_param_delete(root_param);
1698}
#define YAC_ASSERT(exp, msg)
#define __attribute__(x)
Definition core.h:69
int yac_name_type_pair_get_type(struct yac_name_type_pair const *pairs, size_t count, char const *name)
Definition utils_core.c:26
#define DEF_NAME_TYPE_PAIR(NAME, TYPE)
#define DEF_NAME_TYPE_PAIRS(NAME,...)
yac_interpolation_list
@ YAC_N_NEAREST_NEIGHBOR
N-nearest-neighbor interpolation.
@ YAC_CREEP
Creep-fill interpolation.
@ YAC_USER_FILE
User-supplied weights from file.
@ YAC_USER_CALLBACK
@ YAC_SOURCE_TO_TARGET_MAP
Source-to-target mapping (inverse N-nearest-neighbor)
@ YAC_CONSERVATIVE
Conservative remapping (area/flux conserving)
@ YAC_FIXED_VALUE
Assigns a fixed value to all targets.
@ YAC_CHECK
Diagnostic check method (for testing)
@ YAC_DISTANCE_NEAREST_NEIGHBOR
Distance-nearest-neighbor interpolation.
@ YAC_NEAREST_CORNER_CELLS
Nearest-corner-cell interpolation.
@ YAC_RADIAL_BASIS_FUNCTION
Radial basis function interpolation.
@ YAC_AVERAGE
Simple averaging (or linear) interpolation.
#define YAC_MAX_ROUTINE_NAME_LENGTH
Maximum length for routine names (used as keys for callback registration)
#define YAC_MAX_FILE_NAME_LENGTH
Maximum length for file names (used in user file interpolation)
yac_interp_avg_weight_type
@ YAC_INTERP_AVG_DIST
@ YAC_INTERP_AVG_ARITHMETIC
@ YAC_INTERP_AVG_BARY
enum callback_type type
struct @23::@24 value
int yac_interp_method_config_compare(const struct yac_interp_method_config *a, const struct yac_interp_method_config *b)
struct yac_param * yac_interp_method_config_get_param(struct yac_interp_method_config const *config)
enum yac_interpolation_list yac_interp_method_config_get_type(struct yac_interp_method_config const *config)
void yac_interp_method_config_pack(const struct yac_interp_method_config *config, void *buffer, int buffer_size, int *position, MPI_Comm comm)
size_t yac_interp_method_config_get_pack_size(const struct yac_interp_method_config *config, MPI_Comm comm)
struct yac_interp_method_config * yac_interp_method_config_copy(const struct yac_interp_method_config *config)
struct yac_interp_method_config * yac_interp_method_config_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
struct yac_interp_method_config * yac_interp_method_config_default_from_name_new(char const *method_name)
void yac_interp_method_config_delete(struct yac_interp_method_config *config)
struct interp_method * yac_interp_method_config_generate(const struct yac_interp_method_config *config)
Defines the interface for interpolation method configuration "base class" in YAC.
yac_interp_method_conserv_normalisation
@ YAC_INTERP_CONSERV_DESTAREA
@ YAC_INTERP_CONSERV_FRACAREA
yac_interp_dnn_weight_type
@ YAC_INTERP_DNN_WEIGHT_AVG
average of source points within search distance
@ YAC_INTERP_DNN_WEIGHT_DIST
distance weighted average of source points
@ YAC_INTERP_DNN_WEIGHT_GAUSS
Gauss weighted average of source points.
@ YAC_INTERP_DNN_WEIGHT_RBF
radial basis function weighted average
#define YAC_INTERP_DNN_DUMMY_SCALE
yac_interp_dnn_search_distance_type
@ YAC_INTERP_DNN_SEARCH_DISTANCE_FIXED
use a fixed search distance (in radians)
@ YAC_INTERP_DNN_SEARCH_DISTANCE_CELL_AREA
yac_interp_file_on_missing_file
@ YAC_INTERP_FILE_MISSING_CONT
continue on missing file
@ YAC_INTERP_FILE_MISSING_ERROR
abort on missing file
yac_interp_file_on_success
@ YAC_INTERP_FILE_SUCCESS_CONT
@ YAC_INTERP_FILE_SUCCESS_STOP
yac_interp_ncc_weight_type
@ YAC_INTERP_NCC_DIST
distance weighted average of n source points
@ YAC_INTERP_NCC_AVG
average of n source points
yac_interp_nnn_weight_type
@ YAC_INTERP_NNN_GAUSS
distance with Gauss weights of n source points
@ YAC_INTERP_NNN_RBF
radial basis functions
@ YAC_INTERP_NNN_AVG
average of n source points
@ YAC_INTERP_NNN_DIST
distance weighted average of n source points
@ YAC_INTERP_NNN_ZERO
all weights are set to zero
char const * yac_spmap_cell_area_config_get_filename(struct yac_spmap_cell_area_config const *cell_area_config)
struct yac_spmap_cell_area_config const * yac_spmap_scale_config_get_tgt_cell_area_config(struct yac_spmap_scale_config const *scale_config)
struct yac_interp_spmap_config const * yac_spmap_overwrite_config_get_spmap_config(struct yac_spmap_overwrite_config const *overwrite_config)
double yac_spmap_cell_area_config_get_sphere_radius(struct yac_spmap_cell_area_config const *cell_area_config)
struct yac_spmap_cell_area_config * yac_spmap_cell_area_config_file_new(char const *filename, char const *varname, yac_int min_global_id)
struct yac_spmap_overwrite_config * yac_spmap_overwrite_config_new(struct yac_point_selection const *src_point_selection, struct yac_interp_spmap_config const *config)
void yac_spmap_overwrite_configs_delete(struct yac_spmap_overwrite_config **overwrite_configs)
struct yac_point_selection const * yac_spmap_overwrite_config_get_src_point_selection(struct yac_spmap_overwrite_config const *overwrite_config)
yac_int yac_spmap_cell_area_config_get_min_global_id(struct yac_spmap_cell_area_config const *cell_area_config)
enum yac_interp_spmap_cell_area_provider yac_spmap_cell_area_config_get_type(struct yac_spmap_cell_area_config const *cell_area_config)
double yac_interp_spmap_config_get_max_search_distance(struct yac_interp_spmap_config const *spmap_config)
struct yac_spmap_cell_area_config const * yac_spmap_scale_config_get_src_cell_area_config(struct yac_spmap_scale_config const *scale_config)
char const * yac_spmap_cell_area_config_get_varname(struct yac_spmap_cell_area_config const *cell_area_config)
struct yac_interp_spmap_config * yac_interp_spmap_config_new(double spread_distance, double max_search_distance, enum yac_interp_spmap_weight_type weight_type, struct yac_spmap_scale_config const *scale_config)
void yac_spmap_scale_config_delete(struct yac_spmap_scale_config *scale_config)
void yac_interp_spmap_config_delete(struct yac_interp_spmap_config *config)
struct yac_spmap_scale_config const * yac_interp_spmap_config_get_scale_config(struct yac_interp_spmap_config const *spmap_config)
double yac_interp_spmap_config_get_spread_distance(struct yac_interp_spmap_config const *spmap_config)
void yac_spmap_cell_area_config_delete(struct yac_spmap_cell_area_config *cell_area_config)
enum yac_interp_spmap_scale_type yac_spmap_scale_config_get_type(struct yac_spmap_scale_config const *scale_config)
struct yac_spmap_cell_area_config * yac_spmap_cell_area_config_yac_new(double sphere_radius)
enum yac_interp_spmap_weight_type yac_interp_spmap_config_get_weight_type(struct yac_interp_spmap_config const *spmap_config)
struct yac_spmap_scale_config * yac_spmap_scale_config_new(enum yac_interp_spmap_scale_type scale_type, struct yac_spmap_cell_area_config const *source_cell_area_config, struct yac_spmap_cell_area_config const *target_cell_area_config)
yac_interp_spmap_scale_type
@ YAC_INTERP_SPMAP_NONE
weights are not scaled
@ YAC_INTERP_SPMAP_INVTGTAREA
@ YAC_INTERP_SPMAP_SRCAREA
@ YAC_INTERP_SPMAP_FRACAREA
#define YAC_INTERP_SPMAP_SCALE_CONFIG_DEFAULT
#define YAC_INTERP_SPMAP_VARNAME_DEFAULT
#define YAC_INTERP_SPMAP_FILENAME_DEFAULT
yac_interp_spmap_cell_area_provider
@ YAC_INTERP_SPMAP_CELL_AREA_FILE
@ YAC_INTERP_SPMAP_CELL_AREA_YAC
#define YAC_INTERP_SPMAP_SPHERE_RADIUS_DEFAULT
yac_interp_spmap_weight_type
@ YAC_INTERP_SPMAP_AVG
@ YAC_INTERP_SPMAP_DIST
#define YAC_INTERP_SPMAP_MIN_GLOBAL_ID_DEFAULT
void yac_interp_stack_config_entry_get_creep(union yac_interp_stack_config_entry const *interp_stack_entry, int *creep_distance)
void yac_interp_stack_config_add_check(struct yac_interp_stack_config *interp_stack_config, char const *constructor_key, char const *do_search_key)
static struct yac_param * get_entry_param(union yac_interp_stack_config_entry const *interp_stack_entry, char const *routine)
size_t yac_interp_stack_config_get_size(struct yac_interp_stack_config *interp_stack)
Get the number of interpolation methods in the stack.
static struct yac_param * get_sub_param(struct yac_param *param, char const *name, char const *routine)
static struct yac_spmap_ext_cache_entry * yac_spmap_ext_cache_entry_new(struct yac_param *root_param, char const *routine)
static struct yac_interp_method_config * get_entry_method_config(union yac_interp_stack_config_entry const *interp_stack_entry)
static void set_sub_param_int(struct yac_param *param, char const *name, int value, char const *routine)
static void free_spmap_ext_cache_entry(struct yac_spmap_ext_cache_entry *entry)
int yac_interp_stack_config_compare(void const *a_, void const *b_)
Compare two interpolation stack configurations.
union yac_interp_stack_config_entry const * yac_interp_stack_config_get_entry(struct yac_interp_stack_config *interp_stack, size_t interp_stack_idx)
static char * get_param_str_dup(struct yac_param *param, char const *name, char const *routine)
struct yac_interp_method_config const * yac_interp_stack_config_get(struct yac_interp_stack_config *interp_stack, size_t interp_stack_idx)
Get a method configuration from the stack by index.
enum yac_interpolation_list yac_interp_stack_config_entry_get_type(union yac_interp_stack_config_entry const *interp_stack_entry)
void yac_interp_stack_config_add_spmap(struct yac_interp_stack_config *interp_stack_config, double spread_distance, double max_search_distance, enum yac_interp_spmap_weight_type weight_type, enum yac_interp_spmap_scale_type scale_type, double src_sphere_radius, char const *src_filename, char const *src_varname, int src_min_global_id, double tgt_sphere_radius, char const *tgt_filename, char const *tgt_varname, int tgt_min_global_id)
void yac_interp_stack_config_add_fixed(struct yac_interp_stack_config *interp_stack_config, double value)
void yac_interp_stack_config_add_hcsbb(struct yac_interp_stack_config *interp_stack_config)
void yac_interp_stack_config_add_rbf(struct yac_interp_stack_config *interp_stack_config, size_t n, double max_search_distance, double scale)
void yac_interp_stack_config_add_average(struct yac_interp_stack_config *interp_stack_config, enum yac_interp_avg_weight_type reduction_type, int partial_coverage)
void yac_interp_stack_config_add_creep(struct yac_interp_stack_config *interp_stack_config, int creep_distance)
static void set_spmap_cell_area_param(struct yac_param *cell_area_param, struct yac_spmap_cell_area_config const *cell_area_config, char const *name, char const *routine)
static double get_param_dble(struct yac_param *param, char const *name, char const *routine)
static struct yac_spmap_cell_area_config * make_spmap_cell_area_config(struct yac_param *cell_area_oneof_param, char const *name, char const *routine)
void yac_interp_stack_config_entry_get_rbf(union yac_interp_stack_config_entry const *interp_stack_entry, size_t *n, double *max_search_distance, double *scale)
void yac_interp_stack_config_entry_get_user_file(union yac_interp_stack_config_entry const *interp_stack_entry, char const **filename, enum yac_interp_file_on_missing_file *on_missing_file, enum yac_interp_file_on_success *on_success)
void yac_interp_stack_config_add_nnn(struct yac_interp_stack_config *interp_stack_config, enum yac_interp_nnn_weight_type type, size_t n, double max_search_distance, double scale)
void yac_interp_stack_config_add_spmap_f2c(struct yac_interp_stack_config *interp_stack_config, double spread_distance, double max_search_distance, int weight_type, int scale_type, double src_sphere_radius, char const *src_filename, char const *src_varname, int src_min_global_id, double tgt_sphere_radius, char const *tgt_filename, char const *tgt_varname, int tgt_min_global_id)
void yac_interp_stack_config_entry_get_dnn(union yac_interp_stack_config_entry const *interp_stack_entry, enum yac_interp_dnn_weight_type *type, enum yac_interp_dnn_search_distance_type *search_distance_type, double *search_distance, double *scale)
void yac_interp_stack_config_entry_get_ncc(union yac_interp_stack_config_entry const *interp_stack_entry, enum yac_interp_ncc_weight_type *type, int *partial_coverage)
void yac_interp_stack_config_add_conservative_f2c(struct yac_interp_stack_config *interp_stack_config, int order, int enforced_conserv, int partial_coverage, int normalisation)
struct yac_interp_stack_config * yac_interp_stack_config_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
Unpack a stack configuration from a buffer (MPI communication).
void yac_interp_stack_config_add_ncc_f2c(struct yac_interp_stack_config *interp_stack_config, int weight_type, int partial_coverage)
void yac_interp_stack_config_delete(struct yac_interp_stack_config *interp_stack_config)
Free an interpolation stack configuration object.
static struct yac_param * get_method_param(struct yac_interp_method_config *method_config, char const *routine)
void yac_interp_stack_config_entry_get_user_callback(union yac_interp_stack_config_entry const *interp_stack_entry, char const **func_compute_weights_key)
struct yac_interp_stack_config * yac_interp_stack_config_copy(struct yac_interp_stack_config *interp_stack)
Create a deep copy of an interpolation stack configuration.
static void set_sub_param_str(struct yac_param *param, char const *name, char const *value, char const *routine)
void yac_interp_stack_config_add_conservative(struct yac_interp_stack_config *interp_stack_config, int order, int enforced_conserv, int partial_coverage, enum yac_interp_method_conserv_normalisation normalisation)
void yac_interp_stack_config_entry_get_check(union yac_interp_stack_config_entry const *interp_stack_entry, char const **constructor_key, char const **do_search_key)
struct interp_method ** yac_interp_stack_config_generate(struct yac_interp_stack_config *interp_stack)
Generate a NULL-terminated array of interpolation methods from the stack configuration.
void yac_interp_stack_config_entry_get_conservative(union yac_interp_stack_config_entry const *interp_stack_entry, int *order, int *enforced_conserv, int *partial_coverage, enum yac_interp_method_conserv_normalisation *normalisation)
static struct yac_spmap_cell_area_config * generate_spmap_cell_area_config(double sphere_radius, char const *filename, char const *varname, int min_global_id, char const *type)
void yac_interp_stack_config_add_dnn(struct yac_interp_stack_config *interp_stack_config, enum yac_interp_dnn_weight_type type, enum yac_interp_dnn_search_distance_type search_distance_type, double search_distance, double scale)
void yac_interp_stack_config_entry_get_average(union yac_interp_stack_config_entry const *interp_stack_entry, enum yac_interp_avg_weight_type *reduction_type, int *partial_coverage)
void yac_interp_stack_config_add(struct yac_interp_stack_config *interp_stack_config, struct yac_interp_method_config *method_config)
Add an interpolation method configuration to the end of the stack.
size_t yac_interp_stack_config_get_pack_size(struct yac_interp_stack_config *interp_stack, MPI_Comm comm)
Get the size required to pack the stack configuration for MPI.
void yac_interp_stack_config_add_average_f2c(struct yac_interp_stack_config *interp_stack_config, int reduction_type, int partial_coverage)
void yac_interp_stack_config_add_ncc(struct yac_interp_stack_config *interp_stack_config, enum yac_interp_ncc_weight_type weight_type, int partial_coverage)
void yac_interp_stack_config_add_dnn_f2c(struct yac_interp_stack_config *interp_stack_config, int type, int search_distance_type, double search_distance, double scale)
void yac_interp_stack_config_add_nnn_f2c(struct yac_interp_stack_config *interp_stack_config, int type, size_t n, double max_search_distance, double scale)
static void set_spmap_config_param(struct yac_param *param, struct yac_interp_spmap_config const *config, int include_scale, char const *routine)
void yac_interp_stack_config_add_user_file(struct yac_interp_stack_config *interp_stack_config, char const *filename, enum yac_interp_file_on_missing_file on_missing_file, enum yac_interp_file_on_success on_success)
void yac_interp_stack_config_entry_get_nnn(union yac_interp_stack_config_entry const *interp_stack_entry, enum yac_interp_nnn_weight_type *type, size_t *n, double *max_search_distance, double *scale)
void yac_interp_stack_config_entry_get_spmap_ext(union yac_interp_stack_config_entry const *interp_stack_entry, struct yac_interp_spmap_config const **default_config, struct yac_spmap_overwrite_config const ***overwrite_configs)
void yac_interp_stack_config_add_user_callback(struct yac_interp_stack_config *interp_stack_config, char const *func_compute_weights_key)
struct yac_interp_stack_config * yac_interp_stack_config_new()
Allocate a new empty interpolation stack configuration object.
static void set_sub_param_dble(struct yac_param *param, char const *name, double value, char const *routine)
static void yac_interp_stack_config_entry_get_spmap_cell_area_config(struct yac_param *cell_area_oneof_param, char const *routine, char const *name, double *sphere_radius, char const **filename, char const **varname, int *min_global_id)
static size_t get_sub_count(struct yac_param *param, char const *name, char const *routine)
static int get_param_int(struct yac_param *param, char const *name, char const *routine)
void yac_interp_stack_config_pack(struct yac_interp_stack_config *interp_stack, void *buffer, int buffer_size, int *position, MPI_Comm comm)
Pack the stack configuration into a buffer for MPI communication.
static void check_string(char const *string, char const *file, int line, char const *routine, char const *variable)
static struct yac_spmap_ext_cache_entry * get_spmap_ext_cache_entry(union yac_interp_stack_config_entry *interp_stack_entry, struct yac_param *root_param, char const *routine)
void yac_interp_stack_config_add_spmap_ext(struct yac_interp_stack_config *interp_stack_config, struct yac_interp_spmap_config *default_config, struct yac_spmap_overwrite_config **overwrite_configs)
void yac_interp_stack_config_entry_get_fixed(union yac_interp_stack_config_entry const *interp_stack_entry, double *value)
static struct yac_param * get_sub_param_by_index(struct yac_param *param, size_t idx, char const *name, char const *routine)
void yac_interp_stack_config_entry_get_spmap(union yac_interp_stack_config_entry const *interp_stack_entry, double *spread_distance, double *max_search_distance, enum yac_interp_spmap_weight_type *weight_type, enum yac_interp_spmap_scale_type *scale_type, double *src_sphere_radius, char const **src_filename, char const **src_varname, int *src_min_global_id, double *tgt_sphere_radius, char const **tgt_filename, char const **tgt_varname, int *tgt_min_global_id)
void yac_interp_stack_config_add_user_file_f2c(struct yac_interp_stack_config *interp_stack_config, char const *filename, int on_missing_file, int on_success)
int yac_param_get_scalar_dble(const struct yac_param *param, double *value)
Get the value of a scalar parameter as a double.
Definition param.c:166
void yac_param_delete(struct yac_param *param)
Definition param.c:307
int yac_param_get_sub_by_index(struct yac_param *param, size_t idx, struct yac_param **sub_param)
Get a handle to a subparameter by index.
Definition param.c:92
int yac_param_get_scalar(const struct yac_param *param, char *buf, size_t buflen)
Get the value of a scalar parameter as a string.
Definition param.c:128
int yac_param_set_scalar(struct yac_param *param, const char *value_str)
Set the value of a scalar parameter from a string.
Definition param.c:118
int yac_param_append(struct yac_param *param, struct yac_param **sub_param)
Append a new default subparameter to a list parameter and return a handle to it.
Definition param.c:107
int yac_param_set_scalar_int(struct yac_param *param, int value)
Set the value of a scalar parameter as an int.
Definition param.c:139
int yac_param_get_sub_count(const struct yac_param *param, size_t *count)
Get the number of subparameters.
Definition param.c:60
int yac_param_set_scalar_dble(struct yac_param *param, double value)
Set the value of a scalar parameter as a double.
Definition param.c:148
const char * yac_param_get_last_error(void)
Retrieve the last error message for the calling thread.
Definition param.c:301
int yac_param_get_scalar_int(const struct yac_param *param, int *value)
Get the value of a scalar parameter as an int.
Definition param.c:157
const char * yac_param_get_name(const struct yac_param *param)
Get the name of the current parameter.
Definition param.c:50
int yac_param_get_sub_by_name(struct yac_param *param, const char *name, struct yac_param **sub_param)
Get a handle to a subparameter by name.
Definition param.c:75
Public interface for YAC parameters.
struct yac_point_selection * yac_point_selection_bnd_circle_new(double center_lon, double center_lat, double inc_angle)
void yac_point_selection_delete(struct yac_point_selection *point_select)
void yac_point_selection_bnd_circle_get_config(struct yac_point_selection const *point_selection, double *center_lon, double *center_lat, double *inc_angle)
enum yac_point_selection_type yac_point_selection_get_type(struct yac_point_selection const *point_select)
@ YAC_POINT_SELECTION_TYPE_BND_CIRCLE
#define xstrdup(s)
Definition ppm_xfuncs.h:84
#define xrealloc(ptr, size)
Definition ppm_xfuncs.h:67
#define xcalloc(nmemb, size)
Definition ppm_xfuncs.h:64
#define xmalloc(size)
Definition ppm_xfuncs.h:66
struct yac_spmap_scale_config scale_config
union yac_interp_stack_config_entry * entries
struct yac_spmap_overwrite_config ** overwrite_configs
struct yac_interp_spmap_config * default_config
static struct yac_interp_method_config * config
double * buffer
char const * name
Definition toy_scrip.c:114
struct yac_interp_stack_config_entry::@13 data
struct yac_interp_method_config * config
struct yac_spmap_ext_cache_entry * spmap_ext_cache
#define YAC_UNREACHABLE_F(format,...)
Definition yac_assert.h:68
#define YAC_UNREACHABLE_DEFAULT_F(format,...)
Definition yac_assert.h:50
#define YAC_ASSERT_F(exp, format,...)
Definition yac_assert.h:30
#define yac_mpi_call(call, comm)