This example tests the generation of a coupling configuration.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <mpi.h>
#include "tests.h"
char const * ref_start_datetime ="2008-03-09T16:05:07.000";
char const * ref_end_datetime = "2008-03-10T16:05:07.000";
char const * config_filename, int parse_flags);
char const * config_filename, int parse_flags);
static void write_couple_config_to_YAML(
int emit_flags);
static int compare_string(char const * a, char const * b);
#define DEF_INTERP_STACK(IDX, ...) \
{ \
struct yac_interp_stack_config * interp_stack = \
((ref_field_couple_data[IDX].interp_stack_config = \
yac_interp_stack_config_new())); \
__VA_ARGS__ \
}
#define ADD_INTERP(NAME, ...) \
yac_interp_stack_config_add_ ## NAME( \
interp_stack, __VA_ARGS__);
#define ADD_INTERP_NO_PARAM(NAME) \
yac_interp_stack_config_add_ ## NAME(interp_stack);
int main(
int argc,
char** argv) {
MPI_Init(NULL, NULL);
int size, rank;
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
MPI_Comm_size ( MPI_COMM_WORLD, &size );
if (size != 2) {
fputs("ERROR wrong number of processes (has to be 2)", stderr);
exit(EXIT_FAILURE);
}
if (argc != 2) {
PUT_ERR("ERROR: missing config file directory");
xt_finalize();
MPI_Finalize();
return TEST_EXIT_CODE;
}
char const * filename = "couple_config_test.yaml";
char * config_filename = malloc(strlen(argv[1]) + 32);
generate_couple_config_from_YAML_parallel(
strcat(strcpy(config_filename, argv[1]), filename),
check_couple_config_no_delete(couple_config);
{
struct {
int emit_flags;
int parse_flags;
char const * ext;
} formats[] =
.ext = "yaml"},
.ext = "json"}};
enum {NUM_FORMATS = sizeof(formats) / sizeof(formats[0])};
for (int i = 0; i < NUM_FORMATS; ++i) {
sprintf(
config_filename, "temp_couple_config_test.%s", formats[i].ext);
if (rank == 0) {
write_couple_config_to_YAML(
couple_config, config_filename, formats[i].emit_flags);
check_couple_config(
generate_couple_config_from_YAML(
config_filename, formats[i].parse_flags));
unlink(config_filename);
}
MPI_Barrier(MPI_COMM_WORLD);
char const * debug_global_config_file_def_comp = "test_couple_config_def_comp.yaml";
char const * debug_global_config_file_sync_def = "test_couple_config_sync_def.json";
char const * debug_global_config_file_enddef = "test_couple_config_enddef.yaml";
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
char test_reference[32];
sprintf(test_reference, "test_ref_%s", formats[i].ext);
int include_definitions = 0;
couple_config, config_filename, formats[i].filetype, test_reference,
include_definitions);
couple_config, debug_global_config_file_def_comp,
include_definitions);
if (rank == 0) {
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
check_couple_config(
generate_couple_config_from_YAML(
unlink(config_filename);
}
if (rank == 0) {
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
check_couple_config(
generate_couple_config_from_YAML(
unlink(debug_global_config_file_sync_def);
}
if (rank == 0) {
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
PUT_ERR("ERROR config file should not exist");
check_couple_config(
generate_couple_config_from_YAML(
unlink(debug_global_config_file_enddef);
}
}
}
free(config_filename);
check_couple_config(couple_config);
{
couple_config, "comp_a", "grid_a", "field_a",
interp_stack_config, 0, 0, NULL, 0, 1.0, 0.0, 0, NULL, NULL, NULL);
couple_config, (rank == 0)?"comp_c":"comp_d");
}
{
char const * str_interp_stack_config =
"- conservative:\n"
" enforced_conservation: false\n"
" normalisation: fracarea\n"
" partial_coverage: false\n"
"- fixed:\n"
" user_value: -999.0\n";
ref_interp_stack_config, -999.0);
ref_interp_stack_config, interp_stack_config))
PUT_ERR("ERROR in yac_yaml_parse_interp_stack_config_string");
}
{
couple_config, (rank == 0)?"comp_a":"comp_b");
couple_config, (rank == 0)?"comp_b":"comp_a");
couple_config, "comp_a", "grid_a", "field_a",
interp_stack_config, 0, 0, NULL, 0, 1.0, 0.0, 0, NULL, NULL, NULL);
PUT_ERR("ERROR in yac_couple_config_get_num_couples\n");
}
MPI_Finalize();
return TEST_EXIT_CODE;
}
static void check_couple_config_no_delete(
struct yac_couple_config * couple_config) {
struct {
char const * name;
char const * metadata;
} ref_comp_data[] =
{{.name = "ICON-O",
.metadata = "a lot of water"},
{.name = "ICON-A",
.metadata = "a lot of hot air"},
{.name = "DUMMY",
.metadata = NULL},
{.name = "DUMMY_2",
.metadata = NULL},
{.name = "src_comp",
.metadata = NULL},
{.name = "tgt_comp",
.metadata = NULL}};
enum {REF_NUM_COMPS = sizeof(ref_comp_data) / sizeof(ref_comp_data[0])};
struct {
char const * name;
char const * output_filename;
char const * metadata;
} ref_grid_data[] =
{{.name = "grid1", .output_filename = "debug_grid.nc", .metadata = "grid1_meta"},
{.name = "grid2", .output_filename = NULL, .metadata = "grid2_meta"},
{.name = "grid3", .output_filename = NULL, .metadata = NULL},
{.name = "grid4", .output_filename = "debug_grid.nc", .metadata = NULL},
{.name = "src_grid_1", .output_filename = NULL, .metadata = NULL},
{.name = "src_grid_2", .output_filename = NULL, .metadata = NULL},
{.name = "tgt_grid_1", .output_filename = NULL, .metadata = NULL},
{.name = "tgt_grid_2", .output_filename = NULL, .metadata = NULL}};
enum {REF_NUM_GRIDS = sizeof(ref_grid_data) / sizeof(ref_grid_data[0])};
struct {
char const * name;
char const * metadata;
size_t ref_comp_data_idx;
size_t ref_grid_data_idx;
size_t ref_couple_data_idx;
double frac_mask_value;
char const * timestep;
int role;
} ref_field_data[] =
{{.name = "sea_surface_temperature",
.metadata = "T in C",
.ref_comp_data_idx = 0,
.ref_grid_data_idx = 0,
.ref_couple_data_idx = 0,
.timestep = "1",
.collection_size = 3,
{.name = "sea_surface_temperature",
.metadata = "T in K",
.ref_comp_data_idx = 1,
.ref_grid_data_idx = 2,
.ref_couple_data_idx = 0,
.timestep = "10",
.collection_size = 3,
{.name = "wind_speed",
.metadata = "v in km/h",
.ref_comp_data_idx = 0,
.ref_grid_data_idx = 0,
.ref_couple_data_idx = 0,
.frac_mask_value = 1.0,
.timestep = "20",
.collection_size = 3,
{.name = "wind_speed",
.metadata = "v in m/s",
.ref_comp_data_idx = 1,
.ref_grid_data_idx = 2,
.ref_couple_data_idx = 0,
.frac_mask_value = NAN,
.timestep = "2",
.collection_size = 3,
{.name = "water_flux_into_sea_water",
.metadata = NULL,
.ref_comp_data_idx = 0,
.ref_grid_data_idx = 0,
.ref_couple_data_idx = 0,
.frac_mask_value = 0.0,
.timestep = "3",
.collection_size = 4,
{.name = "water_flux_into_sea_water",
.metadata = NULL,
.ref_comp_data_idx = 1,
.ref_grid_data_idx = 2,
.ref_couple_data_idx = 0,
.frac_mask_value = 0.0,
.timestep = "30",
.collection_size = 4,
{.name = "grid_eastward_wind",
.metadata = NULL,
.ref_comp_data_idx = 0,
.ref_grid_data_idx = 1,
.ref_couple_data_idx = 0,
.timestep = "40",
.collection_size = 4,
{.name = "grid_eastward_wind",
.metadata = NULL,
.ref_comp_data_idx = 1,
.ref_grid_data_idx = 2,
.ref_couple_data_idx = 0,
.frac_mask_value = 0.0,
.timestep = "4",
.collection_size = 4,
{.name = "grid_northward_wind",
.metadata = NULL,
.ref_comp_data_idx = 0,
.ref_grid_data_idx = 1,
.ref_couple_data_idx = 0,
.timestep = "5",
.collection_size = 5,
{.name = "grid_northward_wind",
.metadata = NULL,
.ref_comp_data_idx = 1,
.ref_grid_data_idx = 2,
.ref_couple_data_idx = 0,
.timestep = "50",
.collection_size = 5,
{.name = "grid_northward_wind",
.metadata = NULL,
.ref_comp_data_idx = 2,
.ref_grid_data_idx = 3,
.ref_couple_data_idx = 1,
.timestep = "50",
.collection_size = 5,
{.name = "manual_field",
.metadata = NULL,
.ref_comp_data_idx = 0,
.ref_grid_data_idx = 1,
.ref_couple_data_idx = 1,
.timestep = "60",
.collection_size = 2,
{.name = "manual_field",
.metadata = NULL,
.ref_comp_data_idx = 2,
.ref_grid_data_idx = 3,
.ref_couple_data_idx = 1,
.timestep = "6",
.collection_size = 2,
{.name = "manual_field_uncoupled_a",
.metadata = NULL,
.ref_comp_data_idx = 2,
.ref_grid_data_idx = 3,
.ref_couple_data_idx = 1,
.timestep = "6",
.collection_size = 2,
{.name = "manual_field_uncoupled_b",
.metadata = NULL,
.ref_comp_data_idx = 2,
.ref_grid_data_idx = 3,
.ref_couple_data_idx = 1,
.timestep = "6",
.collection_size = SIZE_MAX,
{.name = "manual_field_uncoupled_c",
.metadata = NULL,
.ref_comp_data_idx = 2,
.ref_grid_data_idx = 3,
.ref_couple_data_idx = 1,
.timestep = NULL,
.collection_size = 2,
{.name = "multi_grid_field",
.metadata = NULL,
.ref_comp_data_idx = 4,
.ref_grid_data_idx = 4,
.ref_couple_data_idx = 2,
.timestep = "1",
.collection_size = 1,
{.name = "multi_grid_field",
.metadata = NULL,
.ref_comp_data_idx = 4,
.ref_grid_data_idx = 5,
.ref_couple_data_idx = 2,
.timestep = "1",
.collection_size = 1,
{.name = "multi_grid_field",
.metadata = NULL,
.ref_comp_data_idx = 5,
.ref_grid_data_idx = 6,
.ref_couple_data_idx = 2,
.timestep = "1",
.collection_size = 1,
{.name = "multi_grid_field",
.metadata = NULL,
.ref_comp_data_idx = 5,
.ref_grid_data_idx = 7,
.ref_couple_data_idx = 2,
.timestep = "1",
.collection_size = 1,
enum {REF_NUM_FIELDS = sizeof(ref_field_data) / sizeof(ref_field_data[0])};
struct {
size_t ref_comp_data_idxs[2];
} ref_couple_data[] =
{{.ref_comp_data_idxs = {0, 1}},
{.ref_comp_data_idxs = {0, 2}},
{.ref_comp_data_idxs = {4, 5}}};
enum {REF_NUM_COUPLES = sizeof(ref_couple_data) / sizeof(ref_couple_data[0])};
struct {
size_t ref_src_field_data_idx;
size_t ref_tgt_field_data_idx;
int mapping_on_source;
int src_lag;
int tgt_lag;
char const * src_timestep;
char const * tgt_timestep;
char const * coupling_period;
int enforce_write_weight_file;
char const * weight_file_name;
double scale_factor;
double scale_summand;
size_t num_src_mask_names;
char const * const * src_mask_names;
char const * tgt_mask_name;
char const * yaxt_exchanger_name;
} ref_field_couple_data[] =
{{.ref_src_field_data_idx = 0,
.ref_tgt_field_data_idx = 1,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 0,
.tgt_lag = 4,
.src_timestep = "1",
.tgt_timestep = "10",
.coupling_period = "10",
.enforce_write_weight_file = 1,
.weight_file_name = "weights1.nc",
.scale_factor = 1.0,
.scale_summand = 0.0,
.num_src_mask_names = 1,
.src_mask_names = (char const*[]){"src_sst_mask"},
.tgt_mask_name = "tgt_sst_mask",
.yaxt_exchanger_name = "irecv_send"},
{.ref_src_field_data_idx = 3,
.ref_tgt_field_data_idx = 2,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 1,
.tgt_lag = 3,
.src_timestep = "2",
.tgt_timestep = "20",
.coupling_period = "20",
.enforce_write_weight_file = 0,
.weight_file_name = "\0",
.scale_factor = 10.0,
.scale_summand = 0.0,
.num_src_mask_names = 3,
.src_mask_names = (char const*[]){"src_wind_mask1", "src_wind_mask2", "src_wind_mask3"},
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 4,
.ref_tgt_field_data_idx = 5,
.interp_stack_config = NULL,
.mapping_on_source = 0,
.src_lag = 2,
.tgt_lag = 2,
.src_timestep = "3",
.tgt_timestep = "30",
.coupling_period = "30",
.enforce_write_weight_file = 1,
.weight_file_name = "weights3.nc",
.scale_factor = 1.0,
.scale_summand = -1.0,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 7,
.ref_tgt_field_data_idx = 6,
.interp_stack_config = NULL,
.mapping_on_source = 0,
.src_lag = 3,
.tgt_lag = 1,
.src_timestep = "4",
.tgt_timestep = "40",
.coupling_period = "40",
.enforce_write_weight_file = 0,
.weight_file_name = "\0",
.scale_factor = 0.5,
.scale_summand = -0.5,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 8,
.ref_tgt_field_data_idx = 9,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 4,
.tgt_lag = 0,
.src_timestep = "5",
.tgt_timestep = "50",
.coupling_period = "50",
.enforce_write_weight_file = 1,
.weight_file_name = "weights5.nc",
.scale_factor = 1.0,
.scale_summand = 0.0,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 8,
.ref_tgt_field_data_idx = 10,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 4,
.tgt_lag = 0,
.src_timestep = "5",
.tgt_timestep = "50",
.coupling_period = "50",
.enforce_write_weight_file = 1,
.weight_file_name = "weights6.nc",
.scale_factor = 1.0,
.scale_summand = 0.0,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 12,
.ref_tgt_field_data_idx = 11,
.interp_stack_config = NULL,
.mapping_on_source = 0,
.src_lag = 0,
.tgt_lag = 0,
.src_timestep = "6",
.tgt_timestep = "60",
.coupling_period = "60",
.enforce_write_weight_file = 0,
.weight_file_name = "\0",
.scale_factor = 9.0/5.0,
.scale_summand = 32.0,
.num_src_mask_names = 2,
.src_mask_names = (char const*[]){"src_mask1", "src_mask2"},
.tgt_mask_name = "tgt_mask",
.yaxt_exchanger_name = "irecv_isend"},
{.ref_src_field_data_idx = 16,
.ref_tgt_field_data_idx = 18,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 0,
.tgt_lag = 0,
.src_timestep = "1",
.tgt_timestep = "1",
.coupling_period = "1",
.enforce_write_weight_file = 0,
.weight_file_name = "\0",
.scale_factor = 1.0,
.scale_summand = 0.0,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 16,
.ref_tgt_field_data_idx = 19,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 0,
.tgt_lag = 0,
.src_timestep = "1",
.tgt_timestep = "1",
.coupling_period = "1",
.enforce_write_weight_file = 0,
.weight_file_name = "\0",
.scale_factor = 1.0,
.scale_summand = 0.0,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 17,
.ref_tgt_field_data_idx = 18,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 0,
.tgt_lag = 0,
.src_timestep = "1",
.tgt_timestep = "1",
.coupling_period = "1",
.enforce_write_weight_file = 0,
.weight_file_name = "\0",
.scale_factor = 1.0,
.scale_summand = 0.0,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL},
{.ref_src_field_data_idx = 17,
.ref_tgt_field_data_idx = 19,
.interp_stack_config = NULL,
.mapping_on_source = 1,
.src_lag = 0,
.tgt_lag = 0,
.src_timestep = "1",
.tgt_timestep = "1",
.coupling_period = "1",
.enforce_write_weight_file = 0,
.weight_file_name = "\0",
.scale_factor = 1.0,
.scale_summand = 0.0,
.num_src_mask_names = 0,
.src_mask_names = NULL,
.tgt_mask_name = NULL,
.yaxt_exchanger_name = NULL}};
enum {
REF_NUM_FIELD_COUPLES =
sizeof(ref_field_couple_data) / sizeof(ref_field_couple_data[0])};
DEF_INTERP_STACK(0,
ADD_INTERP(nnn,
ADD_INTERP_NO_PARAM(hcsbb)
ADD_INTERP(user_file, "weights.nc")
ADD_INTERP(fixed, -1.0))
DEF_INTERP_STACK(1,
ADD_INTERP(nnn,
DEF_INTERP_STACK(2,
ADD_INTERP(check, "", "")
ADD_INTERP(check, "check_constructor", "")
ADD_INTERP(check, "", "check_do_search")
ADD_INTERP(check, "check_constructor", "check_do_search")
ADD_INTERP(nnn,
DEF_INTERP_STACK(3,
ADD_INTERP(spmap,
0.0, "area.nc", "cell_area", 1,
ADD_INTERP(nnn,
DEF_INTERP_STACK(4,
ADD_INTERP(creep, 5)
ADD_INTERP(fixed, -2.0))
DEF_INTERP_STACK(5,
ADD_INTERP(creep, -1)
ADD_INTERP(fixed, -1.0))
DEF_INTERP_STACK(6,
ADD_INTERP(fixed, -1.0))
DEF_INTERP_STACK(7,
ADD_INTERP(fixed, -1.0))
DEF_INTERP_STACK(8,
ADD_INTERP(fixed, -1.0))
DEF_INTERP_STACK(9,
ADD_INTERP(fixed, -1.0))
DEF_INTERP_STACK(10,
ADD_INTERP(fixed, -1.0))
int ref_missing_definition_is_fatal = 1;
char * start_datetime =
if (compare_string(start_datetime, ref_start_datetime))
free(start_datetime);
char * end_datetime =
if (compare_string(end_datetime, ref_end_datetime))
free(end_datetime);
for (size_t i = 0; i < REF_NUM_COMPS; ++i) {
couple_config, ref_comp_data[i].name))
PUT_ERR("ERROR in yac_couple_config_component_name_is_valid");
if (compare_string(
couple_config, ref_comp_data[i].name),
ref_comp_data[i].metadata))
PUT_ERR("ERROR in yac_couple_config_component_get_metadata");
size_t comp_idx =
couple_config, ref_comp_data[i].name);
if (compare_string(
ref_comp_data[i].name))
PUT_ERR("ERROR in yac_couple_config_get_component_name");
size_t ref_num_comp_fields = 0;
for (size_t j = 0; j < REF_NUM_FIELDS; ++j)
if (ref_field_data[j].ref_comp_data_idx == i)
++ref_num_comp_fields;
ref_num_comp_fields)
PUT_ERR("ERROR in yac_couple_config_get_num_fields");
}
PUT_ERR("ERROR in yac_couple_config_component_name_is_valid");
PUT_ERR("ERROR in yac_couple_config_get_num_grids");
for (size_t i = 0; i < REF_NUM_GRIDS; ++i) {
couple_config, ref_grid_data[i].name))
PUT_ERR("ERROR in yac_couple_config_contains_grid_name\n");
if (compare_string(
couple_config, ref_grid_data[i].name),
ref_grid_data[i].output_filename))
PUT_ERR("ERROR in yac_couple_config_grid_get_output_filename");
if (compare_string(
couple_config, ref_grid_data[i].name), ref_grid_data[i].metadata))
PUT_ERR("ERROR in yac_couple_config_grid_get_metadata");
size_t grid_idx =
couple_config, ref_grid_data[i].name);
if (compare_string(
ref_grid_data[i].name))
PUT_ERR("ERROR in yac_couple_config_get_grid_name");
}
PUT_ERR("ERROR in yac_couple_config_contains_grid_name\n");
for (size_t i = 0; i < REF_NUM_FIELDS; ++i) {
char const * field_comp_name =
ref_comp_data[ref_field_data[i].ref_comp_data_idx].name;
char const * field_grid_name =
ref_grid_data[ref_field_data[i].ref_grid_data_idx].name;
char const * field_name = ref_field_data[i].name;
if (compare_string(
couple_config, field_comp_name, field_grid_name, field_name),
ref_field_data[i].metadata))
PUT_ERR("ERROR in yac_couple_config_field_get_metadata");
double frac_mask_fallback_value =
couple_config, field_comp_name, field_grid_name, field_name);
if (memcmp(
&frac_mask_fallback_value, &ref_field_data[i].frac_mask_value,
sizeof(frac_mask_fallback_value)))
PUT_ERR("ERROR in yac_couple_config_get_frac_mask_fallback_value");
size_t comp_idx =
couple_config, ref_comp_data[ref_field_data[i].ref_comp_data_idx].name);
size_t grid_idx =
couple_config, ref_grid_data[ref_field_data[i].ref_grid_data_idx].name);
size_t field_idx =
couple_config, comp_idx, grid_idx, ref_field_data[i].name);
if (compare_string(
couple_config, comp_idx, field_idx), field_grid_name))
PUT_ERR("ERROR in yac_couple_config_get_field_grid_name");
if (compare_string(
couple_config, comp_idx, field_idx), field_name))
PUT_ERR("ERROR in yac_couple_config_get_field_name");
if (ref_field_data[i].timestep != NULL)
if (compare_string(
couple_config, field_comp_name, field_grid_name, field_name),
PUT_ERR("ERROR in yac_couple_config_get_field_timestep");
if (ref_field_data[i].collection_size != SIZE_MAX)
couple_config, field_comp_name, field_grid_name, field_name) !=
ref_field_data[i].collection_size)
PUT_ERR("ERROR in yac_couple_config_get_field_collection_size");
couple_config, field_comp_name, field_grid_name, field_name) !=
ref_field_data[i].role)
PUT_ERR("ERROR in yac_couple_config_get_field_role");
((ref_field_data[i].timestep != NULL) &&
(ref_field_data[i].collection_size != SIZE_MAX)))
PUT_ERR("ERROR in yac_couple_config_field_is_valid");
}
PUT_ERR("ERROR in yac_couple_config_get_num_couples\n");
for (size_t i = 0; i < REF_NUM_COUPLES; ++i) {
char const * ref_comp_names[2];
ref_comp_names[0] = ref_comp_data[ref_couple_data[i].ref_comp_data_idxs[0]].name;
ref_comp_names[1] = ref_comp_data[ref_couple_data[i].ref_comp_data_idxs[1]].name;
size_t couple_idx = SIZE_MAX;
for (size_t j = 0; (j < REF_NUM_COUPLES) && (couple_idx == SIZE_MAX); ++j) {
char const * couple_comp_names[2];
couple_config, j, couple_comp_names);
if ((!compare_string(couple_comp_names[0], ref_comp_names[0]) &&
!compare_string(couple_comp_names[1], ref_comp_names[1])) ||
(!compare_string(couple_comp_names[0], ref_comp_names[1]) &&
!compare_string(couple_comp_names[1], ref_comp_names[0])))
couple_idx = j;
}
if (couple_idx == SIZE_MAX) {
PUT_ERR("ERROR: no matching couple found\n");
continue;
}
size_t num_couple_fields = 0;
for (size_t j = 0; j < REF_NUM_FIELD_COUPLES; ++j)
if (((ref_field_data[ref_field_couple_data[j].ref_src_field_data_idx].ref_comp_data_idx ==
ref_couple_data[i].ref_comp_data_idxs[0]) &&
(ref_field_data[ref_field_couple_data[j].ref_tgt_field_data_idx].ref_comp_data_idx ==
ref_couple_data[i].ref_comp_data_idxs[1])) ||
((ref_field_data[ref_field_couple_data[j].ref_src_field_data_idx].ref_comp_data_idx ==
ref_couple_data[i].ref_comp_data_idxs[1]) &&
(ref_field_data[ref_field_couple_data[j].ref_tgt_field_data_idx].ref_comp_data_idx ==
ref_couple_data[i].ref_comp_data_idxs[0])))
++num_couple_fields;
num_couple_fields)
PUT_ERR("ERROR in yac_couple_config_get_num_couple_fields");
}
for (size_t i = 0; i < REF_NUM_FIELD_COUPLES; ++i) {
size_t ref_couple_data_idx;
for (ref_couple_data_idx = 0; ref_couple_data_idx < REF_NUM_COUPLES; ++ref_couple_data_idx)
if (((ref_field_data[ref_field_couple_data[i].ref_src_field_data_idx].ref_comp_data_idx ==
ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[0]) &&
(ref_field_data[ref_field_couple_data[i].ref_tgt_field_data_idx].ref_comp_data_idx ==
ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[1])) ||
((ref_field_data[ref_field_couple_data[i].ref_src_field_data_idx].ref_comp_data_idx ==
ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[1]) &&
(ref_field_data[ref_field_couple_data[i].ref_tgt_field_data_idx].ref_comp_data_idx ==
ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[0]))) break;
char const * ref_comp_names[2];
ref_comp_names[0] =
ref_comp_data[ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[0]].name;
ref_comp_names[1] =
ref_comp_data[ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[1]].name;
size_t couple_idx = SIZE_MAX;
for (size_t j = 0; (j < REF_NUM_COUPLES) && (couple_idx == SIZE_MAX); ++j) {
char const * couple_comp_names[2];
couple_config, j, couple_comp_names);
if ((!compare_string(couple_comp_names[0], ref_comp_names[0]) &&
!compare_string(couple_comp_names[1], ref_comp_names[1])) ||
(!compare_string(couple_comp_names[0], ref_comp_names[1]) &&
!compare_string(couple_comp_names[1], ref_comp_names[0])))
couple_idx = j;
}
if (couple_idx == SIZE_MAX) {
PUT_ERR("ERROR: no matching couple found\n");
continue;
}
size_t num_couples =
char const * src_comp_name, * tgt_comp_name;
char const * src_grid_name, * tgt_grid_name;
char const * src_field_name, * tgt_field_name;
size_t field_couple_idx = SIZE_MAX;
for (size_t j = 0; (j < num_couples) && (field_couple_idx == SIZE_MAX); ++j) {
couple_config, couple_idx, j, &src_comp_name, &tgt_comp_name);
couple_config, couple_idx, j, &src_grid_name, &tgt_grid_name);
couple_config, couple_idx, j, &src_field_name, &tgt_field_name);
if (!compare_string(
src_comp_name,
ref_comp_data[
ref_field_data[
ref_field_couple_data[i].
ref_src_field_data_idx].ref_comp_data_idx].name) &&
!compare_string(
tgt_comp_name,
ref_comp_data[
ref_field_data[
ref_field_couple_data[i].
ref_tgt_field_data_idx].ref_comp_data_idx].name) &&
!compare_string(
src_grid_name,
ref_grid_data[
ref_field_data[
ref_field_couple_data[i].
ref_src_field_data_idx].ref_grid_data_idx].name) &&
!compare_string(
tgt_grid_name,
ref_grid_data[
ref_field_data[
ref_field_couple_data[i].
ref_tgt_field_data_idx].ref_grid_data_idx].name) &&
!compare_string(
src_field_name,
ref_field_data[
ref_field_couple_data[i].ref_src_field_data_idx].name) &&
!compare_string(
tgt_field_name,
ref_field_data[
ref_field_couple_data[i].ref_tgt_field_data_idx].name))
field_couple_idx = j;
}
if (field_couple_idx == SIZE_MAX) {
PUT_ERR("ERROR: no matching field couple found\n");
continue;
}
ref_field_couple_data[i].interp_stack_config,
couple_config, couple_idx, field_couple_idx)))
PUT_ERR("ERROR in yac_interp_stack_config");
ref_field_couple_data[i].interp_stack_config);
couple_config, couple_idx, field_couple_idx) !=
ref_field_couple_data[i].mapping_on_source)
PUT_ERR("ERROR in yac_couple_config_mapping_on_source");
couple_config, couple_idx, field_couple_idx) !=
ref_field_couple_data[i].src_lag)
PUT_ERR("ERROR in yac_couple_config_get_source_lag");
couple_config, couple_idx, field_couple_idx) !=
ref_field_couple_data[i].tgt_lag)
PUT_ERR("ERROR in yac_couple_config_get_target_lag");
if (compare_string(
couple_config, couple_idx, field_couple_idx),
PUT_ERR("ERROR in yac_couple_config_get_source_timestep");
if (compare_string(
couple_config, couple_idx, field_couple_idx),
PUT_ERR("ERROR in yac_couple_config_get_target_timestep");
if (compare_string(
couple_config, couple_idx, field_couple_idx),
PUT_ERR("ERROR in yac_couple_config_get_coupling_period");
couple_config, couple_idx, field_couple_idx) !=
ref_field_couple_data[i].coupling_period_operation)
PUT_ERR("ERROR in yac_couple_config_get_coupling_period_operation");
couple_config, couple_idx, field_couple_idx) !=
ref_field_couple_data[i].enforce_write_weight_file)
PUT_ERR("ERROR in yac_couple_config_enforce_write_weight_file");
if (compare_string(
couple_config, couple_idx, field_couple_idx),
ref_field_couple_data[i].weight_file_name))
PUT_ERR("ERROR in yac_couple_config_get_weight_file_name");
couple_config, couple_idx, field_couple_idx) !=
ref_field_couple_data[i].scale_factor)
PUT_ERR("ERROR in yac_couple_config_get_scale_factor");
couple_config, couple_idx, field_couple_idx) !=
ref_field_couple_data[i].scale_summand)
PUT_ERR("ERROR in yac_couple_config_get_scale_summand");
char const * const * src_mask_names;
size_t num_src_mask_names;
couple_config, couple_idx, field_couple_idx,
&src_mask_names, &num_src_mask_names);
if (ref_field_couple_data[i].num_src_mask_names != num_src_mask_names)
PUT_ERR("ERROR in yac_couple_config_get_src_mask_names");
if (ref_field_couple_data[i].num_src_mask_names == num_src_mask_names)
for (size_t j = 0; j < num_src_mask_names; ++j)
if (compare_string(
ref_field_couple_data[i].src_mask_names[j], src_mask_names[j]))
PUT_ERR("ERROR in yac_couple_config_get_src_mask_names");
char const * tgt_mask_name =
couple_config, couple_idx, field_couple_idx);
if (compare_string(
ref_field_couple_data[i].tgt_mask_name, tgt_mask_name))
PUT_ERR("ERROR in yac_couple_config_get_tgt_mask_name");
char const * yaxt_exchanger_name =
couple_config, couple_idx, field_couple_idx);
if (compare_string(
ref_field_couple_data[i].yaxt_exchanger_name, yaxt_exchanger_name))
PUT_ERR("ERROR in yac_couple_config_get_yaxt_exchanger_name");
if (compare_string("multi_grid_field", tgt_field_name)) {
char const * src_comp_name_, * src_grid_name_, * src_field_name_;
couple_config, tgt_comp_name, tgt_grid_name, tgt_field_name,
&src_comp_name_, &src_grid_name_, &src_field_name_);
if (compare_string(src_comp_name, src_comp_name_) ||
compare_string(src_grid_name, src_grid_name_) ||
compare_string(src_field_name, src_field_name_))
PUT_ERR("ERROR in yac_couple_config_get_field_source");
}
}
ref_missing_definition_is_fatal)
PUT_ERR("ERROR in yac_couple_config_get_missing_definition_is_fatal");
}
check_couple_config_no_delete(couple_config);
couple_config, "2008-03-09T16:05:07", "2008-03-10T16:05:07");
char * start_datetime =
if (compare_string(start_datetime, ref_start_datetime))
PUT_ERR("ERROR in yac_couple_config_get_start_datetime\n");
free(start_datetime);
char * end_datetime =
if (compare_string(end_datetime, ref_end_datetime))
PUT_ERR("ERROR in yac_couple_config_get_end_datetime\n");
free(end_datetime);
}
char const * config_filename, int parse_flags) {
int size, rank;
MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
MPI_Comm_size ( MPI_COMM_WORLD, &size );
if (rank == 0)
couple_config, "2008-03-09T16:05:07.000", "2008-03-10T16:05:07.000");
if (rank == 1)
couple_config, "2008-03-09T16:05:07", "2008-03-10T16:05:07");
if (rank == 0)
couple_config, "grid1", "grid1_meta");
if (rank == 1)
couple_config, "grid2", "grid2_meta");
if (rank == 0)
couple_config, "grid4", "debug_grid.nc");
if (rank == 0)
couple_config, "ICON-O", "a lot of water");
if (rank == 1)
couple_config, "ICON-A", "a lot of hot air");
couple_config, "ICON-O", "grid1", "sea_surface_temperature",
couple_config, "ICON-A", "grid3", "sea_surface_temperature",
if (rank == 0) {
couple_config, "ICON-O", "grid1", "sea_surface_temperature", "T in C");
couple_config, "ICON-A", "grid3", "sea_surface_temperature", "T in K");
}
couple_config, "ICON-A", "grid3", "wind_speed",
couple_config, "ICON-O", "grid1", "wind_speed",
if (rank == 1) {
couple_config, "ICON-A", "grid3", "wind_speed", NAN);
couple_config, "ICON-A", "grid3", "wind_speed", NAN);
couple_config, "ICON-O", "grid1", "wind_speed", 1.0);
couple_config, "ICON-A", "grid3", "wind_speed", "v in m/s");
couple_config, "ICON-O", "grid1", "wind_speed", "v in km/h");
}
couple_config, "ICON-O", "grid1", "water_flux_into_sea_water",
couple_config, "ICON-A", "grid3", "water_flux_into_sea_water",
couple_config, "ICON-O", "grid1", "water_flux_into_sea_water", 0.0);
couple_config, "ICON-A", "grid3", "water_flux_into_sea_water", 0.0);
couple_config, "ICON-A", "grid3", "grid_eastward_wind",
couple_config, "ICON-O", "grid2", "grid_eastward_wind",
couple_config, "ICON-A", "grid3", "grid_eastward_wind", 0.0);
couple_config, "ICON-O", "grid2", "grid_northward_wind",
couple_config, "ICON-A", "grid3", "grid_northward_wind",
couple_config, "ICON-O", "grid2", "grid_northward_wind",
couple_config, "DUMMY", "grid4", "grid_northward_wind",
couple_config, "src_comp", "src_grid_1", "multi_grid_field",
couple_config, "src_comp", "src_grid_2", "multi_grid_field",
couple_config, "tgt_comp", "tgt_grid_1", "multi_grid_field",
couple_config, "tgt_comp", "tgt_grid_2", "multi_grid_field",
if (rank == 0) {
couple_config, "ICON-O", "grid2", "manual_field",
couple_config, "DUMMY", "grid4", "manual_field",
"ICON-O", "grid2", "manual_field",
interp_stack, 0, 0, NULL, 0, 9.0/5.0, 32.0,
2, (char const *[]){"src_mask1", "src_mask2"},
"tgt_mask", "irecv_isend");
} else if (rank == 1) {
couple_config, "DUMMY", "grid4", "manual_field",
}
if (rank == 1) {
couple_config, "DUMMY", "grid4", "manual_field_uncoupled_a",
couple_config, "DUMMY", "grid4", "manual_field_uncoupled_b",
couple_config, "DUMMY", "grid4", "manual_field_uncoupled_c",
NULL, 2);
}
if (rank == 0) {
couple_config, config_filename, parse_flags);
couple_config, config_filename, parse_flags);
}
if (rank == 1)
return couple_config;
}
static void write_couple_config_to_YAML(
int emit_flags) {
FILE * yaml_file = fopen(config_filename, "w");
int include_definitions = 0;
char * str_couple_config =
fputs(str_couple_config, yaml_file);
free(str_couple_config);
fclose(yaml_file);
}
char const * config_filename, int parse_flags) {
couple_config, config_filename, parse_flags);
couple_config, "ICON-O", "a lot of water");
couple_config, "ICON-A", "a lot of hot air");
couple_config, "grid1", "grid1_meta");
couple_config, "grid2", "grid2_meta");
couple_config, "grid4", "debug_grid.nc");
couple_config, "ICON-O", "grid1", "sea_surface_temperature",
couple_config, "ICON-A", "grid3", "sea_surface_temperature",
couple_config, "ICON-O", "grid1", "sea_surface_temperature", "T in C");
couple_config, "ICON-A", "grid3", "sea_surface_temperature", "T in K");
couple_config, "ICON-A", "grid3", "wind_speed",
couple_config, "ICON-A", "grid3", "wind_speed", NAN);
couple_config, "ICON-O", "grid1", "wind_speed",
couple_config, "ICON-O", "grid1", "wind_speed", 1.0);
couple_config, "ICON-A", "grid3", "wind_speed", "v in m/s");
couple_config, "ICON-O", "grid1", "wind_speed", "v in km/h");
couple_config, "ICON-O", "grid1", "water_flux_into_sea_water",
couple_config, "ICON-O", "grid1", "water_flux_into_sea_water", 0.0);
couple_config, "ICON-A", "grid3", "water_flux_into_sea_water",
couple_config, "ICON-A", "grid3", "water_flux_into_sea_water", 0.0);
couple_config, "ICON-A", "grid3", "grid_eastward_wind",
couple_config, "ICON-A", "grid3", "grid_eastward_wind", 0.0);
couple_config, "ICON-O", "grid2", "grid_eastward_wind",
couple_config, "ICON-O", "grid2", "grid_northward_wind",
couple_config, "ICON-A", "grid3", "grid_northward_wind",
couple_config, "DUMMY", "grid4", "grid_northward_wind",
couple_config, "ICON-O", "grid2", "manual_field",
couple_config, "DUMMY", "grid4", "manual_field",
couple_config, "DUMMY", "grid4", "manual_field_uncoupled_a",
couple_config, "DUMMY", "grid4", "manual_field_uncoupled_b",
couple_config, "DUMMY", "grid4", "manual_field_uncoupled_c",
NULL, 2);
couple_config, "src_comp", "src_grid_1", "multi_grid_field",
couple_config, "src_comp", "src_grid_2", "multi_grid_field",
couple_config, "tgt_comp", "tgt_grid_1", "multi_grid_field",
couple_config, "tgt_comp", "tgt_grid_2", "multi_grid_field",
return couple_config;
}
static int compare_string(char const * a, char const * b) {
int ret = (a == NULL) - (b == NULL);
if (ret || (a == NULL)) return ret;
return strcmp((void*)a,(void*)b);
}
struct yac_interp_stack_config * yac_yaml_parse_interp_stack_config_string(char const *str_interp_stack_config, int parse_flags)
int const YAC_YAML_PARSER_JSON_AUTO
char * yac_yaml_emit_coupling(struct yac_couple_config *couple_config, int emit_flags, int include_definitions)
int const YAC_YAML_EMITTER_DEFAULT
emit to YAML format
void yac_yaml_read_coupling(struct yac_couple_config *couple_config, const char *yaml_filename, int parse_flags)
int const YAC_YAML_EMITTER_JSON
emit to JSON format
int const YAC_YAML_PARSER_DEFAULT
default parse flags (YAML format)
char const * yac_time_to_ISO(char const *time, enum yac_time_unit_type time_unit)
int const YAC_YAML_PARSER_JSON_FORCE
assume JSON format
void yac_couple_config_grid_set_metadata(struct yac_couple_config *couple_config, char const *grid_name, const char *metadata)
int yac_couple_config_field_is_valid(struct yac_couple_config *couple_config, size_t component_idx, size_t field_idx)
void yac_couple_config_get_field_source(struct yac_couple_config *couple_config, char const *tgt_component_name, char const *tgt_grid_name, char const *tgt_field_name, char const **src_component_name, char const **src_grid_name, char const **src_field_name)
char const * yac_couple_config_get_yaxt_exchanger_name(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_sync(struct yac_couple_config *couple_config, MPI_Comm comm, char const *output_ref)
void yac_couple_config_field_enable_frac_mask(struct yac_couple_config *couple_config, char const *comp_name, char const *grid_name, char const *field_name, double frac_mask_fallback_value)
size_t yac_couple_config_get_num_fields(struct yac_couple_config *couple_config, size_t component_idx)
void yac_couple_config_get_field_grid_names(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx, char const **src_grid_name, char const **tgt_grid_name)
int yac_couple_config_contains_grid_name(struct yac_couple_config *couple_config, char const *grid_name)
const char * yac_couple_config_grid_get_output_filename(struct yac_couple_config *couple_config, const char *grid_name)
char * yac_couple_config_get_start_datetime(struct yac_couple_config *couple_config)
void yac_couple_config_set_datetime(struct yac_couple_config *couple_config, char const *start, char const *end)
void yac_couple_config_component_add_field(struct yac_couple_config *couple_config, const char *component_name, const char *grid_name, const char *name, char const *timestep, size_t collection_size)
char const * yac_couple_config_get_field_timestep(struct yac_couple_config *couple_config, char const *component_name, char const *grid_name, char const *field_name)
int yac_couple_config_mapping_on_source(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
int yac_couple_config_get_field_role(struct yac_couple_config *couple_config, char const *component_name, char const *grid_name, char const *field_name)
int yac_couple_config_component_name_is_valid(struct yac_couple_config *couple_config, char const *component_name)
char const * yac_couple_config_get_coupling_period(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_field_set_metadata(struct yac_couple_config *couple_config, const char *comp_name, const char *grid_name, const char *field_name, const char *metadata)
struct yac_interp_stack_config * yac_couple_config_get_interp_stack(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
char const * yac_couple_config_get_field_name(struct yac_couple_config *couple_config, size_t component_idx, size_t field_idx)
size_t yac_couple_config_get_field_idx(struct yac_couple_config *couple_config, size_t component_idx, size_t grid_idx, char const *field_name)
void yac_couple_config_component_set_metadata(struct yac_couple_config *couple_config, char const *comp_name, const char *metadata)
size_t yac_couple_config_get_field_collection_size(struct yac_couple_config *couple_config, char const *component_name, char const *grid_name, char const *field_name)
size_t yac_couple_config_get_num_couple_fields(struct yac_couple_config *couple_config, size_t couple_idx)
void yac_couple_config_get_src_mask_names(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx, char const *const **mask_names, size_t *num_mask_names)
size_t yac_couple_config_get_num_couples(struct yac_couple_config *couple_config)
int yac_couple_config_get_target_lag(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_def_couple(struct yac_couple_config *couple_config, char const *src_comp_name, char const *src_grid_name, char const *src_field_name, char const *tgt_comp_name, char const *tgt_grid_name, char const *tgt_field_name, char const *coupling_period, int time_reduction, struct yac_interp_stack_config *interp_stack, int src_lag, int tgt_lag, const char *weight_file_name, int mapping_on_source, double scale_factor, double scale_summand, size_t num_src_mask_names, char const *const *src_mask_names, char const *tgt_mask_name, char const *yaxt_exchanger_name)
double yac_couple_config_get_frac_mask_fallback_value(struct yac_couple_config *couple_config, char const *component_name, char const *grid_name, char const *field_name)
int yac_couple_config_get_source_lag(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
const char * yac_couple_config_field_get_metadata(struct yac_couple_config *couple_config, const char *comp_name, const char *grid_name, const char *field_name)
void yac_couple_config_get_couple_component_names(struct yac_couple_config *couple_config, size_t couple_idx, char const *couple_component_names[2])
const char * yac_couple_config_grid_get_metadata(struct yac_couple_config *couple_config, const char *grid_name)
const char * yac_couple_config_component_get_metadata(struct yac_couple_config *couple_config, const char *comp_name)
double yac_couple_config_get_scale_factor(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
size_t yac_couple_config_get_grid_idx(struct yac_couple_config *couple_config, char const *grid_name)
size_t yac_couple_config_get_component_idx(struct yac_couple_config *couple_config, char const *component_name)
char const * yac_couple_config_get_tgt_mask_name(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_add_grid(struct yac_couple_config *couple_config, char const *name)
char const * yac_couple_config_get_grid_name(struct yac_couple_config *couple_config, size_t grid_idx)
double yac_couple_config_get_scale_summand(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
enum yac_reduction_type yac_couple_config_get_coupling_period_operation(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
int yac_couple_config_enforce_write_weight_file(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_grid_set_output_filename(struct yac_couple_config *couple_config, char const *grid_name, const char *output_filename)
void yac_couple_config_get_field_names(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx, char const **src_field_name, const char **tgt_field_name)
struct yac_couple_config * yac_couple_config_new()
char const * yac_couple_config_get_weight_file_name(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
int yac_couple_config_get_missing_definition_is_fatal(struct yac_couple_config *couple_config)
void yac_couple_config_get_field_couple_component_names(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx, char const **src_component_name, char const **tgt_component_name)
char const * yac_couple_config_get_component_name(struct yac_couple_config *couple_config, size_t component_idx)
void yac_couple_config_set_missing_definition_is_fatal(struct yac_couple_config *couple_config, int missing_definition_is_fatal)
char const * yac_couple_config_get_source_timestep(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_add_component(struct yac_couple_config *couple_config, char const *name)
size_t yac_couple_config_get_num_grids(struct yac_couple_config *couple_config)
char const * yac_couple_config_get_field_grid_name(struct yac_couple_config *couple_config, size_t component_idx, size_t field_idx)
void yac_couple_config_set_config_output_filename(struct yac_couple_config *couple_config, char const *filename, enum yac_text_filetype filetype, char const *ref, int include_definitions)
char * yac_couple_config_get_end_datetime(struct yac_couple_config *couple_config)
char const * yac_couple_config_get_target_timestep(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_delete(struct yac_couple_config *couple_config)
size_t yac_couple_config_get_num_components(struct yac_couple_config *couple_config)
@ YAC_TEXT_FILETYPE_YAML
YAML format.
@ YAC_TEXT_FILETYPE_JSON
JSON format.
int main(int argc, char **argv)
#define YAC_INSTANCE_CONFIG_OUTPUT_REF_ENDDEF
#define YAC_INSTANCE_CONFIG_OUTPUT_REF_COMP
#define YAC_INSTANCE_CONFIG_OUTPUT_REF_SYNC
@ YAC_INTERP_AVG_ARITHMETIC
@ YAC_INTERP_CONSERV_DESTAREA
@ YAC_INTERP_CONSERV_FRACAREA
static void compute_weights(struct tgt_point_search_data *tgt_point_data, size_t num_tgt_points, struct edge_interp_data *edge_data, size_t num_edges, struct triangle_interp_data *triangle_data, size_t num_triangles, struct weight_vector_data **weights, size_t **num_weights_per_tgt, size_t *total_num_weights)
@ YAC_INTERP_NCC_DIST
distance weighted average of n source points
@ 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
#define YAC_INTERP_RBF_MAX_SEARCH_DISTANCE_DEFAULT
#define YAC_INTERP_NNN_MAX_SEARCH_DISTANCE_DEFAULT
#define YAC_INTERP_NNN_GAUSS_SCALE_DEFAULT
#define YAC_INTERP_RBF_SCALE_DEFAULT
#define YAC_INTERP_SPMAP_MAX_SEARCH_DISTANCE_DEFAULT
@ YAC_INTERP_SPMAP_NONE
weights are not scaled
#define YAC_INTERP_SPMAP_VARNAME_DEFAULT
#define YAC_INTERP_SPMAP_FILENAME_DEFAULT
#define YAC_INTERP_SPMAP_MIN_GLOBAL_ID_DEFAULT
int yac_interp_stack_config_compare(void const *a_, void const *b_)
void yac_interp_stack_config_add_fixed(struct yac_interp_stack_config *interp_stack_config, double value)
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_delete(struct yac_interp_stack_config *interp_stack_config)
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)
struct yac_interp_stack_config * yac_interp_stack_config_new()
double const YAC_FRAC_MASK_NO_VALUE
int yac_file_exists(const char *filename)
int const YAC_EXCHANGE_TYPE_SOURCE
int const YAC_EXCHANGE_TYPE_NONE
int const YAC_EXCHANGE_TYPE_TARGET
void yac_cdef_calendar(int calendar)
int const YAC_PROLEPTIC_GREGORIAN
int const YAC_REDUCTION_TIME_NONE