YAC 3.12.0
Yet Another Coupler
Loading...
Searching...
No Matches
interp_operator_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 "interp_operator.h"
9#include "utils_core.h"
13
15 struct yac_interp_operator * interp);
17 struct yac_interp_operator * interp);
19 struct yac_interp_operator * interp,
20 double *** src_fields, double *** src_frac_masks, double ** tgt_field,
21 double frac_mask_fallback_value, double scale_factor, double scale_summand);
23 struct yac_interp_operator * interp,
24 double *** src_fields, double *** src_frac_masks,
25 int is_target, double frac_mask_fallback_value,
26 double scale_factor, double scale_summand);
28 struct yac_interp_operator * interp, double ** tgt_field,
29 double frac_mask_fallback_value, double scale_factor, double scale_summand);
31 struct yac_interp_operator * interp, double ** tgt_field,
32 double frac_mask_fallback_value, double scale_factor, double scale_summand);
34 struct yac_interp_operator * interp);
36 struct yac_interp_operator * interp);
38 struct yac_interp_operator * interp);
40 struct yac_interp_operator * interp);
41
55
67
69 struct yac_collection_selection const * collection_selection,
70 double value, size_t count, size_t const * pos) {
71
72 struct yac_interp_operator_fixed * fixed = xmalloc(1 * sizeof(*fixed));
73
77 fixed->value = value;
78 fixed->count = count;
79 fixed->pos = COPY_DATA(pos, count);
80 fixed->ref_count = 1;
81
82 return (struct yac_interp_operator *)fixed;
83}
84
86 struct yac_interp_operator * interp) {
87 UNUSED(interp);
88
89 return 0;
90}
91
93 struct yac_interp_operator * interp) {
94 return ((struct yac_interp_operator_fixed*)interp)->count > 0;
95}
96
98 struct yac_interp_operator * interp, double ** tgt_field) {
99 struct yac_interp_operator_fixed * fixed =
100 (struct yac_interp_operator_fixed*)interp;
101
102 double const value = fixed->value;
103 size_t * restrict pos = fixed->pos;
104 size_t const count = fixed->count;
105 size_t const collection_size =
107 fixed->collection_selection);
108 size_t const * collection_indices =
110 fixed->collection_selection);
111
112 for (size_t l = 0; l < collection_size; ++l) {
113 size_t l_ = (collection_indices != NULL)?collection_indices[l]:l;
114 for (size_t j = 0; j < count; ++j) {
115 tgt_field[l_][pos[j]] = value;
116 }
117 }
118}
119
121 struct yac_interp_operator * interp, double ** tgt_field,
122 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
123
124 UNUSED(frac_mask_fallback_value);
125 UNUSED(scale_factor);
126 UNUSED(scale_summand);
127
129}
130
132 struct yac_interp_operator * interp, double ** tgt_field,
133 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
134
136 interp, tgt_field, frac_mask_fallback_value, scale_factor, scale_summand);
137}
138
140 struct yac_interp_operator * interp,
141 double *** src_fields, double *** src_frac_masks, double ** tgt_field,
142 double frac_mask_fallback_value, double scale_factor, double scale_summand) {
143
144 UNUSED(src_fields);
145 UNUSED(src_frac_masks);
146 UNUSED(frac_mask_fallback_value);
147 UNUSED(scale_factor);
148 UNUSED(scale_summand);
149
151}
152
154 struct yac_interp_operator * interp,
155 double *** src_fields, double *** src_frac_masks,
156 int is_target, double frac_mask_fallback_value,
157 double scale_factor, double scale_summand) {
158
159 UNUSED(interp);
160 UNUSED(src_fields);
161 UNUSED(src_frac_masks);
162 UNUSED(is_target);
163 UNUSED(frac_mask_fallback_value);
164 UNUSED(scale_factor);
165 UNUSED(scale_summand);
166 return;
167}
168
174
176 struct yac_interp_operator * interp) {
177 UNUSED(interp);
178 return;
179}
180
182 struct yac_interp_operator * interp) {
183 struct yac_interp_operator_fixed * fixed =
184 (struct yac_interp_operator_fixed*)interp;
185
186 fixed->ref_count++;
187
188 return interp;
189}
190
192 struct yac_interp_operator * interp) {
193 if (interp == NULL) return;
194
195 struct yac_interp_operator_fixed * fixed =
196 (struct yac_interp_operator_fixed*)interp;
197
198 if(--(fixed->ref_count)) return;
199
201 free(fixed->pos);
202 free(fixed);
203}
#define UNUSED(x)
Definition core.h:73
size_t yac_collection_selection_get_collection_size(struct yac_collection_selection const *collection_selection)
Get the size of the collection selection.
size_t const * yac_collection_selection_get_indices(struct yac_collection_selection const *collection_selection)
Get explicit selection indices if non-contiguous.
void yac_collection_selection_delete(struct yac_collection_selection *collection_selection)
Delete a collection selection object.
struct yac_collection_selection * yac_collection_selection_copy(const struct yac_collection_selection *collection_selection)
Selection of indices from a collection.
struct yac_interp_operator * yac_interp_operator_fixed_new(struct yac_collection_selection const *collection_selection, double value, size_t count, size_t const *pos)
Create a fixed-value interpolation operator.
struct @34::@35 value
Internal structures for interpolation operators (vtable-based).
YAC_INTERP_TEST_STATUS
@ YAC_INTERP_COMPLETE
static enum YAC_INTERP_TEST_STATUS yac_interp_operator_fixed_execute_test(struct yac_interp_operator *interp)
static void yac_interp_operator_fixed_execute_get_(struct yac_interp_operator *interp, double **tgt_field)
static void yac_interp_operator_fixed_execute_get(struct yac_interp_operator *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static void yac_interp_operator_fixed_execute_get_async(struct yac_interp_operator *interp, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static void yac_interp_operator_fixed_delete(struct yac_interp_operator *interp)
static int yac_interp_operator_fixed_is_target(struct yac_interp_operator *interp)
static void yac_interp_operator_fixed_execute_put(struct yac_interp_operator *interp, double ***src_fields, double ***src_frac_masks, int is_target, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static struct yac_interp_operator * yac_interp_operator_fixed_copy(struct yac_interp_operator *interp)
static void yac_interp_operator_fixed_execute_wait(struct yac_interp_operator *interp)
static struct yac_interp_operator_vtable const interpolation_fixed_vtable
static void yac_interp_operator_fixed_execute(struct yac_interp_operator *interp, double ***src_fields, double ***src_frac_masks, double **tgt_field, double frac_mask_fallback_value, double scale_factor, double scale_summand)
static int yac_interp_operator_fixed_is_source(struct yac_interp_operator *interp)
Fixed-value interpolation operator in YAC.
#define xmalloc(size)
Definition ppm_xfuncs.h:66
struct yac_collection_selection * collection_selection
struct yac_interp_operator_vtable const * vtable
Virtual function table for interpolation operators.
int(* is_source)(struct yac_interp_operator *interp)
Abstract interpolation operator type.
int collection_size
#define COPY_DATA(data, count)
Definition utils_core.h:257