17#include "mtime_calendar.h"
21#include "mtime_datetime.h"
121 xmalloc(1 *
sizeof(*couple_config));
129 couple_config->
grids = NULL;
140 return couple_config;
144 return (
string != NULL)?strdup(
string):NULL;
149 free((
void*)field->
name);
159 for (
size_t i = 0; i < component->
num_fields; ++i)
162 free((
void*)(component->
name));
192 free((
void*)grid->
name);
198 void * config_output_) {
202 free((
void*)config_output->
name);
203 free((
void*)config_output->
ref);
209 "ERROR(yac_couple_config_grid_compare): "
210 "invalid name (NULL is not allowed)");
222 "ERROR(yac_couple_config_field_compare): "
223 "invalid name (NULL is not allowed)");
228 void const * a_,
void const * b_) {
232 "ERROR(yac_couple_config_component_compare): "
233 "invalid name (NULL is not allowed)");
238 void const * a_,
void const * b_) {
256 void const * a_,
void const * b_) {
268 void const * a,
void const * b) {
272 "ERROR(yac_couple_config_config_output_compare): "
273 "invalid ref (NULL is not allowed)");
279 char const * string_name,
char **
string, MPI_Comm comm) {
282 MPI_Comm_rank(comm, &rank);
287 size_t len = (*
string != NULL)?(strlen(*
string) + 1):0;
290 "ERROR(couple_config_sync_string): \"%s\" too long", string_name);
291 data_pair.len = (int)len;
292 data_pair.rank = rank;
297 MPI_IN_PLACE, &data_pair, 1, MPI_2INT, MPI_MAXLOC, comm), comm);
298 if (data_pair.len == 0)
return;
301 char const * string_bak = NULL;
302 if (data_pair.rank != rank) {
303 string_bak = *string;
304 *
string =
xmalloc((
size_t)data_pair.len *
sizeof(**
string));
307 MPI_Bcast(*
string, data_pair.len, MPI_CHAR, data_pair.rank, comm), comm);
310 if (data_pair.rank != rank) {
312 (string_bak == NULL) ||
313 !strcmp(string_bak, *
string),
314 "ERROR(couple_config_sync_string): inconsistent \"%s\" definition "
315 "(\"%s\" != \"%s\")", string_name, string_bak, *
string);
316 free((
void*)string_bak);
321 char const * flag_value_name,
enum flag_value * flag, MPI_Comm comm) {
323 int int_flag = (*flag ==
FLAG_UNSET)?INT_MAX:((int)*flag);
328 MPI_IN_PLACE, &int_flag, 1, MPI_INT, MPI_MIN, comm), comm);
331 if (int_flag == INT_MAX)
return;
335 (*flag ==
FLAG_UNSET) || ((
int)(*flag) == int_flag),
336 "ERROR(couple_config_sync_flag_value): inconsistent \"%s\"-flag definition "
337 "(%s != %s)", flag_value_name, ((int_flag ==
FLAG_TRUE)?
"TRUE":
"FALSE"),
346 int calendar = (int)getCalendarType();
347 if (calendar == CALENDAR_NOT_SET) calendar = INT_MAX;
352 MPI_IN_PLACE, &calendar, 1, MPI_INT, MPI_MIN, comm), comm);
355 if (calendar == INT_MAX)
return;
363 void * a_,
void * b_, MPI_Comm comm) {
378 "component metadata", (
char **)&(a->
metadata), comm);
382 void * a_,
void * b_, MPI_Comm comm) {
400 void * a_,
void * b_, MPI_Comm comm) {
414 MPI_Comm_rank(comm, &rank);
418 } data_pairs[DATA_PAIR_COUNT];
419 size_t timestep_len =
421 size_t metadata_len =
424 timestep_len <= INT_MAX,
425 "ERROR(yac_couple_config_field_merge): timestep string too long");
427 metadata_len <= INT_MAX,
428 "ERROR(yac_couple_config_field_merge): metadata string too long");
432 "ERROR(yac_couple_config_field_merge): invalid collection size \"%zu\"",
434 data_pairs[TIMESTEP_IDX].len = (int)timestep_len;
435 data_pairs[TIMESTEP_IDX].rank = rank;
436 data_pairs[METADATA_IDX].len = (int)metadata_len;
437 data_pairs[METADATA_IDX].rank = rank;
438 data_pairs[FRAC_MASK_IDX].len =
440 data_pairs[FRAC_MASK_IDX].rank = rank;
441 data_pairs[COLLECTION_SIZE_IDX].len =
444 data_pairs[COLLECTION_SIZE_IDX].rank = rank;
449 MPI_IN_PLACE, data_pairs, DATA_PAIR_COUNT, MPI_2INT,
450 MPI_MAXLOC, comm), comm);
453 if (data_pairs[TIMESTEP_IDX].len > 0) {
456 char * timestep_buffer =
xmalloc((
size_t)data_pairs[TIMESTEP_IDX].len);
457 if (data_pairs[TIMESTEP_IDX].rank == rank)
458 strcpy(timestep_buffer, b->
timestep);
461 timestep_buffer, data_pairs[TIMESTEP_IDX].len, MPI_CHAR,
462 data_pairs[TIMESTEP_IDX].rank, comm), comm);
466 (b == NULL) || (b->
timestep == NULL) ||
467 !strcmp(b->
timestep, timestep_buffer),
468 "ERROR(yac_couple_config_field_merge): "
469 "inconsistent timestep definition (\"%s\" != \"%s\")",
478 if (data_pairs[METADATA_IDX].len > 0) {
481 char * metadata_buffer =
xmalloc((
size_t)data_pairs[METADATA_IDX].len);
482 if (data_pairs[METADATA_IDX].rank == rank)
483 strcpy(metadata_buffer, b->
metadata);
486 metadata_buffer, data_pairs[METADATA_IDX].len, MPI_CHAR,
487 data_pairs[METADATA_IDX].rank, comm), comm);
491 (b == NULL) || (b->
metadata == NULL) ||
492 !strcmp(b->
metadata, metadata_buffer),
493 "ERROR(yac_couple_config_field_merge): "
494 "inconsistent metadata definition (\"%s\" != \"%s\")",
503 if (data_pairs[FRAC_MASK_IDX].len != 0) {
506 double frac_mask_fallback_value;
507 if (data_pairs[FRAC_MASK_IDX].rank == rank)
511 &frac_mask_fallback_value, 1, MPI_DOUBLE,
512 data_pairs[FRAC_MASK_IDX].rank, comm), comm);
520 sizeof(frac_mask_fallback_value)),
521 "ERROR(yac_couple_config_field_merge): "
522 "inconsistent fractional mask fallback value definition "
532 if (data_pairs[COLLECTION_SIZE_IDX].len > -1) {
538 "ERROR(yac_couple_config_field_merge): "
539 "inconsistent collection size definition (\"%zu\" != \"%d\")",
548 void * a_,
void * b_, MPI_Comm comm) {
552 if (b_ == NULL)
return;
559 "ERROR(yac_couple_config_field_couple_merge): "
563 "ERROR(yac_couple_config_field_couple_merge): "
567 "ERROR(yac_couple_config_field_couple_merge): "
568 "inconsistent mapping side (%d != %d)",
572 "ERROR(yac_couple_config_field_couple_merge): "
573 "inconsistent interpolation stack")
576 "ERROR(yac_couple_config_field_couple_merge): "
577 "inconsistent coupling period operation (%d != %d)",
581 "ERROR(yac_couple_config_field_couple_merge): "
582 "inconsistent coupling period (%s != %s)",
586 "ERROR(yac_couple_config_field_couple_merge): "
587 "inconsistent defintion of enforce_write_weight_file (%d != %d)",
592 "ERROR(yac_couple_config_field_couple_merge): "
593 "inconsistent weight_file_name (%s != %s)",
597 "ERROR(yac_couple_config_field_couple_merge): "
598 "inconsistent scale factor (%lf != %lf)",
602 "ERROR(yac_couple_config_field_couple_merge): "
603 "inconsistent scale summand (%lf != %lf)",
607 "ERROR(yac_couple_config_field_couple_merge): "
608 "inconsistent number of source mask names (%zu != %zu)",
612 "ERROR(yac_couple_config_field_couple_merge): "
613 "inconsistent availability of source mask names (%s != %s)",
619 "ERROR(yac_couple_config_field_couple_merge): "
620 "inconsistent source mask names at index %zu (\"%s\" != \"%s\")",
624 "ERROR(yac_couple_config_field_couple_merge): "
625 "inconsistent availability of target mask name (%s != %s)",
631 "ERROR(yac_couple_config_field_couple_merge): "
632 "inconsistent target mask name (\"%s\" != \"%s\")",
637 size_t * num_field_couples,
641 void * a_,
void * b_, MPI_Comm comm) {
658 void * a_,
void * b_, MPI_Comm comm) {
667 "ERROR(yac_couple_config_config_output_merge): "
668 "inconsistent file names for ref \"%s\" (\"%s\" != \"%s\")",
672 "ERROR(yac_couple_config_config_output_merge): "
673 "inconsistent file types for ref \"%s\" (%d != %d)",
693 for (
size_t i = 0; i < couple_config->
num_grids; ++i){
696 free(couple_config->
grids);
703 for (
size_t couple_idx = 0; couple_idx < couple_config->
num_couples;
715 "ERROR(yac_couple_config_add_grid_): "
716 "invalid name (NULL is not allowed)")
718 for (
size_t i = 0; i < couple_config->
num_grids; ++i)
721 size_t grid_idx = couple_config->
num_grids;
723 couple_config->
grids =
725 couple_config->
grids,
744 "ERROR(yac_couple_config_add_component_): "
745 "invalid name (NULL is not allowed)")
760 return component_idx;
771 char const * comp_name,
const char* metadata) {
775 = metadata==NULL?NULL:strdup(metadata);
780 char const * grid_name,
const char* output_filename) {
785 output_filename != NULL,
786 "ERROR(yac_couple_config_grid_set_output_filename): invalid output filename "
787 "for grid \"%s\" (NULL is not allowed)",
792 "ERROR(yac_couple_config_grid_set_output_filename): output file name for grid "
793 "\"%s\" has already been set (\"%s\" != \"%s\")",
801 char const * grid_name,
const char* metadata) {
807 = metadata==NULL?NULL:strdup(metadata);
812 const char* comp_name,
const char * grid_name,
const char* field_name,
813 const char* metadata) {
817 comp_idx, grid_idx, field_name);
820 = metadata==NULL?NULL:strdup(metadata);
825 const char * comp_name) {
832 const char * grid_name) {
839 const char * grid_name) {
846 const char* comp_name,
const char * grid_name,
const char* field_name) {
850 comp_idx, grid_idx, field_name);
856 char const * routine_name,
int line) {
860 "ERROR(%s:%d:%s): invalid component_idx", __FILE__, line, routine_name)
865 char const * routine_name,
int line) {
869 "ERROR(%s:%d:%s): invalid grid_idx", __FILE__, line, routine_name)
874 size_t comp_idx,
size_t grid_idx,
char const *
name,
875 char const * timestep,
size_t collection_size) {
878 couple_config, comp_idx,
879 "yac_couple_config_component_add_field_", __LINE__);
881 couple_config, grid_idx,
882 "yac_couple_config_component_add_field_", __LINE__);
887 for (
size_t i = 0; i < component->
num_fields; i++) {
899 "ERROR(yac_couple_config_component_add_field): "
900 "inconsistent timestep definition (\"%s\" != \"%s\")",
903 collection_size == SIZE_MAX ||
905 "ERROR(yac_couple_config_component_add_field): "
906 "inconsistent collection_size definition (%zu != %zu)",
919 sizeof(*(component->
fields)));
921 component->
fields + field_idx;
934 const char* grid_name,
const char*
name,
char const *
timestep,
963 int missing_definition_is_fatal) {
971 "ERROR(yac_couple_config_set_missing_definition_is_fatal): "
972 "inconsistent setting of \"missing_definition_is_fatal\"-flag "
975 (user_value ==
FLAG_TRUE)?
"TRUE":
"FALSE");
982 char const * routine_name,
int line) {
985 couple_idx < couple_config->num_couples,
986 "ERROR(%s:%d:%s): invalid couple_idx", __FILE__, line, routine_name);
993 couple_config, couple_idx,
"yac_couple_config_get_num_couple_fields",
1001 char const * couple_component_names[2]) {
1004 couple_config, couple_idx,
"yac_couple_config_get_couple_component_names",
1007 for (
int i = 0; i < 2; ++i)
1008 couple_component_names[i] =
1018 "ERROR(yac_couple_config_component_name_is_valid): component name is NULL")
1021 "ERROR(yac_couple_config_component_name_is_valid): "
1022 "component name is too long (maximum is YAC_MAX_CHARLEN)")
1024 for (
size_t component_idx = 0; component_idx < couple_config->
num_components;
1026 if (!strcmp(component_name, couple_config->
components[component_idx].
name))
1046 "yac_couple_config_get_num_fields", __LINE__);
1053 size_t component_idx = SIZE_MAX;
1055 (component_idx == SIZE_MAX); ++i)
1060 component_idx != SIZE_MAX,
1061 "ERROR(yac_couple_config_get_component_idx): "
1062 "Component \"%s\" not found in coupling configuration",
1065 return component_idx;
1074 if (!strcmp(couple_config->
grids[i].
name, grid_name))
1079 "ERROR(yac_couple_config_get_grid_idx): "
1080 "grid name \"%s\" not in list of grids", grid_name)
1087 size_t grid_idx,
char const * field_name) {
1089 couple_config, component_idx,
1090 "yac_couple_config_get_component_name", __LINE__);
1092 size_t field_idx = SIZE_MAX;
1097 (i<nbr_fields) && (field_idx == SIZE_MAX); ++i)
1105 field_idx != SIZE_MAX,
1106 "ERROR(yac_couple_config_get_field_idx): "
1108 "(component_idx %zu grid_idx %zu field_name \"%s\"",
1109 component_idx, grid_idx, field_name);
1118 couple_config, component_idx,
1119 "yac_couple_config_get_component_name", __LINE__);
1126 size_t field_idx,
char const * routine_name,
int line) {
1129 couple_config, component_idx, routine_name, __LINE__);
1134 "ERROR(%s:%d:%s): invalid field_idx", __FILE__,
1143 couple_config, component_idx, field_idx,
1144 "yac_couple_config_get_field_grid_name", __LINE__);
1147 couple_config->
grids[
1158 couple_config, component_idx, field_idx,
1159 "yac_couple_config_get_field_name", __LINE__);
1169 char const * component_name,
char const * grid_name,
1170 char const * field_name) {
1172 size_t component_idx =
1178 couple_config, component_idx, grid_idx, field_name);
1189 char const * component_name,
char const * grid_name,
1190 char const * field_name) {
1192 size_t component_idx =
1198 couple_config, component_idx,
grid_idx, field_name);
1201 for(
size_t couple_idx = 0; couple_idx<nbr_couples; ++couple_idx){
1207 for(
size_t trans_couple_idx = 0; trans_couple_idx < nbr_trans_couples;
1208 ++trans_couple_idx){
1228 "yac_couple_config_field_is_valid", __LINE__);
1231 "yac_couple_config_field_is_valid", __LINE__);
1243 size_t field_couple_idx,
char const * routine_name,
int line) {
1250 "ERROR(%s:%d:%s): invalid field_couple_idx",
1251 __FILE__, line, routine_name)
1256 size_t couple_idx,
size_t field_couple_idx) {
1259 couple_config, couple_idx, field_couple_idx,
1260 "yac_couple_config_get_interp_stack", __LINE__);
1264 couples[couple_idx].
1265 field_couples[field_couple_idx].interp_stack;
1270 size_t couple_idx,
size_t field_couple_idx,
1271 char const ** src_grid_name,
char const ** tgt_grid_name) {
1274 couple_config, couple_idx, field_couple_idx,
1275 "yac_couple_config_get_field_grid_names", __LINE__);
1277 size_t src_component_idx =
1278 couple_config->
couples[couple_idx].
1279 field_couples[field_couple_idx].
1280 source.component_idx;
1281 size_t src_field_idx =
1282 couple_config->
couples[couple_idx].
1283 field_couples[field_couple_idx].
1286 size_t tgt_component_idx =
1287 couple_config->
couples[couple_idx].
1288 field_couples[field_couple_idx].
1289 target.component_idx;
1290 size_t tgt_field_idx =
1291 couple_config->
couples[couple_idx].
1292 field_couples[field_couple_idx].
1296 couple_config->
grids[
1297 couple_config->
components[src_component_idx].
1298 fields[src_field_idx].grid_idx].
name;
1300 couple_config->
grids[
1301 couple_config->
components[tgt_component_idx].
1302 fields[tgt_field_idx].grid_idx].
name;
1307 char const * comp_name,
char const * grid_name,
char const * field_name,
1308 double frac_mask_fallback_value) {
1313 "ERROR(yac_couple_config_field_enable_frac_mask): "
1314 "\"%lf\" is not a valid fractional mask fallback value "
1315 "(component: \"%s\" grid: \"%s\" field \"%s\")",
1316 frac_mask_fallback_value, comp_name, grid_name, field_name);
1321 comp_idx, grid_idx, field_name);
1323 double old_frac_mask_fallback_value =
1325 frac_mask_fallback_value;
1332 &old_frac_mask_fallback_value, &frac_mask_fallback_value,
1333 sizeof(frac_mask_fallback_value)),
1334 "ERROR(yac_couple_config_field_enable_frac_mask): "
1335 "fractional mask fallback value was already set:\n"
1336 "\told value \"%lf\" new value \"%lf\" "
1337 "(component: \"%s\" grid: \"%s\" field \"%s\")",
1338 old_frac_mask_fallback_value, frac_mask_fallback_value,
1339 comp_name, grid_name, field_name);
1342 frac_mask_fallback_value = frac_mask_fallback_value;
1347 char const * component_name,
char const * grid_name,
1348 char const * field_name) {
1350 size_t component_idx =
1356 couple_config, component_idx, grid_idx, field_name);
1364 "ERROR(yac_couple_config_get_frac_mask_fallback_value): "
1365 "no valid fractional mask fallback value defined "
1366 "(component: \"%s\" grid: \"%s\" field \"%s\")",
1374 char const * component_name,
char const * grid_name,
1375 char const * field_name) {
1377 size_t component_idx =
1383 couple_config, component_idx,
grid_idx, field_name);
1394 size_t couple_idx,
size_t field_couple_idx,
1395 char const ** src_component_name,
char const ** tgt_component_name) {
1398 couple_config, couple_idx, field_couple_idx,
1399 "yac_couple_config_get_field_couple_component_names", __LINE__);
1401 *src_component_name =
1403 couple_config->
couples[couple_idx].
1404 field_couples[field_couple_idx].source.component_idx].
name;
1405 *tgt_component_name =
1407 couple_config->
couples[couple_idx].
1408 field_couples[field_couple_idx].target.component_idx].
name;
1413 size_t couple_idx,
size_t field_couple_idx,
1414 char const ** src_field_name,
const char ** tgt_field_name) {
1417 couple_config, couple_idx, field_couple_idx,
1418 "yac_couple_config_get_field_names", __LINE__);
1420 size_t src_component_idx =
1421 couple_config->
couples[couple_idx].
1422 field_couples[field_couple_idx].source.component_idx;
1423 size_t tgt_component_idx =
1424 couple_config->
couples[couple_idx].
1425 field_couples[field_couple_idx].target.component_idx;
1426 size_t src_field_idx =
1427 couple_config->
couples[couple_idx].
1428 field_couples[field_couple_idx].source.field_idx;
1429 size_t tgt_field_idx =
1430 couple_config->
couples[couple_idx].
1431 field_couples[field_couple_idx].target.field_idx;
1434 couple_config->
components[src_component_idx].
1435 fields[src_field_idx].name;
1437 couple_config->
components[tgt_component_idx].
1438 fields[tgt_field_idx].name;
1443 size_t couple_idx,
size_t field_couple_idx) {
1446 couple_config, couple_idx, field_couple_idx,
1447 "yac_couple_config_mapping_on_source", __LINE__);
1451 couples[couple_idx].
1452 field_couples[field_couple_idx].
1458 size_t couple_idx,
size_t field_couple_idx) {
1461 couple_config, couple_idx, field_couple_idx,
1462 "yac_couple_config_get_source_lag", __LINE__);
1466 couples[couple_idx].
1467 field_couples[field_couple_idx].
1473 size_t couple_idx,
size_t field_couple_idx) {
1476 couple_config, couple_idx, field_couple_idx,
1477 "yac_couple_config_get_target_lag", __LINE__);
1481 couples[couple_idx].
1482 field_couples[field_couple_idx].
1488 size_t couple_idx,
size_t field_couple_idx) {
1491 couple_config, couple_idx, field_couple_idx,
1492 "yac_couple_config_get_coupling_period", __LINE__);
1496 couples[couple_idx].
1497 field_couples[field_couple_idx].
1503 size_t couple_idx,
size_t field_couple_idx) {
1506 couple_config, couple_idx, field_couple_idx,
1507 "yac_couple_config_get_source_timestep", __LINE__);
1511 char const * timestep =
1517 "ERROR(yac_couple_config_get_source_timestep): "
1518 "no valid timestep defined (component: \"%s\" field \"%s\")",
1528 size_t couple_idx,
size_t field_couple_idx) {
1531 couple_config, couple_idx, field_couple_idx,
1532 "yac_couple_config_get_target_timestep", __LINE__);
1536 char const * timestep =
1545 size_t couple_idx,
size_t field_couple_idx) {
1548 couple_config, couple_idx, field_couple_idx,
1549 "yac_couple_config_get_coupling_period_operation", __LINE__);
1553 couples[couple_idx].
1554 field_couples[field_couple_idx].
1559 char const * type_datetime,
struct _datetime ** old,
char const * str_new) {
1561 if ((str_new == NULL) || (strlen(str_new) == 0))
return;
1565 "ERROR(set_datetime): calendar has not yet been set");
1567 struct _datetime *
new = newDateTime(str_new);
1571 "ERROR(set_datetime): failed to parse datetime \"%s\"", str_new);
1573 char old_datetime_buffer[MAX_DATETIME_STR_LEN],
1574 new_datetime_buffer[MAX_DATETIME_STR_LEN];
1577 (*old == NULL) || (equal_to == compareDatetime(*old,
new)),
1578 "ERROR(set_datetime): inconsistent %s datetime "
1579 "(old: \"%s\" new: \"%s\")", type_datetime,
1580 datetimeToString(*old, old_datetime_buffer),
1581 datetimeToString(
new, new_datetime_buffer));
1583 deallocateDateTime(*old);
1590 char const * start,
char const * end) {
1600 "ERROR(yac_couple_config_get_start_datetime): "
1601 "start_datetime not yet defined");
1603 char datetime_buffer[MAX_DATETIME_STR_LEN];
1606 strdup(datetimeToString(couple_config->
start_datetime, datetime_buffer));
1613 "ERROR(yac_couple_config_get_start_datetime): "
1614 "start_datetime not yet defined");
1616 char datetime_buffer[MAX_DATETIME_STR_LEN];
1619 strdup(datetimeToString(couple_config->
end_datetime, datetime_buffer));
1627 "ERROR(yac_couple_config_get_grid_name): "
1628 "Invalid grid idx %zu", grid_idx);
1630 return couple_config->
grids[grid_idx].
name;
1635 size_t couple_idx,
size_t field_couple_idx) {
1638 couple_config, couple_idx, field_couple_idx,
1639 "yac_couple_config_enforce_write_weight_file", __LINE__);
1643 couples[couple_idx].
1644 field_couples[field_couple_idx].
1645 enforce_write_weight_file;
1650 size_t couple_idx,
size_t field_couple_idx) {
1653 couple_config, couple_idx, field_couple_idx,
1654 "yac_couple_config_get_weight_file_name", __LINE__);
1656 static char dummy[] =
"\0";
1657 char const * weight_file_name =
1659 couples[couple_idx].
1660 field_couples[field_couple_idx].
1663 return (weight_file_name != NULL)?weight_file_name:dummy;
1668 size_t couple_idx,
size_t field_couple_idx) {
1671 couple_config, couple_idx, field_couple_idx,
1672 "yac_couple_config_get_scale_factor", __LINE__);
1676 couples[couple_idx].
1677 field_couples[field_couple_idx].
1683 size_t couple_idx,
size_t field_couple_idx) {
1686 couple_config, couple_idx, field_couple_idx,
1687 "yac_couple_config_get_scale_summand", __LINE__);
1691 couples[couple_idx].
1692 field_couples[field_couple_idx].
1698 size_t couple_idx,
size_t field_couple_idx,
1699 char const *
const ** mask_names,
size_t * num_mask_names) {
1702 couple_config, couple_idx, field_couple_idx,
1703 "yac_couple_config_get_src_mask_names", __LINE__);
1706 (
char const *
const *)(
1708 couples[couple_idx].
1709 field_couples[field_couple_idx].
1713 couples[couple_idx].
1714 field_couples[field_couple_idx].
1720 size_t couple_idx,
size_t field_couple_idx) {
1723 couple_config, couple_idx, field_couple_idx,
1724 "yac_couple_config_get_tgt_mask_name", __LINE__);
1728 couples[couple_idx].
1729 field_couples[field_couple_idx].
1736 for (
size_t grid_idx = 0; grid_idx < couple_config->
num_grids;
1738 if (!strcmp(couple_config->
grids[grid_idx].
name, grid_name))
1744 char const *
string, MPI_Comm comm) {
1746 int strlen_pack_size, string_pack_size;
1747 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &strlen_pack_size), comm);
1749 if (
string != NULL) {
1752 (
int)(strlen(
string)), MPI_CHAR, comm, &string_pack_size), comm);
1754 string_pack_size = 0;
1757 return (
size_t)strlen_pack_size + (size_t)string_pack_size;
1761 void * grid_, MPI_Comm comm) {
1769 void * field_, MPI_Comm comm) {
1776 "ERROR(yac_couple_config_get_field_pack_size):"
1777 "grid_idx is too big")
1780 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &int_pack_size), comm);
1784 return int_pack_size +
1789 void * component_, MPI_Comm comm) {
1799 void * field_couple_, MPI_Comm comm) {
1805 yac_mpi_call(MPI_Pack_size(10, MPI_INT, comm, &ints_pack_size), comm);
1806 int doubles_pack_size;
1807 yac_mpi_call(MPI_Pack_size(2, MPI_DOUBLE, comm, &doubles_pack_size), comm);
1808 int src_mask_names_pack_size = 0;
1811 src_mask_names_pack_size +=
1816 (
size_t)ints_pack_size +
1834 src_mask_names_pack_size +
1840 void * couple_, MPI_Comm comm) {
1844 int component_indices_pack_size;
1846 MPI_Pack_size(2, MPI_INT, comm, &component_indices_pack_size), comm);
1848 return (
size_t)component_indices_pack_size;
1852 void * config_output_, MPI_Comm comm) {
1856 int filetype_pack_size;
1858 MPI_Pack_size(1, MPI_INT, comm, &filetype_pack_size), comm);
1861 filetype_pack_size +
1867 char const *
string,
void * buffer,
int buffer_size,
int * position,
1870 size_t len = (
string == NULL)?0:strlen(
string);
1873 len <= INT_MAX,
"ERROR(yac_couple_config_pack_string): string too long")
1875 int len_int = (int)len;
1879 &len_int, 1, MPI_INT, buffer, buffer_size, position, comm), comm);
1884 string, len_int, MPI_CHAR, buffer, buffer_size, position, comm),
1889 void * grid_,
void * buffer,
int buffer_size,
int * position, MPI_Comm comm) {
1894 grid->
name, buffer, buffer_size, position, comm);
1898 void * field_,
void * buffer,
int buffer_size,
int * position, MPI_Comm comm) {
1905 "ERROR(yac_couple_config_pack_field): grid_idx is too big")
1911 &
grid_idx, 1, MPI_INT, buffer, buffer_size, position, comm), comm);
1913 buffer_size, position, comm);
1917 void * component_,
void * buffer,
int buffer_size,
int * position, MPI_Comm comm) {
1923 component->
name, buffer, buffer_size, position, comm);
1927 void * field_couple_,
void * buffer,
int buffer_size,
int * position,
1935 "ERROR(yac_couple_config_pack_field_couple): "
1936 "source.component_idx bigger than INT_MAX")
1939 "ERROR(yac_couple_config_pack_field_couple): "
1940 "source.field_idx bigger than INT_MAX")
1943 "ERROR(yac_couple_config_pack_field_couple): "
1944 "target.component_idx bigger than INT_MAX")
1947 "ERROR(yac_couple_config_pack_field_couple): "
1948 "target.field_idx bigger than INT_MAX")
1951 "ERROR(yac_couple_config_pack_field_couple): "
1952 "mapping_on_source bigger than INT_MAX")
1955 "ERROR(yac_couple_config_pack_field_couple): "
1956 "coupling_period_operation bigger than INT_MAX")
1959 "ERROR(yac_couple_config_pack_field_couple): "
1960 "enforce_write_weight_file bigger than INT_MAX")
1963 "ERROR(yac_couple_config_pack_field_couple): "
1964 "num_src_mask_names bigger than INT_MAX")
1979 MPI_Pack(ints, 10, MPI_INT, buffer, buffer_size, position, comm), comm);
1986 double doubles[2] = {
1991 MPI_Pack(doubles, 2, MPI_DOUBLE, buffer, buffer_size, position, comm),
1995 field_couple->
interp_stack, buffer, buffer_size, position, comm);
2000 field_couple->
src_mask_names[i], buffer, buffer_size, position, comm);
2003 field_couple->
tgt_mask_name, buffer, buffer_size, position, comm);
2007 void * couple_,
void * buffer,
int buffer_size,
int * position, MPI_Comm comm) {
2015 "ERROR(yac_couple_config_pack_couple): "
2016 "component_indices bigger than INT_MAX")
2028 void * config_output_,
void * buffer,
int buffer_size,
int * position,
2035 config_output->
name, buffer, buffer_size, position, comm);
2036 int filetype_int = (int)config_output->
type;
2039 &filetype_int, 1, MPI_INT, buffer, buffer_size, position, comm), comm);
2041 config_output->
ref, buffer, buffer_size, position, comm);
2045 void * buffer,
int buffer_size,
int * position, MPI_Comm comm) {
2050 buffer, buffer_size, position, &string_len, 1, MPI_INT, comm), comm);
2052 if (string_len <= 0)
return NULL;
2054 char *
string =
xmalloc(((
size_t)string_len + 1) *
sizeof(*
string));
2057 buffer, buffer_size, position,
string, string_len, MPI_CHAR, comm), comm);
2058 string[string_len] =
'\0';
2063 void * buffer,
int buffer_size,
int * position,
void * grid_,
2076 void * buffer,
int buffer_size,
int * position,
void * field_,
2085 buffer, buffer_size, position, &grid_idx_int, 1, MPI_INT, comm), comm);
2089 "ERROR(yac_couple_config_unpack_field): invalid number of grid_idx_int")
2091 field->
grid_idx = (size_t)grid_idx_int;
2095 buffer_size, position, comm);
2101 void * buffer,
int buffer_size,
int * position,
void * component_,
2111 component->
fields = NULL;
2115 void * buffer,
int buffer_size,
int * position,
void * field_couple_,
2124 buffer, buffer_size, position, ints, 10, MPI_INT, comm), comm);
2128 "ERROR(yac_couple_config_unpack_field_couple): "
2129 "invalid source.component_idx")
2132 "ERROR(yac_couple_config_unpack_field_couple): "
2133 "invalid source.field_idx")
2136 "ERROR(yac_couple_config_unpack_field_couple): "
2137 "target.component_idx bigger than INT_MAX")
2140 "ERROR(yac_couple_config_unpack_field_couple): "
2141 "invalid target.field_idx")
2144 "ERROR(yac_couple_config_unpack_field_couple): "
2145 "invalid mapping_on_source")
2148 "ERROR(yac_couple_config_unpack_field_couple): "
2149 "invalid coupling_period_operation")
2152 "ERROR(yac_couple_config_unpack_field_couple): "
2153 "invalid enforce_write_weight_file")
2156 "ERROR(yac_couple_config_unpack_field_couple): "
2157 "invalid num_src_mask_names")
2179 buffer, buffer_size, position, doubles, 2, MPI_DOUBLE, comm), comm);
2195 buffer, buffer_size, position, comm);
2202 buffer, buffer_size, position, comm);
2206 void * buffer,
int buffer_size,
int * position,
void * couple_,
2220 "ERROR(yac_couple_config_unpack_couple): invalid component indices")
2229 void * buffer,
int buffer_size,
int * position,
void * config_output_,
2235 config_output->
name =
2240 buffer, buffer_size, position, &filetype_int, 1, MPI_INT, comm),
2243 config_output->
ref =
2250 char const * src_comp_name,
char const * src_grid_name,
char const * src_field_name,
2251 char const * tgt_comp_name,
char const * tgt_grid_name,
char const * tgt_field_name,
2252 char const * coupling_period,
int time_reduction,
2254 int src_lag,
int tgt_lag,
2255 const char* weight_file_name,
int mapping_on_source,
2256 double scale_factor,
double scale_summand,
2257 size_t num_src_mask_names,
char const *
const * src_mask_names,
2258 char const * tgt_mask_name) {
2260 YAC_ASSERT(src_comp_name && src_comp_name[0] !=
'\0',
2261 "ERROR(yac_couple_config_def_couple): invalid parameter: src_comp_name");
2262 YAC_ASSERT(src_grid_name && src_grid_name[0] !=
'\0',
2263 "ERROR(yac_couple_config_def_couple): invalid parameter: src_grid_name");
2264 YAC_ASSERT(src_field_name && src_field_name[0] !=
'\0',
2265 "ERROR(yac_couple_config_def_couple): invalid parameter: src_field_name");
2266 YAC_ASSERT(tgt_comp_name && tgt_comp_name[0] !=
'\0',
2267 "ERROR(yac_couple_config_def_couple): invalid parameter: tgt_comp_name");
2268 YAC_ASSERT(tgt_grid_name && tgt_grid_name[0] !=
'\0',
2269 "ERROR(yac_couple_config_def_couple): invalid parameter: tgt_grid_name");
2270 YAC_ASSERT(tgt_field_name && tgt_field_name[0] !=
'\0',
2271 "ERROR(yac_couple_config_def_couple): invalid parameter: tgt_field_name");
2272 YAC_ASSERT(coupling_period && coupling_period[0] !=
'\0',
2273 "ERROR(yac_couple_config_def_couple): invalid parameter: coupling_period");
2280 "ERROR(yac_couple_config_def_couple): invalid parameter: time_reduction");
2282 "ERROR(yac_couple_config_def_couple): \"%lf\" is not a valid scale factor",
2284 YAC_ASSERT_F(isnormal(scale_summand) || (scale_summand == 0.0),
2285 "ERROR(yac_couple_config_def_couple): \"%lf\" is not a valid scale summand",
2289 size_t src_comp_idx =
2291 size_t tgt_comp_idx =
2293 size_t src_grid_idx =
2295 size_t tgt_grid_idx =
2299 size_t component_indices[2];
2300 if(src_comp_idx < tgt_comp_idx){
2301 component_indices[0] = src_comp_idx;
2302 component_indices[1] = tgt_comp_idx;
2304 component_indices[0] = tgt_comp_idx;
2305 component_indices[1] = src_comp_idx;
2308 for(
size_t i = 0; (i < couple_config->
num_couples) && !couple; ++i)
2311 couple = &couple_config->
couples[i];
2328 size_t src_field_idx =
2330 couple_config, src_comp_idx, src_grid_idx,
2331 src_field_name, NULL, SIZE_MAX);
2332 size_t tgt_field_idx =
2334 couple_config, tgt_comp_idx, tgt_grid_idx,
2335 tgt_field_name, NULL, SIZE_MAX);
2387 char const * type_datetime,
struct _datetime ** datetime, MPI_Comm comm) {
2390 char datetime_buffer[MAX_DATETIME_STR_LEN];
2391 char * str_datetime = datetimeToString(*datetime, datetime_buffer);
2394 if (str_datetime != NULL) str_datetime = strdup(str_datetime);
2397 deallocateDateTime(*datetime);
2403 *datetime = newDateTime(str_datetime);
2465 size_t* old_to_new_idx;
2466 void * p_grids = couple_config->
grids;
2469 sizeof(couple_config->
grids[0]),
2471 couple_config->
grids = p_grids;
2474 for(
size_t comp_idx = 0; comp_idx < couple_config->
num_components;
2478 for(
size_t field_idx = 0; field_idx < component->
num_fields; ++field_idx)
2483 free(old_to_new_idx);
2492 size_t* old_to_new_idx;
2493 void * p_fields = component->
fields;
2496 sizeof(component->
fields[0]),
2498 component->
fields = p_fields;
2501 for(
size_t couple_idx = 0; couple_idx < couple_config->
num_couples;
2504 couple_config->
couples + couple_idx;
2505 for(
size_t field_couple_idx = 0;
2518 free(old_to_new_idx);
2526 size_t* old_to_new_idx;
2527 void * p_components = couple_config->
components;
2535 for(
size_t couple_idx = 0; couple_idx < couple_config->
num_couples;
2538 couple_config->
couples + couple_idx;
2546 for(
size_t field_couple_idx = 0;
2556 free(old_to_new_idx);
2559 for (
size_t comp_idx = 0; comp_idx < couple_config->
num_components; ++comp_idx)
2579 void * p_couples = couple_config->
couples;
2582 sizeof(couple_config->
couples[0]),
2584 couple_config->
couples = p_couples;
2602 char const * output_ref){
2613 "missing_definition_is_fatal",
2617 if (output_ref != NULL)
2619 (config_output == NULL); ++i)
2623 if (config_output != NULL) {
2626 MPI_Comm_rank(comm, &rank);
2631 FILE * config_file = fopen(config_output->
name,
"w");
2634 config_file != NULL,
2635 "ERROR(yac_couple_config_sync): "
2636 "failed to create coupling configuration file \"%s\"",
2637 config_output->
name);
2642 "ERROR(yac_couple_config_sync): "
2643 "invalid coupling configuration filetype (type = %d)",
2644 config_output->
type);
2647 switch(config_output->
type) {
2660 char * str_couple_config =
2664 fputs(str_couple_config, config_file);
2665 free(str_couple_config);
2666 fclose(config_file);
2679 "ERROR(yac_couple_config_set_config_output_filename): filename is NULL");
2684 "ERROR(yac_couple_config_set_config_output_filename): "
2685 "invalid output configuration filetype (type = %d)",
2690 "ERROR(yac_couple_config_set_config_output_filename): ref is NULL");
2698 "ERROR(yac_couple_config_set_config_output_filename): "
2699 "an filename has already been set for reference "
2700 "(ref \"%s\" curr filename \"%s\" filetype %d; "
2701 "new filename \"%s\" filetype %d",
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
int const YAC_YAML_EMITTER_JSON
emit to JSON format
void yac_couple_config_grid_set_metadata(struct yac_couple_config *couple_config, char const *grid_name, const char *metadata)
struct yac_dist_merge_vtable dist_merge_vtable_couple
static void check_field_couple_idx(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx, char const *routine_name, int line)
static void yac_couple_config_grid_merge(void *a_, void *b_, MPI_Comm comm)
int yac_couple_config_field_is_valid(struct yac_couple_config *couple_config, size_t component_idx, size_t field_idx)
static void set_datetime(char const *type_datetime, struct _datetime **old, char const *str_new)
static void couple_config_sync_time(struct yac_couple_config *couple_config, MPI_Comm comm)
static void yac_couple_config_field_couple_free(void *field_couple_)
struct yac_dist_merge_vtable dist_merge_vtable_config_output
static int yac_couple_config_grid_compare(void const *a, void const *b)
static size_t yac_couple_config_get_grid_pack_size(void *grid_, MPI_Comm comm)
void yac_couple_config_sync(struct yac_couple_config *couple_config, MPI_Comm comm, char const *output_ref)
static void yac_couple_config_component_merge(void *a_, void *b_, MPI_Comm comm)
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)
static void couple_config_sync_string(char const *string_name, char **string, MPI_Comm comm)
static void yac_couple_config_config_output_free(void *config_output_)
static void couple_config_sync_datetime(char const *type_datetime, struct _datetime **datetime, MPI_Comm comm)
static size_t yac_couple_config_get_field_couple_pack_size(void *field_couple_, MPI_Comm comm)
static void merge_fields(struct yac_couple_config *couple_config, size_t comp_idx, MPI_Comm comm)
static char const * string_dup(char const *string)
static void yac_couple_config_couple_free(void *couple_)
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)
static void yac_couple_config_unpack_field(void *buffer, int buffer_size, int *position, void *field_, MPI_Comm comm)
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)
static void yac_couple_config_unpack_config_output(void *buffer, int buffer_size, int *position, void *config_output_, MPI_Comm comm)
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_dist_merge_vtable dist_merge_vtable_grid
static void yac_couple_config_pack_field(void *field_, void *buffer, int buffer_size, int *position, MPI_Comm comm)
static char * yac_couple_config_unpack_string(void *buffer, int buffer_size, int *position, MPI_Comm comm)
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)
static void couple_config_sync_calendar(MPI_Comm comm)
static size_t yac_couple_config_add_component_(struct yac_couple_config *couple_config, char const *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)
static size_t yac_couple_config_add_grid_(struct yac_couple_config *couple_config, char const *name)
static size_t yac_couple_config_get_config_output_pack_size(void *config_output_, MPI_Comm comm)
static void merge_components(struct yac_couple_config *couple_config, MPI_Comm comm)
static void check_couple_idx(struct yac_couple_config *couple_config, size_t couple_idx, char const *routine_name, int line)
static void couple_config_sync_flag_value(char const *flag_value_name, enum flag_value *flag, MPI_Comm comm)
static void yac_couple_config_unpack_grid(void *buffer, int buffer_size, int *position, void *grid_, MPI_Comm comm)
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)
static int yac_couple_config_component_compare(void const *a_, void const *b_)
static size_t yac_couple_config_get_couple_pack_size(void *couple_, MPI_Comm comm)
static void yac_couple_config_pack_config_output(void *config_output_, void *buffer, int buffer_size, int *position, MPI_Comm comm)
static void yac_couple_config_pack_field_couple(void *field_couple_, void *buffer, int buffer_size, int *position, MPI_Comm comm)
struct yac_dist_merge_vtable dist_merge_vtable_field
static size_t yac_couple_config_get_field_pack_size(void *field_, MPI_Comm comm)
static void yac_couple_config_pack_grid(void *grid_, void *buffer, int buffer_size, int *position, MPI_Comm comm)
size_t yac_couple_config_get_num_couples(struct yac_couple_config *couple_config)
static int yac_couple_config_field_compare(void const *a_, void const *b_)
static void yac_couple_config_couple_merge(void *a_, void *b_, MPI_Comm comm)
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)
static void merge_grids(struct yac_couple_config *couple_config, MPI_Comm comm)
static int yac_couple_config_couple_compare(void const *a_, void const *b_)
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)
static void merge_field_couples(size_t *num_field_couples, struct yac_couple_config_field_couple **field_couples, MPI_Comm comm)
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)
struct yac_dist_merge_vtable dist_merge_vtable_component
void yac_couple_config_add_grid(struct yac_couple_config *couple_config, char const *name)
static void yac_couple_config_unpack_couple(void *buffer, int buffer_size, int *position, void *couple_, MPI_Comm comm)
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)
static void yac_couple_config_unpack_field_couple(void *buffer, int buffer_size, int *position, void *field_couple_, MPI_Comm comm)
static size_t yac_couple_config_get_string_pack_size(char const *string, MPI_Comm comm)
static void yac_couple_config_config_output_merge(void *a_, void *b_, MPI_Comm comm)
static size_t yac_couple_config_get_component_pack_size(void *component_, MPI_Comm comm)
int yac_couple_config_enforce_write_weight_file(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
static void yac_couple_config_pack_couple(void *couple_, void *buffer, int buffer_size, int *position, MPI_Comm comm)
static void yac_couple_config_grid_free(void *grid_)
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)
void yac_couple_config_grid_set_output_filename(struct yac_couple_config *couple_config, char const *grid_name, const char *output_filename)
static void merge_config_output(struct yac_couple_config *couple_config, MPI_Comm comm)
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)
static void yac_couple_config_unpack_component(void *buffer, int buffer_size, int *position, void *component_, MPI_Comm comm)
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)
static void check_grid_idx(struct yac_couple_config *couple_config, size_t grid_idx, char const *routine_name, int line)
static size_t yac_couple_config_component_add_field_(struct yac_couple_config *couple_config, size_t comp_idx, size_t grid_idx, char const *name, char const *timestep, size_t collection_size)
int yac_couple_config_get_missing_definition_is_fatal(struct yac_couple_config *couple_config)
struct yac_dist_merge_vtable dist_merge_vtable_field_couple
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)
static void yac_couple_config_field_free(void *field_)
char const * yac_couple_config_get_component_name(struct yac_couple_config *couple_config, size_t component_idx)
static void yac_couple_config_field_couple_merge(void *a_, void *b_, MPI_Comm comm)
void yac_couple_config_set_missing_definition_is_fatal(struct yac_couple_config *couple_config, int missing_definition_is_fatal)
static int yac_couple_config_field_couple_compare(void const *a_, void const *b_)
char const * yac_couple_config_get_source_timestep(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
static void yac_couple_config_component_free(void *component_)
static void yac_couple_config_pack_string(char const *string, void *buffer, int buffer_size, int *position, MPI_Comm comm)
void yac_couple_config_add_component(struct yac_couple_config *couple_config, char const *name)
static int yac_couple_config_config_output_compare(void const *a, void const *b)
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)
static void check_field_idx(struct yac_couple_config *couple_config, size_t component_idx, size_t field_idx, char const *routine_name, int line)
char * yac_couple_config_get_end_datetime(struct yac_couple_config *couple_config)
static void check_component_idx(struct yac_couple_config *couple_config, size_t component_idx, char const *routine_name, int line)
static void merge_couples(struct yac_couple_config *couple_config, MPI_Comm comm)
static void yac_couple_config_pack_component(void *component_, void *buffer, int buffer_size, int *position, MPI_Comm comm)
char const * yac_couple_config_get_target_timestep(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
static void yac_couple_config_field_merge(void *a_, void *b_, MPI_Comm comm)
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)
#define MISSING_DEFINITION_IS_FATAL_DEFAULT_VALUE
@ YAC_TEXT_FILETYPE_YAML
YAML format.
@ YAC_TEXT_FILETYPE_JSON
JSON format.
void yac_dist_merge(size_t *count, void **array, size_t element_size, MPI_Comm comm, struct yac_dist_merge_vtable *vtable, size_t **idx_old_to_new)
int yac_interp_stack_config_compare(void const *a_, void const *b_)
struct yac_interp_stack_config * yac_interp_stack_config_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
void yac_interp_stack_config_delete(struct yac_interp_stack_config *interp_stack_config)
struct yac_interp_stack_config * yac_interp_stack_config_copy(struct yac_interp_stack_config *interp_stack)
size_t yac_interp_stack_config_get_pack_size(struct yac_interp_stack_config *interp_stack, MPI_Comm comm)
void yac_interp_stack_config_pack(struct yac_interp_stack_config *interp_stack, void *buffer, int buffer_size, int *position, MPI_Comm comm)
double const YAC_FRAC_MASK_UNDEF
double const YAC_FRAC_MASK_NO_VALUE
#define xrealloc(ptr, size)
struct yac_couple_config_field * fields
enum yac_text_filetype type
enum flag_value include_definitions
size_t component_indices[2]
struct yac_couple_config_field_couple * field_couples
char const * coupling_period
struct yac_couple_config_field_couple::@60 source
size_t num_src_mask_names
struct yac_interp_stack_config * interp_stack
enum yac_reduction_type coupling_period_operation
int enforce_write_weight_file
struct yac_couple_config_field_couple::@60 target
char const * weight_file_name
double frac_mask_fallback_value
char const * output_filename
struct yac_couple_config_couple * couples
struct yac_couple_config_config_output * config_outputs
size_t num_config_outputs
struct _datetime * end_datetime
struct yac_couple_config_grid * grids
enum flag_value missing_definition_is_fatal
struct _datetime * start_datetime
struct yac_couple_config_component * components
size_t(* get_pack_size)(void *element, MPI_Comm comm)
static struct user_input_data_component ** components
static size_t num_components
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_CALENDAR_NOT_SET
#define YAC_ASSERT_F(exp, format,...)
#define YAC_ASSERT(exp, msg)
#define yac_mpi_call(call, comm)