|
YAC 3.21.0
Yet Another Coupler
|
#include "config.h"#include <libfyaml.h>#include <inttypes.h>#include <limits.h>#include <stdlib.h>#include <string.h>#include <stdbool.h>#include <errno.h>#include "yac.h"#include "utils_mci.h"#include "config_yaml.h"#include "mtime_calendar.h"#include "geometry.h"#include "io_utils.h"#include "interpolation/methods/interp_method_config.h"#include "interpolation/interpolation_internal.h"#include "interpolation/interp_stack_config.h"#include "parameter/param.h"#include "instance.h"#include "fields.h"#include "collection_selection_internal.h"
Go to the source code of this file.
Data Structures | |
| struct | field_couple_buffer |
| struct | field_couple_buffer::field_couple_field_names |
| struct | debug_config_file_buffer |
| struct | debug_config_file_buffer::debug_config_file |
Macros | |
| #define | OUTPUT_GRIDS_FILE_NAME_STR "file_name" |
| #define | YAML_ASSERT(CHECK, MSG) |
| #define | YAML_ASSERT_F(CHECK, MSG, ...) |
| #define | YAML_UNREACHABLE_DEFAULT(MSG) |
| #define | YAML_UNREACHABLE_DEFAULT_F(MSG, ...) |
Typedefs | |
| typedef struct fy_document * | fy_document_t |
| typedef struct fy_node * | fy_node_t |
| typedef struct fy_node_pair * | fy_node_pair_t |
Functions | |
| char const * | yac_time_to_ISO (char const *time, enum yac_time_unit_type time_unit) |
| DEF_NAME_TYPE_PAIRS (yaml_base_keys, DEF_NAME_TYPE_PAIR(start_date, START_DATE), DEF_NAME_TYPE_PAIR(start_datetime, START_DATE), DEF_NAME_TYPE_PAIR(end_date, END_DATE), DEF_NAME_TYPE_PAIR(end_datetime, END_DATE), DEF_NAME_TYPE_PAIR(calendar, CALENDAR), DEF_NAME_TYPE_PAIR(timestep_unit, TIMESTEP_UNIT), DEF_NAME_TYPE_PAIR(coupling, COUPLING), DEF_NAME_TYPE_PAIR(debug, DEBUG)) | |
| static calendarType | yaml_parse_calendar_value (fy_node_t value_node, char const *key_name, char const *yaml_filename) |
| static char const * | yaml_parse_timestep_value (fy_node_t value_node, char const *key_name, char const *yaml_filename, enum yac_time_unit_type time_unit) |
| static enum yac_time_unit_type | yaml_parse_timestep_unit_value (fy_node_t value_node, char const *key_name, char const *yaml_filename) |
| static enum yac_reduction_type | yaml_parse_time_reduction_value (fy_node_t value_node, char const *key_name, char const *yaml_filename) |
| static int | yaml_parse_integer_value (fy_node_t value_node, char const *key_name, char const *yaml_filename) |
| static size_t | yaml_parse_size_t_value (fy_node_t value_node, char const *key_name, char const *yaml_filename) |
| static double | yaml_parse_double_value (fy_node_t value_node, char const *key_name, char const *yaml_filename) |
| static int | yaml_parse_enum_value (struct yac_name_type_pair const *valid_values, size_t num_valid_values, fy_node_t value_node, char const *key_name, char const *yaml_filename) |
| static void | yaml_parse_base_interp_method_node (char const **interpolation_type_str, fy_node_t *parameter_node, fy_node_t interp_method_node, char const *yaml_filename) |
| reads interpolation name and user-provided parameters from YAML node | |
| static void | yaml_set_interp_method_config_param_from_node (struct yac_param *param, fy_node_t value_node, char const *interpolation_name, char const *yaml_filename) |
| static void | yaml_parse_interp_method (struct yac_interp_stack_config *interp_stack, fy_node_t interp_method_node, char const *yaml_filename) |
| static void | yaml_parse_interp_stack_value (struct yac_interp_stack_config *interp_stack, fy_node_t interp_stack_node, char const *yaml_filename) |
| static struct field_couple_field_names | yaml_parse_field_name (fy_node_t field_node, const char *yaml_filename) |
| static void | yaml_parse_size_t_sequence (size_t **values, size_t *num_values, fy_node_t values_node, char const *sequence_name, const char *yaml_filename) |
| static void | yaml_parse_collection_selection_sequence (struct yac_collection_selection **collection_selection, fy_node_t values_node, char const *sequence_name, const char *yaml_filename) |
| static void | yaml_parse_string_sequence (char const ***values, size_t *num_values, fy_node_t values_node, char const *sequence_name, const char *yaml_filename) |
| static void | yaml_parse_field_names (struct field_couple_field_names **field_names, size_t *num_field_names, fy_node_t fields_node, const char *yaml_filename) |
| static void | yaml_parse_comp_grid_names (char const **comp_name, char const ***grid_names, size_t *num_grid_names, fy_node_t values_node, char const *type_name, const char *yaml_filename, int allow_multiple_grids) |
| static void | yaml_parse_weight_file_data (char const **weight_file_name, enum yac_weight_file_on_existing *on_existing, fy_node_t values_node, char const *type_name, const char *yaml_filename) |
| static void | yaml_parse_couple_map_pair (struct field_couple_buffer *field_buffer, fy_node_pair_t couple_pair, const char *yaml_filename, enum yac_time_unit_type time_unit) |
| static void | yaml_parse_couple (struct yac_couple_config *couple_config, fy_node_t couple_node, char const *yaml_filename, enum yac_time_unit_type time_unit) |
| static void | yaml_parse_coupling (struct yac_couple_config *couple_config, fy_node_t coupling_node, char const *yaml_filename, enum yac_time_unit_type time_unit) |
| static struct debug_config_file | yaml_parse_config_file_value (fy_node_t config_file_node, char const *file_type_name, const char *yaml_filename) |
| static void | yaml_parse_debug_config_file_map_pair (struct debug_config_file_buffer *config_file_buffer, fy_node_pair_t config_file_pair, char const *config_file_type_name, const char *yaml_filename) |
| static struct debug_config_file_buffer | yaml_parse_debug_config_file_buffer (fy_node_t config_file_node, char const *config_file_type_name, char const *yaml_filename) |
| static void | yaml_parse_debug_global_config (struct yac_couple_config *couple_config, fy_node_t global_config_node, char const *yaml_filename) |
| static void | yaml_parse_output_grid_pair (char const **grid_name, char const **file_name, fy_node_pair_t output_grid_pair, char const *yaml_filename) |
| static void | yaml_parse_output_grid (struct yac_couple_config *couple_config, fy_node_t output_grid_node, char const *yaml_filename) |
| static void | yaml_parse_all_output_grids (struct yac_couple_config *couple_config, fy_node_t output_grids_node, char const *yaml_filename) |
| static void | yaml_parse_debug_output_grids (struct yac_couple_config *couple_config, fy_node_t output_grids_node, char const *yaml_filename) |
| static void | yaml_parse_debug_map_pair (struct yac_couple_config *couple_config, fy_node_pair_t debug_pair, const char *yaml_filename) |
| static void | yaml_parse_debug (struct yac_couple_config *couple_config, fy_node_t debug_node, char const *yaml_filename) |
| static size_t | yaml_edit_distance (char const *a, char const *b) |
| static void | yaml_check_base_key_typo (char const *unknown_key, char const *yaml_filename) |
| static void | yaml_parse_base_map_pair (struct yac_couple_config *couple_config, fy_node_pair_t base_pair, const char *yaml_filename, enum yac_time_unit_type *time_unit, char const **start_datetime, char const **end_datetime) |
| static void | yaml_parse_document (struct yac_couple_config *couple_config, fy_document_t document, const char *yaml_filename) |
| void | yac_yaml_read_coupling (struct yac_couple_config *couple_config, const char *yaml_filename, int parse_flags) |
| struct yac_interp_stack_config * | yac_yaml_parse_interp_stack_config_string (char const *str_interp_stack_config, int parse_flags) |
| static fy_node_t | yac_yaml_create_scalar (fy_document_t document, char const *value) |
| static fy_node_t | yac_yaml_create_scalar_int (fy_document_t document, int value) |
| static fy_node_t | yac_yaml_create_scalar_size_t (fy_document_t document, size_t value) |
| static fy_node_t | yac_yaml_create_scalar_dble (fy_document_t document, double value) |
| static fy_node_t | yac_yaml_create_sequence_scalar (fy_document_t document, char const *const *values, size_t num_values) |
| static fy_node_t | yac_yaml_create_sequence_scalar_size_t (fy_document_t document, size_t const *values, size_t num_values) |
| static void | yac_yaml_map_append (fy_node_t map, char const *key, fy_node_t value) |
| static void | yac_yaml_map_append_scalar (fy_node_t map, char const *key, char const *value) |
| static void | yac_yaml_map_append_scalar_int (fy_node_t map, char const *key, int value) |
| static void | yac_yaml_map_append_scalar_size_t (fy_node_t map, char const *key, size_t value) |
| static void | yac_yaml_map_append_scalar_dble (fy_node_t map, char const *key, double value) |
| static fy_node_t | yac_yaml_create_field_name_node (fy_document_t document, struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx) |
| static fy_node_t | yac_yaml_create_non_default_param_node (fy_document_t document, struct yac_param *param) |
| static fy_node_t | yac_yaml_create_non_default_scalar_param_node (fy_document_t document, struct yac_param const *param) |
| static fy_node_t | yac_yaml_create_non_default_struct_param_node (fy_document_t document, struct yac_param *param) |
| static fy_node_t | yac_yaml_create_non_default_list_param_node (fy_document_t document, struct yac_param *param) |
| static fy_node_t | yac_yaml_create_interpolation_node (fy_document_t document, struct yac_interp_method_config const *method_config) |
| static fy_node_t | yac_yaml_create_interpolation_stack_node (fy_document_t document, struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx) |
| static void | yac_yaml_append_couple_field_nodes (fy_node_t coupling_node, struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx) |
| static void | yac_yaml_append_couple_nodes (fy_node_t coupling_node, struct yac_couple_config *couple_config, size_t couple_idx) |
| static fy_node_t | yac_yaml_create_output_grid_node (fy_document_t document, char const *grid_name, char const *file_name) |
| static fy_node_t | yac_yaml_create_output_grids_node (fy_document_t document, struct yac_couple_config *couple_config) |
| static fy_node_t | yac_yaml_create_debug_node (fy_document_t document, struct yac_couple_config *couple_config) |
| static fy_node_t | yac_yaml_create_coupling_node (fy_document_t document, struct yac_couple_config *couple_config) |
| static fy_node_t | yac_yaml_create_field_node (fy_document_t document, struct yac_couple_config *couple_config, size_t component_idx, size_t field_idx) |
| static fy_node_t | yac_yaml_create_fields_node (fy_document_t document, struct yac_couple_config *couple_config, size_t component_idx) |
| static fy_node_t | yac_yaml_create_component_node (fy_document_t document, struct yac_couple_config *couple_config, size_t component_idx) |
| static fy_node_t | yac_yaml_create_components_node (fy_document_t document, struct yac_couple_config *couple_config) |
| static fy_node_t | yac_yaml_create_grid_node (fy_document_t document, struct yac_couple_config *couple_config, size_t grid_idx) |
| static fy_node_t | yac_yaml_create_grids_node (fy_document_t document, struct yac_couple_config *couple_config) |
| static fy_node_t | yac_yaml_create_definitions_node (fy_document_t document, struct yac_couple_config *couple_config) |
| static fy_node_t | yac_yaml_create_couple_config_nodes (fy_document_t document, struct yac_couple_config *couple_config, int include_definitions) |
| char * | yac_yaml_emit_coupling (struct yac_couple_config *couple_config, int emit_flags, int include_definitions) |
Variables | |
| int const | YAC_YAML_EMITTER_DEFAULT = EMITTER_DEFAULT |
| emit to YAML format | |
| int const | YAC_YAML_EMITTER_JSON = EMITTER_JSON |
| emit to JSON format | |
| int const | YAC_YAML_PARSER_DEFAULT = PARSER_DEFAULT |
| default parse flags (YAML format) | |
| int const | YAC_YAML_PARSER_JSON_AUTO = PARSER_JSON_AUTO |
| int const | YAC_YAML_PARSER_JSON_FORCE = PARSER_JSON_FORCE |
| assume JSON format | |
| #define OUTPUT_GRIDS_FILE_NAME_STR "file_name" |
Definition at line 184 of file config_yaml.c.
| #define YAML_ASSERT | ( | CHECK, | |
| MSG ) |
| #define YAML_ASSERT_F | ( | CHECK, | |
| MSG, | |||
| ... ) |
| #define YAML_UNREACHABLE_DEFAULT | ( | MSG | ) |
| #define YAML_UNREACHABLE_DEFAULT_F | ( | MSG, | |
| ... ) |
| typedef struct fy_document* fy_document_t |
Definition at line 47 of file config_yaml.c.
| typedef struct fy_node_pair* fy_node_pair_t |
Definition at line 49 of file config_yaml.c.
| typedef struct fy_node* fy_node_t |
Definition at line 48 of file config_yaml.c.
| anonymous enum |
| Enumerator | |
|---|---|
| EMITTER_DEFAULT | |
| EMITTER_JSON | |
| PARSER_DEFAULT | |
| PARSER_JSON_AUTO | |
| PARSER_JSON_FORCE | |
Definition at line 51 of file config_yaml.c.
| enum yaml_base_key_types |
| Enumerator | |
|---|---|
| START_DATE | |
| END_DATE | |
| CALENDAR | |
| TIMESTEP_UNIT | |
| COUPLING | |
| DEBUG | |
Definition at line 108 of file config_yaml.c.
| Enumerator | |
|---|---|
| COMP_NAME | |
| GRID_NAMES | |
Definition at line 160 of file config_yaml.c.
Definition at line 117 of file config_yaml.c.
| enum yaml_debug_key_types |
| Enumerator | |
|---|---|
| GLOBAL_CONFIG | |
| GLOBAL_DEFS | |
| OUTPUT_GRIDS | |
| MISSING_DEF | |
| APPLY_COORD_CHECK | |
| COORDS_MISMATCH_FATAL | |
Definition at line 144 of file config_yaml.c.
| Enumerator | |
|---|---|
| OUTPUT_GRID_GRID_NAME | |
| OUTPUT_GRID_FILE_NAME | |
Definition at line 179 of file config_yaml.c.
| Enumerator | |
|---|---|
| SYNC_LOC_DEF_COMP | |
| SYNC_LOC_SYNC_DEF | |
| SYNC_LOC_ENDDEF | |
| SYNC_LOC_COUNT | |
Definition at line 153 of file config_yaml.c.
| Enumerator | |
|---|---|
| WEIGHT_FILE_DATA_NAME | |
| WEIGHT_FILE_DATA_ON_EXISTING | |
Definition at line 165 of file config_yaml.c.
| DEF_NAME_TYPE_PAIRS | ( | yaml_base_keys | , |
| DEF_NAME_TYPE_PAIR(start_date, START_DATE) | , | ||
| DEF_NAME_TYPE_PAIR(start_datetime, START_DATE) | , | ||
| DEF_NAME_TYPE_PAIR(end_date, END_DATE) | , | ||
| DEF_NAME_TYPE_PAIR(end_datetime, END_DATE) | , | ||
| DEF_NAME_TYPE_PAIR(calendar, CALENDAR) | , | ||
| DEF_NAME_TYPE_PAIR(timestep_unit, TIMESTEP_UNIT) | , | ||
| DEF_NAME_TYPE_PAIR(coupling, COUPLING) | , | ||
| DEF_NAME_TYPE_PAIR(debug, DEBUG) | ) |
Definition at line 186 of file config_yaml.c.
| char const * yac_time_to_ISO | ( | char const * | time, |
| enum yac_time_unit_type | time_unit ) |
|
static |
Definition at line 2272 of file config_yaml.c.


