21#define ARGS(...) __VA_ARGS__
22#define _GET_NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, N, ...) N
24#define FOREACH(name, ...) \
26 enum {NUM_ ## name = sizeof( name ) / sizeof( name [0])}; \
27 int name ## _idx[2]; \
28 for (name ## _idx[0] = 0; name ## _idx[0] < NUM_ ## name; \
29 ++ name ## _idx[0]) { \
30 for (name ## _idx[1] = 0; name ## _idx[1] < NUM_ ## name; \
31 ++ name ## _idx[1]) { \
32 configs_differ += (name ## _idx[0]) != (name ## _idx[1]); \
34 configs_differ -= (name ## _idx[0]) != (name ## _idx[1]); \
38#define FOREACH_ENUM(name, values, ...) \
40 enum yac_ ## name name [] = {values}; \
41 FOREACH(name, __VA_ARGS__) \
43#define FOREACH_TYPE(name, type, values, ...) \
45 type name[] = {values}; \
46 FOREACH(name, __VA_ARGS__) \
48#define FOREACH_INT(name, values, ...) \
49 FOREACH_TYPE(name, int, ARGS(values), __VA_ARGS__)
50#define FOREACH_DBLE(name, values, ...) \
51 FOREACH_TYPE(name, double, ARGS(values), __VA_ARGS__)
52#define FOREACH_BOOL(name, ...) FOREACH_INT(name, ARGS(0, 1), __VA_ARGS__)
53#define FOREACH_STRING(name, values, ...) \
54 FOREACH_TYPE(name, ARGS(char const *), ARGS(values), __VA_ARGS__)
55#define FOREACH_STRUCT(name, struct_name, values, ...) \
56 FOREACH_TYPE(name, ARGS(struct struct_name), ARGS(values), __VA_ARGS__)
57#define _CHECK_STACKS(interp_name, config) \
60 struct yac_interp_stack_config * a = yac_interp_stack_config_new(); \
61 struct yac_interp_stack_config * b = yac_interp_stack_config_new(); \
62 config_idx = 0, yac_interp_stack_config_add_ ## interp_name ( a, config ); \
63 config_idx = 1, yac_interp_stack_config_add_ ## interp_name ( b, config ); \
64 utest_check_compare_stacks(a, b, configs_differ); \
66#define _CONFIG_ARGS1(arg_name) arg_name[arg_name ## _idx[config_idx]]
67#define _CONFIG_ARGS2(arg_name, ...) \
68 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS1(__VA_ARGS__)
69#define _CONFIG_ARGS3(arg_name, ...) \
70 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS2(__VA_ARGS__)
71#define _CONFIG_ARGS4(arg_name, ...) \
72 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS3(__VA_ARGS__)
73#define _CONFIG_ARGS5(arg_name, ...) \
74 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS4(__VA_ARGS__)
75#define _CONFIG_ARGS6(arg_name, ...) \
76 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS5(__VA_ARGS__)
77#define _CONFIG_ARGS7(arg_name, ...) \
78 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS6(__VA_ARGS__)
79#define _CONFIG_ARGS8(arg_name, ...) \
80 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS7(__VA_ARGS__)
81#define _CONFIG_ARGS9(arg_name, ...) \
82 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS8(__VA_ARGS__)
83#define _CONFIG_ARGS10(arg_name, ...) \
84 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS9(__VA_ARGS__)
85#define _CONFIG_ARGS11(arg_name, ...) \
86 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS10(__VA_ARGS__)
87#define _CONFIG_ARGS12(arg_name, ...) \
88 _CONFIG_ARGS1(arg_name), _CONFIG_ARGS11(__VA_ARGS__)
89#define CHECK_STACKS(interp_name, ... ) \
90 _CHECK_STACKS(interp_name, \
91 EXPAND(_GET_NTH_ARG(__VA_ARGS__, _CONFIG_ARGS12, \
102 _CONFIG_ARGS1)(__VA_ARGS__)))
104static void utest_check_compare_stacks(
108static void utest_interp_stack_config_add_spmap_(
110 double spread_distance,
double max_search_distance,
116#define yac_interp_stack_config_add_spmap_ utest_interp_stack_config_add_spmap_
120 MPI_Init(NULL, NULL);
121 xt_initialize(MPI_COMM_WORLD);
123 int configs_differ = 0;
131 utest_check_compare_stacks(a, b, 1);
137 utest_check_compare_stacks(a, b, 0);
142 interp_avg_weight_type,
146 CHECK_STACKS(average, interp_avg_weight_type, partial_coverage)))
150 interp_ncc_weight_type,
154 CHECK_STACKS(ncc, interp_ncc_weight_type, partial_coverage)))
160 interp_nnn_weight_type,
165 max_search_distance,
ARGS(0.0, M_PI_2),
169 nnn, interp_nnn_weight_type, counts,
170 max_search_distance, scales)))))
176 interp_nnn_weight_type,
181 max_search_distance,
ARGS(0.0, M_PI_2),
183 scales,
ARGS(0.5, 1.0),
185 nnn, interp_nnn_weight_type, counts,
186 max_search_distance, scales)))))
192 interp_dnn_weight_type,
195 interp_dnn_search_distance_type,
198 search_distances,
ARGS(0.0, M_PI_2),
202 dnn, interp_dnn_weight_type, interp_dnn_search_distance_type,
203 search_distances, scales)))))
209 interp_dnn_weight_type,
212 interp_dnn_search_distance_type,
215 search_distances,
ARGS(0.0, M_PI_2),
217 scales,
ARGS(0.5, 1.0),
219 dnn, interp_dnn_weight_type, interp_dnn_search_distance_type,
220 search_distances, scales)))))
230 interp_method_conserv_normalisation,
233 order, enforced_conserv, partial_coverage,
234 interp_method_conserv_normalisation)))))
248 NUM_CELL_AREA_CONFIGS =
249 sizeof(cell_area_configs) /
sizeof(cell_area_configs[0])};
254 cell_area_configs[0], cell_area_configs[1], cell_area_configs[2],
255 cell_area_configs[3], cell_area_configs[4], cell_area_configs[5],
256 cell_area_configs[6]),
260 cell_area_configs[0], cell_area_configs[1], cell_area_configs[2],
261 cell_area_configs[3], cell_area_configs[4], cell_area_configs[5],
262 cell_area_configs[6]),
264 spread_distance,
ARGS(0.0, 0.1),
266 max_search_distance,
ARGS(0.0, 0.4),
268 interp_spmap_weight_type,
271 interp_spmap_scale_type,
276 spread_distance, max_search_distance,
277 interp_spmap_weight_type, interp_spmap_scale_type,
278 src_cell_area_config, tgt_cell_area_config)))))))
280 for (
size_t i = 0; i < NUM_CELL_AREA_CONFIGS; ++i)
309 scale_config_custom),
312 NUM_DEFAULT_CONFIGS =
313 sizeof(default_configs)/
sizeof(default_configs[0])};
337 bnd_point_selection_b, spmap_config_custom),
341 bnd_point_selection_a, NULL),
343 bnd_point_selection_b, NULL),
348 bnd_point_selection_b, spmap_config_custom),
350 enum {NUM_OVERWRITE_CONFIGS = 6};
355 default_configs[0], default_configs[1],
356 default_configs[2], default_configs[3]),
360 overwrite_configs[0], overwrite_configs[1], overwrite_configs[2],
361 overwrite_configs[3], overwrite_configs[4], overwrite_configs[5]),
362 CHECK_STACKS(spmap_ext, default_config, overwrite_config)))
364 for (
size_t i = 0; i < NUM_OVERWRITE_CONFIGS; ++i)
366 (overwrite_configs[i] != NULL) && (overwrite_configs[i][j] != NULL);
372 for (
size_t i = 0; i < NUM_DEFAULT_CONFIGS; ++i)
403 send_stack, default_cfg, overwrite_configs);
412 entry, &default_cfg_read, &overwrite_cfgs_read);
415 PUT_ERR(
"ERROR: spmap default config readback mismatch");
416 if (overwrite_cfgs_read == NULL || overwrite_cfgs_read[0] == NULL ||
417 overwrite_cfgs_read[1] == NULL || overwrite_cfgs_read[2] != NULL)
418 PUT_ERR(
"ERROR: spmap overwrite list readback size mismatch");
420 overwrite_cfgs_read[0], overwrite_configs[0]) != 0)
421 PUT_ERR(
"ERROR: spmap overwrite[0] readback mismatch");
423 overwrite_cfgs_read[1], overwrite_configs[1]) != 0)
424 PUT_ERR(
"ERROR: spmap overwrite[1] readback mismatch");
430 int mpi_pack_size = (int)pack_size;
431 void * sendbuf = malloc(mpi_pack_size);
432 void * recvbuf = malloc(mpi_pack_size);
435 send_stack, sendbuf, mpi_pack_size, &pos, MPI_COMM_SELF);
437 sendbuf, mpi_pack_size, MPI_PACKED, 0, 0,
438 recvbuf, mpi_pack_size, MPI_PACKED, 0, 0,
439 MPI_COMM_SELF, MPI_STATUS_IGNORE);
443 recvbuf, mpi_pack_size, &rpos, MPI_COMM_SELF);
446 PUT_ERR(
"ERROR: spmap stack pack/unpack compare mismatch");
454 entry, &default_cfg_read, &overwrite_cfgs_read);
457 PUT_ERR(
"ERROR: unpacked spmap default config mismatch");
458 if (overwrite_cfgs_read == NULL || overwrite_cfgs_read[0] == NULL ||
459 overwrite_cfgs_read[1] == NULL || overwrite_cfgs_read[2] != NULL)
460 PUT_ERR(
"ERROR: unpacked spmap overwrite list size mismatch");
462 overwrite_cfgs_read[0], overwrite_configs[0]) != 0)
463 PUT_ERR(
"ERROR: unpacked spmap overwrite[0] mismatch");
465 overwrite_cfgs_read[1], overwrite_configs[1]) != 0)
466 PUT_ERR(
"ERROR: unpacked spmap overwrite[1] mismatch");
485 "test_interp_stack_config_file_a.nc",
486 "test_interp_stack_config_file_b.nc"),
488 interp_file_on_missing_file,
491 interp_file_on_success,
494 user_file, filename, interp_file_on_missing_file,
495 interp_file_on_success))))
504 constructor_key,
ARGS(NULL,
"constructor_a",
"constructor_b"),
506 do_search_key,
ARGS(NULL,
"do_search_key_a",
"do_search_key_b"),
511 creep_distance,
ARGS(-1, 0, 1),
516 compute_weights_key,
ARGS(
"compute_weights_a",
"compute_weights_b"),
524 PUT_ERR(
"ERROR: unexpected stack size in average getter test");
529 PUT_ERR(
"ERROR: invalid interpolation type in average getter test");
532 int partial_coverage = 0;
534 entry, &reduction_type, &partial_coverage);
536 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_average");
546 PUT_ERR(
"ERROR: unexpected stack size in ncc getter test");
552 PUT_ERR(
"ERROR: invalid interpolation type in ncc getter test");
555 int partial_coverage = 1;
558 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_ncc");
570 PUT_ERR(
"ERROR: unexpected stack size in dnn avg getter test");
576 PUT_ERR(
"ERROR: invalid interpolation type in dnn avg getter test");
581 double search_distance = -1.0;
584 entry, &
type, &search_distance_type, &search_distance, &scale);
587 (fabs(search_distance - 0.11) > 1e-12) ||
589 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_dnn (avg)");
601 PUT_ERR(
"ERROR: unexpected stack size in dnn dist getter test");
607 PUT_ERR(
"ERROR: invalid interpolation type in dnn dist getter test");
612 double search_distance = -1.0;
615 entry, &
type, &search_distance_type, &search_distance, &scale);
618 (fabs(search_distance - 0.12) > 1e-12) ||
620 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_dnn (dist)");
632 PUT_ERR(
"ERROR: unexpected stack size in dnn rbf getter test");
638 PUT_ERR(
"ERROR: invalid interpolation type in dnn rbf getter test");
643 double search_distance = -1.0;
646 entry, &
type, &search_distance_type, &search_distance, &scale);
649 (fabs(search_distance - 0.13) > 1e-12) ||
650 (fabs(scale - 0.91) > 1e-12))
651 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_dnn (rbf)");
663 PUT_ERR(
"ERROR: unexpected stack size in dnn gauss getter test");
669 PUT_ERR(
"ERROR: invalid interpolation type in dnn gauss getter test");
674 double search_distance = -1.0;
677 entry, &
type, &search_distance_type, &search_distance, &scale);
680 (fabs(search_distance - 0.14) > 1e-12) ||
681 (fabs(scale - 0.92) > 1e-12))
682 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_dnn (gauss)");
692 PUT_ERR(
"ERROR: unexpected stack size in nnn getter test");
697 PUT_ERR(
"ERROR: invalid interpolation type in nnn getter test");
701 double max_search_distance = 0.0;
704 entry, &
type, &n, &max_search_distance, &scale);
706 (fabs(max_search_distance - 0.21) > 1e-12) ||
707 (fabs(scale - 1.31) > 1e-12))
708 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_nnn");
718 PUT_ERR(
"ERROR: unexpected stack size in rbf getter test");
724 PUT_ERR(
"ERROR: invalid interpolation type in rbf getter test");
728 double max_search_distance = 0.0;
731 entry, &
type, &n, &max_search_distance, &scale);
733 (fabs(max_search_distance - 0.22) > 1e-12) ||
734 (fabs(scale - 1.32) > 1e-12))
735 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_nnn (rbf)");
738 max_search_distance = 0.0;
741 if ((n != 6) || (fabs(max_search_distance - 0.22) > 1e-12) ||
742 (fabs(scale - 1.32) > 1e-12))
743 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_rbf");
754 PUT_ERR(
"ERROR: unexpected stack size in conservative getter test");
759 PUT_ERR(
"ERROR: invalid interpolation type in conservative getter test");
762 int enforced_conserv = -1;
763 int partial_coverage = -1;
767 entry, &order, &enforced_conserv, &partial_coverage, &normalisation);
768 if ((order != 2) || (enforced_conserv != 1) || (partial_coverage != 0) ||
770 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_conservative");
778 interp_stack,
"test_file.nc",
782 PUT_ERR(
"ERROR: unexpected stack size in user file getter test");
787 PUT_ERR(
"ERROR: invalid interpolation type in user file getter test");
789 char const * filename = NULL;
794 entry, &filename, &on_missing_file, &on_success);
795 if ((filename == NULL) || strcmp(filename,
"test_file.nc") ||
798 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_user_file");
799 free((
void*)filename);
809 PUT_ERR(
"ERROR: unexpected stack size in fixed getter test");
814 PUT_ERR(
"ERROR: invalid interpolation type in fixed getter test");
818 if (fabs(
value - 2.5) > 1e-12)
819 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_fixed");
829 PUT_ERR(
"ERROR: unexpected stack size in check getter test");
834 PUT_ERR(
"ERROR: invalid interpolation type in check getter test");
836 char const * constructor_key = NULL;
837 char const * do_search_key = NULL;
839 if ((constructor_key == NULL) || strcmp(constructor_key,
"") ||
840 (do_search_key == NULL) || strcmp(do_search_key,
"do_search_key"))
841 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_check");
842 free((
void*)constructor_key);
843 free((
void*)do_search_key);
853 PUT_ERR(
"ERROR: unexpected stack size in creep getter test");
858 PUT_ERR(
"ERROR: invalid interpolation type in creep getter test");
860 int creep_distance = -1;
862 if (creep_distance != 3)
863 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_creep");
873 PUT_ERR(
"ERROR: unexpected stack size in user callback getter test");
878 PUT_ERR(
"ERROR: invalid interpolation type in user callback getter test");
880 char const * func_compute_weights_key = NULL;
882 entry, &func_compute_weights_key);
883 if ((func_compute_weights_key == NULL) ||
884 strcmp(func_compute_weights_key,
"compute_weights"))
885 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_user_callback");
886 free((
void*)func_compute_weights_key);
897 0.0,
"src_area.nc",
"src_cell_area", 7,
898 0.0,
"tgt_area.nc",
"tgt_cell_area", 9);
905 entry, &default_cfg, &overwrite_cfgs);
918 PUT_ERR(
"ERROR: unexpected file-based default spmap config");
919 if (overwrite_cfgs != NULL)
920 PUT_ERR(
"ERROR: unexpected overwrite configs for file-based spmap test");
932 double * coords = (
double[]){0.0,0.1,0.2};
934 {utest_generate_basic_grid_data_reg2d(
935 coords, coords, (
size_t[]){2,2},
936 (
size_t[]){0,0}, (
size_t[]){2,2}, 1),
937 utest_generate_basic_grid_data_reg2d(
938 coords, coords, (
size_t[]){2,2},
939 (
size_t[]){0,0}, (
size_t[]){2,2}, 1)};
941 malloc(4 *
sizeof(*cell_center_coords));
942 for (
int i = 0, k = 0; i < 2; ++i)
943 for (
int j = 0; j < 2; ++j, ++k)
945 (coords[j] + coords[j+1])*0.5, (coords[i] + coords[i+1])*0.5,
946 cell_center_coords[k]);
952 size_t src_cell_coord_idx =
955 size_t tgt_cell_coord_idx =
958 free(cell_center_coords);
965 size_t num_src_fields =
sizeof(src_fields) /
sizeof(src_fields[0]);
969 tgt_field.coordinates_idx = tgt_cell_coord_idx;
975 enum {OVERWRITE_CONFIG_COUNT = 1};
977 overwrite_configs[OVERWRITE_CONFIG_COUNT+1];
978 overwrite_configs[OVERWRITE_CONFIG_COUNT] = NULL;
989 overwrite_configs[0] =
1015 double * src_field = (
double[]){1.0,2.0,3.0,4.0};
1016 double ** src_fields = &src_field;
1017 double * tgt_field = (
double[]){0.0,0.0,0.0,0.0};
1018 double const * ref_tgt_field =
1019 (
double[]){1.0/3.0, 2.0+1.0/3.0, 3.0+1.0/3.0, 4.0};
1023 for (
int i = 0; i < 4; ++i)
1024 if (fabs(tgt_field[i] - ref_tgt_field[i]) > 1e-6)
1025 PUT_ERR(
"ERROR in yac_interp_stack_config_add_spmap_ext");
1033 for (
size_t i = 0; i < OVERWRITE_CONFIG_COUNT; ++i)
1047static void utest_check_compare_stacks_(
1049 int configs_differ) {
1051 configs_differ = configs_differ != 0;
1054 PUT_ERR(
"error in yac_interp_stack_config_compare (a != a)")
1061 if ((cmp_a != cmp_b) ^ configs_differ) {
1062 PUT_ERR(
"error in yac_interp_stack_config_compare ((a > b) == (a < b))")
1064 if ((cmp_a != 0) ^ configs_differ) {
1065 PUT_ERR(
"error in yac_interp_stack_config_compare ((a > b) == 0)")
1067 if ((cmp_b != 0) ^ configs_differ) {
1068 PUT_ERR(
"error in yac_interp_stack_config_compare ((a > b) == 0)")
1075static void utest_check_compare_stacks(
1077 int configs_differ) {
1079 utest_check_compare_stacks_(
1082 utest_check_compare_stacks_(a, b, configs_differ);
1085static void utest_interp_stack_config_add_spmap_(
1087 double spread_distance,
double max_search_distance,
1095 double src_sphere_radius =
1098 char const * src_filename =
1101 char const * src_varname =
1110 double tgt_sphere_radius =
1113 char const * tgt_filename =
1116 char const * tgt_varname =
1124 interp_stack_config,
1125 spread_distance, max_search_distance,
weight_type, scale_type,
1138 interp_stack_config,
1140 double spread_distance_;
1141 double max_search_distance_;
1144 double src_sphere_radius_;
1145 char const * src_filename_;
1146 char const * src_varname_;
1147 int src_min_global_id_;
1148 double tgt_sphere_radius_;
1149 char const * tgt_filename_;
1150 char const * tgt_varname_;
1151 int tgt_min_global_id_;
1154 &spread_distance_, &max_search_distance_, &weight_type_, &scale_type_,
1155 &src_sphere_radius_, &src_filename_, &src_varname_, &src_min_global_id_,
1156 &tgt_sphere_radius_, &tgt_filename_, &tgt_varname_, &tgt_min_global_id_);
1158 if (spread_distance_ != spread_distance)
1159 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_spmap");
1160 if (max_search_distance_ != max_search_distance)
1161 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_spmap");
1163 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_spmap");
1164 if (scale_type_ != scale_type)
1165 PUT_ERR(
"ERROR in yac_interp_stack_config_entry_get_spmap");
struct yac_basic_grid * yac_basic_grid_new(char const *name, struct yac_basic_grid_data grid_data)
size_t yac_basic_grid_add_coordinates(struct yac_basic_grid *grid, enum yac_location location, yac_coordinate_pointer coordinates, size_t count)
void yac_basic_grid_delete(struct yac_basic_grid *grid)
void yac_dist_grid_pair_delete(struct yac_dist_grid_pair *grid_pair)
struct yac_dist_grid_pair * yac_dist_grid_pair_new(struct yac_basic_grid *grid_a, struct yac_basic_grid *grid_b, MPI_Comm comm)
void yac_interp_grid_delete(struct yac_interp_grid *interp_grid)
struct yac_interp_grid * yac_interp_grid_new(struct yac_dist_grid_pair *grid_pair, char const *src_grid_name, char const *tgt_grid_name, size_t num_src_fields, struct yac_interp_field const *src_fields, struct yac_interp_field const tgt_field)
void yac_interp_method_delete(struct interp_method **method)
Delete an interpolation stack and free its resources (but not the pointer array).
struct yac_interp_weights * yac_interp_method_do_search(struct interp_method **method, struct yac_interp_grid *interp_grid)
Perform weight computation using given interpolation stack and grid.
@ YAC_N_NEAREST_NEIGHBOR
N-nearest-neighbor interpolation.
@ YAC_CREEP
Creep-fill interpolation.
@ YAC_USER_FILE
User-supplied weights from file.
@ 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.
yac_interp_avg_weight_type
@ YAC_INTERP_AVG_ARITHMETIC
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)
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)
int yac_interp_spmap_config_compare(struct yac_interp_spmap_config const *a, struct yac_interp_spmap_config const *b)
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)
int yac_spmap_overwrite_config_compare(struct yac_spmap_overwrite_config const *a, struct yac_spmap_overwrite_config const *b)
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)
void yac_spmap_cell_area_config_delete(struct yac_spmap_cell_area_config *cell_area_config)
struct yac_spmap_cell_area_config * yac_spmap_cell_area_config_yac_new(double sphere_radius)
void yac_spmap_overwrite_config_delete(struct yac_spmap_overwrite_config *overwrite_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)
#define YAC_INTERP_SPMAP_MAX_SEARCH_DISTANCE_DEFAULT
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_WEIGHTED_DEFAULT
#define YAC_INTERP_SPMAP_SPREAD_DISTANCE_DEFAULT
yac_interp_spmap_cell_area_provider
@ YAC_INTERP_SPMAP_CELL_AREA_FILE
@ YAC_INTERP_SPMAP_CELL_AREA_YAC
yac_interp_spmap_weight_type
#define YAC_INTERP_SPMAP_DEFAULT_CONFIG
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)
size_t yac_interp_stack_config_get_size(struct yac_interp_stack_config *interp_stack)
Get the number of interpolation methods in the stack.
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)
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_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)
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_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)
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_delete(struct yac_interp_stack_config *interp_stack_config)
Free an interpolation stack configuration object.
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.
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)
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)
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_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_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.
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.
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)
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)
struct yac_interpolation * yac_interp_weights_get_interpolation(struct yac_interp_weights *weights, enum yac_interp_weights_reorder_type reorder, size_t collection_size, double frac_mask_fallback_value, double scaling_factor, double scaling_summand, char const *yaxt_exchanger_name, int is_source, int is_target)
void yac_interp_weights_delete(struct yac_interp_weights *weights)
@ YAC_MAPPING_ON_SRC
weights will be applied at source processes
void yac_interpolation_execute(struct yac_interpolation *interp, double ***src_fields, double **tgt_field)
Execute interpolation synchronously and write results to the target field.
void yac_interpolation_delete(struct yac_interpolation *interp)
Free an interpolation object and release all resources.
double const YAC_FRAC_MASK_NO_VALUE
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)
enum yac_location location
struct yac_interp_field tgt_field
struct yac_dist_grid_pair * grid_pair
struct yac_interp_field src_fields[]
static double const fixed_value
#define FOREACH_TYPE(name, type, values,...)
#define FOREACH_STRING(name, values,...)
#define CHECK_STACKS(interp_name,...)
#define FOREACH_DBLE(name, values,...)
#define FOREACH_ENUM(name, values,...)
#define FOREACH_INT(name, values,...)
#define FOREACH_BOOL(name,...)
static void LLtoXYZ(double lon, double lat, double p_out[])
double(* yac_coordinate_pointer)[3]