64 config->collection_selection = NULL;
68 config->scaling_factor = 1.0;
69 config->scaling_summand = 0.0;
70 config->yaxt_exchanger_name = NULL;
78 if (
config == NULL)
return;
80 free(
config->yaxt_exchanger_name);
87 if (
src == NULL)
return NULL;
91 memcpy(copy,
src,
sizeof(*copy));
94 if (
src->yaxt_exchanger_name != NULL) {
110 "invalid reorder value");
122 "invalid reorder value");
137 config->collection_selection =
150 "collection_size of collection_selection must be > 0");
153 config->collection_selection =
164 "%lf is not a valid fractional masking fallback value",
197 free(
config->yaxt_exchanger_name);
226 config->collection_selection != NULL,
"collection_selection is unset");
228 return config->collection_selection;
236 return config->frac_mask_fallback_value;
244 return config->scaling_factor;
252 return config->scaling_summand;
260 return config->yaxt_exchanger_name;
272 ret = (a == NULL) - (b == NULL);
324 int pack_size_int, pack_size_dble;
325 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &pack_size_int), comm);
326 yac_mpi_call(MPI_Pack_size(1, MPI_DOUBLE, comm, &pack_size_dble), comm);
328 return pack_size_int +
333 (cfg != NULL)?cfg->collection_selection:NULL, comm) +
335 "yac_interpolation_gen_config_get_pack_size",
336 (cfg != NULL)?cfg->yaxt_exchanger_name:NULL, comm, 1);
341 void *
buffer,
int buffer_size,
int * position, MPI_Comm comm) {
345 int reorder = (int)cfg->reorder;
347 MPI_Pack(&reorder, 1, MPI_INT,
buffer, buffer_size, position, comm), comm);
351 &cfg->frac_mask_fallback_value, 1, MPI_DOUBLE,
buffer, buffer_size,
352 position, comm), comm);
355 &cfg->scaling_factor, 1, MPI_DOUBLE,
buffer, buffer_size,
356 position, comm), comm);
359 &cfg->scaling_summand, 1, MPI_DOUBLE,
buffer, buffer_size,
360 position, comm), comm);
363 cfg->collection_selection,
buffer, buffer_size, position, comm);
366 "yac_interpolation_gen_config_pack",
367 cfg->yaxt_exchanger_name,
buffer, buffer_size, position, comm, 1);
371 void const *
buffer,
int buffer_size,
int *position, MPI_Comm comm) {
377 MPI_Unpack(
buffer, buffer_size, position, &reorder_int, 1, MPI_INT, comm),
383 buffer, buffer_size, position,
384 &cfg->frac_mask_fallback_value, 1, MPI_DOUBLE, comm), comm);
387 buffer, buffer_size, position,
388 &cfg->scaling_factor, 1, MPI_DOUBLE, comm), comm);
391 buffer, buffer_size, position,
392 &cfg->scaling_summand, 1, MPI_DOUBLE, comm), comm);
394 cfg->collection_selection =
397 cfg->yaxt_exchanger_name =
#define YAC_ASSERT(exp, msg)
size_t yac_collection_selection_get_collection_size(struct yac_collection_selection const *collection_selection)
Get the size of the collection selection.
struct yac_collection_selection * yac_collection_selection_unpack(void const *buffer, int buffer_size, int *position, MPI_Comm comm)
Unpack a collection selection from a contiguous MPI buffer.
size_t yac_collection_selection_get_pack_size(struct yac_collection_selection const *sel, MPI_Comm comm)
Compute the MPI pack size of a collection selection.
void yac_collection_selection_delete(struct yac_collection_selection *collection_selection)
Delete a collection selection object.
int yac_collection_selection_compare(struct yac_collection_selection const *a, struct yac_collection_selection const *b)
Compare two collection selections.
struct yac_collection_selection * yac_collection_selection_copy(const struct yac_collection_selection *collection_selection)
Selection of indices from a collection.
void yac_collection_selection_pack(struct yac_collection_selection const *sel, void *buffer, int buffer_size, int *position, MPI_Comm comm)
Pack a collection selection into a contiguous MPI buffer.
struct yac_collection_selection * yac_collection_selection_new(size_t collection_size, size_t const *selection_indices)
Create a new collection selection.
yac_interp_weights_reorder_type
@ YAC_MAPPING_ON_TGT
weights will be applied at target processes
@ YAC_MAPPING_ON_SRC
weights will be applied at source processes
double const YAC_FRAC_MASK_NO_VALUE
void yac_interpolation_gen_config_set_reorder(struct yac_interpolation_gen_config *config, enum yac_interp_weights_reorder_type reorder)
Set the reordering strategy for interpolation weights.
void yac_interpolation_gen_config_set_collection_size(struct yac_interpolation_gen_config *config, size_t collection_size)
Set the number of contiguous fields (starting at "0") in the field collection.
void yac_interpolation_gen_config_set_yaxt_exchanger_name_f2c(struct yac_interpolation_gen_config *config, char const *name)
enum yac_interp_weights_reorder_type yac_interpolation_gen_config_get_reorder(struct yac_interpolation_gen_config const *config)
Get the configured reordering strategy.
int yac_interpolation_gen_config_compare(struct yac_interpolation_gen_config const *a, struct yac_interpolation_gen_config const *b)
Compare two interpolation configuration structures.
void yac_interpolation_gen_config_set_reorder_f2c(struct yac_interpolation_gen_config *config, int reorder)
double yac_interpolation_gen_config_get_frac_mask_fallback_value(struct yac_interpolation_gen_config const *config)
Get the configured fractional mask fallback value.
void yac_interpolation_gen_config_set_collection_selection(struct yac_interpolation_gen_config *config, struct yac_collection_selection const *collection_selection)
Set the collection selection of source field in the source field collection.
void yac_interpolation_gen_config_set_scaling_factor(struct yac_interpolation_gen_config *config, double scaling_factor)
Set the multiplicative scaling factor.
double yac_interpolation_gen_config_get_scaling_factor(struct yac_interpolation_gen_config const *config)
Get the configured scaling factor.
struct yac_collection_selection const * yac_interpolation_gen_config_get_collection_selection(struct yac_interpolation_gen_config const *config)
Get the configured collection selection.
size_t yac_interpolation_gen_config_get_pack_size(struct yac_interpolation_gen_config const *cfg, MPI_Comm comm)
Get the MPI packing size of an interpolation generation configuration.
void yac_interpolation_gen_config_set_yaxt_exchanger_name(struct yac_interpolation_gen_config *config, char const *name)
Set the name of the Yaxt exchanger.
const char * yac_interpolation_gen_config_get_yaxt_exchanger_name(struct yac_interpolation_gen_config const *config)
Get the configured Yaxt exchanger name.
void yac_interpolation_gen_config_delete(struct yac_interpolation_gen_config *config)
Release a interpolation generation configuration structure allocated by yac_interpolation_gen_config_...
void yac_interpolation_gen_config_set_frac_mask_fallback_value(struct yac_interpolation_gen_config *config, double frac_mask_fallback_value)
Set the fractional mask fallback value.
struct yac_interpolation_gen_config * yac_interpolation_gen_config_copy(struct yac_interpolation_gen_config const *src)
Create a copy of an interpolation generation configuration.
struct yac_interpolation_gen_config * yac_interpolation_gen_config_new(void)
Allocate and initialise an interpolation generation configuration structure.
void yac_interpolation_gen_config_pack(struct yac_interpolation_gen_config const *cfg, void *buffer, int buffer_size, int *position, MPI_Comm comm)
Pack an interpolation generation configuration into an MPI buffer.
void yac_interpolation_gen_config_set_scaling_summand(struct yac_interpolation_gen_config *config, double scaling_summand)
Set the additive scaling summand.
double yac_interpolation_gen_config_get_scaling_summand(struct yac_interpolation_gen_config const *config)
Get the configured scaling summand.
struct yac_interpolation_gen_config * yac_interpolation_gen_config_unpack(void const *buffer, int buffer_size, int *position, MPI_Comm comm)
Unpack an interpolation generation configuration from an MPI buffer.
Defines internal basic interpolation definitions.
#define YAC_FRAC_MASK_VALUE_IS_VALID(value)
Test whether a fractional mask value is valid.
add versions of standard API functions not returning on error
Configuration structure for interpolation generation.
struct yac_collection_selection * collection_selection
char * yaxt_exchanger_name
double frac_mask_fallback_value
enum yac_interp_weights_reorder_type reorder
static struct yac_interp_method_config * config
#define YAC_ASSERT_F(exp, format,...)
size_t yac_string_get_pack_size(char const *caller, char const *string, MPI_Comm comm, int allow_null)
Compute number of bytes required to pack a string for MPI transport.
char * yac_string_unpack(void const *buffer, int buffer_size, int *position, MPI_Comm comm)
Unpack a C string from a buffer packed with yac_string_pack.
void yac_string_pack(char const *caller, char const *string, void *buffer, int buffer_size, int *position, MPI_Comm comm, int allow_null)
Pack a C string into a provided buffer using MPI_Pack semantics.
#define yac_mpi_call(call, comm)