|
static |
Definition at line 2510 of file config_yaml.c.


|
static |
Definition at line 2744 of file config_yaml.c.


|
static |
Definition at line 2773 of file config_yaml.c.


|
static |
Definition at line 2864 of file config_yaml.c.


|
static |
Definition at line 2633 of file config_yaml.c.


|
static |
Definition at line 2589 of file config_yaml.c.


|
static |
Definition at line 2845 of file config_yaml.c.


|
static |
Definition at line 2054 of file config_yaml.c.


|
static |
Definition at line 2653 of file config_yaml.c.


|
static |
Definition at line 2719 of file config_yaml.c.


|
static |
Definition at line 2798 of file config_yaml.c.


|
static |
Definition at line 2821 of file config_yaml.c.


|
static |
Definition at line 2207 of file config_yaml.c.


|
static |
Definition at line 2240 of file config_yaml.c.


|
static |
Definition at line 2158 of file config_yaml.c.


|
static |
Definition at line 2184 of file config_yaml.c.


|
static |
Definition at line 2084 of file config_yaml.c.


|
static |
Definition at line 2107 of file config_yaml.c.


|
static |
Definition at line 2523 of file config_yaml.c.


|
static |
Definition at line 2545 of file config_yaml.c.


|
static |
|
static |
Definition at line 1930 of file config_yaml.c.


