YetAnotherCoupler 3.2.0_a
Loading...
Searching...
No Matches
interpolation_fixed.c
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#include <string.h>
6
8#include "utils_core.h"
10
12 struct yac_interpolation_type * interp);
14 struct yac_interpolation_type * interp);
16 struct yac_interpolation_type * interp,
17 double *** src_fields, double *** src_frac_masks, double ** tgt_field,
18 double frac_mask_fallback_value, double scale_factor, double scale_summand);
20 struct yac_interpolation_type * interp,
21 double *** src_fields, double *** src_frac_masks,
22 int is_target, double frac_mask_fallback_value,
23 double scale_factor, double scale_summand);
25 struct yac_interpolation_type * interp, double ** tgt_field,
26 double frac_mask_fallback_value, double scale_factor, double scale_summand);
28 struct yac_interpolation_type * interp, double ** tgt_field,
29 double frac_mask_fallback_value, double scale_factor, double scale_summand);
31 struct yac_interpolation_type * interp);
33 struct yac_interpolation_type * interp);
35 struct yac_interpolation_type * interp);
37 struct yac_interpolation_type * interp);
38
52
54
56
58
59 double value;
60 size_t * pos;
61 size_t count;
62
64};
65
67 size_t collection_size, double value, size_t count, size_t const * pos) {
68
69 struct yac_interpolation_fixed * fixed = xmalloc(1 * sizeof(*fixed));
70
73 fixed->value = value;
74 fixed->count = count;
75 fixed->pos = COPY_DATA(pos, count);
76 fixed->ref_count = 1;
77
78 return (struct yac_interpolation_type *)fixed;
79}
80
82 struct yac_interpolation_type * interp) {
83
84 return 0;
85}
86
88 struct yac_interpolation_type * interp) {
89
90 return ((struct yac_interpolation_fixed*)interp)->count > 0;
91}
92
94 struct yac_interpolation_type * interp, double ** tgt_field) {
95
96 struct yac_interpolation_fixed * fixed =
97 (struct yac_interpolation_fixed*)interp;
98
99 double const value = fixed->value;
100 size_t * restrict pos = fixed->pos;
101 size_t const count = fixed->count;
102 size_t const collection_size = fixed->collection_size;
103
104 for (size_t l = 0; l < collection_size; ++l)
105 for (size_t j = 0; j < count; ++j)
106 tgt_field[l][pos[j]] = value;
107}
108
110 struct yac_interpolation_type * interp, double ** tgt_field,
111 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
112
113 UNUSED(frac_mask_fallback_value);
114 UNUSED(scale_factor);
115 UNUSED(scale_summand);
116
117 yac_interpolation_fixed_execute_get_(interp, tgt_field);
118}
119
121 struct yac_interpolation_type * interp, double ** tgt_field,
122 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
123
125 interp, tgt_field, frac_mask_fallback_value, scale_factor, scale_summand);
126}
127
129 struct yac_interpolation_type * interp,
130 double *** src_fields, double *** src_frac_masks, double ** tgt_field,
131 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
132
133 UNUSED(src_fields);
134 UNUSED(src_frac_masks);
135 UNUSED(frac_mask_fallback_value);
136 UNUSED(scale_factor);
137 UNUSED(scale_summand);
138
139 yac_interpolation_fixed_execute_get_(interp, tgt_field);
140}
141
143 struct yac_interpolation_type * interp,
144 double *** src_fields, double *** src_frac_masks,
145 int is_target, double frac_mask_fallback_value,
146 double scale_factor, double scale_summand) {
147
148 UNUSED(interp);
149 UNUSED(src_fields);
150 UNUSED(src_frac_masks);
151 UNUSED(is_target);
152 UNUSED(frac_mask_fallback_value);
153 UNUSED(scale_factor);
154 UNUSED(scale_summand);
155 return;
156}
157
159 struct yac_interpolation_type * interp) {
160
161 UNUSED(interp);
162 return 1;
163}
164
166 struct yac_interpolation_type * interp) {
167
168 UNUSED(interp);
169 return;
170}
171
173 struct yac_interpolation_type * interp) {
174
175 struct yac_interpolation_fixed * fixed =
176 (struct yac_interpolation_fixed*)interp;
177
178 fixed->ref_count++;
179
180 return interp;
181}
182
184 struct yac_interpolation_type * interp) {
185
186 if (interp == NULL) return;
187
188 struct yac_interpolation_fixed * fixed =
189 (struct yac_interpolation_fixed*)interp;
190
191 if(--(fixed->ref_count)) return;
192
193 free(fixed->pos);
194 free(fixed);
195}
#define UNUSED(x)
Definition core.h:71
struct @8::@9 value
static void yac_interpolation_fixed_execute(struct yac_interpolation_type *interp, double ***src_fields, double ***src_frac_masks, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static struct yac_interpolation_type_vtable const interpolation_fixed_vtable
static void yac_interpolation_fixed_execute_get_async(struct yac_interpolation_type *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static struct yac_interpolation_type * yac_interpolation_fixed_copy(struct yac_interpolation_type *interp)
static int yac_interpolation_fixed_execute_test(struct yac_interpolation_type *interp)
static int yac_interpolation_fixed_is_source(struct yac_interpolation_type *interp)
static void yac_interpolation_fixed_delete(struct yac_interpolation_type *interp)
static int yac_interpolation_fixed_is_target(struct yac_interpolation_type *interp)
static void yac_interpolation_fixed_execute_get(struct yac_interpolation_type *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static void yac_interpolation_fixed_execute_get_(struct yac_interpolation_type *interp, double **tgt_field)
static void yac_interpolation_fixed_execute_wait(struct yac_interpolation_type *interp)
static void yac_interpolation_fixed_execute_put(struct yac_interpolation_type *interp, double ***src_fields, double ***src_frac_masks, int is_target, double frac_mask_fallback_value, double scale_factor, double scale_summand)
struct yac_interpolation_type * yac_interpolation_fixed_new(size_t collection_size, double value, size_t count, size_t const *pos)
#define xmalloc(size)
Definition ppm_xfuncs.h:66
struct yac_interpolation_type_vtable const * vtable
int(* is_source)(struct yac_interpolation_type *interp)
#define COPY_DATA(data, count)
Definition utils_core.h:209