YetAnotherCoupler 3.5.2
Loading...
Searching...
No Matches
interp_method_spmap.c File Reference
#include "config.h"
#include <float.h>
#include <string.h>
#include "interp_method_internal.h"
#include "interp_method_spmap.h"
#include "ensure_array_size.h"
#include "area.h"
#include "io_utils.h"
#include "yac_mpi_internal.h"
Include dependency graph for interp_method_spmap.c:

Go to the source code of this file.

Data Structures

struct  interp_method_spmap
 

Macros

#define SCALE_WEIGHTS(SRC_CELL_AREA, TGT_CELL_AREA)
 

Functions

static size_t do_search_spmap (struct interp_method *method, struct yac_interp_grid *interp_grid, size_t *tgt_points, size_t count, struct yac_interp_weights *weights)
 
static void delete_spmap (struct interp_method *method)
 
static int compare_size_t (const void *a, const void *b)
 
static int lists_overlap (size_t *list_a, size_t count_a, size_t *list_b, size_t count_b)
 
static void merge_lists (size_t *list, size_t *list_size, size_t *insert, size_t insert_size)
 
static void check_spread_distance (yac_const_coordinate_pointer tgt_field_coords, double max_distance, size_t tgt_start_point, size_t *tgt_points, size_t *count)
 
static void remove_disconnected_points (struct yac_interp_grid *interp_grid, size_t tgt_start_point, size_t *from_tgt_points, size_t *to_tgt_points, size_t *count, int *flag, size_t *temp_cell_edges, size_t **edges_buffer, size_t *edges_buffer_array_size)
 
static size_t check_tgt_result_points (struct yac_interp_grid *interp_grid, double spread_distance, size_t num_src_points, size_t const *const tgt_result_points, size_t *num_tgt_per_src, size_t *spread_tgt_result_points)
 
static double * compute_weights (struct yac_interp_grid *interp_grid, enum yac_interp_spmap_weight_type weight_type, size_t num_src_points, size_t const *const src_points, size_t const *const num_tgt_per_src, size_t total_num_tgt, size_t const *const tgt_result_points)
 
static void compute_cell_areas (struct yac_const_basic_grid_data *basic_grid_data, int *required_cell_areas, double area_scale, char const *type, double *cell_areas)
 
static void dist_read_cell_areas (char const *filename, char const *varname, MPI_Comm comm, int *io_ranks, int io_rank_idx, int num_io_ranks, double **dist_cell_areas, size_t *dist_cell_areas_global_size)
 
static void read_cell_areas (struct yac_const_basic_grid_data *basic_grid_data, struct yac_spmap_cell_area_file_config file_config, MPI_Comm comm, int *required_cell_areas, char const *type, double *cell_areas)
 
static double * get_cell_areas (struct yac_const_basic_grid_data *basic_grid_data, char const *type, struct yac_spmap_cell_area_config cell_area_config, MPI_Comm comm, size_t const *required_points, size_t num_required_points)
 
static void scale_weights (struct yac_interp_grid *interp_grid, struct yac_spmap_scale_config scale_config, size_t num_src_points, size_t const *src_points, size_t const *num_tgt_per_src, size_t const *tgt_points, size_t total_num_weights, double *weights)
 
static void spread_src_data (struct yac_interp_grid *interp_grid, double spread_distance, enum yac_interp_spmap_weight_type weight_type, struct yac_spmap_scale_config scale_config, size_t num_src_points, size_t **src_points_, size_t **tgt_result_points_, double **weights_, size_t *total_num_weights_)
 
static void check_cell_area_config (struct yac_spmap_cell_area_config *cell_area_config, char const *type)
 
struct interp_methodyac_interp_method_spmap_new (double spread_distance, double max_search_distance, enum yac_interp_spmap_weight_type weight_type, struct yac_spmap_scale_config scale_config)
 

Variables

static struct interp_method_vtable interp_method_spmap_vtable
 

Macro Definition Documentation

◆ SCALE_WEIGHTS

#define SCALE_WEIGHTS ( SRC_CELL_AREA,
TGT_CELL_AREA )
Value:
{ \
for (size_t i = 0, offset = 0; i < num_src_points; ++i) { \
size_t curr_num_tgt = num_tgt_per_src[i]; \
for (size_t j = 0; j < curr_num_tgt; ++j, ++offset) { \
weights[offset] *= SRC_CELL_AREA / TGT_CELL_AREA; \
} \
} \
}

Function Documentation

◆ check_cell_area_config()

static void check_cell_area_config ( struct yac_spmap_cell_area_config * cell_area_config,
char const * type )
static

Definition at line 938 of file interp_method_spmap.c.

Here is the caller graph for this function:

◆ check_spread_distance()

static void check_spread_distance ( yac_const_coordinate_pointer tgt_field_coords,
double max_distance,
size_t tgt_start_point,
size_t * tgt_points,
size_t * count )
static

Definition at line 87 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_tgt_result_points()

static size_t check_tgt_result_points ( struct yac_interp_grid * interp_grid,
double spread_distance,
size_t num_src_points,
size_t const *const tgt_result_points,
size_t * num_tgt_per_src,
size_t * spread_tgt_result_points )
static