|
static |
Definition at line 1904 of file config_yaml.c.


|
static |
Definition at line 1917 of file config_yaml.c.


|
static |
Definition at line 1943 of file config_yaml.c.


|
static |
Definition at line 1967 of file config_yaml.c.


| char * yac_yaml_emit_coupling | ( | struct yac_couple_config * | couple_config, |
| int | emit_flags, | ||
| int | include_definitions ) |
Emit coupling configuration to string
| [in] | couple_config | coupling configuration |
| [in] | emit_flags | flags to be used for emitting the coupling configuration |
| [in] | include_definitions | include debug definitions (components, grids, and fields) in the output file |
Definition at line 2927 of file config_yaml.c.


Definition at line 1997 of file config_yaml.c.


|
static |
Definition at line 2015 of file config_yaml.c.


|
static |
Definition at line 2044 of file config_yaml.c.


|
static |
Definition at line 2024 of file config_yaml.c.


|
static |
Definition at line 2034 of file config_yaml.c.


| struct yac_interp_stack_config * yac_yaml_parse_interp_stack_config_string | ( | char const * | interp_stack_config, |
| int | parse_flags ) |
Parse a "0"-terminated string that contains an interpolation stack configuration
| [in] | interp_stack_config | string containing interpolation stack configuration |
| [in] | parse_flags | flags to be used for parsing the string |
Definition at line 1849 of file config_yaml.c.


