YAC 3.13.2
Yet Another Coupler
Loading...
Searching...
No Matches
interp_weights.h File Reference
#include "yac_types.h"
#include "location.h"
#include "interpolation/interpolation.h"
Include dependency graph for interp_weights.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  yac_interp_weights_data
 

Macros

#define YAC_WEIGHT_FILE_ON_EXISTING_DEFAULT_VALUE   (YAC_WEIGHT_FILE_OVERWRITE)
 

Enumerations

enum  yac_interp_weights_reorder_type { YAC_MAPPING_ON_SRC , YAC_MAPPING_ON_TGT }
 
enum  yac_weight_file_on_existing { YAC_WEIGHT_FILE_ERROR = 0 , YAC_WEIGHT_FILE_KEEP = 1 , YAC_WEIGHT_FILE_OVERWRITE = 2 , YAC_WEIGHT_FILE_UNDEFINED = 3 }
 

Functions

struct yac_interp_weightsyac_interp_weights_new (MPI_Comm comm, enum yac_location tgt_location, enum yac_location *src_locations, size_t num_src_fields)
 
void yac_interp_weights_write_to_file (struct yac_interp_weights *weights, char const *filename, char const *src_grid_name, char const *tgt_grid_name, size_t src_grid_size, size_t tgt_grid_size, enum yac_weight_file_on_existing on_existing)
 
struct yac_interpolationyac_interp_weights_get_interpolation (struct yac_interp_weights *weights, enum yac_interp_weights_reorder_type reorder, size_t collection_size, double frac_mask_fallback_value, double scaling_factor, double scaling_summand, char const *yaxt_exchanger_name, int is_source, int is_target)
 
struct yac_interpolationyac_interp_weights_get_interpolation_ext (struct yac_interp_weights const *weights, struct yac_interpolation_gen_config const *interp_gen_config, int is_source, int is_target)
 
void yac_interp_weights_get_interpolation_raw (struct yac_interp_weights *weights, size_t collection_size, double frac_mask_fallback_value, double scaling_factor, double scaling_summand, char const *yaxt_exchanger_name, struct yac_interpolation_exchange **interpolation_exchange, struct yac_interp_weights_data *interp_weights_data, int is_source, int is_target)
 
void yac_interp_weights_get_interpolation_raw_ext (struct yac_interp_weights const *weights, struct yac_interpolation_gen_config const *interp_gen_config, struct yac_interpolation_exchange **interpolation_exchange, struct yac_interp_weights_data *interp_weights_data, int is_source, int is_target)
 
size_t yac_interp_weights_get_interp_count (struct yac_interp_weights *weights)
 
yac_intyac_interp_weights_get_interp_tgt (struct yac_interp_weights *weights)
 
void yac_interp_weights_delete (struct yac_interp_weights *weights)
 
void yac_interp_weights_data_init (struct yac_interp_weights_data *interp_weights_data)
 
struct yac_interp_weights_data yac_interp_weights_data_copy (struct yac_interp_weights_data interp_weights_data)
 
void yac_interp_weights_data_free (struct yac_interp_weights_data interp_weights_data)
 

Macro Definition Documentation

◆ YAC_WEIGHT_FILE_ON_EXISTING_DEFAULT_VALUE

#define YAC_WEIGHT_FILE_ON_EXISTING_DEFAULT_VALUE   (YAC_WEIGHT_FILE_OVERWRITE)

Definition at line 54 of file interp_weights.h.

Enumeration Type Documentation

◆ yac_interp_weights_reorder_type

Enumerator
YAC_MAPPING_ON_SRC 

weights will be applied at source processes

YAC_MAPPING_ON_TGT 

weights will be applied at target processes

Definition at line 42 of file interp_weights.h.

◆ yac_weight_file_on_existing

Enumerator
YAC_WEIGHT_FILE_ERROR 

error when weight file existis already

YAC_WEIGHT_FILE_KEEP 

keep existing weight file

YAC_WEIGHT_FILE_OVERWRITE 

overwrite existing weight file

YAC_WEIGHT_FILE_UNDEFINED 

Definition at line 47 of file interp_weights.h.

Function Documentation

◆ yac_interp_weights_data_copy()

