YetAnotherCoupler 3.2.0
Loading...
Searching...
No Matches
interp_method.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#ifdef HAVE_CONFIG_H
6// Get the definition of the 'restrict' keyword.
7#include "config.h"
8#endif
9
11
13 struct interp_method ** method, struct yac_interp_grid * interp_grid) {
14
16 enum yac_location src_field_locations[num_src_fields];
17 for (size_t i = 0; i < num_src_fields; ++i)
18 src_field_locations[i] =
20 struct yac_interp_weights * weights =
24 src_field_locations, num_src_fields);
25
26 if (*method == NULL) return weights;
27
28 size_t temp_count;
29 size_t * tgt_points;
30 yac_interp_grid_get_tgt_points(interp_grid, &tgt_points, &temp_count);
31
32 size_t final_count = 0;
33 while (*method != NULL) {
34 final_count +=
35 (*method)->vtable->do_search(
36 *method, interp_grid, tgt_points + final_count, temp_count - final_count,
37 weights);
38 ++method;
39 }
40
41 free(tgt_points);
42
43 return weights;
44}
45
47
48 while (*method != NULL) {
49 struct interp_method * curr_method = *method;
50 curr_method->vtable->delete(curr_method);
51 ++method;
52 }
53}
enum yac_location yac_interp_grid_get_tgt_field_location(struct yac_interp_grid *interp_grid)
size_t yac_interp_grid_get_num_src_fields(struct yac_interp_grid *interp_grid)
void yac_interp_grid_get_tgt_points(struct yac_interp_grid *interp_grid, size_t **tgt_indices, size_t *count)
Definition interp_grid.c:89
MPI_Comm yac_interp_grid_get_MPI_Comm(struct yac_interp_grid *interp_grid)
enum yac_location yac_interp_grid_get_src_field_location(struct yac_interp_grid *interp_grid, size_t src_field_idx)
void yac_interp_method_delete(struct interp_method **method)
struct yac_interp_weights * yac_interp_method_do_search(struct interp_method **method, struct yac_interp_grid *interp_grid)
struct yac_interp_weights * yac_interp_weights_new(MPI_Comm comm, enum yac_location tgt_location, enum yac_location *src_locations, size_t num_src_fields)
yac_location
Definition location.h:12
void(* delete)(struct interp_method *method)
struct interp_method_vtable * vtable