YAC 3.20.0
Yet Another Coupler
Loading...
Searching...
No Matches
interp_method_avg.c File Reference
Include dependency graph for interp_method_avg.c:

Go to the source code of this file.

Data Structures

struct  interp_method_avg
 
struct  yac_interp_method_config_avg
 Concrete implementation of yac_interp_method_config for the AVG method. More...
 

Macros

#define IS_GC(x)   (((x) == YAC_GREAT_CIRCLE_EDGE) || ((x) == YAC_LON_CIRCLE_EDGE))
 
#define IS_LON_LAT(x)   (((x) == YAC_LAT_CIRCLE_EDGE) || ((x) == YAC_LON_CIRCLE_EDGE))
 

Typedefs

typedef int(* func_compute_weights) (double[3], size_t, yac_const_coordinate_pointer, int *, double *, enum yac_cell_type cell_type)
 

Functions

static size_t do_search_avg (struct interp_method *method, struct yac_interp_grid *interp_grid, size_t *tgt_points, size_t count, struct yac_interp_weights *weights, int *interpolation_complete)
 
static void delete_avg (struct interp_method *method)
 
static int check_src_field_cell (double *point, size_t field_cell, size_t cell_size, size_t const *vertex_to_cell, size_t const *vertex_to_cell_offsets, yac_const_coordinate_pointer field_coordinates, struct yac_grid_cell *cell_buffer)
 
static enum yac_cell_type determine_cell_type (enum yac_edge_type const *edge_types, size_t const *edge_indices, size_t num_edges)
 
static int compute_weights_avg_yes (double tgt_coords[3], size_t num_vertices, yac_const_coordinate_pointer src_coords, int *src_mask, double *weights, enum yac_cell_type cell_type)
 
static int compute_weights_avg_no (double tgt_coords[3], size_t num_vertices, yac_const_coordinate_pointer src_coords, int *src_mask, double *weights, enum yac_cell_type cell_type)
 
static int compute_weights_dist_yes (double tgt_coords[3], size_t num_vertices, yac_const_coordinate_pointer src_coords, int *src_mask, double *weights, enum yac_cell_type cell_type)
 
static int compute_weights_dist_no (double tgt_coords[3], size_t num_vertices, yac_const_coordinate_pointer src_coords, int *src_mask, double *weights, enum yac_cell_type cell_type)
 
static int compute_barycentric_coords (double *barycentric_coords, size_t triangle_indices[3], yac_const_coordinate_pointer grid_coords, char const *caller)
 
static int get_lat_edge_ordering (double const *a, double const *b)
 
static void get_cell_lon_lat_bounds (yac_const_coordinate_pointer coords, double lon[2], double lat[2], int reorder[4])
 
static void get_point_lon_lat (double point_coord[3], double cell_lon[2], double cell_lat[2], double *point_lon, double *point_lat)
 
static int determine_triangle_idx (double point_lon, double point_lat, double cell_lon[2], double cell_lat[2])
 
static void compute_weights_bary_reg (double tgt_coords[3], yac_const_coordinate_pointer src_coords, double *weights)
 
static int compute_weights_bary_check_weights (double *weights, int num_weights, int *src_mask, int partial_coverage)
 
static int compute_weights_bary (double tgt_coords[3], size_t num_vertices, yac_const_coordinate_pointer src_coords, int *src_mask, double *weights, enum yac_cell_type cell_type, int partial_coverage)
 Computes barycentric weights for interpolation.
 
static int compute_weights_bary_yes (double tgt_coords[3], size_t num_vertices, yac_const_coordinate_pointer src_coords, int *src_mask, double *weights, enum yac_cell_type cell_type)
 Computes barycentric weights for interpolation allowing partial coverage.
 
static int compute_weights_bary_no (double tgt_coords[3], size_t num_vertices, yac_const_coordinate_pointer src_coords, int *src_mask, double *weights, enum yac_cell_type cell_type)
 Computes barycentric weights for interpolation not allowing partial coverage.
 
static func_compute_weights select_compute_weight_routine (enum yac_interp_avg_weight_type weight_type, int partial_coverage)
 
struct interp_methodyac_interp_method_avg_new (enum yac_interp_avg_weight_type weight_type, int partial_coverage)
 
static void config_avg_delete (struct yac_interp_method_config *config)
 
static struct yac_interp_method_configconfig_avg_copy (const struct yac_interp_method_config *config)
 