struct yac_interp_weights_data yac_interp_weights_data_copy ( struct yac_interp_weights_data interp_weights_data)

Generates a copy of a provided instance of type yac_interp_weights_data

Parameters
[in]interp_weights_datadata to be copied
Returns
copy of provided instance of type yac_interp_weights_data

Definition at line 6433 of file interp_weights.c.

Here is the caller graph for this function:

◆ yac_interp_weights_data_free()

void yac_interp_weights_data_free ( struct yac_interp_weights_data interp_weights_data)

Frees data associated with an instance of type yac_interp_weights_data

Parameters
[in,out]interp_weights_datadata to be free
Remarks
an object of type yac_interp_weights_data can be generate by yac_interp_weights_get_interpolation_raw

Definition at line 6479 of file interp_weights.c.

Here is the caller graph for this function:

◆ yac_interp_weights_data_init()

void yac_interp_weights_data_init ( struct yac_interp_weights_data * interp_weights_data)

Initialises an instance of type yac_interp_weights_data with empty data

Parameters
[in,out]interp_weights_datadata to be initialised

Definition at line 6426 of file interp_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_interp_weights_delete()

void yac_interp_weights_delete ( struct yac_interp_weights * weights)

Destructor for interpolation weights.

Parameters
[in,out]weightsinterpolation weights

Definition at line 6416 of file interp_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_interp_weights_get_interp_count()

size_t yac_interp_weights_get_interp_count ( struct yac_interp_weights * weights)

returns the count of all target for which the weights contain a stencil

Parameters
[in]weightsinterpolation weights
Returns
count of all targets in weights with a stencil

Definition at line 6392 of file interp_weights.c.

Here is the caller graph for this function:

◆ yac_interp_weights_get_interp_tgt()

yac_int * yac_interp_weights_get_interp_tgt ( struct yac_interp_weights * weights)

returns the global ids of all targets for which the weights contain a stencil

Parameters
[in]weightsinterpolation weights
Returns
global ids of all targets in weights with a stencil

Definition at line 6398 of file interp_weights.c.

Here is the caller graph for this function:

◆ yac_interp_weights_get_interpolation()

struct yac_interpolation * yac_interp_weights_get_interpolation ( struct yac_interp_weights * weights,
enum yac_interp_weights_reorder_type reorder,
size_t collection_size,
double frac_mask_fallback_value,
double scaling_factor,
double scaling_summand,
char const * yaxt_exchanger_name,
int is_source,
int is_target )

generates an interpolation from interpolation weights

Parameters
[in]weightsinterpolation weights
[in]reorderdetermines at which processes the weights are to be applied
[in]collection_sizecollection size
[in]frac_mask_fallback_valuefallback value for dynamic fractional masking
[in]scaling_factorscaling factor
[in]scaling_summandscaling summand
[in]yaxt_exchanger_namename of the yaxt exchanger that is to be used in the interpolation
[in]is_sourcedefined whether the local process is a source
[in]is_targetdefined whether the local process is a target
Returns
interpolation
Remarks
if frac_mask_fallback_value != YAC_FRAC_MASK_NO_VALUE, dynamic fractional masking will be used
all target field values, whose source points are not masked by the fractional mask, that receive an interpolation value, which is not a fixed value will by scaled by the following formula:
y = scaling_factor * x + scaling_summand
if yaxt_exchanger_name == NULL, the default exchanger will be used
The interpolation weights may contain stencils for processes, which are not actually a target (is_target == 0). In this case the respective stencils will be ignored.

Definition at line 4837 of file interp_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_interp_weights_get_interpolation_ext()

struct yac_interpolation * yac_interp_weights_get_interpolation_ext ( struct yac_interp_weights const * weights,
struct yac_interpolation_gen_config const * interp_gen_config,
int is_source,
int is_target )

Generates an interpolation from interpolation weights.

Parameters
[in]weightsPointer to a valid interpolation weights object.
[in]interp_gen_configPointer to a configuration structure defining the interpolation generation options.
[in]is_sourceDefined whether the local process is a source.
[in]is_targetDefined whether the local process is a target.

Definition at line 4858 of file interp_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_interp_weights_get_interpolation_raw()

