55 if (entry == NULL)
return;
67 xmalloc(1 *
sizeof(*interp_stack_copy));
68 interp_stack_copy->
size = interp_stack->size;
71 for (
size_t i = 0; i < interp_stack_copy->
size; ++i) {
76 return interp_stack_copy;
89 size_t stack_size = a->
size;
90 for (
size_t method_idx = 0; method_idx < stack_size; ++method_idx)
101 size_t interp_stack_size = interp_stack->size;
103 xmalloc((interp_stack_size + 1) *
sizeof(*method_stack));
104 method_stack[interp_stack_size] = NULL;
106 for (
size_t i = 0; i < interp_stack_size; ++i) {
117 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &size_pack_size), comm);
119 size_t config_pack_size = 0;
121 for (
size_t i = 0; i < interp_stack->size; ++i)
124 interp_stack->entries[i].data.config, comm);
125 return (
size_t)size_pack_size + config_pack_size;
130 void *
buffer,
int buffer_size,
int * position, MPI_Comm comm) {
132 int stack_size = (int)(interp_stack->size);
135 &stack_size, 1, MPI_INT,
136 buffer, buffer_size, position, comm), comm);
138 for (
size_t i = 0; i < interp_stack->size; ++i)
140 interp_stack->entries[i].data.config,
141 buffer, buffer_size, position, comm);
145 void *
buffer,
int buffer_size,
int * position, MPI_Comm comm) {
150 buffer, buffer_size, position, &stack_size, 1, MPI_INT, comm), comm);
154 "ERROR(yac_interp_stack_config_unpack_interp_stack): invalid stack size")
159 interp_stack->size = (size_t)stack_size;
160 interp_stack->entries =
161 xmalloc((
size_t)stack_size *
sizeof(*interp_stack->entries));
163 for (
int i = 0; i < stack_size; ++i) {
164 interp_stack->entries[i].data.config =
166 interp_stack->entries[i].data.spmap_ext_cache = NULL;
174 xmalloc(1 *
sizeof(*interp_stack_config));
175 interp_stack_config->
entries = NULL;
176 interp_stack_config->
size = 0;
178 return interp_stack_config;
183 for (
size_t i = 0; i < interp_stack_config->
size; ++i) {
189 free(interp_stack_config->
entries);
190 free(interp_stack_config);
196 interp_stack_config->
size++;
200 interp_stack_config->
size *
sizeof(*(interp_stack_config->
entries)));
204 spmap_ext_cache = NULL;
209 char const * routine) {
215 "ERROR(%s): failed to get method configuration parameters", routine);
222 char const * routine) {
229 "ERROR(%s): failed to access parameter \"%s\": %s",
238 char const * routine) {
245 "ERROR(%s): failed to access parameter \"%s\" (idx=%zu): %s",
253 char const * routine) {
255 size_t count = SIZE_MAX;
259 "ERROR(%s): failed to read sub-parameter count of \"%s\": %s",
267 char const * routine) {
274 "ERROR(%s): failed to read parameter \"%s\": %s",
282 char const * routine) {
289 "ERROR(%s): failed to read parameter \"%s\": %s",
297 char const * routine) {
304 "ERROR(%s): failed to read parameter \"%s\": %s",
310 struct yac_param * cell_area_oneof_param,
311 char const *
name,
char const * routine) {
317 cell_area_type_name != NULL,
318 "ERROR(%s): invalid %s configuration", routine,
name);
331 type_table, type_table_size, cell_area_type_name);
337 "ERROR(%s): invalid cell area configuration type \"%s\"",
338 routine, cell_area_type_name);
344 "filename", routine);
352 "min_global_id", routine);
365 "sphere_radius", routine));
369 return cell_area_config;
374 char const * routine) {
381 "src_cell_area", routine);
385 "tgt_cell_area", routine);
391 src_cell_area_config, tgt_cell_area_config);
400 "spread_distance", routine),
403 "max_search_distance", routine),
406 "weighted", routine),
412 size_t overwrite_count =
get_sub_count(overwrite_param,
"overwrite", routine);
415 (overwrite_count > 0)?
418 for (
size_t i = 0; i < overwrite_count; ++i) {
419 struct yac_param * overwrite_entry_param =
422 struct yac_param * condition_oneof_param =
426 condition_oneof_param, 0,
"condition", routine);
427 char const * condition_type =
430 (condition_type != NULL) &&
431 (!strcmp(condition_type,
"bnd_circle") ||
432 !strcmp(condition_type,
"bounding_circle")),
433 "ERROR(%s): unsupported overwrite condition type",
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),
462 "weighted", routine),
478 char const * routine) {
497 char const * routine) {
504 int value,
char const * routine) {
510 "ERROR(%s): failed to set parameter \"%s\": %s",
516 double value,
char const * routine) {
522 "ERROR(%s): failed to set parameter \"%s\": %s",
528 char const *
value,
char const * routine) {
534 "ERROR(%s): failed to set parameter \"%s\": %s",
542 char const * routine =
"yac_interp_stack_config_add_average";
558 int reduction_type,
int partial_coverage) {
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");
577 char const * routine =
"yac_interp_stack_config_add_ncc";
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");
611 double search_distance,
double scale) {
613 char const * routine =
"yac_interp_stack_config_add_dnn";
621 struct yac_param * search_distance_param =
623 switch (search_distance_type) {
625 "ERROR(%s): invalid search distance type", routine);
628 search_distance_param,
"fixed", search_distance, routine);
632 search_distance_param,
"cell_area", search_distance, routine);
637 "ERROR(%s): invalid weight type", routine);
645 root_param,
"rbf_scale", scale, routine);
658 int type,
int search_distance_type,
double search_distance,
double scale) {
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.")
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.")
680 search_distance, scale);
686 double max_search_distance,
double scale) {
689 char const * routine =
"yac_interp_stack_config_add_nnn";
701 root_param,
"max_search_distance", max_search_distance, routine);
714 size_t n,
double max_search_distance,
double scale) {
721 int type,
size_t n,
double max_search_distance,
double scale) {
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.")
735 max_search_distance, scale);
740 int order,
int enforced_conserv,
int partial_coverage,
743 char const * routine =
"yac_interp_stack_config_add_conservative";
746 (order == 1) || (order == 2),
747 "ERROR(%s): order must be 1 (first order) or 2 (second order), got %d",
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);
770 int order,
int enforced_conserv,
int partial_coverage,
776 "ERROR(yac_interp_stack_config_add_conservative_f2c): "
777 "type must be one of "
778 "YAC_INTERP_CONSERV_DESTAREA/YAC_INTERP_CONSERV_FRACAREA.")
781 interp_stack_config, order, enforced_conserv, partial_coverage,
789 char const * routine =
"generate_spmap_cell_area_config";
795 "ERROR(%s): %s sphere_radius != 0.0, but filename and varname are not NULL",
802 "ERROR(%s): %s sphere_radius == 0.0, "
803 "but filename and/or varname are invalid", routine,
type);
814 char const *
name,
char const * routine) {
821 "ERROR(%s): invalid %s type",
835 file_param,
"filename",
838 file_param,
"varname",
841 file_param,
"min_global_id",
853 char const * routine) {
856 param,
"spread_distance",
859 param,
"max_search_distance",
865 if (!include_scale)
return;
876 "src_cell_area", routine);
880 "tgt_cell_area", routine);
888 char const * routine =
"yac_interp_stack_config_add_spmap_ext";
900 (overwrite_configs != NULL) && (overwrite_configs[i] != NULL);
903 struct yac_param * overwrite_entry_param = NULL;
906 overwrite_param, &overwrite_entry_param);
909 "ERROR(%s): failed to append overwrite config: %s",
917 "ERROR(%s): unsupported overwrite source point selection type", routine);
922 struct yac_param * condition_oneof_param =
925 get_sub_param(condition_oneof_param,
"bounding_circle", routine);
933 overwrite_entry_param,
944 double spread_distance,
double max_search_distance,
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) {
954 src_sphere_radius, src_filename, src_varname,
955 src_min_global_id,
"source");
958 tgt_sphere_radius, tgt_filename, tgt_varname,
959 tgt_min_global_id,
"target");
962 scale_type, src_cell_area_config, tgt_cell_area_config);
974 interp_stack_config, default_config, overwrite_configs);
980 double spread_distance,
double max_search_distance,
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) {
987 char const * routine =
"yac_interp_stack_config_add_spmap_f2c";
992 "ERROR(%s): weight_type must be one of "
993 "YAC_INTERP_SPMAP_AVG/YAC_INTERP_SPMAP_DIST.", routine)
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)
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;
1010 interp_stack_config, spread_distance, max_search_distance,
1013 src_sphere_radius, src_filename, src_varname, src_min_global_id,
1014 tgt_sphere_radius, tgt_filename, tgt_varname, tgt_min_global_id);
1027 char const *
string,
char const * file,
int line,
char const * routine,
1028 char const * variable) {
1031 string != NULL,
"ERROR(%s:%d:%s): %s is NULL",
1032 file, line, routine, variable)
1035 "ERROR(%s:%d:%s): %s is too long", file, line, routine, variable)
1040 char const * filename,
1044 char const * routine =
"yac_interp_stack_config_add_user_file";
1046 check_string(filename, __FILE__, __LINE__, routine,
"filename");
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);
1066 char const * filename,
int on_missing_file,
int on_success) {
1068 char const * routine =
"yac_interp_stack_config_add_user_file_f2c";
1070 if (filename && (filename[0] ==
'\0')) filename = NULL;
1074 "ERROR(%s): on_missing_file must be one of "
1075 "YAC_INTERP_FILE_MISSING_ERROR/YAC_INTERP_FILE_MISSING_CONT.", routine)
1079 "ERROR(%s): on_success must be one of "
1080 "YAC_INTERP_FILE_SUCCESS_STOP/YAC_INTERP_FILE_SUCCESS_CONT.", routine)
1083 interp_stack_config, filename,
1091 char const * routine =
"yac_interp_stack_config_add_fixed";
1105 char const * constructor_key,
char const * do_search_key) {
1107 char const * routine =
"yac_interp_stack_config_add_check";
1111 "ERROR(%s): constructor_key name \"%s\" is too long "
1112 "(has to be smaller than %d)",
1116 "ERROR(%s): do_search_key name \"%s\" is too long "
1117 "(has to be smaller than %d)",
1126 root_param,
"constructor_key", constructor_key?constructor_key:
"", routine);
1128 root_param,
"do_search_key", do_search_key?do_search_key:
"", routine);
1137 char const * routine =
"yac_interp_stack_config_add_creep";
1151 char const * func_compute_weights_key) {
1153 char const * routine =
"yac_interp_stack_config_add_user_callback";
1156 func_compute_weights_key, __FILE__, __LINE__,
1157 routine,
"func_compute_weights_key");
1164 root_param,
"func_compute_weights", func_compute_weights_key, routine);
1173 return interp_stack->size;
1178 size_t interp_stack_idx) {
1181 interp_stack_idx < interp_stack->size,
1182 "ERROR(yac_interp_stack_config_get): invalid interpolation stack index");
1184 return interp_stack->entries[interp_stack_idx].data.config;
1190 size_t interp_stack_idx) {
1193 interp_stack_idx < interp_stack->size,
1194 "ERROR(yac_interp_stack_config_get_entry): "
1195 "invalid interpolation stack index");
1197 return &interp_stack->entries[interp_stack_idx];
1211 int * partial_coverage) {
1215 char const * routine =
"yac_interp_stack_config_entry_get_average";
1218 "ERROR(yac_interp_stack_config_entry_get_average): "
1219 "wrong interpolation stack entry type");
1226 get_sub_param(root_param,
"weighted", routine),
"weighted", routine);
1230 "partial_coverage", routine);
1241 char const * routine =
"yac_interp_stack_config_entry_get_ncc";
1244 "ERROR(yac_interp_stack_config_entry_get_ncc): "
1245 "wrong interpolation stack entry type");
1252 get_sub_param(root_param,
"weighted", routine),
"weighted", routine);
1256 "partial_coverage", routine);
1265 double * search_distance,
double * scale) {
1269 char const * routine =
"yac_interp_stack_config_entry_get_dnn";
1273 "ERROR(%s): wrong interpolation stack entry type", routine);
1280 get_sub_param(root_param,
"weighted", routine),
"weighted", routine);
1282 struct yac_param * search_distance_oneof_param =
1284 struct yac_param * search_distance_param =
1286 search_distance_oneof_param, 0,
"search_distance", routine);
1287 char const * search_distance_name =
1290 search_distance_name != NULL,
1291 "ERROR(%s): invalid search_distance parameter", routine);
1293 if (!strcmp(search_distance_name,
"fixed")) {
1295 }
else if (!strcmp(search_distance_name,
"cell_area")) {
1299 "ERROR(%s): invalid search distance type \"%s\"",
1300 routine, search_distance_name);
1304 get_param_dble(search_distance_param,
"search_distance", routine);
1306 switch (*search_distance_type) {
1308 "ERROR(%s): invalid search distance type", routine);
1324 "rbf_scale", routine);
1330 "gauss_scale", routine);
1340 double * max_search_distance,
double * scale) {
1344 char const * routine =
"yac_interp_stack_config_entry_get_nnn";
1352 "ERROR(%s): wrong interpolation stack entry type", routine);
1360 get_sub_param(root_param,
"weighted", routine),
"weighted", routine);
1364 *max_search_distance =
1367 "max_search_distance", routine);
1372 "rbf_scale", routine);
1377 "gauss_scale", routine);
1384 size_t * n,
double * max_search_distance,
double * scale) {
1388 char const * routine =
"yac_interp_stack_config_entry_get_rbf";
1391 "ERROR(%s): wrong interpolation stack entry type", routine);
1398 *max_search_distance =
1401 "max_search_distance", routine);
1405 "rbf_scale", routine);
1412 int * order,
int * enforced_conserv,
int * partial_coverage,
1417 char const * routine =
"yac_interp_stack_config_entry_get_conservative";
1420 "ERROR(%s): wrong interpolation stack entry type", routine);
1429 get_sub_param(root_param,
"enforced_conservation", routine),
1430 "enforced_conservation", routine);
1434 "partial_coverage", routine);
1438 "normalisation", routine);
1450 char const * routine =
"yac_interp_stack_config_entry_get_spmap_ext";
1453 "ERROR(%s): wrong interpolation stack entry type", routine);
1457 size_t overwrite_count =
1460 "overwrite", routine);
1465 root_param, routine);
1467 size_t cache_overwrite_count = 0;
1470 ++cache_overwrite_count)
1473 cache_overwrite_count == overwrite_count,
1474 "ERROR(%s): inconsistent overwrite configuration count", routine);
1484 struct yac_param * cell_area_oneof_param,
1485 char const * routine,
1487 double * sphere_radius,
1488 char const ** filename,
char const ** varname,
int * min_global_id) {
1495 "ERROR(%s): invalid %s cell area configuration type",
1521 double * spread_distance,
double * max_search_distance,
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) {
1531 char const * routine =
"yac_interp_stack_config_entry_get_spmap";
1535 "ERROR(%s): wrong interpolation stack entry type", routine);
1540 size_t overwrite_count =
1542 "overwrite", routine);
1545 overwrite_count == 0,
1546 "ERROR(%s): contains overwrite configurations, use "
1547 "yac_interp_stack_config_entry_get_spmap_ext instead", routine);
1552 "spread_distance", routine);
1553 *max_search_distance =
1556 "max_search_distance", routine);
1559 get_sub_param(root_param,
"weighted", routine),
"weighted", routine);
1563 get_sub_param(root_param,
"scale", routine),
"scale", routine);
1567 routine,
"src_cell_area",
1568 src_sphere_radius, src_filename, src_varname, src_min_global_id);
1571 routine,
"tgt_cell_area",
1572 tgt_sphere_radius, tgt_filename, tgt_varname, tgt_min_global_id);
1579 char const ** filename,
1585 char const * routine =
"yac_interp_stack_config_entry_get_user_file";
1588 "ERROR(%s): wrong interpolation stack entry type", routine);
1596 "filename", routine);
1600 "on_missing_file", routine);
1604 "on_success", routine);
1615 char const * routine =
"yac_interp_stack_config_entry_get_fixed";
1618 "ERROR(%s): wrong interpolation stack entry type", routine);
1625 get_sub_param(root_param,
"user_value", routine),
"user_value", routine);
1632 char const ** constructor_key,
char const ** do_search_key) {
1636 char const * routine =
"yac_interp_stack_config_entry_get_check";
1639 "ERROR(%s): wrong interpolation stack entry type", routine);
1647 "constructor_key", routine);
1651 "do_search_key", routine);
1658 int * creep_distance) {
1662 char const * routine =
"yac_interp_stack_config_entry_get_creep";
1665 "ERROR(%s): wrong interpolation stack entry type", routine);
1673 "creep_distance", routine);
1680 char const ** func_compute_weights_key) {
1684 char const * routine =
"yac_interp_stack_config_entry_get_user_callback";
1687 "ERROR(%s): wrong interpolation stack entry type", routine);
1692 *func_compute_weights_key =
1695 "func_compute_weights", routine);
#define YAC_ASSERT(exp, msg)
int yac_name_type_pair_get_type(struct yac_name_type_pair const *pairs, size_t count, char const *name)
#define DEF_NAME_TYPE_PAIR(NAME, TYPE)
#define DEF_NAME_TYPE_PAIRS(NAME,...)
@ YAC_N_NEAREST_NEIGHBOR
N-nearest-neighbor interpolation.
@ YAC_CREEP
Creep-fill interpolation.
@ YAC_USER_FILE
User-supplied weights from file.
@ 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_ARITHMETIC
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
#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.
void yac_param_delete(struct yac_param *param)
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.
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.
int yac_param_set_scalar(struct yac_param *param, const char *value_str)
Set the value of a scalar parameter from a string.
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.
int yac_param_set_scalar_int(struct yac_param *param, int value)
Set the value of a scalar parameter as an int.
int yac_param_get_sub_count(const struct yac_param *param, size_t *count)
Get the number of subparameters.
int yac_param_set_scalar_dble(struct yac_param *param, double value)
Set the value of a scalar parameter as a double.
const char * yac_param_get_last_error(void)
Retrieve the last error message for the calling thread.
int yac_param_get_scalar_int(const struct yac_param *param, int *value)
Get the value of a scalar parameter as an int.
const char * yac_param_get_name(const struct yac_param *param)
Get the name of the current parameter.
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.
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 xrealloc(ptr, size)
#define xcalloc(nmemb, size)
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
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,...)
#define YAC_UNREACHABLE_DEFAULT_F(format,...)
#define YAC_ASSERT_F(exp, format,...)
#define yac_mpi_call(call, comm)