YAC 3.18.0
Yet Another Coupler
Loading...
Searching...
No Matches
interpolation.h File Reference

Public interface for interpolation execution in YAC. More...

#include <math.h>
Include dependency graph for interpolation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct Xt_redist_ * Xt_redist
 

Functions

struct yac_interpolationyac_interpolation_new (struct yac_collection_selection const *collection_selection, double frac_mask_fallback_value, double scale_factor, double scale_summand)
 Create a new interpolation object.
 
void yac_interpolation_inc_ref_count (struct yac_interpolation *interpolation)
 Increase the reference count of an interpolation.
 
int yac_interpolation_with_frac_mask (struct yac_interpolation *interpolation)
 Query whether interpolation uses fractional masks.
 
void yac_interpolation_add_fixed (struct yac_interpolation *interp, double value, size_t count, size_t *pos)
 Add a fixed-value operator to an interpolation.
 
void yac_interpolation_add_direct (struct yac_interpolation *interp, Xt_redist redist)
 Add a direct redistribution operator.
 
void yac_interpolation_add_direct_mf (struct yac_interpolation *interp, Xt_redist *redists, size_t num_src_fields)
 Add a direct redistribution operator for multiple source fields.
 
void yac_interpolation_add_sum_at_src (struct yac_interpolation *interp, Xt_redist *halo_redists, size_t tgt_count, size_t *num_src_per_tgt, size_t *src_field_idx, size_t *src_idx, size_t num_src_fields, Xt_redist result_redist)
 Add a sum operator where accumulation occurs on source processes.
 
void yac_interpolation_add_sum_at_tgt (struct yac_interpolation *interp, Xt_redist *src_redists, size_t *tgt_pos, size_t tgt_count, size_t *num_src_per_tgt, size_t *src_field_idx, size_t *src_idx, size_t num_src_fields)
 Add a sum operator where accumulation occurs on target processes.
 
void yac_interpolation_add_weight_sum_mvp_at_src (struct yac_interpolation *interp, Xt_redist *halo_redists, size_t tgt_count, size_t *num_src_per_tgt, double *weights, size_t *src_field_idx, size_t *src_idx, size_t num_src_fields, Xt_redist result_redist)
 Add a weighted sum operator (distributed matrix-vector product), which computes the productes at the source processes.
 
void yac_interpolation_add_weight_sum_mvp_at_tgt (struct yac_interpolation *interp, Xt_redist *src_redists, size_t *tgt_pos, size_t tgt_count, size_t *num_src_per_tgt, double *weights, size_t *src_field_idx, size_t *src_idx, size_t num_src_fields)
 Add a weighted sum operator (distributed matrix-vector product), which computes the product at the target processes.
 
struct yac_interpolationyac_interpolation_copy (struct yac_interpolation *interp)
 Create a deep copy of an interpolation object.
 
void yac_interpolation_execute (struct yac_interpolation *interp, double ***src_fields, double **tgt_field)
 Execute interpolation synchronously and write results to the target field.
 
void yac_interpolation_execute_frac (struct yac_interpolation *interp, double ***src_fields, double ***src_frac_masks, double **tgt_field)
 Execute interpolation with fractional masks and write results to the target field.
 
void yac_interpolation_execute_put (struct yac_interpolation *interp, double ***src_fields)
 Provide source field data and start asynchronous execution of interpolation (put phase).
 
void yac_interpolation_execute_put_frac (struct yac_interpolation *interp, double ***src_fields, double ***src_frac_masks)
 Provide source field data with fractional masks and start asynchronous execution of interpolation (put phase).
 
void yac_interpolation_execute_get (struct yac_interpolation *interp, double **tgt_field)
 Complete interpolation and write results to the target field (get phase).
 
void yac_interpolation_execute_get_async (struct yac_interpolation *interp, double **tgt_field)
 Complete interpolation asynchronously and write results to the target field (get phase).
 
int yac_interpolation_execute_put_test (struct yac_interpolation *interp)
 Test whether the asynchronous put phase has completed.
 
int yac_interpolation_execute_get_test (struct yac_interpolation *interp)
 Test whether the asynchronous get phase has completed.
 