static int config_avg_compare (void const *a_, void const *b_)
 
static size_t config_avg_get_pack_size (struct yac_interp_method_config const *config, MPI_Comm comm)
 
static void config_avg_pack (struct yac_interp_method_config const *config, void *buffer, int buffer_size, int *position, MPI_Comm comm)
 
static enum yac_interpolation_list config_avg_get_type ()
 
static struct interp_methodconfig_avg_generate (struct yac_interp_method_config const *config)
 
static struct yac_paramconfig_avg_get_param (struct yac_interp_method_config const *config)
 
struct yac_interp_method_configyac_interp_method_config_default_avg_new (void)
 Creates an average interpolation method configuration with default parameters.
 
struct yac_interp_method_configyac_interp_method_config_avg_unpack (void *buffer, int buffer_size, int *position, MPI_Comm comm)
 Unpacks an average interpolation method configuration from a buffer.
 

Variables

static struct interp_method_vtable interp_method_avg_vtable
 
static struct yac_interp_method_config_vtable yac_interp_method_config_vtable_avg
 

Macro Definition Documentation

◆ IS_GC

#define IS_GC ( x)    (((x) == YAC_GREAT_CIRCLE_EDGE) || ((x) == YAC_LON_CIRCLE_EDGE))

Definition at line 82 of file interp_method_avg.c.

◆ IS_LON_LAT

#define IS_LON_LAT ( x)    (((x) == YAC_LAT_CIRCLE_EDGE) || ((x) == YAC_LON_CIRCLE_EDGE))

Definition at line 83 of file interp_method_avg.c.

Typedef Documentation

◆ func_compute_weights

typedef int(* func_compute_weights) (double[3], size_t, yac_const_coordinate_pointer, int *, double *, enum yac_cell_type cell_type)

Definition at line 30 of file interp_method_avg.c.

Function Documentation

◆ check_src_field_cell()

static int check_src_field_cell ( double * point,
size_t field_cell,
size_t cell_size,
size_t const * vertex_to_cell,
size_t const * vertex_to_cell_offsets,
yac_const_coordinate_pointer field_coordinates,
struct yac_grid_cell * cell_buffer )
static

Definition at line 45 of file interp_method_avg.c.

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

◆ compute_barycentric_coords()

static int compute_barycentric_coords ( double * barycentric_coords,
size_t triangle_indices[3],
yac_const_coordinate_pointer grid_coords,
char const * caller )
static

Definition at line 530 of file interp_method_avg.c.

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

◆ compute_weights_avg_no()

static int compute_weights_avg_no ( double tgt_coords[3],
size_t num_vertices,
yac_const_coordinate_pointer src_coords,
int * src_mask,
double * weights,
enum yac_cell_type cell_type )
static

Definition at line 405 of file interp_method_avg.c.

Here is the caller graph for this function:

◆ compute_weights_avg_yes()

static int compute_weights_avg_yes ( double tgt_coords[3],
size_t num_vertices,
yac_const_coordinate_pointer src_coords,
int * src_mask,
double * weights,
enum yac_cell_type cell_type )
static

Definition at line 377 of file interp_method_avg.c.

Here is the caller graph for this function:

◆ compute_weights_bary()

static int compute_weights_bary ( double tgt_coords[3],
size_t num_vertices,
yac_const_coordinate_pointer src_coords,
int * src_mask,
double * weights,
enum yac_cell_type cell_type,
int partial_coverage )
static

Computes barycentric weights for interpolation.

This function calculates barycentric coordinates/weights for a target point with respect to source vertices of a cell. The weights can be used for interpolation purposes in the averaging interpolation method.

Parameters
[in]tgt_coordsTarget point coordinates
[in]num_verticesNumber of source point
[in]src_coordsSource point coordinates
[in]src_maskSource point mask
[out]weightsComputed weights
[in]cell_typeType of the cell (supported: YAC_LON_LAT_CELL, YAC_GREAT_CIRCLE_CELL)
[in]partial_coverageIf 0, partial coverage of source vertices by the source mask is not supported. All other values enable it.
Returns
1 on success, 0 otherwise

Definition at line 787 of file interp_method_avg.c.

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

◆ compute_weights_bary_check_weights()

static int compute_weights_bary_check_weights ( double * weights,
int num_weights,
int * src_mask,
int partial_coverage )
static

Definition at line 704 of file interp_method_avg.c.

Here is the caller graph for this function:

◆ compute_weights_bary_no()

