YetAnotherCoupler 3.5.2
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 UNUSED(interp);
85
86 return 0;
87}
88
90 struct yac_interpolation_type * interp) {
91
92 return ((struct yac_interpolation_fixed*)interp)->count > 0;
93}
94
96 struct yac_interpolation_type * interp, double ** tgt_field) {
97
98 struct yac_interpolation_fixed * fixed =
99 (struct yac_interpolation_fixed*)interp;
100
101 double const value = fixed->value;
102 size_t * restrict pos = fixed->pos;
103 size_t const count = fixed->count;
104 size_t const collection_size = fixed->collection_size;
105
106 for (size_t l = 0; l < collection_size; ++l)
107 for (size_t j = 0; j < count; ++j)
108 tgt_field[l][pos[j]] = value;
109}
110
112 struct yac_interpolation_type * interp, double ** tgt_field,
113 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
114
115 UNUSED(frac_mask_fallback_value);
116 UNUSED(scale_factor);
117 UNUSED(scale_summand);
118
119 yac_interpolation_fixed_execute_get_(interp, tgt_field);
120}
121
123 struct yac_interpolation_type * interp, double ** tgt_field,
124 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
125
127 interp, tgt_field, frac_mask_fallback_value, scale_factor, scale_summand);
128}
129
131 struct yac_interpolation_type * interp,
132 double *** src_fields, double *** src_frac_masks, double ** tgt_field,
133 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
134
135 UNUSED(src_fields);
136 UNUSED(src_frac_masks);
137 UNUSED(frac_mask_fallback_value);
138 UNUSED(scale_factor);
139 UNUSED(scale_summand);
140
141 yac_interpolation_fixed_execute_get_(interp, tgt_field);
142}
143
145 struct yac_interpolation_type * interp,
146 double *** src_fields, double *** src_frac_masks,
147 int is_target, double frac_mask_fallback_value,
148 double scale_factor, double scale_summand) {
149
150 UNUSED(interp);
151 UNUSED(src_fields);
152 UNUSED(src_frac_masks);
153 UNUSED(is_target);
154 UNUSED(frac_mask_fallback_value);
155 UNUSED(scale_factor);
156 UNUSED(scale_summand);
157 return;
158}
159
161 struct yac_interpolation_type * interp) {
162
163 UNUSED(interp);
164 return 1;
165}
166
168 struct yac_interpolation_type * interp) {
169
170 UNUSED(interp);
171 return;
172}
173
175 struct yac_interpolation_type * interp) {
176
177 struct yac_interpolation_fixed * fixed =
178 (struct yac_interpolation_fixed*)interp;
179
180 fixed->ref_count++;
181
182 return interp;
183}
184
186 struct yac_interpolation_type * interp) {
187
188 if (interp == NULL) return;
189
190 struct yac_interpolation_fixed * fixed =
191 (struct yac_interpolation_fixed*)interp;
192
193 if(--(fixed->ref_count)) return;
194
195 free(fixed->pos);
196 free(fixed);
197}
#define UNUSED(x)
Definition core.h:73
struct @7::@8 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:237