void yac_interpolation_execute_wait (struct yac_interpolation *interp)
 Wait for completion of pending asynchronous interpolation operations.
 
void yac_interpolation_delete (struct yac_interpolation *interp)
 Free an interpolation object and release all resources.
 

Variables

double const YAC_FRAC_MASK_NO_VALUE
 

Detailed Description

Public interface for interpolation execution in YAC.

This header provides the API for building, composing, and executing distributed interpolation operators. Interpolation objects encapsulate both numerical operators (fixed values, direct redistribution, sums, weighted sums) and the communication patterns required to apply them in parallel across MPI processes.

An interpolation object may consist of multiple operators that are applied in sequence. At runtime, users can put source fields into the interpolation, optionally provide fractional masks, and obtain the interpolated results on the target fields.

The API supports both synchronous and asynchronous execution, as well as source- and target-side accumulation strategies.

Definition in file interpolation.h.

Typedef Documentation

◆ Xt_redist

typedef struct Xt_redist_* Xt_redist

Definition at line 29 of file interpolation.h.

Function Documentation

◆ yac_interpolation_add_direct()

void yac_interpolation_add_direct ( struct yac_interpolation * interp,
Xt_redist redist )

Add a direct redistribution operator.

Parameters
[in,out]interpInterpolation object.
[in]redistRedistribution handle from yaxt.

Definition at line 127 of file interpolation.c.

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

◆ yac_interpolation_add_direct_mf()

void yac_interpolation_add_direct_mf ( struct yac_interpolation * interp,
Xt_redist * redists,
size_t num_src_fields )

Add a direct redistribution operator for multiple source fields.

Parameters
[in,out]interpInterpolation object.
[in]redistsArray of redistribution handles (length = num_src_fields).
[in]num_src_fieldsNumber of source fields to redistribute.

Definition at line 134 of file interpolation.c.

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

◆ yac_interpolation_add_fixed()

void yac_interpolation_add_fixed ( struct yac_interpolation * interp,
double value,
size_t count,
size_t * pos )

Add a fixed-value operator to an interpolation.

Parameters
[in,out]interpInterpolation object.
[in]valueFixed value to assign.
[in]countNumber of target positions to assign.
[in]posArray of target indices of length count.

Definition at line 117 of file interpolation.c.

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

◆ yac_interpolation_add_sum_at_src()

void yac_interpolation_add_sum_at_src ( struct yac_interpolation * interp,
Xt_redist * halo_redists,
size_t tgt_count,
size_t * num_src_per_tgt,
size_t * src_field_idx,
size_t * src_idx,
size_t num_src_fields,
Xt_redist result_redist )

Add a sum operator where accumulation occurs on source processes.

Parameters
[in,out]interpInterpolation object.
[in]halo_redistsRedistribution handles for halo exchanges.
[in]tgt_countNumber of target points.
[in]num_src_per_tgtArray giving number of source points per target.
[in]src_field_idxArray of source field indices.
[in]src_idxArray of source local indices.
[in]num_src_fieldsNumber of source fields.
[in]result_redistRedistribution handle for final results.

Definition at line 144 of file interpolation.c.

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

◆ yac_interpolation_add_sum_at_tgt()

void yac_interpolation_add_sum_at_tgt ( struct yac_interpolation * interp,
Xt_redist * src_redists,
size_t * tgt_pos,
size_t tgt_count,
size_t * num_src_per_tgt,
size_t * src_field_idx,
size_t * src_idx,
size_t num_src_fields )

Add a sum operator where accumulation occurs on target processes.

Parameters
[in,out]interpInterpolation object.
[in]src_redistsRedistribution handles for source fields.
[in]tgt_posTarget positions.
[in]tgt_countNumber of target points.
[in]num_src_per_tgtArray giving number of source points per target.
[in]src_field_idxArray of source field indices.
[in]src_idxArray of source local indices.
[in]num_src_fieldsNumber of source fields.

Definition at line 158 of file interpolation.c.

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

◆ yac_interpolation_add_weight_sum_mvp_at_src()

void yac_interpolation_add_weight_sum_mvp_at_src ( struct yac_interpolation * interp,
Xt_redist * halo_redists,
size_t tgt_count,
size_t * num_src_per_tgt,
double * weights,
size_t * src_field_idx,
size_t * src_idx,
size_t num_src_fields,
Xt_redist result_redist )

