YetAnotherCoupler 3.5.2
Loading...
Searching...
No Matches
interpolation.h
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef INTERPOLATION_H
6#define INTERPOLATION_H
7
8// YAC PUBLIC HEADER START
9
38#include <yaxt.h>
39#include <math.h>
40
41extern double const YAC_FRAC_MASK_NO_VALUE;
42extern double const YAC_FRAC_MASK_UNDEF;
43
44// nan is a valid value for frac_mask_fallback_value, therefore when
45// comparing against it the result can change depending on compiler
46// optimisation
47#define YAC_FRAC_MASK_VALUE_IS_SET(value) \
48 (!isnormal(value) || ((value) != YAC_FRAC_MASK_UNDEF))
49#define YAC_FRAC_MASK_VALUE_IS_VALID(value) \
50 (!isnormal(value) || \
51 (((value) != YAC_FRAC_MASK_UNDEF) && ((value) != YAC_FRAC_MASK_NO_VALUE)))
52
54
57 double scale_factor, double scale_summand);
58
59void yac_interpolation_inc_ref_count(struct yac_interpolation * interpolation);
60
61int yac_interpolation_with_frac_mask(struct yac_interpolation * interpolation);
62
64 struct yac_interpolation * interp, double value, size_t count, size_t * pos);
65
67 struct yac_interpolation * interp, Xt_redist redist);
68
70 struct yac_interpolation * interp, Xt_redist * redists, size_t num_src_fields);
71
72/*
73 * The target points consist of the sum of a number of source points. The sum
74 * can be computed on the source or target processes.
75 */
77 struct yac_interpolation * interp, Xt_redist * halo_redists,
78 size_t tgt_count, size_t * num_src_per_tgt,
79 size_t * src_field_idx, size_t * src_idx,
80 size_t num_src_fields, Xt_redist result_redist);
81
83 struct yac_interpolation * interp, Xt_redist * src_redists,
84 size_t * tgt_pos, size_t tgt_count, size_t * num_src_per_tgt,
85 size_t * src_field_idx, size_t * src_idx,
86 size_t num_src_fields);
87
88/*
89 * The target points consist of a weighted sum of a number of source points. The
90 * operation can be expressed as a distributed Matrix-Vector-Product. This
91 * Product can be computed on the source or target processes.
92 */
94 struct yac_interpolation * interp, Xt_redist * halo_redists,
95 size_t tgt_count, size_t * num_src_per_tgt, double * weights,
96 size_t * src_field_idx, size_t * src_idx,
97 size_t num_src_fields, Xt_redist result_redist);
98
100 struct yac_interpolation * interp, Xt_redist * src_redists,
101 size_t * tgt_pos, size_t tgt_count, size_t * num_src_per_tgt,
102 double * weights, size_t * src_field_idx, size_t * src_idx,
103 size_t num_src_fields);
104
106 struct yac_interpolation * interp);
107
108// src_fields dimensions [collection_idx]
109// [field index]
110// [local_idx]
111// tgt_field dimensions [collection_idx]
112// [local_idx]
114 struct yac_interpolation * interp, double *** src_fields,
115 double ** tgt_field);
117 struct yac_interpolation * interp, double *** src_fields,
118 double *** src_frac_masks, double ** tgt_field);
119
120// src_fields dimensions [collection_idx]
121// [field index]
122// [local_idx]
124 struct yac_interpolation * interp, double *** src_fields);
126 struct yac_interpolation * interp, double *** src_fields,
127 double *** src_frac_masks);
128
129// tgt_field dimensions [collection_idx]
130// [local_idx]
132 struct yac_interpolation * interp, double ** tgt_field);
134 struct yac_interpolation * interp, double ** tgt_field);
135
138
140
141void yac_interpolation_delete(struct yac_interpolation * interp);
142
143// YAC PUBLIC HEADER STOP
144
145#endif // INTERPOLATION_H
struct @7::@8 value
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)
struct yac_interpolation * yac_interpolation_copy(struct yac_interpolation *interp)
void yac_interpolation_inc_ref_count(struct yac_interpolation *interpolation)
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)
struct yac_interpolation * yac_interpolation_new(size_t collection_size, double frac_mask_fallback_value, double scale_factor, double scale_summand)
void yac_interpolation_execute(struct yac_interpolation *interp, double ***src_fields, double **tgt_field)
int yac_interpolation_with_frac_mask(struct yac_interpolation *interpolation)
void yac_interpolation_add_direct_mf(struct yac_interpolation *interp, Xt_redist *redists, size_t num_src_fields)
void yac_interpolation_delete(struct yac_interpolation *interp)
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)
int yac_interpolation_execute_put_test(struct yac_interpolation *interp)
void yac_interpolation_add_fixed(struct yac_interpolation *interp, double value, size_t count, size_t *pos)
void yac_interpolation_execute_wait(struct yac_interpolation *interp)
void yac_interpolation_execute_frac(struct yac_interpolation *interp, double ***src_fields, double ***src_frac_masks, double **tgt_field)
void yac_interpolation_execute_get(struct yac_interpolation *interp, double **tgt_field)
void yac_interpolation_execute_get_async(struct yac_interpolation *interp, double **tgt_field)
double const YAC_FRAC_MASK_UNDEF
void yac_interpolation_add_direct(struct yac_interpolation *interp, Xt_redist redist)
void yac_interpolation_execute_put_frac(struct yac_interpolation *interp, double ***src_fields, double ***src_frac_masks)
void yac_interpolation_execute_put(struct yac_interpolation *interp, double ***src_fields)
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)
int yac_interpolation_execute_get_test(struct yac_interpolation *interp)
double const YAC_FRAC_MASK_NO_VALUE
double frac_mask_fallback_value