Internal constructor for the "sum_mvp_at_src" interpolation operator.
This function creates a source-side accumulation (sum) interpolation operator, where all source contributions are first locally combined (optionally weighted and/or masked) on the source processes before being redistributed to the target ranks using the provided exchange mappings (src2halo and result2tgt respectivily).
The operator represents the "sum over source" phase of the interpolation matrix-vector product (MVP) and performs the following conceptual operations:
- Halo Exchange: Local source fields (and optionally fractional masks) are communicated between source processes according to the
src2halo exchange pattern to ensure each process has access to all source data required by its local stencils.
- Local Accumulation: Each process computes the contributions of its available source points to all target points assigned to it, according to the interpolation weights.
- Result Redistribution: The locally computed target sums are sent to their owning target ranks via the
result2tgt exchange mapping.
Unlike the public constructor yac_interp_operator_sum_mvp_at_src_new(), this routine takes already prepared internal data structures, such as initialized interpolation buffers and exchange descriptors. It is also used internally by yac_interp_operator_sum_mvp_at_src_copy().
The resulting operator computes, for each target point t, the following:
where:
is the set of source contributions for target t (including both locally owned and halo-exchanged source values),
is the interpolation weight associated with contribution i (or 1.0 if unweighted),
identifies the source field index (or SIZE_MAX for a contribution originating from a remote process),
is the local source index within that field (or the receive buffer)
If fractional masks are enabled (with_frac_mask != 0), each source value is multiplied by its corresponding mask before accumulation. The sum of all mask values for a given target is used to normalize the result; if the normalization denominator is zero, the provided fallback value (see frac_mask_fallback_value during execution) is used instead.
- Parameters
-
| [in] | collection_selection | Selection of field collections to which this operator applies. |
| [in] | halo_data | Interpolation buffer used to receive halo-exchanged source data from neighbouring processes (as defined by src2halo). |
| [in] | result_data | Interpolation buffer holding locally computed target field results before redistribution to target ranks (as defined by result2tgt). |
| [in] | src2halo | Exchange structure describing the halo redistribution pattern for source data between source processes. |
| [in] | result2tgt | Exchange structure describing redistribution of computed target field results from source processes to target processes. |
| [in] | tgt_count | Number of target points handled by this interpolation operator. |
| [in] | prefix_num_src_per_tgt | Prefix-sum array of length tgt_count + 1. Defines the cumulative number of source contributions per target point. The number of source entries for target i is given by: . |
| [in] | weights | Interpolation weights for all source contributions (length = prefix_num_src_per_tgt[tgt_count]). If NULL, an unweighted sum is performed. |
| [in] | src_field_idx | Array mapping each source contribution to a source field index (same length as weights). The special value SIZE_MAX denotes a contribution from a halo (non-local) source. |
| [in] | src_idx | Array of source indices for each source contribution (same length as weights). Defines the position within the local source field data or halo buffer. |
| [in] | num_src_fields | Number of source fields in the interpolation setup. |
| [in] | with_frac_mask | Non-zero enables fractional mask support. Both source values and masks are then redistributed via src2halo. |
| [in,out] | ref_count | Optional external reference counter. If non-NULL, it is incremented and stored. Upon deletion, it is decremented. This allows shared ownership of data arrays among copies of the same operator. |
- Returns
- Newly allocated interpolation operator implementing "sum_mvp_at_src" semantics.
Definition at line 240 of file interp_operator_sum_mvp_at_src.c.