Add a weighted sum operator (distributed matrix-vector product), which computes the productes at the source processes.

Parameters
[in,out]interpInterpolation object.
[in]halo_redistsRedistribution handles for halo exchanges.
[in]tgt_countNumber of target points.
[in]num_src_per_tgtArray giving number of source points per target.
[in]weightsArray of interpolation weights.
[in]src_field_idxArray of source field indices.
[in]src_idxArray of source local indices.
[in]num_src_fieldsNumber of source fields.
[in]result_redistRedistribution handle for final results.

Definition at line 172 of file interpolation.c.

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

◆ yac_interpolation_add_weight_sum_mvp_at_tgt()

void yac_interpolation_add_weight_sum_mvp_at_tgt ( struct yac_interpolation * interp,
Xt_redist * src_redists,
size_t * tgt_pos,
size_t tgt_count,
size_t * num_src_per_tgt,
double * weights,
size_t * src_field_idx,
size_t * src_idx,
size_t num_src_fields )

Add a weighted sum operator (distributed matrix-vector product), which computes the product at the target processes.

Parameters
[in,out]interpInterpolation object.
[in]src_redistsRedistribution handles for source fields.
[in]tgt_posTarget positions.
[in]tgt_countNumber of target points.
[in]num_src_per_tgtArray giving number of source points per target.
[in]weightsArray of interpolation weights.
[in]src_field_idxArray of source field indices.
[in]src_idxArray of source local indices.
[in]num_src_fieldsNumber of source fields.

Definition at line 186 of file interpolation.c.

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

◆ yac_interpolation_copy()

struct yac_interpolation * yac_interpolation_copy ( struct yac_interpolation * interp)

Create a deep copy of an interpolation object.

Parameters
[in]interpInterpolation object to copy.
Returns
Newly allocated copy of the interpolation object.

Definition at line 200 of file interpolation.c.

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

◆ yac_interpolation_delete()

void yac_interpolation_delete ( struct yac_interpolation * interp)

Free an interpolation object and release all resources.

Parameters
[in]interpInterpolation object to delete (NULL is safe).

Definition at line 373 of file interpolation.c.

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

◆ yac_interpolation_execute()

void yac_interpolation_execute ( struct yac_interpolation * interp,
double *** src_fields,
double ** tgt_field )

Execute interpolation synchronously and write results to the target field.

Parameters
[in]interpInterpolation object.
[in]src_fieldsSource field data
dimensions: [collection_idx][field_idx][local_idx]
[out]tgt_fieldTarget field data
dimensions: [collection_idx][local_idx]

Definition at line 253 of file interpolation.c.

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

◆ yac_interpolation_execute_frac()

void yac_interpolation_execute_frac ( struct yac_interpolation * interp,
double *** src_fields,
double *** src_frac_masks,
double ** tgt_field )

Execute interpolation with fractional masks and write results to the target field.

Parameters
[in]interpInterpolation object.
[in]src_fieldsSource field data, pre-multiplied by the corresponding fractional mask values
dimensions: [collection_idx][field_idx][local_idx]
[in]src_frac_masksFractional mask values
dimensions: [collection_idx][field_idx][local_idx]
[out]tgt_fieldTarget field data
dimensions: [collection_idx][local_idx]

Definition at line 230 of file interpolation.c.

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

◆ yac_interpolation_execute_get()

void yac_interpolation_execute_get ( struct yac_interpolation * interp,
double ** tgt_field )

Complete interpolation and write results to the target field (get phase).

Parameters
[in]interpInterpolation object.
[out]tgt_fieldTarget field data
dimensions: [collection_idx][local_idx]

Definition at line 309 of file interpolation.c.

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

◆ yac_interpolation_execute_get_async()

void yac_interpolation_execute_get_async ( struct yac_interpolation * interp,
double ** tgt_field )

Complete interpolation asynchronously and write results to the target field (get phase).

Parameters
[in]interpInterpolation object.
[out]tgt_fieldTarget field data
dimensions: [collection_idx][local_idx]
Remarks
yac_interpolation_execute_wait has to be called to ensure finalisation of asynchronous execution.