Definition at line 176 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare_size_t()

static int compare_size_t ( const void * a,
const void * b )
inlinestatic

Definition at line 41 of file interp_method_spmap.c.

Here is the caller graph for this function:

◆ compute_cell_areas()

static void compute_cell_areas ( struct yac_const_basic_grid_data * basic_grid_data,
int * required_cell_areas,
double area_scale,
char const * type,
double * cell_areas )
static

Definition at line 331 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_weights()

static double * compute_weights ( struct yac_interp_grid * interp_grid,
enum yac_interp_spmap_weight_type weight_type,
size_t num_src_points,
size_t const *const src_points,
size_t const *const num_tgt_per_src,
size_t total_num_tgt,
size_t const *const tgt_result_points )
static

Definition at line 240 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_spmap()

static void delete_spmap ( struct interp_method * method)
static

Definition at line 1012 of file interp_method_spmap.c.

◆ dist_read_cell_areas()

static void dist_read_cell_areas ( char const * filename,
char const * varname,
MPI_Comm comm,
int * io_ranks,
int io_rank_idx,
int num_io_ranks,
double ** dist_cell_areas,
size_t * dist_cell_areas_global_size )
static

Definition at line 359 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_search_spmap()

static size_t do_search_spmap ( struct interp_method * method,
struct yac_interp_grid * interp_grid,
size_t * tgt_points,
size_t count,
struct yac_interp_weights * weights )
static

Definition at line 798 of file interp_method_spmap.c.

Here is the call graph for this function:

◆ get_cell_areas()

static double * get_cell_areas ( struct yac_const_basic_grid_data * basic_grid_data,
char const * type,
struct yac_spmap_cell_area_config cell_area_config,
MPI_Comm comm,
size_t const * required_points,
size_t num_required_points )
static

Definition at line 594 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lists_overlap()

static int lists_overlap ( size_t * list_a,
size_t count_a,
size_t * list_b,
size_t count_b )
static

Definition at line 48 of file interp_method_spmap.c.

Here is the caller graph for this function:

◆ merge_lists()

static void merge_lists ( size_t * list,
size_t * list_size,
size_t * insert,
size_t insert_size )
static

Definition at line 66 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_cell_areas()

static void read_cell_areas ( struct yac_const_basic_grid_data * basic_grid_data,
struct yac_spmap_cell_area_file_config file_config,
MPI_Comm comm,
int * required_cell_areas,
char const * type,
double * cell_areas )
static

Definition at line 472 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_disconnected_points()

static void remove_disconnected_points ( struct yac_interp_grid * interp_grid,
size_t tgt_start_point,
size_t * from_tgt_points,
size_t * to_tgt_points,
size_t * count,
int * flag,
size_t * temp_cell_edges,
size_t ** edges_buffer,
size_t * edges_buffer_array_size )
static

Definition at line 104 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale_weights()

static void scale_weights ( struct yac_interp_grid * interp_grid,
struct yac_spmap_scale_config scale_config,
size_t num_src_points,
size_t const * src_points,
size_t const * num_tgt_per_src,
size_t const * tgt_points,
size_t total_num_weights,
double * weights )
static

Definition at line 639 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spread_src_data()

static void spread_src_data ( struct yac_interp_grid * interp_grid,
double spread_distance,
enum yac_interp_spmap_weight_type weight_type,
struct yac_spmap_scale_config scale_config,
size_t num_src_points,
size_t ** src_points_,
size_t ** tgt_result_points_,
double ** weights_,
size_t * total_num_weights_ )
static

Definition at line 701 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_interp_method_spmap_new()

struct interp_method * yac_interp_method_spmap_new ( double spread_distance,
double max_search_distance,
enum yac_interp_spmap_weight_type weight_type,
struct yac_spmap_scale_config scale_config )

Constructor for a interpolation method of type interp_method_spmap
This method searches for each unmasked source point the closest unmasked target point.
If the maximum search distance is > 0.0, only target points that are within this distance from the source points are being considered. If spread_distance is > 0.0, the method uses the previously found target points as a starting point. Around each starting point, a bounding circle is generated. Afterwards for each starting point all target cells whose bounding circles intersect with the generated one are put into a list. Out of this list all target cells connected directly or indirectly through other cells from this list to the target cell of the starting are selected for the interpolation. Then a weighting method is applied to the selected target cells to generate the weights. Afterwards the weights are scaled.

Parameters
[in]spread_distancespreading distance
[in]max_search_distancemaximum search distance
[in]weight_typeweighting type
[in]scale_configscaling configuration
Remarks
the unit for the spread and maximum search distance is Radian
Examples
test_interp_method_spmap_parallel.c.

Definition at line 982 of file interp_method_spmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ interp_method_spmap_vtable

struct interp_method_vtable interp_method_spmap_vtable
static
Initial value:
= {
.do_search = do_search_spmap,
.delete = delete_spmap
}
static void delete_spmap(struct interp_method *method)
static size_t do_search_spmap(struct interp_method *method, struct yac_interp_grid *interp_grid, size_t *tgt_points, size_t count, struct yac_interp_weights *weights)

Definition at line 27 of file interp_method_spmap.c.