static int compute_weights_bary_no ( double tgt_coords[3],
size_t num_vertices,
yac_const_coordinate_pointer src_coords,
int * src_mask,
double * weights,
enum yac_cell_type cell_type )
static

Computes barycentric weights for interpolation not allowing partial coverage.

This function calculates barycentric coordinates/weights for a target point with respect to source vertices of a cell. The weights can be used for interpolation purposes in the averaging interpolation method.

Parameters
[in]tgt_coordsTarget point coordinates
[in]num_verticesNumber of source cell vertices
[in]src_coordsSource vertex coordinates
[in]src_maskSource vertex mask
[out]weightsComputed weights
[in]cell_typeType of the cell (supported: YAC_LON_LAT_CELL, YAC_GREAT_CIRCLE_CELL)
Returns
1 on success, 0 otherwise

Definition at line 962 of file interp_method_avg.c.

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

◆ compute_weights_bary_reg()

static void compute_weights_bary_reg ( double tgt_coords[3],
yac_const_coordinate_pointer src_coords,
double * weights )
static

Definition at line 665 of file interp_method_avg.c.

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

◆ compute_weights_bary_yes()

static int compute_weights_bary_yes ( double tgt_coords[3],
size_t num_vertices,
yac_const_coordinate_pointer src_coords,
int * src_mask,
double * weights,
enum yac_cell_type cell_type )
static

Computes barycentric weights for interpolation allowing partial coverage.

This function calculates barycentric coordinates/weights for a target point with respect to source vertices of a cell. The weights can be used for interpolation purposes in the averaging interpolation method.

Parameters
[in]tgt_coordsTarget point coordinates
[in]num_verticesNumber of source cell vertices
[in]src_coordsSource vertex coordinates
[in]src_maskSource vertex mask
[out]weightsComputed weights
[in]cell_typeType of the cell (supported: YAC_LON_LAT_CELL, YAC_GREAT_CIRCLE_CELL)
Returns
1 on success, 0 otherwise

Definition at line 932 of file interp_method_avg.c.

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

◆ compute_weights_dist_no()

static int compute_weights_dist_no ( double tgt_coords[3],
size_t num_vertices,
yac_const_coordinate_pointer src_coords,
int * src_mask,
double * weights,
enum yac_cell_type cell_type )
static

Definition at line 487 of file interp_method_avg.c.

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

◆ compute_weights_dist_yes()

static int compute_weights_dist_yes ( double tgt_coords[3],
size_t num_vertices,
yac_const_coordinate_pointer src_coords,
int * src_mask,
double * weights,
enum yac_cell_type cell_type )
static

Definition at line 425 of file interp_method_avg.c.

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

◆ config_avg_compare()

static int config_avg_compare ( void const * a_,
void const * b_ )
static

Definition at line 1047 of file interp_method_avg.c.

◆ config_avg_copy()

static struct yac_interp_method_config * config_avg_copy ( const struct yac_interp_method_config * config)
static

Definition at line 1036 of file interp_method_avg.c.

◆ config_avg_delete()

static void config_avg_delete ( struct yac_interp_method_config * config)
static

Definition at line 1031 of file interp_method_avg.c.

◆ config_avg_generate()

static struct interp_method * config_avg_generate ( struct yac_interp_method_config const * config)
static

Definition at line 1089 of file interp_method_avg.c.

Here is the call graph for this function:

◆ config_avg_get_pack_size()

static size_t config_avg_get_pack_size ( struct yac_interp_method_config const * config,
MPI_Comm comm )
static

Definition at line 1058 of file interp_method_avg.c.

◆ config_avg_get_param()

static struct yac_param * config_avg_get_param ( struct yac_interp_method_config const * config)
static

Definition at line 1097 of file interp_method_avg.c.

Here is the call graph for this function:

◆ config_avg_get_type()

static enum yac_interpolation_list config_avg_get_type ( )
static

Definition at line 1084 of file interp_method_avg.c.

◆ config_avg_pack()

static void config_avg_pack ( struct yac_interp_method_config const * config,
void * buffer,
int buffer_size,
int * position,
MPI_Comm comm )
static

Definition at line 1068 of file interp_method_avg.c.

◆ delete_avg()

static void delete_avg ( struct interp_method * method)
static

Definition at line 1010 of file interp_method_avg.c.

◆ determine_cell_type()

static enum yac_cell_type determine_cell_type ( enum yac_edge_type const * edge_types,
size_t const * edge_indices,
size_t num_edges )
static

