31static void utest_check_couple_config(
33static void utest_check_couple_config_no_delete(
36 utest_generate_couple_config_from_YAML_parallel(
40static void utest_write_couple_config_to_YAML(
43static int utest_compare_string(
char const * a,
char const * b);
45#define DEF_INTERP_STACK(IDX, ...) \
47 struct yac_interp_stack_config * interp_stack = \
48 ((ref_field_couple_data[IDX].interp_stack_config = \
49 yac_interp_stack_config_new())); \
52#define ADD_INTERP(NAME, ...) \
53 yac_interp_stack_config_add_ ## NAME( \
54 interp_stack, __VA_ARGS__);
55#define ADD_INTERP_NO_PARAM(NAME) \
56 yac_interp_stack_config_add_ ## NAME(interp_stack);
58int main(
int argc,
char** argv) {
63 MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
64 MPI_Comm_size ( MPI_COMM_WORLD, &size );
67 fputs(
"ERROR wrong number of processes (has to be 2)", stderr);
72 PUT_ERR(
"ERROR: missing config file directory");
80 char const * filename =
"couple_config_test.yaml";
84 utest_generate_couple_config_from_YAML_parallel(
88 utest_check_couple_config_no_delete(couple_config);
107 enum {NUM_FORMATS =
sizeof(formats) /
sizeof(formats[0])};
109 for (
int i = 0; i < NUM_FORMATS; ++i) {
115 utest_write_couple_config_to_YAML(
118 utest_check_couple_config(
119 utest_generate_couple_config_from_YAML(
125 MPI_Barrier(MPI_COMM_WORLD);
127 char const * debug_global_config_file_def_comp =
"test_couple_config_def_comp.yaml";
128 char const * debug_global_config_file_sync_def =
"test_couple_config_sync_def.json";
129 char const * debug_global_config_file_enddef =
"test_couple_config_enddef.yaml";
132 PUT_ERR(
"ERROR config file should not exist");
134 PUT_ERR(
"ERROR config file should not exist");
136 PUT_ERR(
"ERROR config file should not exist");
138 PUT_ERR(
"ERROR config file should not exist");
140 char test_reference[32];
141 sprintf(test_reference,
"test_ref_%s", formats[i].ext);
142 int include_definitions = 0;
145 include_definitions);
147 couple_config, debug_global_config_file_def_comp,
149 include_definitions);
155 PUT_ERR(
"ERROR config file should not exist");
157 PUT_ERR(
"ERROR config file should not exist");
159 PUT_ERR(
"ERROR config file should not exist");
161 PUT_ERR(
"ERROR config file should not exist");
163 utest_check_couple_config(
164 utest_generate_couple_config_from_YAML(
176 PUT_ERR(
"ERROR config file should not exist");
178 PUT_ERR(
"ERROR config file should not exist");
180 PUT_ERR(
"ERROR config file should not exist");
182 PUT_ERR(
"ERROR config file should not exist");
184 utest_check_couple_config(
185 utest_generate_couple_config_from_YAML(
188 unlink(debug_global_config_file_sync_def);
197 PUT_ERR(
"ERROR config file should not exist");
199 PUT_ERR(
"ERROR config file should not exist");
201 PUT_ERR(
"ERROR config file should not exist");
203 PUT_ERR(
"ERROR config file should not exist");
205 utest_check_couple_config(
206 utest_generate_couple_config_from_YAML(
209 unlink(debug_global_config_file_enddef);
216 utest_check_couple_config(couple_config);
225 couple_config,
"comp_a",
"grid_a",
"field_a",
227 interp_stack_config, 0, 0, NULL,
229 NULL, NULL, NULL, collection_selection, 0);
232 couple_config, (rank == 0)?
"comp_c":
"comp_d");
238 char const * str_interp_stack_config =
240 " enforced_conservation: false\n"
241 " normalisation: fracarea\n"
242 " partial_coverage: false\n"
244 " user_value: -999.0\n";
254 ref_interp_stack_config, -999.0);
257 ref_interp_stack_config, interp_stack_config))
258 PUT_ERR(
"ERROR in yac_yaml_parse_interp_stack_config_string");
270 couple_config, (rank == 0)?
"comp_a":
"comp_b");
272 couple_config, (rank == 0)?
"comp_b":
"comp_a");
275 couple_config,
"comp_a",
"grid_a",
"field_a",
277 interp_stack_config, 0, 0, NULL,
279 NULL, NULL, NULL, collection_selection, 0);
283 PUT_ERR(
"ERROR in yac_couple_config_get_num_couples\n");
292static void utest_check_couple_config_no_delete(
301 char const * metadata;
304 .metadata =
"a lot of water"},
306 .metadata =
"a lot of hot air"},
315 enum {REF_NUM_COMPS =
sizeof(ref_comp_data) /
sizeof(ref_comp_data[0])};
319 char const * output_filename;
320 char const * metadata;
322 {{.name =
"grid1", .output_filename =
"debug_grid.nc", .metadata =
"grid1_meta"},
323 {.name =
"grid2", .output_filename = NULL, .metadata =
"grid2_meta"},
324 {.name =
"grid3", .output_filename = NULL, .metadata = NULL},
325 {.name =
"grid4", .output_filename =
"debug_grid.nc", .metadata = NULL},
326 {.name =
"src_grid_1", .output_filename = NULL, .metadata = NULL},
327 {.name =
"src_grid_2", .output_filename = NULL, .metadata = NULL},
328 {.name =
"tgt_grid_1", .output_filename = NULL, .metadata = NULL},
329 {.name =
"tgt_grid_2", .output_filename = NULL, .metadata = NULL}};
330 enum {REF_NUM_GRIDS =
sizeof(ref_grid_data) /
sizeof(ref_grid_data[0])};
334 char const * metadata;
335 size_t ref_comp_data_idx;
336 size_t ref_grid_data_idx;
337 size_t ref_couple_data_idx;
338 double frac_mask_value;
339 char const * timestep;
344 {{.name =
"sea_surface_temperature",
345 .metadata =
"T in C",
346 .ref_comp_data_idx = 0,
347 .ref_grid_data_idx = 0,
348 .ref_couple_data_idx = 0,
351 .collection_size = 3,
354 {.name =
"sea_surface_temperature",
355 .metadata =
"T in K",
356 .ref_comp_data_idx = 1,
357 .ref_grid_data_idx = 2,
358 .ref_couple_data_idx = 0,
361 .collection_size = 1,
364 {.name =
"wind_speed",
365 .metadata =
"v in km/h",
366 .ref_comp_data_idx = 0,
367 .ref_grid_data_idx = 0,
368 .ref_couple_data_idx = 0,
369 .frac_mask_value = 1.0,
371 .collection_size = 3,
374 {.name =
"wind_speed",
375 .metadata =
"v in m/s",
376 .ref_comp_data_idx = 1,
377 .ref_grid_data_idx = 2,
378 .ref_couple_data_idx = 0,
379 .frac_mask_value = NAN,
381 .collection_size = 3,
384 {.name =
"water_flux_into_sea_water",
386 .ref_comp_data_idx = 0,
387 .ref_grid_data_idx = 0,
388 .ref_couple_data_idx = 0,
389 .frac_mask_value = 0.0,
391 .collection_size = 4,
394 {.name =
"water_flux_into_sea_water",
396 .ref_comp_data_idx = 1,
397 .ref_grid_data_idx = 2,
398 .ref_couple_data_idx = 0,
399 .frac_mask_value = 0.0,
401 .collection_size = 2,
404 {.name =
"grid_eastward_wind",
406 .ref_comp_data_idx = 0,
407 .ref_grid_data_idx = 1,
408 .ref_couple_data_idx = 0,
411 .collection_size = 4,
414 {.name =
"grid_eastward_wind",
416 .ref_comp_data_idx = 1,
417 .ref_grid_data_idx = 2,
418 .ref_couple_data_idx = 0,
419 .frac_mask_value = 0.0,
421 .collection_size = 4,
424 {.name =
"grid_northward_wind",
426 .ref_comp_data_idx = 0,
427 .ref_grid_data_idx = 1,
428 .ref_couple_data_idx = 0,
431 .collection_size = 5,
434 {.name =
"grid_northward_wind",
436 .ref_comp_data_idx = 1,
437 .ref_grid_data_idx = 2,
438 .ref_couple_data_idx = 0,
441 .collection_size = 5,
444 {.name =
"grid_northward_wind",
446 .ref_comp_data_idx = 2,
447 .ref_grid_data_idx = 3,
448 .ref_couple_data_idx = 1,
451 .collection_size = 5,
454 {.name =
"manual_field",
456 .ref_comp_data_idx = 0,
457 .ref_grid_data_idx = 1,
458 .ref_couple_data_idx = 1,
461 .collection_size = 2,
464 {.name =
"manual_field",
466 .ref_comp_data_idx = 2,
467 .ref_grid_data_idx = 3,
468 .ref_couple_data_idx = 1,
471 .collection_size = 2,
474 {.name =
"manual_field_uncoupled_a",
476 .ref_comp_data_idx = 2,
477 .ref_grid_data_idx = 3,
478 .ref_couple_data_idx = 1,
481 .collection_size = 2,
484 {.name =
"manual_field_uncoupled_b",
486 .ref_comp_data_idx = 2,
487 .ref_grid_data_idx = 3,
488 .ref_couple_data_idx = 1,
491 .collection_size = SIZE_MAX,
494 {.name =
"manual_field_uncoupled_c",
496 .ref_comp_data_idx = 2,
497 .ref_grid_data_idx = 3,
498 .ref_couple_data_idx = 1,
501 .collection_size = 2,
504 {.name =
"multi_grid_field",
506 .ref_comp_data_idx = 4,
507 .ref_grid_data_idx = 4,
508 .ref_couple_data_idx = 2,
511 .collection_size = 1,
514 {.name =
"multi_grid_field",
516 .ref_comp_data_idx = 4,
517 .ref_grid_data_idx = 5,
518 .ref_couple_data_idx = 2,
521 .collection_size = 1,
524 {.name =
"multi_grid_field",
526 .ref_comp_data_idx = 5,
527 .ref_grid_data_idx = 6,
528 .ref_couple_data_idx = 2,
531 .collection_size = 1,
534 {.name =
"multi_grid_field",
536 .ref_comp_data_idx = 5,
537 .ref_grid_data_idx = 7,
538 .ref_couple_data_idx = 2,
541 .collection_size = 1,
544 {.name =
"manual_field_coll_sel",
546 .ref_comp_data_idx = 0,
547 .ref_grid_data_idx = 1,
548 .ref_couple_data_idx = 1,
551 .collection_size = 3,
554 {.name =
"manual_field_coll_sel",
556 .ref_comp_data_idx = 2,
557 .ref_grid_data_idx = 3,
558 .ref_couple_data_idx = 1,
561 .collection_size = 5,
563 enum {REF_NUM_FIELDS =
sizeof(ref_field_data) /
sizeof(ref_field_data[0])};
566 size_t ref_comp_data_idxs[2];
567 } ref_couple_data[] =
568 {{.ref_comp_data_idxs = {0, 1}},
569 {.ref_comp_data_idxs = {0, 2}},
570 {.ref_comp_data_idxs = {4, 5}}};
571 enum {REF_NUM_COUPLES =
sizeof(ref_couple_data) /
sizeof(ref_couple_data[0])};
574 size_t ref_src_field_data_idx;
575 size_t ref_tgt_field_data_idx;
577 int mapping_on_source;
580 char const * src_timestep;
581 char const * tgt_timestep;
582 char const * coupling_period;
584 int enforce_write_weight_file;
588 double scale_summand;
589 size_t num_src_mask_names;
590 char const *
const * src_mask_names;
591 char const * tgt_mask_name;
595 } ref_field_couple_data[] =
596 {{.ref_src_field_data_idx = 0,
597 .ref_tgt_field_data_idx = 1,
598 .interp_stack_config = NULL,
599 .mapping_on_source = 1,
603 .tgt_timestep =
"10",
604 .coupling_period =
"10",
606 .enforce_write_weight_file = 1,
607 .weight_file_name =
"weights1.nc",
610 .scale_summand = 0.0,
611 .num_src_mask_names = 1,
612 .src_mask_names = (
char const*[]){
"src_sst_mask"},
613 .tgt_mask_name =
"tgt_sst_mask",
614 .yaxt_exchanger_name =
"irecv_send",
616 .use_raw_exchange = 1},
617 {.ref_src_field_data_idx = 3,
618 .ref_tgt_field_data_idx = 2,
619 .interp_stack_config = NULL,
620 .mapping_on_source = 1,
624 .tgt_timestep =
"20",
625 .coupling_period =
"20",
627 .enforce_write_weight_file = 0,
628 .weight_file_name =
"\0",
630 .scale_factor = 10.0,
631 .scale_summand = 0.0,
632 .num_src_mask_names = 3,
633 .src_mask_names = (
char const*[]){
"src_wind_mask1",
"src_wind_mask2",
"src_wind_mask3"},
634 .tgt_mask_name = NULL,
635 .yaxt_exchanger_name = NULL,
636 .collection_selection = NULL,
637 .use_raw_exchange = 0},
638 {.ref_src_field_data_idx = 4,
639 .ref_tgt_field_data_idx = 5,
640 .interp_stack_config = NULL,
641 .mapping_on_source = 0,
645 .tgt_timestep =
"30",
646 .coupling_period =
"30",
648 .enforce_write_weight_file = 1,
649 .weight_file_name =
"weights3.nc",
652 .scale_summand = -1.0,
653 .num_src_mask_names = 0,
654 .src_mask_names = NULL,
655 .tgt_mask_name = NULL,
656 .yaxt_exchanger_name = NULL,
658 .use_raw_exchange = 0},
659 {.ref_src_field_data_idx = 7,
660 .ref_tgt_field_data_idx = 6,
661 .interp_stack_config = NULL,
662 .mapping_on_source = 0,
666 .tgt_timestep =
"40",
667 .coupling_period =
"40",
669 .enforce_write_weight_file = 0,
670 .weight_file_name =
"\0",
673 .scale_summand = -0.5,
674 .num_src_mask_names = 0,
675 .src_mask_names = NULL,
676 .tgt_mask_name = NULL,
677 .yaxt_exchanger_name = NULL,
678 .collection_selection = NULL,
679 .use_raw_exchange = 0},
680 {.ref_src_field_data_idx = 8,
681 .ref_tgt_field_data_idx = 9,
682 .interp_stack_config = NULL,
683 .mapping_on_source = 1,
687 .tgt_timestep =
"50",
688 .coupling_period =
"50",
690 .enforce_write_weight_file = 1,
691 .weight_file_name =
"weights5.nc",
694 .scale_summand = 0.0,
695 .num_src_mask_names = 0,
696 .src_mask_names = NULL,
697 .tgt_mask_name = NULL,
698 .yaxt_exchanger_name = NULL,
699 .collection_selection = NULL,
700 .use_raw_exchange = 0},
701 {.ref_src_field_data_idx = 8,
702 .ref_tgt_field_data_idx = 10,
703 .interp_stack_config = NULL,
704 .mapping_on_source = 1,
708 .tgt_timestep =
"50",
709 .coupling_period =
"50",
711 .enforce_write_weight_file = 1,
712 .weight_file_name =
"weights6.nc",
715 .scale_summand = 0.0,
716 .num_src_mask_names = 0,
717 .src_mask_names = NULL,
718 .tgt_mask_name = NULL,
719 .yaxt_exchanger_name = NULL,
720 .collection_selection = NULL,
721 .use_raw_exchange = 0},
722 {.ref_src_field_data_idx = 12,
723 .ref_tgt_field_data_idx = 11,
724 .interp_stack_config = NULL,
725 .mapping_on_source = 0,
729 .tgt_timestep =
"60",
730 .coupling_period =
"60",
732 .enforce_write_weight_file = 0,
733 .weight_file_name =
"\0",
735 .scale_factor = 9.0/5.0,
736 .scale_summand = 32.0,
737 .num_src_mask_names = 2,
738 .src_mask_names = (
char const*[]){
"src_mask1",
"src_mask2"},
739 .tgt_mask_name =
"tgt_mask",
740 .yaxt_exchanger_name =
"irecv_isend",
741 .collection_selection = NULL,
742 .use_raw_exchange = 1},
743 {.ref_src_field_data_idx = 16,
744 .ref_tgt_field_data_idx = 18,
745 .interp_stack_config = NULL,
746 .mapping_on_source = 1,
751 .coupling_period =
"1",
753 .enforce_write_weight_file = 0,
754 .weight_file_name =
"\0",
757 .scale_summand = 0.0,
758 .num_src_mask_names = 0,
759 .src_mask_names = NULL,
760 .tgt_mask_name = NULL,
761 .yaxt_exchanger_name = NULL,
762 .collection_selection = NULL,
763 .use_raw_exchange = 0},
764 {.ref_src_field_data_idx = 16,
765 .ref_tgt_field_data_idx = 19,
766 .interp_stack_config = NULL,
767 .mapping_on_source = 1,
772 .coupling_period =
"1",
774 .enforce_write_weight_file = 0,
775 .weight_file_name =
"\0",
778 .scale_summand = 0.0,
779 .num_src_mask_names = 0,
780 .src_mask_names = NULL,
781 .tgt_mask_name = NULL,
782 .yaxt_exchanger_name = NULL,
783 .collection_selection = NULL,
784 .use_raw_exchange = 0},
785 {.ref_src_field_data_idx = 17,
786 .ref_tgt_field_data_idx = 18,
787 .interp_stack_config = NULL,
788 .mapping_on_source = 1,
793 .coupling_period =
"1",
795 .enforce_write_weight_file = 0,
796 .weight_file_name =
"\0",
799 .scale_summand = 0.0,
800 .num_src_mask_names = 0,
801 .src_mask_names = NULL,
802 .tgt_mask_name = NULL,
803 .yaxt_exchanger_name = NULL,
804 .collection_selection = NULL,
805 .use_raw_exchange = 0},
806 {.ref_src_field_data_idx = 17,
807 .ref_tgt_field_data_idx = 19,
808 .interp_stack_config = NULL,
809 .mapping_on_source = 1,
814 .coupling_period =
"1",
816 .enforce_write_weight_file = 0,
817 .weight_file_name =
"\0",
820 .scale_summand = 0.0,
821 .num_src_mask_names = 0,
822 .src_mask_names = NULL,
823 .tgt_mask_name = NULL,
824 .yaxt_exchanger_name = NULL,
825 .collection_selection = NULL,
826 .use_raw_exchange = 0},
827 {.ref_src_field_data_idx = 21,
828 .ref_tgt_field_data_idx = 20,
829 .interp_stack_config = NULL,
830 .mapping_on_source = 0,
834 .tgt_timestep =
"60",
835 .coupling_period =
"60",
837 .enforce_write_weight_file = 0,
838 .weight_file_name =
"\0",
841 .scale_summand = 0.0,
842 .num_src_mask_names = 0,
843 .src_mask_names = NULL,
844 .tgt_mask_name = NULL,
845 .yaxt_exchanger_name = NULL,
847 .use_raw_exchange = 1}};
849 REF_NUM_FIELD_COUPLES =
850 sizeof(ref_field_couple_data) /
sizeof(ref_field_couple_data[0])};
859 } spmap_overwrite_config_data[] = {
860 {.src_point_selection =
869 {.src_point_selection =
878 {.src_point_selection =
888 NUM_SPMAP_OVERWRITE_CONFIGS =
889 sizeof(spmap_overwrite_config_data)/
890 sizeof(spmap_overwrite_config_data[0])};
893 (NUM_SPMAP_OVERWRITE_CONFIGS + 1) *
sizeof(*spmap_overwrite_configs));
894 for (
size_t i = 0;
i < NUM_SPMAP_OVERWRITE_CONFIGS; ++
i)
895 spmap_overwrite_configs[i] =
898 spmap_overwrite_config_data[i].spmap_config);
899 spmap_overwrite_configs[NUM_SPMAP_OVERWRITE_CONFIGS] = NULL;
912 spmap_default_config, spmap_overwrite_configs)
914 for (
size_t i = 0; i < NUM_SPMAP_OVERWRITE_CONFIGS; ++i) {
918 spmap_overwrite_config_data[i].spmap_config);
935 ADD_INTERP(check,
"check_constructor",
"check_do_search")
945 0.0,
"area.nc",
"cell_area", 1,
982 int ref_missing_definition_is_fatal = 1;
988 char * start_datetime =
992 free(start_datetime);
994 char * end_datetime =
1007 for (
size_t i = 0; i < REF_NUM_COMPS; ++i) {
1010 couple_config, ref_comp_data[i].
name))
1011 PUT_ERR(
"ERROR in yac_couple_config_component_name_is_valid");
1013 if (utest_compare_string(
1015 couple_config, ref_comp_data[i].
name),
1016 ref_comp_data[i].metadata))
1017 PUT_ERR(
"ERROR in yac_couple_config_component_get_metadata");
1021 couple_config, ref_comp_data[i].
name);
1022 if (utest_compare_string(
1024 ref_comp_data[i].
name))
1025 PUT_ERR(
"ERROR in yac_couple_config_get_component_name");
1028 size_t ref_num_comp_fields = 0;
1029 for (
size_t j = 0; j < REF_NUM_FIELDS; ++j)
1030 if (ref_field_data[j].ref_comp_data_idx == i)
1031 ++ref_num_comp_fields;
1034 ref_num_comp_fields)
1035 PUT_ERR(
"ERROR in yac_couple_config_get_num_fields");
1039 PUT_ERR(
"ERROR in yac_couple_config_component_name_is_valid");
1046 PUT_ERR(
"ERROR in yac_couple_config_get_num_grids");
1048 for (
size_t i = 0;
i < REF_NUM_GRIDS; ++
i) {
1051 couple_config, ref_grid_data[i].
name))
1052 PUT_ERR(
"ERROR in yac_couple_config_contains_grid_name\n");
1054 if (utest_compare_string(
1056 couple_config, ref_grid_data[i].
name),
1057 ref_grid_data[i].output_filename))
1058 PUT_ERR(
"ERROR in yac_couple_config_grid_get_output_filename");
1060 if (utest_compare_string(
1062 couple_config, ref_grid_data[i].
name), ref_grid_data[i].metadata))
1063 PUT_ERR(
"ERROR in yac_couple_config_grid_get_metadata");
1067 couple_config, ref_grid_data[i].
name);
1068 if (utest_compare_string(
1070 ref_grid_data[i].
name))
1071 PUT_ERR(
"ERROR in yac_couple_config_get_grid_name");
1075 PUT_ERR(
"ERROR in yac_couple_config_contains_grid_name\n");
1081 for (
size_t i = 0;
i < REF_NUM_FIELDS; ++
i) {
1083 char const * field_comp_name =
1084 ref_comp_data[ref_field_data[
i].ref_comp_data_idx].name;
1085 char const * field_grid_name =
1086 ref_grid_data[ref_field_data[
i].ref_grid_data_idx].name;
1087 char const * field_name = ref_field_data[
i].name;
1089 if (utest_compare_string(
1091 couple_config, field_comp_name, field_grid_name, field_name),
1092 ref_field_data[i].metadata))
1093 PUT_ERR(
"ERROR in yac_couple_config_field_get_metadata");
1096 double frac_mask_fallback_value =
1098 couple_config, field_comp_name, field_grid_name, field_name);
1100 &frac_mask_fallback_value, &ref_field_data[i].frac_mask_value,
1101 sizeof(frac_mask_fallback_value)))
1102 PUT_ERR(
"ERROR in yac_couple_config_get_frac_mask_fallback_value");
1106 couple_config, ref_comp_data[ref_field_data[i].ref_comp_data_idx].
name);
1109 couple_config, ref_grid_data[ref_field_data[i].ref_grid_data_idx].
name);
1112 couple_config, comp_idx,
grid_idx, ref_field_data[i].
name);
1114 if (utest_compare_string(
1116 couple_config, comp_idx, field_idx), field_grid_name))
1117 PUT_ERR(
"ERROR in yac_couple_config_get_field_grid_name");
1119 if (utest_compare_string(
1121 couple_config, comp_idx, field_idx), field_name))
1122 PUT_ERR(
"ERROR in yac_couple_config_get_field_name");
1125 if (ref_field_data[i].timestep != NULL)
1126 if (utest_compare_string(
1128 couple_config, field_comp_name, field_grid_name, field_name),
1130 PUT_ERR(
"ERROR in yac_couple_config_get_field_timestep");
1135 couple_config, field_comp_name, field_grid_name, field_name) !=
1137 PUT_ERR(
"ERROR in yac_couple_config_get_field_collection_size");
1140 couple_config, field_comp_name, field_grid_name, field_name) !=
1141 ref_field_data[i].role)
1142 PUT_ERR(
"ERROR in yac_couple_config_get_field_role");
1145 ((ref_field_data[i].timestep != NULL) &&
1147 PUT_ERR(
"ERROR in yac_couple_config_field_is_valid");
1155 PUT_ERR(
"ERROR in yac_couple_config_get_num_couples\n");
1157 for (
size_t i = 0;
i < REF_NUM_COUPLES; ++
i) {
1159 char const * ref_comp_names[2];
1160 ref_comp_names[0] = ref_comp_data[ref_couple_data[
i].ref_comp_data_idxs[0]].name;
1161 ref_comp_names[1] = ref_comp_data[ref_couple_data[
i].ref_comp_data_idxs[1]].name;
1164 size_t couple_idx = SIZE_MAX;
1165 for (
size_t j = 0; (j < REF_NUM_COUPLES) && (couple_idx == SIZE_MAX); ++j) {
1167 char const * couple_comp_names[2];
1169 couple_config, j, couple_comp_names);
1170 if ((!utest_compare_string(couple_comp_names[0], ref_comp_names[0]) &&
1171 !utest_compare_string(couple_comp_names[1], ref_comp_names[1])) ||
1172 (!utest_compare_string(couple_comp_names[0], ref_comp_names[1]) &&
1173 !utest_compare_string(couple_comp_names[1], ref_comp_names[0])))
1177 if (couple_idx == SIZE_MAX) {
1178 PUT_ERR(
"ERROR: no matching couple found\n");
1182 size_t num_couple_fields = 0;
1183 for (
size_t j = 0; j < REF_NUM_FIELD_COUPLES; ++j)
1184 if (((ref_field_data[ref_field_couple_data[j].ref_src_field_data_idx].ref_comp_data_idx ==
1185 ref_couple_data[i].ref_comp_data_idxs[0]) &&
1186 (ref_field_data[ref_field_couple_data[j].ref_tgt_field_data_idx].ref_comp_data_idx ==
1187 ref_couple_data[i].ref_comp_data_idxs[1])) ||
1188 ((ref_field_data[ref_field_couple_data[j].ref_src_field_data_idx].ref_comp_data_idx ==
1189 ref_couple_data[i].ref_comp_data_idxs[1]) &&
1190 (ref_field_data[ref_field_couple_data[j].ref_tgt_field_data_idx].ref_comp_data_idx ==
1191 ref_couple_data[i].ref_comp_data_idxs[0])))
1192 ++num_couple_fields;
1196 PUT_ERR(
"ERROR in yac_couple_config_get_num_couple_fields");
1203 for (
size_t i = 0;
i < REF_NUM_FIELD_COUPLES; ++
i) {
1206 size_t ref_couple_data_idx;
1207 for (ref_couple_data_idx = 0; ref_couple_data_idx < REF_NUM_COUPLES; ++ref_couple_data_idx)
1208 if (((ref_field_data[ref_field_couple_data[i].ref_src_field_data_idx].ref_comp_data_idx ==
1209 ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[0]) &&
1210 (ref_field_data[ref_field_couple_data[i].ref_tgt_field_data_idx].ref_comp_data_idx ==
1211 ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[1])) ||
1212 ((ref_field_data[ref_field_couple_data[i].ref_src_field_data_idx].ref_comp_data_idx ==
1213 ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[1]) &&
1214 (ref_field_data[ref_field_couple_data[i].ref_tgt_field_data_idx].ref_comp_data_idx ==
1215 ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[0])))
break;
1217 char const * ref_comp_names[2];
1219 ref_comp_data[ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[0]].name;
1221 ref_comp_data[ref_couple_data[ref_couple_data_idx].ref_comp_data_idxs[1]].name;
1224 size_t couple_idx = SIZE_MAX;
1225 for (
size_t j = 0; (j < REF_NUM_COUPLES) && (couple_idx == SIZE_MAX); ++j) {
1227 char const * couple_comp_names[2];
1229 couple_config, j, couple_comp_names);
1230 if ((!utest_compare_string(couple_comp_names[0], ref_comp_names[0]) &&
1231 !utest_compare_string(couple_comp_names[1], ref_comp_names[1])) ||
1232 (!utest_compare_string(couple_comp_names[0], ref_comp_names[1]) &&
1233 !utest_compare_string(couple_comp_names[1], ref_comp_names[0])))
1237 if (couple_idx == SIZE_MAX) {
1238 PUT_ERR(
"ERROR: no matching couple found\n");
1242 size_t num_couples =
1245 char const * src_comp_name, * tgt_comp_name;
1247 char const * src_field_name, * tgt_field_name;
1250 size_t field_couple_idx = SIZE_MAX;
1251 for (
size_t j = 0; (j < num_couples) && (field_couple_idx == SIZE_MAX); ++j) {
1254 couple_config, couple_idx, j, &src_comp_name, &tgt_comp_name);
1258 couple_config, couple_idx, j, &src_field_name, &tgt_field_name);
1260 if (!utest_compare_string(
1264 ref_field_couple_data[i].
1265 ref_src_field_data_idx].ref_comp_data_idx].
name) &&
1266 !utest_compare_string(
1270 ref_field_couple_data[i].
1271 ref_tgt_field_data_idx].ref_comp_data_idx].
name) &&
1272 !utest_compare_string(
1276 ref_field_couple_data[i].
1277 ref_src_field_data_idx].ref_grid_data_idx].
name) &&
1278 !utest_compare_string(
1282 ref_field_couple_data[i].
1283 ref_tgt_field_data_idx].ref_grid_data_idx].
name) &&
1284 !utest_compare_string(
1287 ref_field_couple_data[i].ref_src_field_data_idx].
name) &&
1288 !utest_compare_string(
1291 ref_field_couple_data[i].ref_tgt_field_data_idx].
name))
1292 field_couple_idx = j;
1295 if (field_couple_idx == SIZE_MAX) {
1296 PUT_ERR(
"ERROR: no matching field couple found\n");
1301 ref_field_couple_data[i].interp_stack_config,
1303 couple_config, couple_idx, field_couple_idx)))
1304 PUT_ERR(
"ERROR in yac_interp_stack_config");
1307 ref_field_couple_data[i].interp_stack_config);
1310 couple_config, couple_idx, field_couple_idx) !=
1311 ref_field_couple_data[i].mapping_on_source)
1312 PUT_ERR(
"ERROR in yac_couple_config_mapping_on_source");
1315 couple_config, couple_idx, field_couple_idx) !=
1316 ref_field_couple_data[i].src_lag)
1317 PUT_ERR(
"ERROR in yac_couple_config_get_source_lag");
1320 couple_config, couple_idx, field_couple_idx) !=
1321 ref_field_couple_data[i].tgt_lag)
1322 PUT_ERR(
"ERROR in yac_couple_config_get_target_lag");
1324 if (utest_compare_string(
1326 couple_config, couple_idx, field_couple_idx),
1328 PUT_ERR(
"ERROR in yac_couple_config_get_source_timestep");
1330 if (utest_compare_string(
1332 couple_config, couple_idx, field_couple_idx),
1334 PUT_ERR(
"ERROR in yac_couple_config_get_target_timestep");
1336 if (utest_compare_string(
1338 couple_config, couple_idx, field_couple_idx),
1340 PUT_ERR(
"ERROR in yac_couple_config_get_coupling_period");
1343 couple_config, couple_idx, field_couple_idx) !=
1344 ref_field_couple_data[i].coupling_period_operation)
1345 PUT_ERR(
"ERROR in yac_couple_config_get_coupling_period_operation");
1348 couple_config, couple_idx, field_couple_idx) !=
1349 ref_field_couple_data[i].enforce_write_weight_file)
1350 PUT_ERR(
"ERROR in yac_couple_config_enforce_write_weight_file");
1352 if (utest_compare_string(
1354 couple_config, couple_idx, field_couple_idx),
1356 PUT_ERR(
"ERROR in yac_couple_config_get_weight_file_name");
1359 couple_config, couple_idx, field_couple_idx) !=
1360 ref_field_couple_data[i].weight_file_on_existing)
1361 PUT_ERR(
"ERROR in yac_couple_config_get_weight_file_on_existing");
1364 couple_config, couple_idx, field_couple_idx) !=
1365 ref_field_couple_data[i].scale_factor)
1366 PUT_ERR(
"ERROR in yac_couple_config_get_scale_factor");
1369 couple_config, couple_idx, field_couple_idx) !=
1370 ref_field_couple_data[i].scale_summand)
1371 PUT_ERR(
"ERROR in yac_couple_config_get_scale_summand");
1373 char const *
const * src_mask_names;
1374 size_t num_src_mask_names;
1376 couple_config, couple_idx, field_couple_idx,
1377 &src_mask_names, &num_src_mask_names);
1378 if (ref_field_couple_data[i].num_src_mask_names != num_src_mask_names)
1379 PUT_ERR(
"ERROR in yac_couple_config_get_src_mask_names");
1380 if (ref_field_couple_data[i].num_src_mask_names == num_src_mask_names)
1381 for (
size_t j = 0; j < num_src_mask_names; ++j)
1382 if (utest_compare_string(
1383 ref_field_couple_data[i].src_mask_names[j], src_mask_names[j]))
1384 PUT_ERR(
"ERROR in yac_couple_config_get_src_mask_names");
1386 char const * tgt_mask_name =
1388 couple_config, couple_idx, field_couple_idx);
1389 if (utest_compare_string(
1390 ref_field_couple_data[i].tgt_mask_name, tgt_mask_name))
1391 PUT_ERR(
"ERROR in yac_couple_config_get_tgt_mask_name");
1395 couple_config, couple_idx, field_couple_idx);
1396 if (utest_compare_string(
1397 ref_field_couple_data[i].yaxt_exchanger_name, yaxt_exchanger_name))
1398 PUT_ERR(
"ERROR in yac_couple_config_get_yaxt_exchanger_name");
1402 couple_config, couple_idx, field_couple_idx);
1404 ref_field_couple_data[i].collection_selection, collection_selection))
1405 PUT_ERR(
"ERROR in yac_couple_config_get_collection_selection");
1408 couple_config, couple_idx, field_couple_idx) !=
1409 ref_field_couple_data[i].use_raw_exchange)
1410 PUT_ERR(
"ERROR in yac_couple_config_get_use_raw_exchange");
1412 if (utest_compare_string(
"multi_grid_field", tgt_field_name)) {
1413 char const * src_comp_name_, * src_grid_name_, * src_field_name_;
1416 couple_config, tgt_comp_name,
tgt_grid_name, tgt_field_name,
1417 &src_comp_name_, &src_grid_name_, &src_field_name_);
1419 if (utest_compare_string(src_comp_name, src_comp_name_) ||
1421 utest_compare_string(src_field_name, src_field_name_))
1422 PUT_ERR(
"ERROR in yac_couple_config_get_field_source");
1429 if (!ref_field_couple_data[i].mapping_on_source)
1434 ref_interp_gen_config,
1443 ref_field_couple_data[i].ref_src_field_data_idx].frac_mask_value))
1445 ref_interp_gen_config,
1447 ref_field_couple_data[i].ref_src_field_data_idx].frac_mask_value);
1449 ref_interp_gen_config, ref_field_couple_data[i].scale_factor);
1451 ref_interp_gen_config, ref_field_couple_data[i].scale_summand);
1457 couple_config, couple_idx, field_couple_idx);
1460 ref_interp_gen_config, interp_gen_config))
1461 PUT_ERR(
"ERROR in yac_couple_config_get_interpolation_gen_config");
1472 for (
size_t i = 0;
i < REF_NUM_FIELD_COUPLES; ++
i) {
1482 ref_missing_definition_is_fatal)
1483 PUT_ERR(
"ERROR in yac_couple_config_get_missing_definition_is_fatal");
1486static void utest_check_couple_config(
1489 utest_check_couple_config_no_delete(couple_config);
1492 couple_config,
"2008-03-09T16:05:07",
"2008-03-10T16:05:07");
1494 char * start_datetime =
1497 PUT_ERR(
"ERROR in yac_couple_config_get_start_datetime\n");
1498 free(start_datetime);
1500 char * end_datetime =
1503 PUT_ERR(
"ERROR in yac_couple_config_get_end_datetime\n");
1510 utest_generate_couple_config_from_YAML_parallel(
1514 MPI_Comm_rank ( MPI_COMM_WORLD, &rank );
1515 MPI_Comm_size ( MPI_COMM_WORLD, &size );
1522 couple_config,
"2008-03-09T16:05:07.000",
"2008-03-10T16:05:07.000");
1525 couple_config,
"2008-03-09T16:05:07",
"2008-03-10T16:05:07");
1538 couple_config,
"grid1",
"grid1_meta");
1541 couple_config,
"grid2",
"grid2_meta");
1544 couple_config,
"grid4",
"debug_grid.nc");
1556 couple_config,
"ICON-O",
"a lot of water");
1559 couple_config,
"ICON-A",
"a lot of hot air");
1563 couple_config,
"ICON-O",
"grid1",
"sea_surface_temperature",
1566 couple_config,
"ICON-A",
"grid3",
"sea_surface_temperature",
1570 couple_config,
"ICON-O",
"grid1",
"sea_surface_temperature",
"T in C");
1572 couple_config,
"ICON-A",
"grid3",
"sea_surface_temperature",
"T in K");
1578 couple_config,
"ICON-A",
"grid3",
"wind_speed",
1581 couple_config,
"ICON-O",
"grid1",
"wind_speed",
1585 couple_config,
"ICON-A",
"grid3",
"wind_speed", NAN);
1587 couple_config,
"ICON-A",
"grid3",
"wind_speed", NAN);
1589 couple_config,
"ICON-O",
"grid1",
"wind_speed", 1.0);
1591 couple_config,
"ICON-A",
"grid3",
"wind_speed",
"v in m/s");
1593 couple_config,
"ICON-O",
"grid1",
"wind_speed",
"v in km/h");
1598 couple_config,
"ICON-O",
"grid1",
"water_flux_into_sea_water",
1601 couple_config,
"ICON-A",
"grid3",
"water_flux_into_sea_water",
1604 couple_config,
"ICON-O",
"grid1",
"water_flux_into_sea_water", 0.0);
1606 couple_config,
"ICON-A",
"grid3",
"water_flux_into_sea_water", 0.0);
1610 couple_config,
"ICON-A",
"grid3",
"grid_eastward_wind",
1613 couple_config,
"ICON-O",
"grid2",
"grid_eastward_wind",
1616 couple_config,
"ICON-A",
"grid3",
"grid_eastward_wind", 0.0);
1619 couple_config,
"ICON-O",
"grid2",
"grid_northward_wind",
1622 couple_config,
"ICON-A",
"grid3",
"grid_northward_wind",
1626 couple_config,
"ICON-O",
"grid2",
"grid_northward_wind",
1629 couple_config,
"DUMMY",
"grid4",
"grid_northward_wind",
1633 couple_config,
"src_comp",
"src_grid_1",
"multi_grid_field",
1636 couple_config,
"src_comp",
"src_grid_2",
"multi_grid_field",
1639 couple_config,
"tgt_comp",
"tgt_grid_1",
"multi_grid_field",
1642 couple_config,
"tgt_comp",
"tgt_grid_2",
"multi_grid_field",
1653 couple_config,
"ICON-O",
"grid2",
"manual_field",
1657 couple_config,
"DUMMY",
"grid4",
"manual_field",
1658 "ICON-O",
"grid2",
"manual_field",
1661 0, 9.0/5.0, 32.0, 2, (
char const *[]){
"src_mask1",
"src_mask2"},
1666 couple_config,
"ICON-O",
"grid2",
"manual_field_coll_sel",
1671 couple_config,
"DUMMY",
"grid4",
"manual_field_coll_sel",
1672 "ICON-O",
"grid2",
"manual_field_coll_sel",
1675 0, 1.0, 0.0, 0, NULL, NULL, NULL, collection_selection, 1);
1679 }
else if (rank == 1) {
1681 couple_config,
"DUMMY",
"grid4",
"manual_field",
1684 couple_config,
"DUMMY",
"grid4",
"manual_field_coll_sel",
1691 couple_config,
"DUMMY",
"grid4",
"manual_field_uncoupled_a",
1694 couple_config,
"DUMMY",
"grid4",
"manual_field_uncoupled_b",
1697 couple_config,
"DUMMY",
"grid4",
"manual_field_uncoupled_c",
1716 return couple_config;
1719static void utest_write_couple_config_to_YAML(
1725 int include_definitions = 0;
1726 char * str_couple_config =
1729 fputs(str_couple_config, yaml_file);
1730 free(str_couple_config);
1744 couple_config,
"ICON-O",
"a lot of water");
1746 couple_config,
"ICON-A",
"a lot of hot air");
1748 couple_config,
"grid1",
"grid1_meta");
1750 couple_config,
"grid2",
"grid2_meta");
1752 couple_config,
"grid4",
"debug_grid.nc");
1754 couple_config,
"ICON-O",
"grid1",
"sea_surface_temperature",
1757 couple_config,
"ICON-A",
"grid3",
"sea_surface_temperature",
1760 couple_config,
"ICON-O",
"grid1",
"sea_surface_temperature",
"T in C");
1762 couple_config,
"ICON-A",
"grid3",
"sea_surface_temperature",
"T in K");
1764 couple_config,
"ICON-A",
"grid3",
"wind_speed",
1767 couple_config,
"ICON-A",
"grid3",
"wind_speed", NAN);
1769 couple_config,
"ICON-O",
"grid1",
"wind_speed",
1772 couple_config,
"ICON-O",
"grid1",
"wind_speed", 1.0);
1774 couple_config,
"ICON-A",
"grid3",
"wind_speed",
"v in m/s");
1776 couple_config,
"ICON-O",
"grid1",
"wind_speed",
"v in km/h");
1778 couple_config,
"ICON-O",
"grid1",
"water_flux_into_sea_water",
1781 couple_config,
"ICON-O",
"grid1",
"water_flux_into_sea_water", 0.0);
1783 couple_config,
"ICON-A",
"grid3",
"water_flux_into_sea_water",
1786 couple_config,
"ICON-A",
"grid3",
"water_flux_into_sea_water", 0.0);
1788 couple_config,
"ICON-A",
"grid3",
"grid_eastward_wind",
1791 couple_config,
"ICON-A",
"grid3",
"grid_eastward_wind", 0.0);
1793 couple_config,
"ICON-O",
"grid2",
"grid_eastward_wind",
1796 couple_config,
"ICON-O",
"grid2",
"grid_northward_wind",
1799 couple_config,
"ICON-A",
"grid3",
"grid_northward_wind",
1802 couple_config,
"DUMMY",
"grid4",
"grid_northward_wind",
1805 couple_config,
"ICON-O",
"grid2",
"manual_field",
1808 couple_config,
"DUMMY",
"grid4",
"manual_field",
1811 couple_config,
"DUMMY",
"grid4",
"manual_field_uncoupled_a",
1814 couple_config,
"DUMMY",
"grid4",
"manual_field_uncoupled_b",
1817 couple_config,
"DUMMY",
"grid4",
"manual_field_uncoupled_c",
1820 couple_config,
"src_comp",
"src_grid_1",
"multi_grid_field",
1823 couple_config,
"src_comp",
"src_grid_2",
"multi_grid_field",
1826 couple_config,
"tgt_comp",
"tgt_grid_1",
"multi_grid_field",
1829 couple_config,
"tgt_comp",
"tgt_grid_2",
"multi_grid_field",
1832 couple_config,
"ICON-O",
"grid2",
"manual_field_coll_sel",
1835 couple_config,
"DUMMY",
"grid4",
"manual_field_coll_sel",
1838 return couple_config;
1841static int utest_compare_string(
char const * a,
char const * b) {
1843 int ret = (a == NULL) - (b == NULL);
1844 if (ret || (a == NULL))
return ret;
1845 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)
struct yac_interpolation_gen_config * yac_couple_config_get_interpolation_gen_config(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
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)
enum yac_weight_file_on_existing yac_couple_config_get_weight_file_on_existing(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)
int yac_couple_config_get_use_raw_exchange(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
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)
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)
struct yac_collection_selection const * yac_couple_config_get_collection_selection(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)
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 weight_file_on_existing, 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, struct yac_collection_selection const *collection_selection, int use_raw_exchange)
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.
void yac_collection_selection_delete(struct yac_collection_selection *collection_selection)
Delete a collection selection object.
int yac_collection_selection_compare(struct yac_collection_selection const *a, struct yac_collection_selection const *b)
Compare two collection selections.
struct yac_collection_selection * yac_collection_selection_new(size_t collection_size, size_t const *selection_indices)
Create a new collection selection.
#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
#define YAC_INTERP_FILE_ON_SUCCESS_DEFAULT
@ YAC_INTERP_FILE_MISSING_CONT
continue on missing file
@ YAC_INTERP_FILE_SUCCESS_STOP
#define YAC_INTERP_FILE_ON_MISSING_FILE_DEFAULT
@ 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
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_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_interp_spmap_config_delete(struct yac_interp_spmap_config *config)
#define YAC_INTERP_SPMAP_MAX_SEARCH_DISTANCE_DEFAULT
@ YAC_INTERP_SPMAP_NONE
weights are not scaled
#define YAC_INTERP_SPMAP_SCALE_CONFIG_DEFAULT
#define YAC_INTERP_SPMAP_VARNAME_DEFAULT
#define YAC_INTERP_SPMAP_FILENAME_DEFAULT
#define YAC_INTERP_SPMAP_WEIGHTED_DEFAULT
#define YAC_INTERP_SPMAP_SPREAD_DISTANCE_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()
#define YAC_WEIGHT_FILE_ON_EXISTING_DEFAULT_VALUE
@ YAC_MAPPING_ON_TGT
weights will be applied at target processes
yac_weight_file_on_existing
@ YAC_WEIGHT_FILE_KEEP
keep existing weight file
@ YAC_WEIGHT_FILE_ERROR
error when weight file existis already
double const YAC_FRAC_MASK_NO_VALUE
void yac_interpolation_gen_config_set_reorder(struct yac_interpolation_gen_config *config, enum yac_interp_weights_reorder_type reorder)
Set the reordering strategy for interpolation weights.
void yac_interpolation_gen_config_set_collection_size(struct yac_interpolation_gen_config *config, size_t collection_size)
Set the number of contiguous fields (starting at "0") in the field collection.
int yac_interpolation_gen_config_compare(struct yac_interpolation_gen_config const *a, struct yac_interpolation_gen_config const *b)
Compare two interpolation configuration structures.
void yac_interpolation_gen_config_set_collection_selection(struct yac_interpolation_gen_config *config, struct yac_collection_selection const *collection_selection)
Set the collection selection of source field in the source field collection.
void yac_interpolation_gen_config_set_scaling_factor(struct yac_interpolation_gen_config *config, double scaling_factor)
Set the multiplicative scaling factor.
void yac_interpolation_gen_config_set_yaxt_exchanger_name(struct yac_interpolation_gen_config *config, char const *name)
Set the name of the Yaxt exchanger.
void yac_interpolation_gen_config_delete(struct yac_interpolation_gen_config *config)
Release a interpolation generation configuration structure allocated by yac_interpolation_gen_config_...
void yac_interpolation_gen_config_set_frac_mask_fallback_value(struct yac_interpolation_gen_config *config, double frac_mask_fallback_value)
Set the fractional mask fallback value.
struct yac_interpolation_gen_config * yac_interpolation_gen_config_new(void)
Allocate and initialise an interpolation generation configuration structure.
void yac_interpolation_gen_config_set_scaling_summand(struct yac_interpolation_gen_config *config, double scaling_summand)
Set the additive scaling summand.
Defines internal basic interpolation definitions.
#define YAC_FRAC_MASK_VALUE_IS_VALID(value)
Test whether a fractional mask value is valid.
int yac_file_exists(const char *filename)
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)
Configuration structure for interpolation generation.
struct yac_collection_selection * collection_selection
char * yaxt_exchanger_name
struct yac_point_selection * src_point_selection
#define ADD_INTERP(NAME,...)
char const * ref_end_datetime
char const * ref_start_datetime
#define ADD_INTERP_NO_PARAM(NAME)
#define DEF_INTERP_STACK(IDX,...)
char const * weight_file_name
char const src_grid_name[]
char const tgt_grid_name[]
char const * config_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