9from types
import coroutine
10from dataclasses
import dataclass, field
12from libc.stdlib cimport malloc, free
14cdef
import from "<mpi.h>" nogil:
15 ctypedef struct _mpi_comm_t
16 ctypedef _mpi_comm_t* MPI_Comm
17 int MPI_Comm_c2f(MPI_Comm)
18 MPI_Comm MPI_Comm_f2c(int)
20cdef extern
from "Python.h":
21 int Py_AtExit(void (*)())
23cdef extern
from "yac.h":
24 cdef const int _LOCATION_CELL
"YAC_LOCATION_CELL"
25 cdef const int _LOCATION_CORNER
"YAC_LOCATION_CORNER"
26 cdef const int _LOCATION_EDGE
"YAC_LOCATION_EDGE"
28 cdef const int _EXCHANGE_TYPE_NONE
"YAC_EXCHANGE_TYPE_NONE"
29 cdef const int _EXCHANGE_TYPE_SOURCE
"YAC_EXCHANGE_TYPE_SOURCE"
30 cdef const int _EXCHANGE_TYPE_TARGET
"YAC_EXCHANGE_TYPE_TARGET"
32 cdef const int _ACTION_NONE
"YAC_ACTION_NONE"
33 cdef const int _ACTION_REDUCTION
"YAC_ACTION_REDUCTION"
34 cdef const int _ACTION_COUPLING
"YAC_ACTION_COUPLING"
35 cdef const int _ACTION_GET_FOR_RESTART
"YAC_ACTION_GET_FOR_RESTART"
36 cdef const int _ACTION_PUT_FOR_RESTART
"YAC_ACTION_PUT_FOR_RESTART"
37 cdef const int _ACTION_OUT_OF_BOUND
"YAC_ACTION_OUT_OF_BOUND"
39 cdef const int _REDUCTION_TIME_NONE
"YAC_REDUCTION_TIME_NONE"
40 cdef const int _REDUCTION_TIME_ACCUMULATE
"YAC_REDUCTION_TIME_ACCUMULATE"
41 cdef const int _REDUCTION_TIME_AVERAGE
"YAC_REDUCTION_TIME_AVERAGE"
42 cdef const int _REDUCTION_TIME_MINIMUM
"YAC_REDUCTION_TIME_MINIMUM"
43 cdef const int _REDUCTION_TIME_MAXIMUM
"YAC_REDUCTION_TIME_MAXIMUM"
45 cdef const int _CALENDAR_NOT_SET
"YAC_CALENDAR_NOT_SET"
46 cdef const int _PROLEPTIC_GREGORIAN
"YAC_PROLEPTIC_GREGORIAN"
47 cdef const int _YEAR_OF_365_DAYS
"YAC_YEAR_OF_365_DAYS"
48 cdef const int _YEAR_OF_360_DAYS
"YAC_YEAR_OF_360_DAYS"
50 cdef const int _TIME_UNIT_MILLISECOND
"YAC_TIME_UNIT_MILLISECOND"
51 cdef const int _TIME_UNIT_SECOND
"YAC_TIME_UNIT_SECOND"
52 cdef const int _TIME_UNIT_MINUTE
"YAC_TIME_UNIT_MINUTE"
53 cdef const int _TIME_UNIT_HOUR
"YAC_TIME_UNIT_HOUR"
54 cdef const int _TIME_UNIT_DAY
"YAC_TIME_UNIT_DAY"
55 cdef const int _TIME_UNIT_MONTH
"YAC_TIME_UNIT_MONTH"
56 cdef const int _TIME_UNIT_YEAR
"YAC_TIME_UNIT_YEAR"
57 cdef const int _TIME_UNIT_ISO_FORMAT
"YAC_TIME_UNIT_ISO_FORMAT"
59 cdef const int _AVG_ARITHMETIC
"YAC_AVG_ARITHMETIC"
60 cdef const int _AVG_DIST
"YAC_AVG_DIST"
61 cdef const int _AVG_BARY
"YAC_AVG_BARY"
63 cdef const int _NCC_AVG
"YAC_NCC_AVG"
64 cdef const int _NCC_DIST
"YAC_NCC_DIST"
66 cdef const int _NNN_AVG
"YAC_NNN_AVG"
67 cdef const int _NNN_DIST
"YAC_NNN_DIST"
68 cdef const int _NNN_GAUSS
"YAC_NNN_GAUSS"
69 cdef const int _NNN_RBF
"YAC_NNN_RBF"
71 cdef const int _CONSERV_DESTAREA
"YAC_CONSERV_DESTAREA"
72 cdef const int _CONSERV_FRACAREA
"YAC_CONSERV_FRACAREA"
74 cdef const int _SPMAP_AVG
"YAC_SPMAP_AVG"
75 cdef const int _SPMAP_DIST
"YAC_SPMAP_DIST"
77 cdef const int _SPMAP_NONE
"YAC_SPMAP_NONE"
78 cdef const int _SPMAP_SRCAREA
"YAC_SPMAP_SRCAREA"
79 cdef const int _SPMAP_INVTGTAREA
"YAC_SPMAP_INVTGTAREA"
80 cdef const int _SPMAP_FRACAREA
"YAC_SPMAP_FRACAREA"
82 cdef const int _FILE_MISSING_ERROR
"YAC_FILE_MISSING_ERROR"
83 cdef const int _FILE_MISSING_CONT
"YAC_FILE_MISSING_CONT"
85 cdef const int _FILE_SUCCESS_STOP
"YAC_FILE_SUCCESS_STOP"
86 cdef const int _FILE_SUCCESS_CONT
"YAC_FILE_SUCCESS_CONT"
88 cdef const int _CONFIG_OUTPUT_FORMAT_YAML
"YAC_CONFIG_OUTPUT_FORMAT_YAML"
89 cdef const int _CONFIG_OUTPUT_FORMAT_JSON
"YAC_CONFIG_OUTPUT_FORMAT_JSON"
91 cdef const int _CONFIG_OUTPUT_SYNC_LOC_DEF_COMP
"YAC_CONFIG_OUTPUT_SYNC_LOC_DEF_COMP"
92 cdef const int _CONFIG_OUTPUT_SYNC_LOC_SYNC_DEF
"YAC_CONFIG_OUTPUT_SYNC_LOC_SYNC_DEF"
93 cdef const int _CONFIG_OUTPUT_SYNC_LOC_ENDDEF
"YAC_CONFIG_OUTPUT_SYNC_LOC_ENDDEF"
95 cdef const int _WGT_ON_EXISTING_ERROR
"YAC_WGT_ON_EXISTING_ERROR"
96 cdef const int _WGT_ON_EXISTING_KEEP
"YAC_WGT_ON_EXISTING_KEEP"
97 cdef const int _WGT_ON_EXISTING_OVERWRITE
"YAC_WGT_ON_EXISTING_OVERWRITE"
100 void yac_cinit_instance ( int * yac_instance_id )
101 void yac_cinit_comm (MPI_Comm comm )
102 void yac_cinit_comm_instance (MPI_Comm comm, int * yac_instance_id )
104 void yac_ccleanup_instance (int yac_instance_id)
105 void yac_cdef_comp_instance ( int yac_instance_id,
106 const char * comp_name,
108 void yac_cdef_comps_instance ( int yac_instance_id,
109 const char ** comp_names,
112 void yac_cpredef_comp_instance ( int yac_instance_id,
113 const char * comp_name,
115 void yac_cget_comp_comm ( int comp_id, MPI_Comm* comp_comm )
116 void yac_cdef_datetime_instance ( int yac_instance_id,
117 const char * start_datetime,
118 const char * end_datetime )
120 const char ** comp_names,
122 MPI_Comm * comps_comm)
123 void yac_cdef_calendar ( int calendar )
124 int yac_cget_calendar ( )
125 void yac_cenddef_instance ( int yac_instance_id )
126 int yac_cget_nbr_comps_instance ( int yac_instance_id )
127 int yac_cget_nbr_grids_instance ( int yac_instance_id )
128 int yac_cget_comp_nbr_grids_instance ( int yac_instance_id, const char* comp_name )
129 int yac_cget_nbr_fields_instance ( int yac_instance_id, const char * comp_name,
130 const char* grid_name)
131 void yac_cget_comp_names_instance ( int yac_instance_id, int nbr_comps,
132 const char ** comp_names )
133 void yac_cget_grid_names_instance ( int yac_instance_id, int nbr_grids,
134 const char ** grid_names )
135 void yac_cget_comp_grid_names_instance ( int yac_instance_id, const char* comp_name,
136 int nbr_grids, const char ** grid_names )
137 void yac_cget_field_names_instance ( int yac_instance_id, const char* comp_name,
138 const char* grid_name,
139 int nbr_fields, const char ** field_names )
140 int yac_cget_field_id_instance ( int yac_instance_id, const char* comp_name,
141 const char* grid_name,
142 const char * field_name )
143 const char* yac_cget_field_timestep_instance ( int yac_instance_id, const char* comp_name,
144 const char* grid_name,
145 const char * field_name )
146 int yac_cget_field_role_instance ( int yac_instance_id, const char* comp_name,
147 const char* grid_name, const char* field_name )
148 void yac_cget_field_source_instance ( int yac_instance_id, const char* tgt_comp_name,
149 const char* tgt_grid_name, const char* tgt_field_name,
150 const char** src_comp_name, const char** src_grid_name,
151 const char** src_field_name)
152 void yac_cenable_field_frac_mask_instance ( int yac_instance_id,
153 const char* comp_name,
154 const char* grid_name,
155 const char * field_name,
156 double frac_mask_fallback_value)
157 int yac_cget_field_collection_size_instance ( int yac_instance_id,
158 const char* comp_name,
159 const char* grid_name,
160 const char * field_name )
161 double yac_cget_field_frac_mask_fallback_value_instance ( int yac_instance_id,
162 const char* comp_name,
163 const char* grid_name,
164 const char * field_name )
165 void yac_cdef_component_metadata_instance ( int yac_instance_id,
166 const char* comp_name,
167 const char* metadata)
168 void yac_cdef_grid_metadata_instance ( int yac_instance_id,
169 const char* grid_name,
170 const char* metadata)
171 void yac_cdef_field_metadata_instance ( int yac_instance_id,
172 const char* comp_name,
173 const char* grid_name,
174 const char* field_name,
175 const char* metadata)
177 const char* comp_name)
179 const char* grid_name)
181 const char* comp_name,
182 const char* grid_name,
183 const char* field_name)
184 char * yac_cget_start_datetime_instance ( int yac_instance_id )
185 char * yac_cget_end_datetime_instance ( int yac_instance_id )
186 char * yac_cget_version ()
187 void yac_cdef_grid_reg2d ( const char * grid_name,
193 void yac_cdef_points_reg2d ( const int grid_id,
196 const double *x_points,
197 const double *y_points,
199 void yac_cdef_grid_reg2d_rot ( const char * grid_name,
207 void yac_cdef_points_reg2d_rot ( const int grid_id,
210 const double *x_points,
211 const double *y_points,
215 void yac_cdef_grid_curve2d ( const char * grid_name,
221 void yac_cdef_points_curve2d ( const int grid_id,
224 const double *x_points,
225 const double *y_points,
227 void yac_cdef_grid_cloud ( const char * grid_name,
232 void yac_cdef_grid_unstruct ( const char * grid_name,
235 int *num_vertices_per_cell,
240 void yac_cdef_grid_unstruct_ll ( const char * grid_name,
243 int *num_vertices_per_cell,
248 void yac_cdef_grid_unstruct_edge ( const char * grid_name,
252 int *num_edges_per_cell,
258 void yac_cdef_grid_unstruct_edge_ll ( const char * grid_name,
262 int *num_edges_per_cell,
268 void yac_cdef_points_unstruct ( const int grid_id,
269 const int nbr_points,
271 const double *x_points,
272 const double *y_points,
274 void yac_cset_global_index ( const int * global_index,
277 void yac_cdef_field ( const char * field_name,
278 const int component_id,
279 const int * point_ids,
280 const int num_pointsets,
282 const char* timestep,
285 void yac_cdef_field_mask ( const char * field_name,
286 const int component_id,
287 const int * point_ids,
288 const int * mask_ids,
289 const int num_pointsets,
291 const char* timestep,
294 void yac_csync_def_instance ( int yac_instance_id )
297 const char * weight_file)
299 int ext_couple_config_id, int weight_file_on_existing)
305 double scale_summand)
307 int ext_couple_config_id, size_t num_src_mask_names,
308 const char * const * src_mask_names)
310 int ext_couple_config_id, const char * tgt_mask_name)
312 int ext_couple_config_id, const char * yaxt_exchanger_name)
314 int ext_couple_config_id, int use_raw_exchange);
317 const char * src_comp_name,
318 const char * src_grid_name,
319 const char * src_field_name,
320 const char * tgt_comp_name,
321 const char * tgt_grid_name,
322 const char * tgt_field_name,
323 const char * coupling_timestep,
324 int time_unit, int time_reduction,
325 int interp_stack_config_id,
326 int src_lag, int tgt_lag,
327 int ext_couple_config_id)
328 void yac_cget_ ( const int field_id,
329 const int collection_size,
333 void yac_cget_async_ ( const int field_id,
334 const int collection_size,
338 void yac_cput_ ( const int field_id,
339 const int collection_size,
343 void yac_cput_frac_ ( const int field_id,
344 const int collection_size,
346 double *send_frac_mask,
349 void yac_cget_raw_ ( const int field_id,
350 const int collection_size,
351 double *src_field_buffer,
354 void yac_cget_raw_async_ ( const int field_id,
355 const int collection_size,
356 double *src_field_buffer,
359 void yac_cget_raw_frac_ ( const int field_id,
360 const int collection_size,
361 double *src_field_buffer,
362 double *src_frac_mask_buffer,
365 void yac_cget_raw_frac_async_ ( const int field_id,
366 const int collection_size,
367 double *src_field_buffer,
368 double *src_frac_mask_buffer,
371 void yac_cexchange_ ( const int send_field_id,
372 const int recv_field_id,
373 const int collection_size,
379 void yac_cexchange_frac_ ( const int send_field_id,
380 const int recv_field_id,
381 const int collection_size,
383 double *send_frac_mask,
388 void yac_ctest ( int field_id, int * flag )
389 void yac_cwait ( int field_id ) nogil
391 const char* yac_cget_field_name_from_field_id ( int field_id )
392 const char* yac_cget_component_name_from_field_id ( int field_id )
393 const char* yac_cget_grid_name_from_field_id ( int field_id )
394 int yac_cget_role_from_field_id ( int field_id )
395 const char* yac_cget_timestep_from_field_id ( int field_id )
396 size_t yac_cget_grid_size ( int location, int grid_id )
397 size_t yac_cget_points_size ( int points_id )
398 int yac_cget_collection_size_from_field_id ( const int field_id )
402 int interp_stack_config_id, int reduction_type, int partial_coverage)
404 int interp_stack_config_id, int weight_type, int partial_coverage)
407 double max_search_distance,
411 double max_search_distance,
414 int interp_stack_config_id, int order, int enforced_conserv,
415 int partial_coverage, int normalisation)
417 int interp_stack_config_id, double spread_distance,
418 double max_search_distance, int weight_type, int scale_type,
419 double src_sphere_radius, char * src_filename,
420 char * src_varname, int src_min_global_id,
421 double tgt_sphere_radius, char * tgt_filename,
422 char * tgt_varname, int tgt_min_global_id)
425 int interp_stack_config_id, char * filename,
426 int on_missing_file, int on_success)
428 int interp_stack_config_id, double value)
430 int interp_stack_config_id, char * constructor_key, char * do_search_key)
432 int interp_stack_config_id, int creep_distance)
434 int * interp_stack_config_id)
436 int * interp_stack_config_id)
438 void yac_cset_core_mask ( const int * is_core,
441 void yac_cset_mask ( const int * is_valid,
443 void yac_cdef_mask_named ( const int grid_id,
444 const int nbr_points,
446 const int * is_valid,
450 ctypedef void (*yac_abort_func)(MPI_Comm comm, const char *msg,
451 const char *source, int line)
except *
455 const char * yaml_file)
458 const char * filename,
461 int include_definitions);
463 const char * gridname,
464 const char * filename);
466 void yac_cget_raw_interp_weights_data ( const int field_id,
467 double * frac_mask_fallback_value,
468 double * scaling_factor,
469 double * scaling_summand,
470 size_t * num_fixed_values,
471 double ** fixed_values,
472 size_t ** num_tgt_per_fixed_value,
473 size_t ** tgt_idx_fixed,
474 size_t * num_wgt_tgt,
475 size_t ** wgt_tgt_idx,
476 size_t ** num_src_per_tgt,
478 size_t ** src_field_idx,
480 size_t * num_src_fields,
481 size_t ** src_field_buffer_sizes );
482 void yac_cget_raw_interp_weights_data_csr ( const int field_id,
483 double * frac_mask_fallback_value,
484 double * scaling_factor,
485 double * scaling_summand,
486 size_t * num_fixed_values,
487 double ** fixed_values,
488 size_t ** num_tgt_per_fixed_value,
489 size_t ** tgt_idx_fixed,
490 size_t ** src_indptr,
492 size_t ** src_field_idx,
494 size_t * num_src_fields,
495 size_t ** src_field_buffer_sizes );
502_logger = logging.getLogger(
"yac")
503_logger.addHandler(logging.NullHandler())
509 Refers to @ref YAC_LOCATION_CELL, @ref YAC_LOCATION_CORNER and @ref YAC_LOCATION_EDGE
511 CELL = _LOCATION_CELL
512 CORNER = _LOCATION_CORNER
513 EDGE = _LOCATION_EDGE
517 Exchange type of a field
519 Refers to @ref YAC_EXCHANGE_TYPE_NONE, @ref YAC_EXCHANGE_TYPE_SOURCE and @ref YAC_EXCHANGE_TYPE_TARGET
521 NONE = _EXCHANGE_TYPE_NONE
522 SOURCE = _EXCHANGE_TYPE_SOURCE
523 TARGET = _EXCHANGE_TYPE_TARGET
527 Refers to @ref YAC_ACTION_NONE, @ref YAC_ACTION_REDUCTION etc.
530 REDUCTION = _ACTION_REDUCTION
531 COUPLING = _ACTION_COUPLING
532 GET_FOR_RESTART = _ACTION_GET_FOR_RESTART
533 PUT_FOR_RESTART = _ACTION_PUT_FOR_RESTART
534 OUT_OF_BOUND = _ACTION_OUT_OF_BOUND
538 Reduction type for the definition of interpolations
540 Refers to @ref YAC_REDUCTION_TIME_NONE, @ref YAC_REDUCTION_TIME_ACCUMULATE etc.
542 TIME_NONE = _REDUCTION_TIME_NONE
543 TIME_ACCUMULATE = _REDUCTION_TIME_ACCUMULATE
544 TIME_AVERAGE = _REDUCTION_TIME_AVERAGE
545 TIME_MINIMUM = _REDUCTION_TIME_MINIMUM
546 TIME_MAXIMUM = _REDUCTION_TIME_MAXIMUM
550 Calendar type for use in def_calendar
552 Refers to @ref YAC_CALENDAR_NOT_SET, @ref YAC_PROLEPTIC_GREGORIAN etc.
554 CALENDAR_NOT_SET = _CALENDAR_NOT_SET
555 PROLEPTIC_GREGORIAN = _PROLEPTIC_GREGORIAN
556 YEAR_OF_365_DAYS = _YEAR_OF_365_DAYS
557 YEAR_OF_360_DAYS = _YEAR_OF_360_DAYS
561 @see yac_cdef_calendar
567 @see yac_cget_calendar
574 Refers to @ref YAC_TIME_UNIT_MILLISECOND, @ref YAC_TIME_UNIT_SECOND etc.
576 MILLISECOND = _TIME_UNIT_MILLISECOND
577 SECOND = _TIME_UNIT_SECOND
578 MINUTE = _TIME_UNIT_MINUTE
579 HOUR = _TIME_UNIT_HOUR
581 MONTH = _TIME_UNIT_MONTH
582 YEAR = _TIME_UNIT_YEAR
583 ISO_FORMAT = _TIME_UNIT_ISO_FORMAT
587 Reduction type for average interpolation
589 Refers to @ref YAC_AVG_ARITHMETIC, @ref YAC_AVG_DIST and @ref YAC_AVG_BARY
591 AVG_ARITHMETIC = _AVG_ARITHMETIC
597 Reduction type for ncc interpolation
599 Refers to @ref YAC_NCC_AVG and @ref YAC_NCC_DIST
606 Reduction type for nnn interpolation
608 Refers to @ref YAC_NNN_AVG, @ref YAC_NNN_DIST etc.
617 Normalization type for conservative interpolation
619 Refers to @ref YAC_CONSERV_DESTAREA and @ref YAC_CONSERV_FRACAREA
621 DESTAREA = _CONSERV_DESTAREA
622 FRACAREA = _CONSERV_FRACAREA
626 Refers to @ref YAC_SPMAP_AVG and @ref YAC_SPMAP_DIST
633 Refers to @ref YAC_SPMAP_NONE, @ref YAC_SPMAP_SRCAREA
634 @ref YAC_SPMAP_INVTGTAREA, and @ref YAC_SPMAP_FRACAREA
637 SRCAREA = _SPMAP_SRCAREA
638 INVTGTAREA = _SPMAP_INVTGTAREA
639 FRACAREA = _SPMAP_FRACAREA
643 Refers to @ref YAC_FILE_MISSING_ERROR, @ref YAC_FILE_MISSING_CONT
645 ERROR = _FILE_MISSING_ERROR
646 CONT = _FILE_MISSING_CONT
650 Refers to @ref YAC_FILE_SUCCESS_STOP, @ref YAC_FILE_SUCCESS_CONT
652 STOP = _FILE_SUCCESS_STOP
653 CONT = _FILE_SUCCESS_CONT
656 YAML = _CONFIG_OUTPUT_FORMAT_YAML
657 JSON = _CONFIG_OUTPUT_FORMAT_JSON
660 DEF_COMP = _CONFIG_OUTPUT_SYNC_LOC_DEF_COMP
661 SYNC_DEF = _CONFIG_OUTPUT_SYNC_LOC_SYNC_DEF
662 ENDDEF = _CONFIG_OUTPUT_SYNC_LOC_ENDDEF
666 Handling of existing files, if weight file is to be written
668 Refers to @ref YAC_WGT_ON_EXISTING_ERROR, @ref YAC_WGT_ON_EXISTING_KEEP and
669 @ref YAC_WGT_ON_EXISTING_OVERWRITE
671 ERROR = _WGT_ON_EXISTING_ERROR
673 KEEP = _WGT_ON_EXISTING_KEEP
674 OVERWRITE = _WGT_ON_EXISTING_OVERWRITE
684 Initializies a YAC instance and provides further functionality
686 The destructor finalizes the YAC instance by calling yac_cfinalize_instance
688 def __init__(self, comm = None, default_instance = False):
690 @see yac_cinit_instance
696 _logger.debug(
"init")
700 _logger.debug(
"init_instance")
703 from mpi4py
import MPI
704 if type(comm)
is MPI.Intracomm:
705 comm = MPI.Comm.py2f(comm)
707 _logger.debug(
"init_comm")
711 _logger.debug(
"init_comm_instance")
713 _logger.debug(f
"instance_id={instance_id}")
688 def __init__(self, comm = None, default_instance = False):
…
723 yac = cls.__new__(cls)
725 yac.owned_instance =
False
733 @see yac_ccleanup_instance
736 _logger.debug(f
"cleanup instance_id={self.instance_id}")
742 @see yac_cdef_comp_instance
745 _logger.debug(f
"def_comp: comp_name={comp_name}")
747 _logger.debug(f
"comp_id={comp_id}")
752 @see yac_cdef_comps_instance
754 cdef int comp_len = len(comp_names)
755 cdef const char **c_comp_names = <const char **>malloc(comp_len * sizeof(const char *))
756 cdef int *c_comp_ids = <int*>malloc(comp_len * sizeof(int))
757 _logger.debug(f
"def_comps: comp_names={comp_names}")
758 byte_comp_names = [c.encode()
for c
in comp_names]
759 for i
in range(comp_len):
760 c_comp_names[i] = byte_comp_names[i]
762 comp_list = [
Component(c_comp_ids[i])
for i
in range(comp_len) ]
765 _logger.debug(
"comp_list={comp_list}")
770 @see yac_cpredef_comp_instance
773 _logger.debug(f
"predef_comp: comp_name={comp_name}")
775 _logger.debug(
"comp_id={comp_id}")
780 @see yac_cdef_datetime_instance
782 The parameters can be given either as a string in iso8601
783 format or as datetime objects
787 if(
type(start_datetime)
is datetime.datetime):
788 start_datetime = start_datetime.isoformat()
791 if start_datetime
is not None:
792 _logger.debug(f
"def_datetime start: {start_datetime}")
794 start_datetime.encode(),
798 if(
type(end_datetime)
is datetime.datetime):
799 end_datetime = end_datetime.isoformat()
802 if end_datetime
is not None:
803 _logger.debug(f
"def_datetime end: {end_datetime}")
806 end_datetime.encode())
811 @see yac_cget_start_datetime_instance (`datetime.datetime`, read-only).
814 return bytes.decode(start)
819 @see yac_cget_end_datetime_instance (`datetime.datetime`, read-only).
822 return bytes.decode(end)
826 @see yac_csync_def_instance
828 _logger.debug(
"sync_def")
832 src_comp : str, src_grid : str, src_field,
833 tgt_comp : str, tgt_grid : str, tgt_field,
834 coupling_timestep : str, timeunit : TimeUnit,
835 time_reduction : Reduction,
836 interp_stack, src_lag = 0, tgt_lag = 0,
838 weight_file_on_existing : WeightFileOnExisting =
839 WeightFileOnExisting.OVERWRITE,
840 mapping_on_source = 1,
841 scale_factor = 1.0, scale_summand = 0.0,
842 src_masks_names =
None, tgt_mask_name =
None,
843 yaxt_exchanger_name =
None,
844 use_raw_exchange =
False):
846 @see yac_cdef_couple_instance
848 cdef char * weight_file_ptr
849 if weight_file
is None:
850 weight_file_ptr = NULL
852 weight_file_bytes = weight_file.encode()
853 weight_file_ptr = weight_file_bytes
854 cdef const char ** src_mask_names_ptr = NULL
855 cdef const char * tgt_mask_name_ptr = NULL
856 cdef const char * yaxt_exchanger_name_ptr = NULL
857 cdef int couple_config_id
870 if src_masks_names
is not None:
871 if type(src_masks_names)
is str:
872 src_masks = [src_masks_names]
873 src_masks_enc = [s.encode()
for s
in src_masks_names]
874 src_mask_names_ptr = <const char **>malloc(len(src_masks_enc) * sizeof(char*))
875 for i
in range(len(src_masks_enc)):
876 src_mask_names_ptr[i] = src_masks_enc[i]
880 free(src_mask_names_ptr)
881 if tgt_mask_name
is not None:
883 if yaxt_exchanger_name
is not None:
886 _logger.debug(f
"def_couple {(src_comp.encode(), src_grid.encode(), src_field.encode())}, {(tgt_comp.encode(), tgt_grid.encode(), tgt_field.encode())}")
888 src_comp.encode(), src_grid.encode(), src_field.encode(),
889 tgt_comp.encode(), tgt_grid.encode(), tgt_field.encode(),
890 coupling_timestep.encode(),
TimeUnit(timeunit).value,
892 interp_stack.interp_stack_id, src_lag, tgt_lag,
898 @see yac_cenddef_instance
900 _logger.debug(
"enddef")
906 @see yac_cget_comp_names
909 cdef const char **ret = <const char **>malloc(nbr_components * sizeof(const char *))
911 comp_list = [bytes(ret[i]).decode(
'UTF-8')
for i
in range(nbr_components) ]
918 @see yac_cget_grid_names
921 cdef const char **ret = <const char **>malloc(nbr_grids * sizeof(const char *))
923 grid_list = [bytes(ret[i]).decode(
'UTF-8')
for i
in range(nbr_grids) ]
929 @see yac_cget_comp_grid_names
932 cdef const char **ret = <const char **>malloc(nbr_grids * sizeof(const char *))
934 grid_list = [bytes(ret[i]).decode(
'UTF-8')
for i
in range(nbr_grids) ]
940 @see yac_cget_field_names
945 cdef const char **ret = <const char **>malloc(nbr_fields * sizeof(const char *))
947 grid_name.encode(), nbr_fields, ret)
948 field_list = [bytes(ret[i]).decode(
'UTF-8')
for i
in range(nbr_fields) ]
952 def get_field_id(self, comp_name : str, grid_name : str, field_name : str):
954 @see yac_cget_field_id
956 return yac_cget_field_id_instance (self.
instance_id,
952 def get_field_id(self, comp_name : str, grid_name : str, field_name : str):
…
963 @see yac_cget_field_timestep
968 field_name.encode()).decode(
'UTF-8')
972 @see yac_cget_field_role
977 field_name.encode()))
981 cdef const char* src_comp
982 cdef const char* src_grid
983 cdef const char* src_field
991 return (src_comp.decode(
"UTF-8"),
992 src_grid.decode(
"UTF-8"),
993 src_field.decode(
"UTF-8"))
997 @see yac_cget_field_collection_size
1002 field_name.encode())
1006 @see yac_cget_field_frac_mask_fallback_value
1011 field_name.encode())
1014 frac_mask_fallback_value : _np.float64):
1016 @see yac_cenable_field_frac_mask
1018 _logger.debug(f
"enable_field_frac_mask {(comp_name, grid_name, field_name)})")
1022 field_name.encode(),
1023 frac_mask_fallback_value)
1027 @see yac_cdef_component_metadata
1029 _logger.debug(f
"def_component_metadata comp_name={comp_name}")
1031 comp_name.encode(), metadata)
1035 @see yac_cdef_grid_metadata
1037 _logger.debug(f
"def_grid_metadata grid_name={grid_name}")
1039 grid_name.encode(), metadata)
1042 field_name : str,metadata : bytes):
1044 @see yac_cdef_field_metadata
1046 _logger.debug(
"def_field_metadata (comp_name, grid_name, field_name)="
1047 f
"{(comp_name, grid_name, field_name)}")
1049 grid_name.encode(), field_name.encode(),
1054 @see yac_cget_component_metadata
1058 return bytes(metadata).decode(
'UTF-8')
if metadata != NULL
else None
1062 @see yac_cget_grid_metadata
1066 return bytes(metadata).decode(
'UTF-8')
if metadata != NULL
else None
1070 @see yac_cget_field_metadata
1075 field_name.encode())
1076 return bytes(metadata).decode(
'UTF-8')
if metadata != NULL
else None
1080 @see yac_cget_comps_comm
1082 from mpi4py
import MPI
1084 cptr = [c.encode()
for c
in comp_names]
1085 cdef const char ** comp_names_c_ptr = <const char **>malloc(len(comp_names) * sizeof(const char *))
1086 for i
in range(len(comp_names)):
1087 comp_names_c_ptr[i] = cptr[i]
1089 free(comp_names_c_ptr)
1091 return MPI.Comm.f2py(MPI_Comm_c2f(comm))
1095 @see yac_cread_config_yaml_instance
1097 _logger.debug(f
"read_config_yaml yaml_file={yaml_file}")
1101 fileformat : ConfigOutputFormat,
1102 sync_location : ConfigOutputSyncLoc,
1103 include_definitions : bool =
False):
1105 @see yac_cset_config_output_file_instance
1110 sync_location.value,
1111 1
if include_definitions
else 0)
1115 @see yac_cset_grid_output_file_instance
1123 Stores the component_id and provides further functionality
1131 @see yac_cget_comp_comm (`MPI.Comm`, read-only)
1133 from mpi4py
import MPI
1137 return MPI.Comm.f2py(MPI_Comm_c2f(comm))
1142 number of processes in this component
1151 process index in the component
1166 Stores the grid_id and provides further functionality
1168 Base class for Reg2dGrid and UnstructuredGrid
1171 _logger.debug(f
"grid_id={grid_id}")
1176 @see yac_cset_global_index
1178 cdef const int[::1] global_index_view = _np.ascontiguousarray(global_index, dtype=_np.intc)
1179 assert len(global_index_view) == yac_cget_grid_size ( location.value, self.
grid_id ), \
1180 "Wrong number of indices provided"
1181 _logger.debug(f
"set_global_index grid_id={self.grid_id}")
1187 @see yac_cget_grid_size (`int`, read-only)
1189 return yac_cget_grid_size ( Location.CELL.value, self.
grid_id )
1194 @see yac_cget_grid_size (`int`, read-only)
1196 return yac_cget_grid_size ( Location.CORNER.value, self.
grid_id )
1201 @see yac_cget_grid_size (`int`, read-only)
1203 return yac_cget_grid_size ( Location.EDGE.value, self.
grid_id )
1207 @see yac_cset_core_mask
1209 cdef size_t len_is_core = len(is_core)
1211 cdef const int[::1] np_mask = _np.ascontiguousarray(is_core, dtype=_np.intc)
1212 _logger.debug(f
"set_core_mask grid_id={self.grid_id}")
1213 yac_cset_core_mask ( &np_mask[0], location.value, self.
grid_id)
1216 is_valid, name =
None):
1217 cdef int len_is_valid = len(is_valid)
1218 cdef const int[::1] np_mask = _np.ascontiguousarray(is_valid, dtype=_np.int32)
1220 cdef char* c_name = NULL
1221 if name
is not None:
1222 name_enc = name.encode()
1224 _logger.debug(f
"def_mask_named grid_id={self.grid_id}, name={name}")
1225 yac_cdef_mask_named ( self.
grid_id,
1231 return Mask(mask_id)
1235 @see yac_ccompute_grid_cell_areas
1237 if cell_areas
is None:
1239 cdef double[::1] np_cell_areas = _np.ascontiguousarray(cell_areas, dtype=_np.double)
1245 Stores the points_id and provides further functionality
1253 @see yac_cget_points_size (`int`, read-only)
1255 return yac_cget_points_size ( self.
points_id )
1261 cdef size_t len_is_valid = len(is_valid)
1262 assert len_is_valid==self.
size
1263 cdef const int[::1] np_mask = _np.ascontiguousarray(is_valid, dtype=_np.intc)
1264 _logger.debug(f
"set_mask points_id={self.points_id}")
1265 yac_cset_mask ( &np_mask[0],
1272 def __init__(self, grid_name : str, x_vertices, y_vertices,
1273 cyclic = [
False,
False], north_pole =
None):
1275 @see yac_cdef_grid_reg2d
1278 cdef const double[::1] x = _np.ascontiguousarray(x_vertices, dtype=_np.double)
1279 cdef const double[::1] y = _np.ascontiguousarray(y_vertices, dtype=_np.double)
1280 cdef int[2] cyclic_view = cyclic
1281 cdef const double[::1] n_p
1283 if north_pole
is None:
1284 _logger.debug(f
"def_grid_reg2d grid_name={grid_name}")
1286 cyclic_view, <double*>&x[0], <double*>&y[0],
1289 n_p = _np.ascontiguousarray(north_pole, dtype=_np.double)
1290 _logger.debug(f
"def_grid_reg2d_rot grid_name={grid_name}")
1292 cyclic_view, <double*>&x[0], <double*>&y[0],
1293 n_p[0], n_p[1], &grid_id)
1272 def __init__(self, grid_name : str, x_vertices, y_vertices,
…
1297 x_vertices, y_vertices):
1299 @see yac_cdef_points_reg2d
1302 cdef const double[::1] x = _np.ascontiguousarray(x_vertices, dtype=_np.double)
1303 cdef const double[::1] y = _np.ascontiguousarray(y_vertices, dtype=_np.double)
1304 cdef const double[::1] n_p
1306 _logger.debug(f
"def_points_reg2d grid_id={self.grid_id}")
1308 location.value, &x[0], &y[0], &points_id)
1310 n_p = _np.ascontiguousarray(self.
north_pole, dtype=_np.double)
1311 _logger.debug(f
"def_points_reg2d_rot grid_id={self.grid_id}")
1313 location.value, &x[0], &y[0],
1316 _logger.debug(f
"points_id={points_id}")
1320 x_vertices, y_vertices):
1322 @see yac_cdef_points_unstruct
1324 assert len(x_vertices) == len(y_vertices)
1326 cdef const double[::1] x = _np.ascontiguousarray(x_vertices, dtype=_np.double)
1327 cdef const double[::1] y = _np.ascontiguousarray(y_vertices, dtype=_np.double)
1328 _logger.debug(f
"def_points_unstruct grid_id={self.grid_id}")
1330 location.value, &x[0], &y[0], &points_id)
1331 _logger.debug(f
"points_id={points_id}")
1336 A curvilinear stuctured 2d Grid
1338 def __init__(self, grid_name : str, x_vertices, y_vertices,
1339 cyclic = [
False,
False]):
1341 @see yac_cdef_grid_curve2d
1344 cdef const double[::1] x = _np.ascontiguousarray(x_vertices.flatten(), dtype=_np.double)
1345 cdef const double[::1] y = _np.ascontiguousarray(y_vertices.flatten(), dtype=_np.double)
1346 cdef int[2] cyclic_view = cyclic
1347 _logger.debug(f
"def_grid_curve2d grid_name={grid_name}")
1349 [_np.shape(x_vertices)[1], _np.shape(y_vertices)[0]],
1350 cyclic_view, <double*>&x[0], <double*>&y[0], &grid_id)
1338 def __init__(self, grid_name : str, x_vertices, y_vertices,
…
1354 x_vertices, y_vertices):
1356 @see yac_cdef_points_curve2d
1358 assert x_vertices.shape == y_vertices.shape
1360 cdef const double[::1] x = _np.ascontiguousarray(x_vertices.flatten(), dtype=_np.double)
1361 cdef const double[::1] y = _np.ascontiguousarray(y_vertices.flatten(), dtype=_np.double)
1362 _logger.debug(f
"def_points_curve2d grid_id={self.grid_id}")
1364 [_np.shape(x_vertices)[1], _np.shape(x_vertices)[0]],
1365 location.value, &x[0], &y[0], &points_id)
1366 _logger.debug(f
"points_id={points_id}")
1370 x_vertices, y_vertices):
1372 @see yac_cdef_points_unstruct
1374 assert len(x_vertices) == len(y_vertices)
1376 cdef const double[::1] x = _np.ascontiguousarray(x_vertices, dtype=_np.double)
1377 cdef const double[::1] y = _np.ascontiguousarray(y_vertices, dtype=_np.double)
1378 _logger.debug(f
"def_points_unstruct grid_id={self.grid_id}")
1380 location.value, &x[0], &y[0], &points_id)
1381 _logger.debug(f
"points_id={points_id}")
1390 x_points, y_points):
1392 @see yac_cdef_points_unstruct
1395 cdef const double[::1] x_points_view = _np.ascontiguousarray(x_points, dtype=_np.double)
1396 cdef const double[::1] y_points_view = _np.ascontiguousarray(y_points, dtype=_np.double)
1397 _logger.debug(f
"yac_cdef_points_unstruct grid_id={self.grid_id}")
1399 &x_points_view[0], &y_points_view[0], &points_id)
1400 _logger.debug(f
"points_id={points_id}")
1405 An unstuctured 2d Grid
1407 def __init__(self, grid_name : str, num_vertices_per_cell,
1408 x_vertices, y_vertices, cell_to_vertex, use_ll_edges=
False):
1410 @see yac_cdef_grid_unstruct and @see yac_cdef_grid_unstruct_ll
1413 cdef const int[::1] num_vertices_per_cell_view = _np.ascontiguousarray(num_vertices_per_cell, dtype=_np.intc)
1414 cdef const double[::1] x_vertices_view = _np.ascontiguousarray(x_vertices, dtype=_np.double)
1415 cdef const double[::1] y_vertices_view = _np.ascontiguousarray(y_vertices, dtype=_np.double)
1416 cdef const int[::1] cell_to_vertex_view = _np.ascontiguousarray(cell_to_vertex, dtype=_np.intc)
1417 assert len(num_vertices_per_cell_view) > 0, \
1418 "UnstrucuredGrid needs at least one cell. Use CloudGrid if you dont need to define cells."
1419 if not use_ll_edges:
1420 _logger.debug(f
"def_grid_unstruct grid_name={grid_name}")
1422 len(num_vertices_per_cell_view),
1423 <int*>&num_vertices_per_cell_view[0],
1424 <double*>&x_vertices_view[0],
1425 <double*>&y_vertices_view[0],
1426 <int*>&cell_to_vertex_view[0], &grid_id)
1428 _logger.debug(f
"def_grid_unstruct_ll grid_name={grid_name}")
1430 len(num_vertices_per_cell_view),
1431 <int*>&num_vertices_per_cell_view[0],
1432 <double*>&x_vertices_view[0],
1433 <double*>&y_vertices_view[0],
1434 <int*>&cell_to_vertex_view[0], &grid_id)
1407 def __init__(self, grid_name : str, num_vertices_per_cell,
…
1439 @see yac_cdef_grid_cloud
1441 def __init__(self, grid_name : str, x_vertices, y_vertices):
1443 cdef const double[::1] x_vertices_view = _np.ascontiguousarray(x_vertices, dtype=_np.double)
1444 cdef const double[::1] y_vertices_view = _np.ascontiguousarray(y_vertices, dtype=_np.double)
1445 _logger.debug(f
"def_grid_cloud grid_name={grid_name}")
1446 yac_cdef_grid_cloud (grid_name.encode(),
1447 len(x_vertices_view),
1448 <double*>&x_vertices_view[0],
1449 <double*>&y_vertices_view[0],
1441 def __init__(self, grid_name : str, x_vertices, y_vertices):
…
1454 return super().
def_points(Location.CORNER, x_points, y_points)
1458 def __init__(self, grid_name : str, num_edges_per_cell,
1459 x_vertices, y_vertices, cell_to_edge, edge_to_vertex,
1460 use_ll_edges=
False):
1462 cdef const int[::1] num_edges_per_cell_view = _np.ascontiguousarray(num_edges_per_cell, dtype=_np.intc)
1463 cdef const double[::1] x_vertices_view = _np.ascontiguousarray(x_vertices, dtype=_np.double)
1464 cdef const double[::1] y_vertices_view = _np.ascontiguousarray(y_vertices, dtype=_np.double)
1465 cdef const int[::1] cell_to_edge_view = _np.ascontiguousarray(cell_to_edge, dtype=_np.intc)
1466 cdef const int[:, ::1] edge_to_vertex_view = _np.ascontiguousarray(edge_to_vertex, dtype=_np.intc)
1467 assert edge_to_vertex_view.shape[1] == 2, \
1468 "dimension 1 of edge_to_vertex must be 2"
1469 assert len(num_edges_per_cell_view) > 0, \
1470 "UnstrucuredGridEdge needs at least one cell. Use CloudGrid if you dont need to define cells."
1471 if not use_ll_edges:
1472 _logger.debug(f
"def_grid_unstruct_edge grid_name={grid_name}")
1474 len(num_edges_per_cell_view),
1475 edge_to_vertex_view.shape[0],
1476 <int*>&num_edges_per_cell_view[0],
1477 <double*>&x_vertices_view[0],
1478 <double*>&y_vertices_view[0],
1479 <int*>&cell_to_edge_view[0],
1480 <int*>&edge_to_vertex_view[0,0],
1483 _logger.debug(f
"def_grid_unstruct_edge_ll grid_name={grid_name}")
1485 len(num_edges_per_cell_view),
1486 edge_to_vertex_view.shape[0],
1487 <int*>&num_edges_per_cell_view[0],
1488 <double*>&x_vertices_view[0],
1489 <double*>&y_vertices_view[0],
1490 <int*>&cell_to_edge_view[0],
1491 <int*>&edge_to_vertex_view[0,0],
1505 def create(cls, field_name : str, comp : Component, points, collection_size,
1506 timestep : str, timeunit : TimeUnit, masks =
None):
1510 from collections.abc
import Iterable
1512 if not isinstance(points, Iterable):
1514 cdef const int[:] point_ids_array = _np.array([p.points_id
for p
in points], dtype=_np.intc)
1515 size = sum(p.size
for p
in points)
1516 cdef const int[:] mask_ids_array
1518 _logger.debug(f
"def_field field_name={field_name}, comp_id={comp.comp_id}, point_ids={[p.points_id for p in points]}")
1520 &point_ids_array[0], len(point_ids_array),
1521 collection_size, timestep.encode(),
TimeUnit(timeunit).value, &field_id)
1523 if not isinstance(masks, Iterable):
1525 mask_ids_array = _np.array([m.mask_id
for m
in masks], dtype=_np.intc)
1526 _logger.debug(f
"def_field_mask field_name={field_name}, comp_id={comp.comp_id}, point_ids={[p.points_id for p in points]}")
1528 &point_ids_array[0], &mask_ids_array[0],
1529 len(point_ids_array),
1530 collection_size, timestep.encode(),
TimeUnit(timeunit).value, &field_id)
1531 _logger.debug(f
"field_id={field_id}")
1532 return Field(field_id, size)
1505 def create(cls, field_name : str, comp : Component, points, collection_size,
…
1540 _logger.debug(f
"test field_id={self.field_id}")
1542 _logger.debug(f
"flag={flag}")
1551 _logger.debug(f
"wait field_id={field_id}")
1553 yac_cwait ( field_id )
1558 Coroutine. Blocks until the communication is completed.
1560 while self.
test() == 0:
1563 @cython.boundscheck(False)
1564 def get(self, buf=None, asyn=False):
1566 @see yac_cget_ and variants
1568 @param[out] buf receive buffer, if `None` a numpy array of correct size is allocated
1569 @param[in] asyn if True the call returns immediately and must be completed
1570 with `test` or `wait`
1578 if buf_in
is not None and buf.base
is None:
1579 _logger.warning(
"get: non-contiguous buffer passed to get. Reallocated memory.")
1580 cdef double[:,::1] buf_view = buf
1584 _logger.debug(f
"get_async_ field_id={self.field_id}")
1585 yac_cget_async_(field_id, collection_size, &buf_view[0,0], &info, &ierror)
1587 _logger.debug(f
"get_ field_id={self.field_id}")
1589 yac_cget_(field_id, collection_size, &buf_view[0,0], &info, &ierror)
1591 raise RuntimeError(
"yac_cget returned error number " + str(ierror))
1592 _logger.debug(f
"info={info}")
1564 def get(self, buf=None, asyn=False):
…
1597 Coroutine. Executes a get operation.
1599 @see yac_cget_async_
1601 @param[out] buf receive buffer, if `None` a numpy array of correct size is allocated
1603 buf, info = self.
get(buf, asyn=
True)
1607 @cython.boundscheck(False)
1608 def get_raw(self, buf, frac_mask=None, asyn=False):
1610 @see yac_cget_raw_ and variants
1612 @param[inout] buf receive buffer, if `None` a numpy array of correct size is allocated
1613 @param[inout] frac_mask receive buffer for frac_mask, if `None` a numpy array of correct size is allocated
1614 @param[in] asyn if True the call returns immediately and must be completed
1615 with `test` or `wait`
1620 if buf.base
is None:
1621 _logger.warning(
"get: non-contiguous buffer passed to get_raw. Reallocated memory.")
1622 cdef double[:,::1] buf_view = buf
1623 if frac_mask
is not None:
1625 if frac_mask
is not None and frac_mask.base
is None:
1626 _logger.warning(
"get: non-contiguous frac_mask buffer passed to get_raw. Reallocated memory.")
1627 cdef double[:,::1] frac_mask_view = frac_mask
1631 if frac_mask
is not None:
1632 _logger.debug(f
"get_raw_frac_async_ field_id={self.field_id}")
1634 &frac_mask_view[0,0], &info, &ierror)
1636 _logger.debug(f
"get_raw_async_ field_id={self.field_id}")
1639 if frac_mask
is not None:
1640 _logger.debug(f
"get_raw_frac_ field_id={self.field_id}")
1643 &frac_mask_view[0,0], &info, &ierror)
1645 _logger.debug(f
"get_raw_ field_id={self.field_id}")
1647 yac_cget_raw_(field_id, collection_size, &buf_view[0,0], &info, &ierror)
1649 raise RuntimeError(
"yac_cget returned error number " + str(ierror))
1650 _logger.debug(f
"info={info}")
1651 return buf, frac_mask,
Action(info)
1653 @cython.boundscheck(False)
1654 def put(self, buf, frac_mask = None):
1661 cdef const double[:,:,::1] frac_mask_view
1664 if frac_mask
is not None:
1665 frac_mask_view = _np.ascontiguousarray(
1667 _logger.debug(f
"put_frac_ field_id={self.field_id}")
1669 yac_cput_frac_(field_id, collection_size, <double*>&buf_view[0,0,0],
1670 <double*>&frac_mask_view[0,0,0], &info, &ierror)
1672 _logger.debug(f
"put_ field_id={self.field_id}")
1674 yac_cput_(field_id, collection_size, <double*>&buf_view[0,0,0], &info, &ierror)
1676 raise RuntimeError(
"yac_cput returned error number " + str(ierror))
1677 _logger.debug(f
"info={info}")
1654 def put(self, buf, frac_mask = None):
…
1682 Coroutine. Executes a put operation.
1687 return self.
put(buf, frac_mask)
1693 _logger.debug(f
"update field_id={self.field_id}")
1697 @cython.boundscheck(False)
1698 def exchange(cls, send_field, recv_field, send_buf, recv_buf=None, send_frac_mask=None):
1700 @see yac_cexchange_frac_
1702 assert send_field.collection_size == recv_field.collection_size,
"exchange can only be used with fields of the same collection_size"
1703 cdef int collection_size = send_field.collection_size
1707 cdef const double[:,:,::1] send_buf_view = _np.ascontiguousarray(send_buf.reshape(-1,collection_size,send_field.size), dtype=_np.double)
1708 cdef const double[:,:,::1] frac_mask_view
1709 if recv_buf
is None:
1710 recv_buf = _np.empty((collection_size, recv_field.size), dtype=_np.double)
1711 recv_buf = _np.ascontiguousarray(recv_buf.reshape(collection_size, recv_field.size), dtype=_np.double)
1712 cdef double[:,::1] recv_buf_view = recv_buf
1713 cdef int send_field_id = send_field.field_id
1714 cdef int recv_field_id = recv_field.field_id
1715 if send_frac_mask
is None:
1716 _logger.debug(f
"exchange_ with send_field.field_id={send_field.field_id} and recv_field.field_id={recv_field.field_id}")
1719 <double*>&send_buf_view[0,0,0],
1720 <double*>&recv_buf_view[0,0],
1721 &send_info, &recv_info, &ierror)
1723 _logger.debug(f
"exchange_frac_ with send_field.field_id={send_field.field_id} and recv_field.field_id={recv_field.field_id}")
1724 frac_mask_view = _np.ascontiguousarray(
1725 send_frac_mask.reshape(-1,collection_size,send_field.size), dtype=_np.double)
1728 <double*>&send_buf_view[0,0,0],
1729 <double*>&frac_mask_view[0,0,0],
1730 <double*>&recv_buf_view[0,0],
1731 &send_info, &recv_info, &ierror)
1733 raise RuntimeError(
"yac_cexchange_frac_ returned error number " + str(ierror))
1735 return recv_buf, send_info, recv_info
1698 def exchange(cls, send_field, recv_field, send_buf, recv_buf=None, send_frac_mask=None):
…
1740 @see yac_cget_field_name_from_field_id
1742 return bytes.decode(yac_cget_field_name_from_field_id ( self.
field_id ))
1747 @see yac_cget_grid_name_from_field_id
1749 return bytes.decode(yac_cget_grid_name_from_field_id ( self.
field_id ))
1754 @see yac_cget_component_name_from_field_id
1756 return bytes.decode(yac_cget_component_name_from_field_id ( self.
field_id ))
1761 @see yac_cget_role_from_field_id
1768 @see yac_cget_timestep_from_field_id
1770 return bytes.decode(yac_cget_timestep_from_field_id ( self.
field_id ))
1775 @see yac_cget_collection_size_from_field_id
1782 The size of the corresponding points object
1789 @see yac_cget_field_datetime
1796 @see yac_cget_action
1804 @see yac_cget_raw_interp_weights_data
1806 Returns a dictionary with the corresponding values
1808 cdef double frac_mask_fallback_value;
1809 cdef double scaling_factor;
1810 cdef double scaling_summand;
1811 cdef size_t num_fixed_values;
1812 cdef double * fixed_values;
1813 cdef size_t * num_tgt_per_fixed_value;
1814 cdef size_t * tgt_idx_fixed;
1815 cdef size_t num_wgt_tgt;
1816 cdef size_t * wgt_tgt_idx;
1817 cdef size_t * num_src_per_tgt;
1818 cdef double * weights;
1819 cdef size_t * src_field_idx;
1820 cdef size_t * src_idx;
1821 cdef size_t num_src_fields;
1822 cdef size_t * src_field_buffer_sizes;
1823 yac_cget_raw_interp_weights_data ( self.
field_id,
1824 &frac_mask_fallback_value,
1829 &num_tgt_per_fixed_value,
1838 &src_field_buffer_sizes );
1841 frac_mask_fallback_value=frac_mask_fallback_value,
1842 scaling_factor=scaling_factor,
1843 scaling_summand=scaling_summand)
1845 if num_fixed_values > 0:
1846 result.fixed_values = _np.array(<double[:num_fixed_values]> fixed_values)
1847 result.num_tgt_per_fixed_value = _np.array(<size_t[:num_fixed_values]> num_tgt_per_fixed_value)
1848 tgt_idx_fixed_size = _np.sum(result.num_tgt_per_fixed_value)
1849 result.tgt_idx_fixed = _np.array(<size_t[:tgt_idx_fixed_size]> tgt_idx_fixed)
1852 result.wgt_tgt_idx = _np.array(<size_t[:num_wgt_tgt]>wgt_tgt_idx)
1853 result.num_src_per_tgt = _np.array(<size_t[:num_wgt_tgt]> num_src_per_tgt)
1854 num_weights = _np.sum(result.num_src_per_tgt)
1855 result.weights = _np.array(<double[:num_weights]>weights)
1856 result.src_field_idx = _np.array(<size_t[:num_weights]> src_field_idx)
1857 result.src_idx = _np.array(<size_t[:num_weights]> src_idx)
1859 if num_src_fields > 0:
1860 result.src_field_buffer_sizes = _np.array(<size_t[:num_src_fields]> src_field_buffer_sizes)
1863 free(num_tgt_per_fixed_value);
1864 free(tgt_idx_fixed);
1866 free(num_src_per_tgt);
1868 free(src_field_idx);
1870 free(src_field_buffer_sizes);
1875 @see yac_cget_raw_interp_weights_data
1877 Returns a dictionary with the corresponding values
1879 cdef double frac_mask_fallback_value;
1880 cdef double scaling_factor;
1881 cdef double scaling_summand;
1882 cdef size_t num_fixed_values;
1883 cdef double * fixed_values;
1884 cdef size_t * num_tgt_per_fixed_value;
1885 cdef size_t * tgt_idx_fixed;
1886 cdef size_t * src_indptr;
1887 cdef double * weights;
1888 cdef size_t * src_field_idx;
1889 cdef size_t * src_idx;
1890 cdef size_t num_src_fields;
1891 cdef size_t * src_field_buffer_sizes;
1892 yac_cget_raw_interp_weights_data_csr ( self.
field_id,
1893 &frac_mask_fallback_value,
1898 &num_tgt_per_fixed_value,
1905 &src_field_buffer_sizes );
1908 frac_mask_fallback_value=frac_mask_fallback_value,
1909 scaling_factor=scaling_factor,
1910 scaling_summand=scaling_summand)
1912 if num_fixed_values > 0:
1913 result.fixed_values = _np.array(<double[:num_fixed_values]> fixed_values)
1914 result.num_tgt_per_fixed_value = _np.array(<size_t[:num_fixed_values]> num_tgt_per_fixed_value)
1915 tgt_idx_fixed_size = _np.sum(result.num_tgt_per_fixed_value)
1916 result.tgt_idx_fixed = _np.array(<size_t[:tgt_idx_fixed_size]> tgt_idx_fixed)
1918 result.src_indptr = _np.array(<size_t[:self.
sizesize + 1]> src_indptr)
1919 num_weights = result.src_indptr[-1]
1920 result.weights = _np.array(<double[:num_weights]>weights)
1921 result.src_field_idx = _np.array(<size_t[:num_weights]> src_field_idx)
1922 result.src_idx = _np.array(<size_t[:num_weights]> src_idx)
1924 if num_src_fields > 0:
1925 result.src_field_buffer_sizes = _np.array(<size_t[:num_src_fields]> src_field_buffer_sizes)
1928 free(num_tgt_per_fixed_value);
1929 free(tgt_idx_fixed);
1932 free(src_field_idx);
1934 free(src_field_buffer_sizes);
1940 frac_mask_fallback_value : float
1941 scaling_factor : float
1942 scaling_summand : float
1943 fixed_values : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.float64))
1944 num_tgt_per_fixed_value : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1945 tgt_idx_fixed : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1946 wgt_tgt_idx : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1947 num_src_per_tgt : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1948 weights : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.float64))
1949 src_field_idx : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1950 src_idx : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1951 src_field_buffer_sizes : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1956 frac_mask_fallback_value : float
1957 scaling_factor : float
1958 scaling_summand : float
1959 fixed_values : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.float64))
1960 num_tgt_per_fixed_value : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1961 tgt_idx_fixed : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1962 src_indptr : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1963 weights : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.float64))
1964 src_field_idx : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1965 src_idx : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1966 src_field_buffer_sizes : _np.ndarray = field(default_factory=
lambda: _np.empty(shape=[0], dtype=_np.uintp))
1971 @see yac_cget_interp_stack_config
1973 cdef int interp_stack_config_id
1974 _logger.debug(f
"get_interp_stack_config")
1976 _logger.debug(f
"interp_stack_config_id={interp_stack_config_id}")
1981 interp_stack = cls.__new__(cls)
1982 cdef int interp_stack_config_id
1983 _logger.debug(f
"get_interp_stack_config_from_string_yaml: interp_stack_string={interp_stack_string}")
1985 _logger.debug(f
"interp_stack_config_id_from_string_yaml={interp_stack_config_id}")
1986 interp_stack.interp_stack_id = interp_stack_config_id
1991 interp_stack = cls.__new__(cls)
1992 cdef int interp_stack_config_id
1993 _logger.debug(f
"get_interp_stack_config_from_string_json: interp_stack_string={interp_stack_string}")
1995 _logger.debug(f
"interp_stack_config_id_from_string_json={interp_stack_config_id}")
1996 interp_stack.interp_stack_id = interp_stack_config_id
1999 def add_average(self, reduction_type : AverageReductionType, partial_coverage):
2001 @see yac_cadd_interp_stack_config_average
2003 _logger.debug(f
"add_interp_stack_config_average interp_stack_id={self.interp_stack_id}")
1999 def add_average(self, reduction_type : AverageReductionType, partial_coverage):
…
2008 def add_ncc(self, reduction_type : NCCReductionType, partial_coverage):
2010 @see yac_cadd_interp_stack_config_ncc
2012 _logger.debug(f
"add_interp_stack_config_ncc interp_stack_id={self.interp_stack_id}")
2008 def add_ncc(self, reduction_type : NCCReductionType, partial_coverage):
…
2017 def add_nnn(self, reduction_type : NNNReductionType, n : int,
2018 max_search_distance : _np.float64, scale : _np.float64):
2020 @see yac_cadd_interp_stack_config_nnn
2022 _logger.debug(f
"add_interp_stack_config_nnn interp_stack_id={self.interp_stack_id}")
2025 n, max_search_distance, scale)
2017 def add_nnn(self, reduction_type : NNNReductionType, n : int,
…
2027 def add_rbf(self, n : int = 9, max_search_distance : _np.float64 = 0.0,
2028 scale : _np.float64 = 1.487973e+01):
2030 @see yac_cadd_interp_stack_config_rbf
2032 _logger.debug(f
"add_interp_stack_config_rbf interp_stack_id={self.interp_stack_id}")
2034 n, max_search_distance, scale)
2027 def add_rbf(self, n : int = 9, max_search_distance : _np.float64 = 0.0,
…
2037 partial_coverage : int, normalisation : ConservNormalizationType):
2039 @see yac_cadd_interp_stack_config_conservative
2041 _logger.debug(f
"add_interp_stack_config_conservative interp_stack_id={self.interp_stack_id}")
2043 order, enforced_conserv,
2047 def add_spmap(self, spread_distance : _np.float64, max_search_distance : _np.float64,
2048 weight_type : SPMAPWeightType, scale_type : SPMAPScaleType,
2049 src_sphere_radius : _np.float64 = 1.0, src_filename : str =
None,
2050 src_varname : str =
None, src_min_global_id : int = 0,
2051 tgt_sphere_radius : _np.float64 = 1.0, tgt_filename : str =
None,
2052 tgt_varname : str =
None, tgt_min_global_id : int = 0):
2054 @see yac_cadd_interp_stack_config_spmap
2056 _logger.debug(f
"add_interp_stack_config_spmap interp_stack_id={self.interp_stack_id}")
2057 cdef char * src_filename_ptr
2058 if src_filename
is None:
2059 src_filename_ptr = NULL
2061 src_filename_bytes = src_filename.encode()
2062 src_filename_ptr = src_filename_bytes
2063 cdef char * src_varname_ptr
2064 if src_varname
is None:
2065 src_varname_ptr = NULL
2067 src_varname_bytes = src_varname.encode()
2068 src_varname_ptr = src_varname_bytes
2069 cdef char * tgt_filename_ptr
2070 if tgt_filename
is None:
2071 tgt_filename_ptr = NULL
2073 tgt_filename_bytes = tgt_filename.encode()
2074 tgt_filename_ptr = tgt_filename_bytes
2075 cdef char * tgt_varname_ptr
2076 if tgt_varname
is None:
2077 tgt_varname_ptr = NULL
2079 tgt_varname_bytes = tgt_varname.encode()
2080 tgt_varname_ptr = tgt_varname_bytes
2082 spread_distance, max_search_distance,
2085 src_sphere_radius, src_filename_ptr,
2086 src_varname_ptr, src_min_global_id,
2087 tgt_sphere_radius, tgt_filename_ptr,
2088 tgt_varname_ptr, tgt_min_global_id)
2047 def add_spmap(self, spread_distance : _np.float64, max_search_distance : _np.float64,
…
2092 @see yac_cadd_interp_stack_config_hcsbb
2094 _logger.debug(f
"add_interp_stack_config_hcsbb interp_stack_id={self.interp_stack_id}")
2098 on_missing_file : UserFileOnMissingFile =
2099 UserFileOnMissingFile.ERROR,
2100 on_success : UserFileOnSuccess = UserFileOnSuccess.CONT):
2102 @see yac_cadd_interp_stack_config_user_file
2104 _logger.debug(f
"add_interp_stack_config_user_file interp_stack_id={self.interp_stack_id}")
2113 @see yac_cadd_interp_stack_config_fixed
2115 _logger.debug(f
"add_interp_stack_config_fixed interp_stack_id={self.interp_stack_id}")
2118 def add_check(self, constructor_key : str, do_search_key : str):
2120 @see yac_cadd_interp_stack_config_check
2122 _logger.debug(f
"add_interp_stack_config_check interp_stack_id={self.interp_stack_id}")
2124 constructor_key.encode(), do_search_key.encode())
2118 def add_check(self, constructor_key : str, do_search_key : str):
…
2128 @see yac_cadd_interp_stack_config_creep
2130 _logger.debug(f
"add_interp_stack_config_creep interp_stack_id={self.interp_stack_id}")
2136 @see yac_cfree_interp_stack_config
2138 _logger.debug(f
"free_interp_stack_config interp_stack_id={self.interp_stack_id}")
2143 @see yac_cget_version
2148if Py_AtExit(yac_cfinalize) < 0:
2151 b
"could not register yac_cfinalize with Py_AtExit()",
2156cdef void yac_python_abort(MPI_Comm comm, const char* msg,
2157 const char* source, int line) noexcept
with gil:
2159 traceback.print_stack()
char const * grid_names[]
char const * component_names[]
Refers to YAC_ACTION_NONE, YAC_ACTION_REDUCTION etc.
Reduction type for average interpolation.
Calendar type for use in def_calendar.
__init__(self, str grid_name, x_vertices, y_vertices)
def_points(self, x_points, y_points)
Stores the component_id and provides further functionality.
size(self)
number of processes in this component
rank(self)
process index in the component
Normalization type for conservative interpolation.
A curvilinear stuctured 2d Grid.
def_points_unstruct(self, Location location, x_vertices, y_vertices)
def_points(self, Location location, x_vertices, y_vertices)
__init__(self, str grid_name, x_vertices, y_vertices, cyclic=[False, False])
Exchange type of a field.
get_raw(self, buf, frac_mask=None, asyn=False)
put_coro(self, buf, frac_mask=None)
Coroutine.
get_coro(self, buf=None)
Coroutine.
size(self)
The size of the corresponding points object.
wait_coro(self)
Coroutine.
get_raw_interp_weights_data(self)
get(self, buf=None, asyn=False)
exchange(cls, send_field, recv_field, send_buf, recv_buf=None, send_frac_mask=None)
create(cls, str field_name, Component comp, points, collection_size, str timestep, TimeUnit timeunit, masks=None)
get_raw_interp_weights_data_csr(self)
__init__(self, field_id, size=None)
put(self, buf, frac_mask=None)
Stores the grid_id and provides further functionality.
set_core_mask(self, is_core, Location location)
set_global_index(self, global_index, Location location)
def_mask(self, Location location, is_valid, name=None)
compute_grid_cell_areas(self, cell_areas=None)
add_check(self, str constructor_key, str do_search_key)
add_average(self, AverageReductionType reduction_type, partial_coverage)
add_spmap(self, _np.float64 spread_distance, _np.float64 max_search_distance, SPMAPWeightType weight_type, SPMAPScaleType scale_type, _np.float64 src_sphere_radius=1.0, str src_filename=None, str src_varname=None, int src_min_global_id=0, _np.float64 tgt_sphere_radius=1.0, str tgt_filename=None, str tgt_varname=None, int tgt_min_global_id=0)
add_user_file(self, str filename, UserFileOnMissingFile on_missing_file=UserFileOnMissingFile.ERROR, UserFileOnSuccess on_success=UserFileOnSuccess.CONT)
add_conservative(self, int order, int enforced_conserv, int partial_coverage, ConservNormalizationType normalisation)
add_creep(self, int creep_distance)
add_rbf(self, int n=9, _np.float64 max_search_distance=0.0, _np.float64 scale=1.487973e+01)
add_fixed(self, _np.float64 value)
from_string_json(cls, str interp_stack_string)
from_string_yaml(cls, str interp_stack_string)
add_nnn(self, NNNReductionType reduction_type, int n, _np.float64 max_search_distance, _np.float64 scale)
add_ncc(self, NCCReductionType reduction_type, partial_coverage)
Reduction type for ncc interpolation.
Reduction type for nnn interpolation.
Stores the points_id and provides further functionality.
__init__(self, points_id)
Reduction type for the definition of interpolations.
def_points(self, Location location, x_vertices, y_vertices)
__init__(self, str grid_name, x_vertices, y_vertices, cyclic=[False, False], north_pole=None)
def_points_unstruct(self, Location location, x_vertices, y_vertices)
Refers to YAC_SPMAP_NONE, YAC_SPMAP_SRCAREA YAC_SPMAP_INVTGTAREA, and YAC_SPMAP_FRACAREA.
Refers to YAC_SPMAP_AVG and YAC_SPMAP_DIST.
Refers to YAC_TIME_UNIT_MILLISECOND, YAC_TIME_UNIT_SECOND etc.
__init__(self, str grid_name, num_edges_per_cell, x_vertices, y_vertices, cell_to_edge, edge_to_vertex, use_ll_edges=False)
__init__(self, str grid_name, num_vertices_per_cell, x_vertices, y_vertices, cell_to_vertex, use_ll_edges=False)
Refers to YAC_FILE_MISSING_ERROR, YAC_FILE_MISSING_CONT.
Refers to YAC_FILE_SUCCESS_STOP, YAC_FILE_SUCCESS_CONT.
Handling of existing files, if weight file is to be written.
Initializies a YAC instance and provides further functionality.
read_config_yaml(self, str yaml_file)
def_comp(self, str comp_name)
predef_comp(self, str comp_name)
get_grid_metadata(self, str grid_name)
def_component_metadata(self, str comp_name, bytes metadata)
def_field_metadata(self, str comp_name, str grid_name, str field_name, bytes metadata)
def_grid_metadata(self, str grid_name, bytes metadata)
get_field_metadata(self, str comp_name, str grid_name, str field_name)
get_comps_comm(self, comp_names)
get_field_names(self, str comp_name, str grid_name)
get_field_id(self, str comp_name, str grid_name, str field_name)
def_comps(self, comp_names=[])
set_grid_output_file(self, str gridname, str filename)
get_component_metadata(self, str comp_name)
def_datetime(self, start_datetime, end_datetime)
get_field_role(self, str comp_name, str grid_name, str field_name)
get_field_source(self, str comp_name, str grid_name, str field_name)
def_couple(self, str src_comp, str src_grid, src_field, str tgt_comp, str tgt_grid, tgt_field, str coupling_timestep, TimeUnit timeunit, Reduction time_reduction, interp_stack, src_lag=0, tgt_lag=0, weight_file=None, WeightFileOnExisting weight_file_on_existing=WeightFileOnExisting.OVERWRITE, mapping_on_source=1, scale_factor=1.0, scale_summand=0.0, src_masks_names=None, tgt_mask_name=None, yaxt_exchanger_name=None, use_raw_exchange=False)
enable_field_frac_mask(self, str comp_name, str grid_name, str field_name, _np.float64 frac_mask_fallback_value)
get_comp_grid_names(self, comp_name)
get_field_timestep(self, str comp_name, str grid_name, str field_name)
get_field_frac_mask_fallback_value(self, str comp_name, str grid_name, str field_name)
__init__(self, comm=None, default_instance=False)
get_field_collection_size(self, str comp_name, str grid_name, str field_name)
set_config_output_file(self, str filename, ConfigOutputFormat fileformat, ConfigOutputSyncLoc sync_location, bool include_definitions=False)
def_points(self, Location location, x_points, y_points)
__get__(self, cls, owner)
def_calendar(Calendar calendar)
void yac_ccompute_grid_cell_areas(int grid_id, double *cell_areas)
void yac_cadd_interp_stack_config_ncc(int interp_stack_config_id, int weight_type, int partial_coverage)
const char * yac_cget_field_metadata_instance(int yac_instance_id, const char *comp_name, const char *grid_name, const char *field_name)
void yac_cpredef_comp_instance(int yac_instance_id, char const *name, int *comp_id)
char * yac_cget_start_datetime_instance(int yac_instance_id)
void yac_cdef_field_mask(char const *name, int const comp_id, int const *point_ids, int const *mask_ids, int const num_pointsets, int collection_size, const char *timestep, int time_unit, int *field_id)
void yac_cset_global_index(int const *global_index, int location, int grid_id)
void yac_cset_grid_output_file_instance(int yac_instance_id, const char *gridname, const char *filename)
void yac_cget_(int const field_id, int const collection_size, double *recv_field, int *info, int *ierr)
int yac_cget_nbr_grids_instance(int yac_instance_id)
void yac_cfree_ext_couple_config(int ext_couple_config_id)
const char * yac_cget_grid_metadata_instance(int yac_instance_id, const char *grid_name)
char * yac_cget_end_datetime_instance(int yac_instance_id)
void yac_cadd_interp_stack_config_user_file_2(int interp_stack_config_id, char const *filename, int on_missing_file, int on_succes)
void yac_cset_ext_couple_config_tgt_mask_name(int ext_couple_config_id, char const *tgt_mask_name)
void yac_cdef_grid_curve2d(const char *grid_name, int nbr_vertices[2], int cyclic[2], double *x_vertices, double *y_vertices, int *grid_id)
void yac_cget_grid_names_instance(int yac_instance_id, int nbr_grids, const char **grid_names)
void yac_cset_ext_couple_config_scale_factor(int ext_couple_config_id, double scale_factor)
void yac_cset_ext_couple_config_weight_file_on_existing(int ext_couple_config_id, int weight_file_on_existing)
void yac_cadd_interp_stack_config_creep(int interp_stack_config_id, int creep_distance)
void yac_cput_frac_(int const field_id, int const collection_size, double *send_field, double *send_frac_mask, int *info, int *ierr)
void yac_cget_comp_rank_c2py(int comp_id, int *rank)
void yac_cget_comp_size_c2py(int comp_id, int *size)
int yac_cget_comp_nbr_grids_instance(int yac_instance_id, const char *comp_name)
void yac_cdef_grid_unstruct_ll(const char *grid_name, int nbr_vertices, int nbr_cells, int *num_vertices_per_cell, double *x_vertices, double *y_vertices, int *cell_to_vertex, int *grid_id)
void yac_csync_def_instance(int yac_instance_id)
void yac_cget_interp_stack_config_from_string_json(char const *interp_stack_config, int *interp_stack_config_id)
void yac_cdef_grid_reg2d_rot(const char *grid_name, int nbr_vertices[2], int cyclic[2], double *x_vertices, double *y_vertices, double x_north_pole, double y_north_pole, int *grid_id)
void yac_cget_raw_(int const field_id, int const collection_size, double *src_field_buffer, int *info, int *ierr)
void yac_cfinalize()
Finalises YAC.
void yac_cadd_interp_stack_config_check(int interp_stack_config_id, char const *constructor_key, char const *do_search_key)
void yac_cenddef_instance(int yac_instance_id)
void yac_cset_ext_couple_config_src_mask_names(int ext_couple_config_id, size_t num_src_mask_names, char const *const *src_mask_names)
void yac_cget_raw_async_(int const field_id, int const collection_size, double *src_field_buffer, int *info, int *ierr)
int yac_cget_nbr_comps_instance(int yac_instance_id)
int yac_cget_nbr_fields_instance(int yac_instance_id, const char *comp_name, const char *grid_name)
void yac_cget_ext_couple_config(int *ext_couple_config_id)
void yac_cdef_grid_unstruct_edge(const char *grid_name, int nbr_vertices, int nbr_cells, int nbr_edges, int *num_edges_per_cell, double *x_vertices, double *y_vertices, int *cell_to_edge, int *edge_to_vertex, int *grid_id)
void yac_cdef_grid_metadata_instance(int yac_instance_id, const char *grid_name, const char *metadata)
void yac_cset_ext_couple_config_weight_file(int ext_couple_config_id, char const *weight_file)
const char * yac_cget_component_metadata_instance(int yac_instance_id, const char *comp_name)
void yac_cread_config_yaml_instance(int yac_instance_id, const char *yaml_filename)
void yac_cset_ext_couple_config_yaxt_exchanger_name(int ext_couple_config_id, char const *yaxt_exchanger_name)
const char * yac_cget_field_timestep_instance(int yac_instance_id, const char *comp_name, const char *grid_name, const char *field_name)
void yac_cset_ext_couple_config_scale_summand(int ext_couple_config_id, double scale_summand)
void yac_cget_comp_comm(int comp_id, MPI_Comm *comp_comm)
const char * yac_cget_field_datetime(int field_id)
void yac_cdef_comp_instance(int yac_instance_id, char const *comp_name, int *comp_id)
void yac_cupdate(int field_id)
void yac_cget_action(int field_id, int *action)
void yac_cexchange_(int const send_field_id, int const recv_field_id, int const collection_size, double *send_field, double *recv_field, int *send_info, int *recv_info, int *ierr)
void yac_cdef_points_reg2d_rot(int const grid_id, int const *nbr_points, int const located, double const *x_points, double const *y_points, double x_north_pole, double y_north_pole, int *point_id)
int yac_cget_collection_size_from_field_id(int field_id)
void yac_cdef_grid_reg2d(const char *grid_name, int nbr_vertices[2], int cyclic[2], double *x_vertices, double *y_vertices, int *grid_id)
void yac_cdef_couple_custom_instance(int yac_instance_id, 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_timestep, int time_unit, int time_reduction, int interp_stack_config_id, int src_lag, int tgt_lag, int ext_couple_config_id)
void yac_cset_ext_couple_config_use_raw_exchange(int ext_couple_config_id, int use_raw_exchange)
void yac_cset_config_output_file_instance(int yac_instance_id, const char *filename, int fileformat, int sync_location, int include_definitions)
void yac_cdef_points_reg2d(int const grid_id, int const *nbr_points, int const located, double const *x_points, double const *y_points, int *point_id)
void yac_cinit_comm_instance(MPI_Comm comm, int *yac_instance_id)
void yac_cenable_field_frac_mask_instance(int yac_instance_id, const char *comp_name, const char *grid_name, const char *field_name, double frac_mask_fallback_value)
void yac_cget_interp_stack_config_from_string_yaml(char const *interp_stack_config, int *interp_stack_config_id)
void yac_cadd_interp_stack_config_conservative(int interp_stack_config_id, int order, int enforced_conserv, int partial_coverage, int normalisation)
void yac_cdef_grid_unstruct(const char *grid_name, int nbr_vertices, int nbr_cells, int *num_vertices_per_cell, double *x_vertices, double *y_vertices, int *cell_to_vertex, int *grid_id)
void yac_cdef_points_unstruct(int const grid_id, int const nbr_points, int const located, double const *x_points, double const *y_points, int *point_id)
char * yac_cget_version(void)
int yac_cget_default_instance_id()
void yac_cexchange_frac_(int const send_field_id, int const recv_field_id, int const collection_size, double *send_field, double *send_frac_mask, double *recv_field, int *send_info, int *recv_info, int *ierr)
void yac_cdef_component_metadata_instance(int yac_instance_id, const char *comp_name, const char *metadata)
void yac_cdef_calendar(int calendar)
void yac_cget_raw_frac_async_(int const field_id, int const collection_size, double *src_field_buffer, double *src_frac_mask_buffer, int *info, int *ierr)
void yac_cadd_interp_stack_config_rbf(int interp_stack_config_id, size_t n, double max_search_distance, double scale)
void yac_cget_raw_frac_(int const field_id, int const collection_size, double *src_field_buffer, double *src_frac_mask_buffer, int *info, int *ierr)
void yac_cput_(int const field_id, int const collection_size, double *send_field, int *info, int *ierr)
void yac_cget_comp_grid_names_instance(int yac_instance_id, const char *comp_name, int nbr_grids, const char **grid_names)
void yac_cget_async_(int const field_id, int const collection_size, double *recv_field, int *info, int *ierr)
void yac_cadd_interp_stack_config_hcsbb(int interp_stack_config_id)
void yac_cget_comps_comm_instance(int yac_instance_id, char const **comp_names, int num_comps, MPI_Comm *comps_comm)
void yac_cadd_interp_stack_config_fixed(int interp_stack_config_id, double value)
double yac_cget_field_frac_mask_fallback_value_instance(int yac_instance_id, const char *comp_name, const char *grid_name, const char *field_name)
void yac_cget_field_source_instance(int yac_instance_id, const char *tgt_comp_name, const char *tgt_grid_name, const char *tgt_field_name, const char **src_comp_name, const char **src_grid_name, const char **src_field_name)
void yac_cadd_interp_stack_config_spmap(int interp_stack_config_id, double spread_distance, double max_search_distance, int weight_type, int scale_type, double src_sphere_radius, char const *src_filename, char const *src_varname, int src_min_global_id, double tgt_sphere_radius, char const *tgt_filename, char const *tgt_varname, int tgt_min_global_id)
void yac_cdef_grid_unstruct_edge_ll(const char *grid_name, int nbr_vertices, int nbr_cells, int nbr_edges, int *num_edges_per_cell, double *x_vertices, double *y_vertices, int *cell_to_edge, int *edge_to_vertex, int *grid_id)
void yac_cdef_points_curve2d(int const grid_id, int const *nbr_points, int const located, double const *x_points, double const *y_points, int *point_id)
void yac_cset_ext_couple_config_mapping_side(int ext_couple_config_id, int mapping_side)
void yac_ccleanup_instance(int yac_instance_id)
Clean-up a YAC instance (see Restarting YAC)
int yac_cget_field_collection_size_instance(int yac_instance_id, const char *comp_name, const char *grid_name, const char *field_name)
void yac_cfree_interp_stack_config(int interp_stack_config_id)
void yac_cadd_interp_stack_config_nnn(int interp_stack_config_id, int type, size_t n, double max_search_distance, double scale)
size_t yac_cget_grid_size(int located, int grid_id)
void yac_cinit_instance(int *yac_instance_id)
void yac_cget_interp_stack_config(int *interp_stack_config_id)
void yac_cadd_interp_stack_config_average(int interp_stack_config_id, int reduction_type, int partial_coverage)
void yac_cdef_field(char const *name, int const comp_id, int const *point_ids, int const num_pointsets, int collection_size, const char *timestep, int time_unit, int *field_id)
void yac_cdef_field_metadata_instance(int yac_instance_id, const char *comp_name, const char *grid_name, const char *field_name, const char *metadata)
void yac_cget_field_names_instance(int yac_instance_id, const char *comp_name, const char *grid_name, int nbr_fields, const char **field_names)
void yac_cdef_comps_instance(int yac_instance_id, char const **comp_names, int num_comps, int *comp_ids)
void yac_cget_comp_names_instance(int yac_instance_id, int nbr_comps, const char **comp_names)
void yac_cinit_comm(MPI_Comm comm)
yac_abort_func yac_get_abort_handler(void)
void yac_set_abort_handler(yac_abort_func custom_abort)