Definition at line 85 of file interp_method_avg.c.

Here is the caller graph for this function:

◆ determine_triangle_idx()

static int determine_triangle_idx ( double point_lon,
double point_lat,
double cell_lon[2],
double cell_lat[2] )
static

Definition at line 658 of file interp_method_avg.c.

Here is the caller graph for this function:

◆ do_search_avg()

static size_t do_search_avg ( struct interp_method * method,
struct yac_interp_grid * interp_grid,
size_t * tgt_points,
size_t count,
struct yac_interp_weights * weights,
int * interpolation_complete )
static

Definition at line 124 of file interp_method_avg.c.

Here is the call graph for this function:

◆ get_cell_lon_lat_bounds()

static void get_cell_lon_lat_bounds ( yac_const_coordinate_pointer coords,
double lon[2],
double lat[2],
int reorder[4] )
static

Definition at line 584 of file interp_method_avg.c.

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

◆ get_lat_edge_ordering()

static int get_lat_edge_ordering ( double const * a,
double const * b )
inlinestatic

Definition at line 579 of file interp_method_avg.c.

Here is the caller graph for this function:

◆ get_point_lon_lat()

static void get_point_lon_lat ( double point_coord[3],
double cell_lon[2],
double cell_lat[2],
double * point_lon,
double * point_lat )
static

Definition at line 638 of file interp_method_avg.c.

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

◆ select_compute_weight_routine()

static func_compute_weights select_compute_weight_routine ( enum yac_interp_avg_weight_type weight_type,
int partial_coverage )
static

Definition at line 974 of file interp_method_avg.c.

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

◆ yac_interp_method_avg_new()

struct interp_method * yac_interp_method_avg_new ( enum yac_interp_avg_weight_type weight_type,
int partial_coverage )

Definition at line 997 of file interp_method_avg.c.

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

◆ yac_interp_method_config_avg_unpack()

struct yac_interp_method_config * yac_interp_method_config_avg_unpack ( void * buffer,
int buffer_size,
int * position,
MPI_Comm comm )

Unpacks an average interpolation method configuration from a buffer.

Parameters
[in]bufferBuffer containing the packed configuration data
[in]buffer_sizeSize of the buffer
[in,out]positionCurrent position in the buffer (will be updated)
[in]commMPI communicator for parallel unpacking
Returns
Pointer to the unpacked yac_interp_method_config structure

Definition at line 1167 of file interp_method_avg.c.

◆ yac_interp_method_config_default_avg_new()

struct yac_interp_method_config * yac_interp_method_config_default_avg_new ( void )

Creates an average interpolation method configuration with default parameters.

Returns
Pointer to the created yac_interp_method_config structure

Definition at line 1155 of file interp_method_avg.c.

Variable Documentation

◆ interp_method_avg_vtable

struct interp_method_vtable interp_method_avg_vtable
static
Initial value:
= {
.do_search = do_search_avg,
.delete = delete_avg}
static void delete_avg(struct interp_method *method)
static size_t do_search_avg(struct interp_method *method, struct yac_interp_grid *interp_grid, size_t *tgt_points, size_t count, struct yac_interp_weights *weights, int *interpolation_complete)

Definition at line 35 of file interp_method_avg.c.

◆ yac_interp_method_config_vtable_avg

struct yac_interp_method_config_vtable yac_interp_method_config_vtable_avg
static
Initial value:
= {
.delete = config_avg_delete,
.copy = config_avg_copy,
.compare = config_avg_compare,
.get_pack_size = config_avg_get_pack_size,
.pack = config_avg_pack,
.get_type = config_avg_get_type,
.generate = config_avg_generate,
.get_param = config_avg_get_param
}
static int config_avg_compare(void const *a_, void const *b_)
static enum yac_interpolation_list config_avg_get_type()
static size_t config_avg_get_pack_size(struct yac_interp_method_config const *config, MPI_Comm comm)
static struct yac_param * config_avg_get_param(struct yac_interp_method_config const *config)
static void config_avg_delete(struct yac_interp_method_config *config)
static struct yac_interp_method_config * config_avg_copy(const struct yac_interp_method_config *config)
static void config_avg_pack(struct yac_interp_method_config const *config, void *buffer, int buffer_size, int *position, MPI_Comm comm)
static struct interp_method * config_avg_generate(struct yac_interp_method_config const *config)

Definition at line 1144 of file interp_method_avg.c.