YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
interp_method_utils.h
Go to the documentation of this file.
1// Copyright (c) 2026 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef INTERP_METHOD_UTILS_H
6#define INTERP_METHOD_UTILS_H
7
8#include "yac_types.h"
11
22 double tgt_coord[3], yac_const_coordinate_pointer src_coords,
23 size_t const n, double * weights, double const scale);
24
35 double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n,
36 double * weights, double const dummy);
37
48 double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n,
49 double * weights, double const dummy);
50
61 double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n,
62 double * weights, double const gauss_scale);
63
74 double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n,
75 double * weights, double const rbf_scale);
76
77// Validation macros for interpolation methods
78
79// Helper macro to check if source fields exist
80#define CHECK_INTERP_GRID_HAS_SRC_FIELDS(INTERP_GRID) \
81 YAC_INTERP_GRID_ASSERT( \
82 INTERP_GRID, yac_interp_grid_get_num_src_fields(INTERP_GRID) != 0, \
83 "Number of source fields is 0.")
84
85#define CHECK_SRC_FIELD_COUNT_SINGLE(INTERP_GRID) \
86 CHECK_INTERP_GRID_HAS_SRC_FIELDS(INTERP_GRID) \
87 YAC_INTERP_GRID_FIELD_ASSERT_F( \
88 INTERP_GRID, yac_interp_grid_get_num_src_fields(INTERP_GRID) == 1, \
89 "Invalid number of source fields. Got %zu, expected 1.", \
90 yac_interp_grid_get_num_src_fields(INTERP_GRID))
91
92#define CHECK_SRC_FIELD_LOCATION_CORNER_OR_CELL(INTERP_GRID) \
93 CHECK_INTERP_GRID_HAS_SRC_FIELDS(INTERP_GRID) \
94 YAC_INTERP_GRID_FIELD_ASSERT( \
95 INTERP_GRID, \
96 (yac_interp_grid_get_src_field_location(INTERP_GRID, 0) == YAC_LOC_CORNER) || \
97 (yac_interp_grid_get_src_field_location(INTERP_GRID, 0) == YAC_LOC_CELL), \
98 "This interpolation method only supports source fields defined as CORNER or CELL")
99
100#define CHECK_SRC_FIELD_LOCATION_CELL(INTERP_GRID) \
101 CHECK_INTERP_GRID_HAS_SRC_FIELDS(INTERP_GRID) \
102 YAC_INTERP_GRID_FIELD_ASSERT( \
103 INTERP_GRID, \
104 yac_interp_grid_get_src_field_location(INTERP_GRID, 0) == YAC_LOC_CELL, \
105 "This interpolation method only supports source fields defined as CELL")
106
107#define CHECK_TGT_FIELD_LOCATION_CELL(INTERP_GRID) \
108 YAC_INTERP_GRID_FIELD_ASSERT( \
109 INTERP_GRID, \
110 yac_interp_grid_get_tgt_field_location(INTERP_GRID) == YAC_LOC_CELL, \
111 "This interpolation method only supports target fields defined as CELL")
112
113#endif // INTERP_METHOD_UTILS_H
void yac_interp_compute_weights_gauss(double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n, double *weights, double const gauss_scale)
void yac_interp_compute_weights_avg(double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n, double *weights, double const dummy)
void(* yac_interp_compute_weights_func)(double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n, double *weights, double const scale)
void yac_interp_compute_weights_dist(double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n, double *weights, double const dummy)
void yac_interp_compute_weights_rbf(double tgt_coord[3], yac_const_coordinate_pointer src_coords, size_t const n, double *weights, double const rbf_scale)
Utility macros and functions for interpolation operators. This file contains utility macros for targe...
double const (* yac_const_coordinate_pointer)[3]
Definition yac_types.h:22