| void yac_yaml_read_coupling | ( | struct yac_couple_config * | couple_config, |
| const char * | yaml_filename, | ||
| int | parse_flags ) |
Reader for yaml while, which parses the given yaml file and adds the coupling from the file to the coupling configuration data
| [in,out] | couple_config | coupling configuration data |
| [in] | yaml_filename | name of yaml configuration file |
| [in] | parse_flags | flags to be used for parsing the configuration file |
Definition at line 1806 of file config_yaml.c.


|
static |
Definition at line 1675 of file config_yaml.c.


|
static |
|
static |
Parses an output grids mapping, which applies to all grids and therefore only supports the key "file_name".
Definition at line 1510 of file config_yaml.c.


|
static |
reads interpolation name and user-provided parameters from YAML node
| [out] | interpolation_type_str | name of the interpolation |
| [out] | parameter_node | YAML node containing user-provided interpolation method configuration |
| [in] | interp_method_node | YAML node containing interpolation |
| [in] | yaml_filename | name of the YAML file (used for error messages) |
Definition at line 495 of file config_yaml.c.

|
static |
Definition at line 1701 of file config_yaml.c.


|
static |
Definition at line 344 of file config_yaml.c.


|
static |
Definition at line 794 of file config_yaml.c.


|
static |
Definition at line 870 of file config_yaml.c.


