|
YAC 3.12.0
Yet Another Coupler
|
#include <math.h>#include "utils_common.h"#include "ppm/ppm_xfuncs.h"#include "interpolation/interpolation_internal.h"

Go to the source code of this file.
Data Structures | |
| struct | yac_interpolation_buffer |
Macros | |
| #define | FRAC_MASK_TOL (1e-12) |
| #define | COMPUTE_TGT_FIELD_WGT_FRAC_(TGT_POS, WEIGHT, SCALE) |
| #define | COMPUTE_TGT_FIELD_WGT_NOFRAC_(TGT_POS, WEIGHT, SCALE) |
| #define | COMPUTE_TGT_FIELD_WGT(COMPUTE, SCALE) |
| #define | COMPUTE_TGT_FIELD_WGT_FRAC(SCALE) COMPUTE_TGT_FIELD_WGT(COMPUTE_TGT_FIELD_WGT_FRAC_, SCALE) |
| #define | COMPUTE_TGT_FIELD_WGT_NOFRAC(SCALE) COMPUTE_TGT_FIELD_WGT(COMPUTE_TGT_FIELD_WGT_NOFRAC_, SCALE) |
| #define | NO_SCALING(RESULT) (RESULT) |
| #define | MULT(RESULT) ((RESULT) * scale_factor) |
| #define | ADD(RESULT) ((RESULT) + scale_summand) |
| #define | MULT_ADD(RESULT) ((RESULT) * scale_factor + scale_summand) |
| #define | COMPUTE_FIELD(COMPUTE_FIELD_FRAC, COMPUTE_FIELD_NOFRAC) |
| #define | COMPUTE_TGT_FIELD_FRAC(SCALE) |
| #define | COMPUTE_TGT_FIELD_NOFRAC(SCALE) |
| #define | CHECK_WITH_FRAC_MASK(ROUTINE) |
Enumerations | |
| enum | yac_interpolation_buffer_type { SEND_BUFFER , RECV_BUFFER } |
Functions | |
| static void | compute_tgt_field_wgt (double const *restrict **src_fields, double const *restrict **src_frac_masks, double const *restrict *remote_src_fields, double const *restrict *remote_src_frac_masks, double *restrict *tgt_field, size_t const *restrict tgt_pos, size_t tgt_count, size_t const *restrict prefix_num_src_per_tgt, double const *restrict weights, size_t const *restrict src_field_idx, size_t const *restrict src_idx, size_t num_src_fields, size_t collection_size, double frac_mask_fallback_value, double scale_factor, double scale_summand) |
| Compute target field values optionally using weighted sums of source data and optionally applying fractional masking. | |
| static void | compute_tgt_field (double const *restrict **src_fields, double const *restrict **src_frac_masks, double *restrict *tgt_field, size_t *restrict tgt_buffer_sizes, size_t num_src_fields, size_t collection_size, double frac_mask_fallback_value, double scale_factor, double scale_summand) |
| struct yac_interpolation_buffer | yac_interpolation_buffer_init (Xt_redist *redists, size_t num_fields, size_t collection_size, enum yac_interpolation_buffer_type type) |
| struct yac_interpolation_buffer | yac_interpolation_buffer_init_2 (Xt_redist *redists, size_t *min_buffer_sizes, size_t num_fields, size_t collection_size, enum yac_interpolation_buffer_type type) |
| struct yac_interpolation_buffer | yac_interpolation_buffer_copy (struct yac_interpolation_buffer buffer, size_t num_fields, size_t collection_size) |
| void | yac_interpolation_buffer_free (struct yac_interpolation_buffer *buffer) |
| #define ADD | ( | RESULT | ) | ((RESULT) + scale_summand) |
| #define CHECK_WITH_FRAC_MASK | ( | ROUTINE | ) |
Definition at line 310 of file interpolation_utils.h.
| #define COMPUTE_FIELD | ( | COMPUTE_FIELD_FRAC, | |
| COMPUTE_FIELD_NOFRAC ) |
| #define COMPUTE_TGT_FIELD_FRAC | ( | SCALE | ) |
| #define COMPUTE_TGT_FIELD_NOFRAC | ( | SCALE | ) |
| #define COMPUTE_TGT_FIELD_WGT | ( | COMPUTE, | |
| SCALE ) |
| #define COMPUTE_TGT_FIELD_WGT_FRAC | ( | SCALE | ) | COMPUTE_TGT_FIELD_WGT(COMPUTE_TGT_FIELD_WGT_FRAC_, SCALE) |
| #define COMPUTE_TGT_FIELD_WGT_FRAC_ | ( | TGT_POS, | |
| WEIGHT, | |||
| SCALE ) |
| #define COMPUTE_TGT_FIELD_WGT_NOFRAC | ( | SCALE | ) | COMPUTE_TGT_FIELD_WGT(COMPUTE_TGT_FIELD_WGT_NOFRAC_, SCALE) |
| #define COMPUTE_TGT_FIELD_WGT_NOFRAC_ | ( | TGT_POS, | |
| WEIGHT, | |||
| SCALE ) |
| #define FRAC_MASK_TOL (1e-12) |
| #define MULT | ( | RESULT | ) | ((RESULT) * scale_factor) |
| #define MULT_ADD | ( | RESULT | ) | ((RESULT) * scale_factor + scale_summand) |
| #define NO_SCALING | ( | RESULT | ) | (RESULT) |
| Enumerator | |
|---|---|
| SEND_BUFFER | |
| RECV_BUFFER | |
Definition at line 321 of file interpolation_utils.h.
|
inlinestatic |
|
inlinestatic |
Compute target field values optionally using weighted sums of source data and optionally applying fractional masking.
This routine computes a target field based on the provided source data and weights. This is basically a sparse-matrix-vector multiplication.
If no weights are provided, all source contributions are weighted equally (unweighted sum).
This routine can also optionally apply fractional masking and scaling.
The user has to provide the locally available source field. All source field data required from other processes has to be gathered by the user beforehand and provided in the dedicated buffers.
Each target point tgt_pos[i] is computed as a (weighted or unweighted) sum of source values (from local or remote processes).
| [in] | src_fields | Local source field data. dimensions: [collection_size][num_src_fields][local_points]. |
| [in] | src_frac_masks | Local source fractional mask. (same structure as src_fields; values are expected to be in the range of [0.0;1.0]). |
| [in] | remote_src_fields | Received source field contributions from other ranks dimensions: [collection_size][required_remote_points]. Received source data of all fields of each collection is expected to be in a single contiguous buffer, therefore this argument is missing the "num_src_fields" dimension. |
| [in] | remote_src_frac_masks | Received fractional masks for remote source data (same structure as remote_src_fields). |
| [out] | tgt_field | Target field values to be computed, array of dimension [collection_size][tgt_points]. |
| [in] | tgt_pos | Indices of target points to be computed (length = tgt_count). |
| [in] | tgt_count | Number of target points to be computed. |
| [in] | prefix_num_src_per_tgt | Prefix-sum array encoding the number of source contributions per target. Length = tgt_count + 1Where: prefix_num_src_per_tgt[i+1] - prefix_num_src_per_tgt[i] gives the number of sources for i'th target point. |
| [in] | weights | Interpolation weights for each source contribution. If NULL, all contributions are weighted equally (unweighted sum). |
| [in] | src_field_idx | Source field index for each contribution.SIZE_MAX indicates that the contribution originates from remote process gathered in remote_src_fields and remote_src_frac_masks |
| [in] | src_idx | Source index within the chosen source field. In case of remote data (src_field_idx == SIZE_MAX), it is the index in the contiguous buffer containing received data for all source fields of a collection. |
| [in] | num_src_fields | Number of source fields. |
| [in] | collection_size | Number of field collections. |
| [in] | frac_mask_fallback_value | Value to used, if the sum of fractional mask values of all source contributions for a target is 0.0. If it is YAC_FRAC_MASK_NO_VALUE, no fractional masking will be applied. |
| [in] | scale_factor | Scaling factor applied to the final weighted sum. Not applied, if the frac_mask_fallback_value is assigned to a target. |
| [in] | scale_summand | Summand added to the scaled result. Not applied, if the frac_mask_fallback_value is assigned to a target. |
Definition at line 100 of file interpolation_utils.h.

| struct yac_interpolation_buffer yac_interpolation_buffer_copy | ( | struct yac_interpolation_buffer | buffer, |
| size_t | num_fields, | ||
| size_t | collection_size ) |
Definition at line 114 of file interpolation_utils.c.


| void yac_interpolation_buffer_free | ( | struct yac_interpolation_buffer * | buffer | ) |
| struct yac_interpolation_buffer yac_interpolation_buffer_init | ( | Xt_redist * | redists, |
| size_t | num_fields, | ||
| size_t | collection_size, | ||
| enum yac_interpolation_buffer_type | type ) |
Definition at line 86 of file interpolation_utils.c.


| struct yac_interpolation_buffer yac_interpolation_buffer_init_2 | ( | Xt_redist * | redists, |
| size_t * | min_buffer_sizes, | ||
| size_t | num_fields, | ||
| size_t | collection_size, | ||
| enum yac_interpolation_buffer_type | type ) |
Definition at line 98 of file interpolation_utils.c.