Definition at line 320 of file interpolation.c.

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

◆ yac_interpolation_execute_get_test()

int yac_interpolation_execute_get_test ( struct yac_interpolation * interp)

Test whether the asynchronous get phase has completed.

Parameters
[in]interpInterpolation object.
Returns
Nonzero if the get phase has completed, 0 otherwise.

Definition at line 343 of file interpolation.c.

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

◆ yac_interpolation_execute_put()

void yac_interpolation_execute_put ( struct yac_interpolation * interp,
double *** src_fields )

Provide source field data and start asynchronous execution of interpolation (put phase).

Parameters
[in]interpInterpolation object.
[in]src_fieldsSource field data
dimensions: [collection_idx][field_idx][local_idx]

Definition at line 295 of file interpolation.c.

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

◆ yac_interpolation_execute_put_frac()

void yac_interpolation_execute_put_frac ( struct yac_interpolation * interp,
double *** src_fields,
double *** src_frac_masks )

Provide source field data with fractional masks and start asynchronous execution of interpolation (put phase).

Parameters
[in]interpInterpolation object.
[in]src_fieldsSource field data, pre-multiplied by the corresponding fractional mask values
dimensions: [collection_idx][field_idx][local_idx]
[in]src_frac_masksFractional mask values
dimensions: [collection_idx][field_idx][local_idx]

Definition at line 272 of file interpolation.c.

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

◆ yac_interpolation_execute_put_test()

int yac_interpolation_execute_put_test ( struct yac_interpolation * interp)

Test whether the asynchronous put phase has completed.

Parameters
[in]interpInterpolation object.
Returns
Nonzero if the put phase has completed, 0 otherwise.

Definition at line 331 of file interpolation.c.

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

◆ yac_interpolation_execute_wait()

void yac_interpolation_execute_wait ( struct yac_interpolation * interp)

Wait for completion of pending asynchronous interpolation operations.

This routine blocks until all outstanding put/get operations associated with interp have finished.

Parameters
[in]interpInterpolation object.

Definition at line 355 of file interpolation.c.

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

◆ yac_interpolation_inc_ref_count()

void yac_interpolation_inc_ref_count ( struct yac_interpolation * interpolation)

Increase the reference count of an interpolation.

Parameters
[in,out]interpolationInterpolation object.

Definition at line 362 of file interpolation.c.

Here is the caller graph for this function:

◆ yac_interpolation_new()

struct yac_interpolation * yac_interpolation_new ( struct yac_collection_selection const * collection_selection,
double frac_mask_fallback_value,
double scale_factor,
double scale_summand )

Create a new interpolation object.

This constructor initializes a new interpolation structure operating on the provided source collection selection. The target field space is assumed to be contiguous with a collection size equal to the number of selected source collections.

Parameters
[in]collection_selectionSelection of field collections to which this interpolation applies. Must not be NULL.
[in]frac_mask_fallback_valueValue to be assigned to target points whose sum of fractional mask values of all contributing source points is zero.
If the value YAC_FRAC_MASK_NO_VALUE is provided, fractional masking is deactivated for this interpolation object.
[in]scale_factorScaling factor applied to all interpolated target points (except those receiving a fixed value).
[in]scale_summandScaling summand added to all interpolated target points (except those receiving a fixed value).
Returns
Newly allocated interpolation object.
Remarks
  • The collection_selection applies exclusively to the source side.
  • The target side always assumes a contiguous field collection layout, with size equal to yac_collection_selection_get_size(collection_selection).

Definition at line 54 of file interpolation.c.

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

◆ yac_interpolation_with_frac_mask()

int yac_interpolation_with_frac_mask ( struct yac_interpolation * interpolation)

Query whether interpolation uses fractional masks.

Parameters
[in]interpolationInterpolation object.
Returns
Nonzero if fractional masking is enabled, 0 otherwise.

Definition at line 367 of file interpolation.c.

Here is the caller graph for this function:

Variable Documentation

◆ YAC_FRAC_MASK_NO_VALUE

double const YAC_FRAC_MASK_NO_VALUE
extern

Value used to indicate that not fractional masking is to be use

Definition at line 27 of file interpolation.c.