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

Go to the source code of this file.

Data Structures

struct  interp_method_conserv
 
struct  weight_vector_data
 
struct  weight_vector_data_3d
 
struct  weight_vector_3d
 
struct  supermesh_cell
 
struct  yac_interp_method_config_conserv
 Concrete implementation of yac_interp_method_config for the conservative method. More...
 

Macros

#define AREA_TOL_FACTOR   (1e-6)
 

Functions

static size_t do_search_conserv_1st_order (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 size_t do_search_conserv_2nd_order (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_conserv (struct interp_method *method)
 
static int get_max_num_vertices_per_cell (struct yac_const_basic_grid_data *basic_grid_data)
 
static void get_cell_buffers (struct yac_interp_grid *interp_grid, size_t max_num_src_per_tgt, struct yac_grid_cell *tgt_grid_cell, struct yac_grid_cell **src_grid_cells)
 
static void get_cell_buffers_ (struct yac_interp_grid *interp_grid, struct yac_grid_cell *tgt_grid_cell, struct yac_grid_cell *src_grid_cell)
 
static int compute_1st_order_weights (struct yac_const_basic_grid_data *tgt_basic_grid_data, size_t tgt_cell, struct yac_const_basic_grid_data *src_basic_grid_data, size_t src_count, size_t *src_cells, struct yac_grid_cell tgt_grid_cell_buffer, struct yac_grid_cell *src_grid_cell_buffer, double *weights, size_t *num_weights, int partial_coverage, enum yac_interp_method_conserv_normalisation normalisation, int enforced_conserv)
 
static int compare_supermesh_cell_src_local_ids (const void *a, const void *b)
 
static int compare_supermesh_cell_tgt_local_ids (const void *a, const void *b)
 
static void orthogonalise_weight_vector (double *src_cell_centroid, struct weight_vector_3d *G_i, struct weight_vector_data_3d *buffer)
 
static int compare_weight_vector_data_weight (void const *a, void const *b)
 
static int compare_weight_vector_data (void const *a, void const *b)
 
static void compact_weight_vector_data (struct weight_vector_data *weights, size_t *n)
 
static size_t compute_2nd_order_tgt_cell_weights (struct supermesh_cell *super_cell, struct weight_vector_data *weights)
 
static void compute_cell_barycenter (struct yac_const_basic_grid_data *grid_data, size_t cell_idx, double barycenter[3])
 
static void compute_super_cells (struct yac_interp_grid *interp_grid, size_t *tgt_points, size_t count, struct supermesh_cell **super_cells_, size_t *num_super_cells, int *interp_fail_flag, size_t **src_cells, size_t *num_src_cells, enum yac_interp_method_conserv_normalisation normalisation, int partial_coverage)
 
static yac_coordinate_pointer compute_src_cell_centroids (struct yac_interp_grid *interp_grid, size_t *src_cells, int *skip_src_cell, size_t num_src_cells, struct supermesh_cell *super_cells, size_t num_super_cells)
 
static struct weight_vector_3dcompute_src_cell_gradients (struct yac_interp_grid *interp_grid, size_t *src_cells, yac_coordinate_pointer src_cell_centroids, int *skip_src_cell, size_t num_src_cells, size_t *src_cell_neighbours)
 
static size_t compute_2nd_order_weights (size_t *tgt_cells, int *interp_fail_flag, size_t num_tgt_cells, struct supermesh_cell *super_cells, size_t num_super_cells, size_t **src_per_tgt, double **weights, size_t *num_src_per_tgt)
 
struct interp_methodyac_interp_method_conserv_new (int order, int enforced_conserv, int partial_coverage, enum yac_interp_method_conserv_normalisation normalisation)
 
static void config_conserv_delete (struct yac_interp_method_config *config)
 
static struct yac_interp_method_configconfig_conserv_copy (const struct yac_interp_method_config *config)
 
static int config_conserv_compare (void const *a_, void const *b_)
 
static size_t config_conserv_get_pack_size (struct yac_interp_method_config const *config, MPI_Comm comm)
 
static void config_conserv_pack (struct yac_interp_method_config const *config, void *buffer, int buffer_size, int *position, MPI_Comm comm)
 
static enum yac_interpolation_list config_conserv_get_type ()
 
static struct interp_methodconfig_conserv_generate (struct yac_interp_method_config const *config)
 
static struct yac_paramconfig_conserv_get_param (struct yac_interp_method_config const *config)
 
struct yac_interp_method_configyac_interp_method_config_default_conserv_new (void)
 Creates a conservative interpolation method configuration with default parameters.
 
struct yac_interp_method_configyac_interp_method_config_conserv_unpack (void *buffer, int buffer_size, int *position, MPI_Comm comm)
 Unpacks a conservative interpolation method configuration from a buffer.
 

Variables

static struct interp_method_vtable interp_method_conserv_1st_order_vtable
 
static struct interp_method_vtable interp_method_conserv_2nd_order_vtable
 
static struct yac_interp_method_config_vtable yac_interp_method_config_vtable_conserv
 

Macro Definition Documentation

◆ AREA_TOL_FACTOR

#define AREA_TOL_FACTOR   (1e-6)

Definition at line 25 of file interp_method_conserv.c.

Function Documentation

◆ compact_weight_vector_data()

static void compact_weight_vector_data ( struct weight_vector_data * weights,
size_t * n )
static

Definition at line 474 of file interp_method_conserv.c.

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

◆ compare_supermesh_cell_src_local_ids()

static int compare_supermesh_cell_src_local_ids ( const void * a,
const void * b )
static

Definition at line 378 of file interp_method_conserv.c.

Here is the caller graph for this function:

◆ compare_supermesh_cell_tgt_local_ids()

static int compare_supermesh_cell_tgt_local_ids ( const void * a,
const void * b )
static

Definition at line 391 of file interp_method_conserv.c.

Here is the caller graph for this function:

◆ compare_weight_vector_data()

static int compare_weight_vector_data ( void const * a,
void const * b )
static

Definition at line 463 of file interp_method_conserv.c.

Here is the caller graph for this function:

◆ compare_weight_vector_data_weight()

static int compare_weight_vector_data_weight ( void const * a,
void const * b )
static

Definition at line 445 of file interp_method_conserv.c.

Here is the caller graph for this function:

◆ compute_1st_order_weights()

static int compute_1st_order_weights ( struct yac_const_basic_grid_data * tgt_basic_grid_data,
size_t tgt_cell,
struct yac_const_basic_grid_data * src_basic_grid_data,
size_t src_count,
size_t * src_cells,
struct yac_grid_cell tgt_grid_cell_buffer,
struct yac_grid_cell * src_grid_cell_buffer,
double * weights,
size_t * num_weights,
int partial_coverage,
enum yac_interp_method_conserv_normalisation normalisation,
int enforced_conserv )
static

Definition at line 167 of file interp_method_conserv.c.

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

◆ compute_2nd_order_tgt_cell_weights()

static size_t compute_2nd_order_tgt_cell_weights ( struct supermesh_cell * super_cell,
struct weight_vector_data * weights )
static

Definition at line 513 of file interp_method_conserv.c.

Here is the caller graph for this function:

◆ compute_2nd_order_weights()

static size_t compute_2nd_order_weights ( size_t * tgt_cells,
int * interp_fail_flag,
size_t num_tgt_cells,
struct supermesh_cell * super_cells,
size_t num_super_cells,
size_t ** src_per_tgt,
double ** weights,
size_t * num_src_per_tgt )
static

Definition at line 990 of file interp_method_conserv.c.

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

◆ compute_cell_barycenter()

static void compute_cell_barycenter ( struct yac_const_basic_grid_data * grid_data,
size_t cell_idx,
double barycenter[3] )
static

Definition at line 543 of file interp_method_conserv.c.

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

◆ compute_src_cell_centroids()

static yac_coordinate_pointer compute_src_cell_centroids ( struct yac_interp_grid * interp_grid,
size_t * src_cells,
int * skip_src_cell,
size_t num_src_cells,
struct supermesh_cell * super_cells,
size_t num_super_cells )
static

Definition at line 735 of file interp_method_conserv.c.

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

◆ compute_src_cell_gradients()

static struct weight_vector_3d * compute_src_cell_gradients ( struct yac_interp_grid * interp_grid,
size_t * src_cells,
yac_coordinate_pointer src_cell_centroids,
int * skip_src_cell,
size_t num_src_cells,
size_t * src_cell_neighbours )
static

Definition at line 811 of file interp_method_conserv.c.

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

◆ compute_super_cells()

static void compute_super_cells ( struct yac_interp_grid * interp_grid,
size_t * tgt_points,
size_t count,
struct supermesh_cell ** super_cells_,
size_t * num_super_cells,
int * interp_fail_flag,
size_t ** src_cells,
size_t * num_src_cells,
enum yac_interp_method_conserv_normalisation normalisation,
int partial_coverage )
static

Definition at line 565 of file interp_method_conserv.c.

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

◆ config_conserv_compare()

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

Definition at line 1289 of file interp_method_conserv.c.

◆ config_conserv_copy()

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

Definition at line 1278 of file interp_method_conserv.c.

◆ config_conserv_delete()

static void config_conserv_delete ( struct yac_interp_method_config * config)
static

Definition at line 1273 of file interp_method_conserv.c.

◆ config_conserv_generate()

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

Definition at line 1347 of file interp_method_conserv.c.

Here is the call graph for this function:

◆ config_conserv_get_pack_size()

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

Definition at line 1309 of file interp_method_conserv.c.

◆ config_conserv_get_param()

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

Definition at line 1358 of file interp_method_conserv.c.

Here is the call graph for this function:

◆ config_conserv_get_type()

static enum yac_interpolation_list config_conserv_get_type ( )
static

Definition at line 1343 of file interp_method_conserv.c.

◆ config_conserv_pack()

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

Definition at line 1320 of file interp_method_conserv.c.

◆ delete_conserv()

static void delete_conserv ( struct interp_method * method)
static

Definition at line 1252 of file interp_method_conserv.c.

◆ do_search_conserv_1st_order()

static size_t do_search_conserv_1st_order ( 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 235 of file interp_method_conserv.c.

Here is the call graph for this function:

◆ do_search_conserv_2nd_order()

static size_t do_search_conserv_2nd_order ( 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 1088 of file interp_method_conserv.c.

Here is the call graph for this function:

◆ get_cell_buffers()

static void get_cell_buffers ( struct yac_interp_grid * interp_grid,
size_t max_num_src_per_tgt,
struct yac_grid_cell * tgt_grid_cell,
struct yac_grid_cell ** src_grid_cells )
static

Definition at line 97 of file interp_method_conserv.c.

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

◆ get_cell_buffers_()

static void get_cell_buffers_ ( struct yac_interp_grid * interp_grid,
struct yac_grid_cell * tgt_grid_cell,
struct yac_grid_cell * src_grid_cell )
static

Definition at line 136 of file interp_method_conserv.c.

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

◆ get_max_num_vertices_per_cell()

static int get_max_num_vertices_per_cell ( struct yac_const_basic_grid_data * basic_grid_data)
static

Definition at line 85 of file interp_method_conserv.c.

Here is the caller graph for this function:

◆ orthogonalise_weight_vector()

static void orthogonalise_weight_vector ( double * src_cell_centroid,
struct weight_vector_3d * G_i,
struct weight_vector_data_3d * buffer )
inlinestatic

Definition at line 403 of file interp_method_conserv.c.

Here is the caller graph for this function:

◆ yac_interp_method_config_conserv_unpack()

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

Unpacks a conservative 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 1453 of file interp_method_conserv.c.

◆ yac_interp_method_config_default_conserv_new()

struct yac_interp_method_config * yac_interp_method_config_default_conserv_new ( void )

Creates a conservative interpolation method configuration with default parameters.

Returns
Pointer to the created yac_interp_method_config structure

Definition at line 1438 of file interp_method_conserv.c.

◆ yac_interp_method_conserv_new()

struct interp_method * yac_interp_method_conserv_new ( int order,
int enforced_conserv,
int partial_coverage,
enum yac_interp_method_conserv_normalisation normalisation )

constructor for an interpolation method of type interp_method_conserv

Parameters
[in]order1st or 2nd order remapping
[in]enforced_conservenforce conservation by correcting truncation errors
[in]partial_coverageif == 0, target cells that are not completely covered by non-masked source cells will not be interpolated (this is the default option)
if != 0, for target cells that are only partially covered by non-mask source cells the interpolation value will be determined by the contributions of the respective source cells
[in]normalisationspecifies how to do the normalisation

Definition at line 1228 of file interp_method_conserv.c.

Here is the caller graph for this function:

Variable Documentation

◆ interp_method_conserv_1st_order_vtable

struct interp_method_vtable interp_method_conserv_1st_order_vtable
static
Initial value:
= {
.delete = delete_conserv}
static void delete_conserv(struct interp_method *method)
static size_t do_search_conserv_1st_order(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 40 of file interp_method_conserv.c.

◆ interp_method_conserv_2nd_order_vtable

struct interp_method_vtable interp_method_conserv_2nd_order_vtable
static
Initial value:
= {
.delete = delete_conserv}
static size_t do_search_conserv_2nd_order(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 45 of file interp_method_conserv.c.

◆ yac_interp_method_config_vtable_conserv

struct yac_interp_method_config_vtable yac_interp_method_config_vtable_conserv
static
Initial value:
= {
.get_pack_size = config_conserv_get_pack_size,
}
static struct yac_param * config_conserv_get_param(struct yac_interp_method_config const *config)
static size_t config_conserv_get_pack_size(struct yac_interp_method_config const *config, MPI_Comm comm)
static int config_conserv_compare(void const *a_, void const *b_)
static struct yac_interp_method_config * config_conserv_copy(const struct yac_interp_method_config *config)
static void config_conserv_pack(struct yac_interp_method_config const *config, void *buffer, int buffer_size, int *position, MPI_Comm comm)
static struct interp_method * config_conserv_generate(struct yac_interp_method_config const *config)
static enum yac_interpolation_list config_conserv_get_type()
static void config_conserv_delete(struct yac_interp_method_config *config)

Definition at line 1427 of file interp_method_conserv.c.