YAC 3.7.0
Yet Another Coupler
Loading...
Searching...
No Matches
couple_config.h
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
9#ifndef COUPLE_CONFIG_H
10#define COUPLE_CONFIG_H
11
12#include "interp_method_avg.h"
14#include "interp_method_check.h"
16#include "interp_method_creep.h"
17#include "interp_method_file.h"
18#include "interp_method_fixed.h"
19#include "interp_method_hcsbb.h"
20#include "interp_method_ncc.h"
21#include "interp_method_nnn.h"
22#include "interp_method_spmap.h"
23#include "interp_stack_config.h"
24#include "interp_weights.h"
25
37
45
50
51#define MISSING_DEFINITION_IS_FATAL_DEFAULT_VALUE (1)
52
54
55// general couple config routines
57void yac_couple_config_delete(struct yac_couple_config * couple_config);
58
59// basic run parameters
61 struct yac_couple_config * couple_config);
63 struct yac_couple_config * couple_config);
65 struct yac_couple_config * couple_config,
66 char const * start, char const * end);
67
68// components
70 struct yac_couple_config * couple_config);
72 struct yac_couple_config * couple_config, char const * component_name);
74 struct yac_couple_config * couple_config, char const * component_name);
76 struct yac_couple_config * couple_config, size_t component_idx);
78 struct yac_couple_config * couple_config, char const * name);
80 struct yac_couple_config * couple_config,
81 char const * comp_name, const char* metadata);
83 struct yac_couple_config * couple_config,
84 char const * comp_name);
86 struct yac_couple_config * couple_config, char const * component_name);
88 struct yac_couple_config * couple_config, size_t component_idx);
89
90// grids
92 struct yac_couple_config * couple_config);
94 struct yac_couple_config * couple_config, char const * grid_name);
96 struct yac_couple_config * couple_config, char const * name);
98 struct yac_couple_config * couple_config,
99 char const * grid_name, const char* metadata);
101 struct yac_couple_config * couple_config,
102 char const * grid_name);
104 struct yac_couple_config * couple_config, char const * grid_name);
106 struct yac_couple_config * couple_config, size_t grid_idx);
108 struct yac_couple_config * couple_config, const char * grid_name,
109 char const * output_filename);
111 struct yac_couple_config * couple_config, const char * grid_name);
112
113// fields
115 struct yac_couple_config * couple_config,
116 const char * component_name, const char * grid_name,
117 const char * name, const char * timestep, size_t collection_size);
119 struct yac_couple_config * couple_config,
120 char const * comp_name, char const * grid_name, char const * field_name,
121 const char* metadata);
123 struct yac_couple_config * couple_config,
124 char const * comp_name, char const * grid_name, char const * field_name);
126 struct yac_couple_config * couple_config, size_t component_idx,
127 size_t grid_idx, char const * field_name);
129 struct yac_couple_config * couple_config,
130 char const * comp_name, char const * grid_name, char const * field_name,
131 double frac_mask_fallback_value);
133 struct yac_couple_config * couple_config,
134 char const * component_name, char const * grid_name,
135 char const * field_name);
137 struct yac_couple_config * couple_config, size_t component_idx,
138 size_t field_idx);
140 struct yac_couple_config * couple_config, size_t component_idx,
141 size_t field_idx);
143 struct yac_couple_config * couple_config,
144 char const * component_name, char const * grid_name,
145 char const * field_name);
147 struct yac_couple_config * couple_config,
148 char const * component_name, char const * grid_name,
149 char const * field_name);
151 struct yac_couple_config * couple_config,
152 char const * component_name, char const * grid_name,
153 char const * field_name);
155 struct yac_couple_config * couple_config,
156 size_t component_idx, size_t field_idx);
157
158// couples
160 struct yac_couple_config * couple_config,
161 char const * src_comp_name, char const * src_grid_name, char const * src_field_name,
162 char const * tgt_comp_name, char const * tgt_grid_name, char const * tgt_field_name,
163 char const * coupling_period, int time_reduction,
164 struct yac_interp_stack_config * interp_stack, int src_lag, int tgt_lag,
165 char const * weight_file_name, int weight_file_on_existing,
166 int mapping_on_source, double scale_factor, double scale_summand,
167 size_t num_src_mask_names, char const * const * src_mask_names,
168 char const * tgt_mask_name, char const * yaxt_exchanger_name,
169 int use_raw_exchange);
171 struct yac_couple_config * couple_config);
173 struct yac_couple_config * couple_config, size_t couple_idx);
175 struct yac_couple_config * couple_config, size_t couple_idx,
176 char const * couple_component_names[2]);
178 struct yac_couple_config * couple_config,
179 size_t couple_idx, size_t field_couple_idx,
180 char const ** src_component_name, char const ** tgt_component_name);
182 struct yac_couple_config * couple_config,
183 size_t couple_idx, size_t field_couple_idx,
184 char const ** src_grid_name, char const ** tgt_grid_name);
186 struct yac_couple_config * couple_config,
187 size_t couple_idx, size_t field_couple_idx,
188 const char ** src_field_name, const char ** tgt_field_name);
190 struct yac_couple_config * couple_config,
191 size_t couple_idx, size_t field_couple_idx);
193 struct yac_couple_config * couple_config,
194 size_t couple_idx, size_t field_couple_idx);
196 struct yac_couple_config * couple_config,
197 size_t couple_idx, size_t field_couple_idx);
199 struct yac_couple_config * couple_config,
200 size_t couple_idx, size_t field_couple_idx);
202 struct yac_couple_config * couple_config,
203 size_t couple_idx, size_t field_couple_idx);
205 struct yac_couple_config * couple_config,
206 size_t couple_idx, size_t field_couple_idx);
208 struct yac_couple_config * couple_config,
209 size_t couple_idx, size_t field_couple_idx);
211 struct yac_couple_config * couple_config,
212 size_t couple_idx, size_t field_couple_idx);
214 struct yac_couple_config * couple_config,
215 size_t couple_idx, size_t field_couple_idx);
217 struct yac_couple_config * couple_config,
218 size_t couple_idx, size_t field_couple_idx);
220 struct yac_couple_config * couple_config,
221 size_t couple_idx, size_t field_couple_idx);
223 struct yac_couple_config * couple_config,
224 size_t couple_idx, size_t field_couple_idx);
226 struct yac_couple_config * couple_config,
227 size_t couple_idx, size_t field_couple_idx);
229 struct yac_couple_config * couple_config,
230 size_t couple_idx, size_t field_couple_idx,
231 char const * const ** mask_names, size_t * num_mask_names);
233 struct yac_couple_config * couple_config,
234 size_t couple_idx, size_t field_couple_idx);
236 struct yac_couple_config * couple_config,
237 size_t couple_idx, size_t field_couple_idx);
239 struct yac_couple_config * couple_config,
240 char const * tgt_component_name, char const * tgt_grid_name,
241 char const * tgt_field_name, char const ** src_component_name,
242 char const ** src_grid_name, char const ** src_field_name);
244 struct yac_couple_config * couple_config,
245 size_t couple_idx, size_t field_couple_idx);
246
258 struct yac_couple_config * couple_config, MPI_Comm comm,
259 char const * output_ref);
260
261// output configuration
262
276 struct yac_couple_config * couple_config,
277 char const * filename, enum yac_text_filetype filetype, char const * ref,
278 int include_definitions);
279
287 struct yac_couple_config * couple_config);
288
296 struct yac_couple_config * couple_config,
297 int missing_definition_is_fatal);
298
299#endif // COUPLE_CONFIG_H
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)
yac_text_filetype
@ YAC_TEXT_FILETYPE_YAML
YAML format.
@ YAC_TEXT_FILETYPE_JSON
JSON format.
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)
yac_reduction_type
@ TIME_NONE
@ TIME_ACCUMULATE
@ TIME_MAXIMUM
@ TIME_MINIMUM
@ TIME_AVERAGE
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)
char const * yac_couple_config_get_field_timestep(struct yac_couple_config *couple_config, char const *component_name, char const *grid_name, char const *field_name)
int yac_couple_config_mapping_on_source(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
int yac_couple_config_get_field_role(struct yac_couple_config *couple_config, char const *component_name, char const *grid_name, char const *field_name)
int yac_couple_config_component_name_is_valid(struct yac_couple_config *couple_config, char const *component_name)
char const * yac_couple_config_get_coupling_period(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
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_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, char const *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, int use_raw_exchange)
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)
const char * yac_couple_config_field_get_metadata(struct yac_couple_config *couple_config, char const *comp_name, char const *grid_name, char const *field_name)
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)
void yac_couple_config_get_couple_component_names(struct yac_couple_config *couple_config, size_t couple_idx, char const *couple_component_names[2])
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)
const char * yac_couple_config_component_get_metadata(struct yac_couple_config *couple_config, char const *comp_name)
const char * yac_couple_config_grid_get_metadata(struct yac_couple_config *couple_config, char const *grid_name)
yac_time_unit_type
@ C_SECOND
@ TIME_UNIT_UNDEFINED
@ C_HOUR
@ C_DAY
@ C_MILLISECOND
@ C_MINUTE
@ C_MONTH
@ C_ISO_FORMAT
@ C_YEAR
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)
void yac_couple_config_grid_set_output_filename(struct yac_couple_config *couple_config, const char *grid_name, char const *output_filename)
int yac_couple_config_enforce_write_weight_file(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
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)
void yac_couple_config_get_field_names(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx, const char **src_field_name, const char **tgt_field_name)
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_component_add_field(struct yac_couple_config *couple_config, const char *component_name, const char *grid_name, const char *name, const char *timestep, size_t collection_size)
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_field_set_metadata(struct yac_couple_config *couple_config, char const *comp_name, char const *grid_name, char const *field_name, const char *metadata)
void yac_couple_config_set_config_output_filename(struct yac_couple_config *couple_config, char const *filename, enum yac_text_filetype filetype, char const *ref, int include_definitions)
char * yac_couple_config_get_end_datetime(struct yac_couple_config *couple_config)
char const * yac_couple_config_get_target_timestep(struct yac_couple_config *couple_config, size_t couple_idx, size_t field_couple_idx)
void yac_couple_config_delete(struct yac_couple_config *couple_config)
size_t yac_couple_config_get_num_components(struct yac_couple_config *couple_config)
yac_weight_file_on_existing