|
static |
Definition at line 1275 of file config_yaml.c.


|
static |
Definition at line 1137 of file config_yaml.c.


|
static |
Definition at line 980 of file config_yaml.c.


|
static |
Definition at line 1255 of file config_yaml.c.


|
static |
Definition at line 1617 of file config_yaml.c.


|
static |
Definition at line 1383 of file config_yaml.c.


|
static |
Definition at line 1351 of file config_yaml.c.


|
static |
Definition at line 1420 of file config_yaml.c.


|
static |
Definition at line 1569 of file config_yaml.c.


|
static |
Definition at line 1542 of file config_yaml.c.


|
static |
Definition at line 1769 of file config_yaml.c.


|
static |
|
static |
Definition at line 468 of file config_yaml.c.


|
static |
|
static |
Definition at line 845 of file config_yaml.c.


|
static |
|
static |
Definition at line 672 of file config_yaml.c.


|
static |
Definition at line 701 of file config_yaml.c.


|
static |
Definition at line 1477 of file config_yaml.c.


|
static |
Definition at line 1445 of file config_yaml.c.


|
static |
Definition at line 764 of file config_yaml.c.


|
static |
|
static |
|
static |
Definition at line 400 of file config_yaml.c.


|
static |
Definition at line 383 of file config_yaml.c.


|
static |
Definition at line 361 of file config_yaml.c.


|
static |
Definition at line 927 of file config_yaml.c.


|
static |
Definition at line 547 of file config_yaml.c.


| int const YAC_YAML_EMITTER_DEFAULT = EMITTER_DEFAULT |
emit to YAML format
Definition at line 59 of file config_yaml.c.
| int const YAC_YAML_EMITTER_JSON = EMITTER_JSON |
emit to JSON format
Definition at line 60 of file config_yaml.c.
| int const YAC_YAML_PARSER_DEFAULT = PARSER_DEFAULT |
default parse flags (YAML format)
Definition at line 61 of file config_yaml.c.
| int const YAC_YAML_PARSER_JSON_AUTO = PARSER_JSON_AUTO |
switch to JSON format, if indicated by file extension
Definition at line 62 of file config_yaml.c.
| int const YAC_YAML_PARSER_JSON_FORCE = PARSER_JSON_FORCE |
assume JSON format
Definition at line 63 of file config_yaml.c.