void yac_interp_weights_get_interpolation_raw ( struct yac_interp_weights * weights,
size_t collection_size,
double frac_mask_fallback_value,
double scaling_factor,
double scaling_summand,
char const * yaxt_exchanger_name,
struct yac_interpolation_exchange ** interpolation_exchange,
struct yac_interp_weights_data * interp_weights_data,
int is_source,
int is_target )

generates a raw interpolation from interpolation weights

In an exchange, the interpolation will receive on all target process the source points required to compute the local target points based on the interpolation data, which is provied by this routine as well.

Parameters
[in]weightsinterpolation weights
[in]collection_sizecollection size
[in]frac_mask_fallback_valuefallback value for dynamic fractional masking
[in]scaling_factorscaling factor
[in]scaling_summandscaling summand
[in]yaxt_exchanger_namename of the yaxt exchanger that is to be used in the interpolation
[out]interpolation_exchangeinterpolation exchange structure
[out]interp_weights_datainterpolation data required to compute local target points from the received source points
[in]is_sourcedefined whether the local process is a source
[in]is_targetdefined whether the local process is a target
Remarks
if yaxt_exchanger_name == NULL, the default exchanger will be used
memory associated with interp_weights_data can be free by a call to yac_interp_weights_data_free
The interpolation weights may contain stencils for processes, which are not actually a target (is_target == 0). In this case the respective stencils will be ignored.

Definition at line 5402 of file interp_weights.c.

Here is the call graph for this function:

◆ yac_interp_weights_get_interpolation_raw_ext()

void yac_interp_weights_get_interpolation_raw_ext ( struct yac_interp_weights const * weights,
struct yac_interpolation_gen_config const * interp_gen_config,
struct yac_interpolation_exchange ** interpolation_exchange,
struct yac_interp_weights_data * interp_weights_data,
int is_source,
int is_target )

generates a raw interpolation from interpolation weights

In an exchange, the interpolation will receive on all target process the source points required to compute the local target points based on the interpolation data, which is provied by this routine as well.

Parameters
[in]weightsinterpolation weights
[in]interp_gen_configPointer to a configuration structure defining the interpolation generation options. (Reorder configuration is ignored for raw interpolation.)
[out]interpolation_exchangeinterpolation exchange structure
[out]interp_weights_datainterpolation data required to compute local target points from the received source points
[in]is_sourcedefined whether the local process is a source
[in]is_targetdefined whether the local process is a target
Remarks
if yaxt_exchanger_name == NULL, the default exchanger will be used
memory associated with interp_weights_data can be free by a call to yac_interp_weights_data_free
The interpolation weights may contain stencils for processes, which are not actually a target (is_target == 0). In this case the respective stencils will be ignored.

Definition at line 5422 of file interp_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_interp_weights_new()

struct yac_interp_weights * yac_interp_weights_new ( MPI_Comm comm,
enum yac_location tgt_location,
enum yac_location * src_locations,
size_t num_src_fields )

Constructor for interpolation weights.

Parameters
[in]commMPI communicator
[in]tgt_locationlocation of target field
[in]src_locationslocations of source fields
[in]num_src_fieldsnumber of source fields
Returns
interpolation weights

Definition at line 152 of file interp_weights.c.

Here is the caller graph for this function:

◆ yac_interp_weights_write_to_file()

void yac_interp_weights_write_to_file ( struct yac_interp_weights * weights,
char const * filename,
char const * src_grid_name,
char const * tgt_grid_name,
size_t src_grid_size,
size_t tgt_grid_size,
enum yac_weight_file_on_existing on_existing )

writes interpolation weights to file

Parameters
[in]weightsinterpolation weights
[in]filenamefile name
[in]src_grid_namename of the source grid
[in]tgt_grid_namename of the target grid
[in]src_grid_sizeglobal size of the source grid
[in]tgt_grid_sizeglobal size of the target grid
[in]on_existingspecifies how YAC is supposed to handle the case of an already existing file with the same name
Remarks
this call is collective
Global grid size argument can be either the global grid size or zero. If a valid global grid size was provided by at least one process, it will be added as a dimension to the weight file.

Definition at line 6139 of file interp_weights.c.

Here is the call graph for this function:
Here is the caller graph for this function: