![]() |
YAC 3.7.0
Yet Another Coupler
|
#include "grid_cell.h"
Go to the source code of this file.
Functions | |
void | yac_cell_clipping (size_t N, struct yac_grid_cell *source_cell, struct yac_grid_cell target_cell, struct yac_grid_cell *overlap_buffer) |
cell clipping to get the cells describing the intersections | |
void | yac_cell_lat_clipping (size_t N, struct yac_grid_cell *cells, double lat_bounds[2], struct yac_grid_cell *overlap_buffer) |
cell clipping to get the cells describing the intersections | |
void | yac_compute_overlap_areas (size_t N, struct yac_grid_cell *source_cell, struct yac_grid_cell target_cell, double *partial_areas) |
calculates partial areas for all overlapping parts of the source cells with arbitrary target cells, this is required for conservative remapping. | |
void | yac_compute_overlap_info (size_t N, struct yac_grid_cell *source_cell, struct yac_grid_cell target_cell, double *overlap_areas, double(*overlap_barycenters)[3]) |
calculates partial areas for all overlapping parts of the source cells with arbitrary target cells, this is required for conservative remapping. In addition, the barycenter of each overlap is calculated. | |
void | yac_compute_overlap_buf_free () |
void | yac_correct_weights (size_t N, double *weight) |
correct interpolation weights | |
void | yac_circle_generate (double const *a, double const *b, enum yac_edge_type type, int edge_ordering, struct yac_circle *circle) |
int | yac_circle_compare (void const *a, void const *b) |
int | yac_circle_contains_north_pole (struct yac_circle *circle) |
int | yac_circle_point_is_inside (double const point[3], struct yac_circle *circle) |
int | yac_circle_compare_distances (double const a[3], double const b[3], struct yac_circle *circle) |
void yac_cell_clipping | ( | size_t | N, |
struct yac_grid_cell * | source_cell, | ||
struct yac_grid_cell | target_cell, | ||
struct yac_grid_cell * | overlap_buffer ) |
cell clipping to get the cells describing the intersections
The routine takes (a list of) source cells and a target cell. It sets the target cell data and does some further initialisation. Thus it needs to be called for each new target cell intersection calculation
The vertices of source and target cells can be either provided in a clockwise or anticlockwise sense.
[in] | N | number of source cells |
[in] | source_cell | list of source cells |
[in] | target_cell | target cell |
[in] | overlap_buffer | buffer for the overlaps between the target and the source cells |
Definition at line 1090 of file clipping.c.
void yac_cell_lat_clipping | ( | size_t | N, |
struct yac_grid_cell * | cells, | ||
double | lat_bounds[2], | ||
struct yac_grid_cell * | overlap_buffer ) |
cell clipping to get the cells describing the intersections
The routine takes (a list of) cells and two latitude bounds.
[in] | N | number of cells |
[in] | cells | list of cells |
[in] | lat_bounds | latitude bounds in radiant |
[in] | overlap_buffer | buffer for the overlaps between the cells and latitude band |
Definition at line 1327 of file clipping.c.
int yac_circle_compare | ( | void const * | a, |
void const * | b ) |
Compare routine for yac circles (first by type and second parameters of the circle, if types are identical)
[in] | a | yac circle a |
[in] | b | yac circle b |
Definition at line 344 of file clipping.c.
int yac_circle_compare_distances | ( | double const | a[3], |
double const | b[3], | ||
struct yac_circle * | circle ) |
Compares the distances of two points to a given yac circle
[in] | a | point a |
[in] | b | point b |
[in] | circle | yac circle |
Definition at line 509 of file clipping.c.
int yac_circle_contains_north_pole | ( | struct yac_circle * | circle | ) |
Determines whether the provided yac circle contains the north pole
[in] | circle | yac circle |
Definition at line 563 of file clipping.c.
void yac_circle_generate | ( | double const * | a, |
double const * | b, | ||
enum yac_edge_type | type, | ||
int | edge_ordering, | ||
struct yac_circle * | circle ) |
Generate a yac circle
[in] | a | point a |
[in] | b | point b |
[in] | type | typ of edge connecting points a and b |
[in] | edge_ordering | ordering of the points a and b |
[out] | circle | yac circle |
Definition at line 415 of file clipping.c.
int yac_circle_point_is_inside | ( | double const | point[3], |
struct yac_circle * | circle ) |
Determines whether a given point is on the "inside"-side of a plane defined by the given yac circle
[in] | point | point to be checked |
[in] | circle | yac circle |
Definition at line 471 of file clipping.c.
void yac_compute_overlap_areas | ( | size_t | N, |
struct yac_grid_cell * | source_cell, | ||
struct yac_grid_cell | target_cell, | ||
double * | partial_areas ) |
calculates partial areas for all overlapping parts of the source cells with arbitrary target cells, this is required for conservative remapping.
Some of the underlying concepts can be found in
See e.g. Joseph O'Rourke, Computational Geometry in C, 2nd Ed., 1998 Sec. 7.6 Intersections of Convex Polygons, page 253.
The routine takes (a list of) source cells and a target cell. It determines the clipping points of the intersection between a source and the target cells using cell_clipping internally. In a second step areas are calculated for each intersection described in the overlap cells. If a target cell is fully covered by N source cells the N partial areas should add up to the area of the target cell.
[in] | N | number of source cells |
[in] | source_cell | list of source cells |
[in] | target_cell | target cell |
[out] | partial_areas | list of N partial weights, one weight for each source-target intersection |
Definition at line 276 of file clipping.c.
void yac_compute_overlap_buf_free | ( | ) |
Frees buffer allocated by yac_compute_overlap_info
Definition at line 88 of file clipping.c.
void yac_compute_overlap_info | ( | size_t | N, |
struct yac_grid_cell * | source_cell, | ||
struct yac_grid_cell | target_cell, | ||
double * | overlap_areas, | ||
double(*) | overlap_barycenters[3] ) |
calculates partial areas for all overlapping parts of the source cells with arbitrary target cells, this is required for conservative remapping. In addition, the barycenter of each overlap is calculated.
Some of the underlying concepts can be found in
See e.g. Joseph O'Rourke, Computational Geometry in C, 2nd Ed., 1998 Sec. 7.6 Intersections of Convex Polygons, page 253.
The routine takes (a list of) source cells and a target cell. It determines the clipping points of the intersection between a source and the target cells using cell_clipping internally. In a second step areas are calculated for each intersection described in the overlap cells. If a target cell is fully covered by N source cells the N partial areas should add up to the area of the target cell.
[in] | N | number of source cells |
[in] | source_cell | list of source cells |
[in] | target_cell | target cell |
[out] | overlap_areas | list of N partial weights, one weight for each source-target intersection |
[out] | overlap_barycenters | coordinates of the barycenters of the overlap cell |
Definition at line 119 of file clipping.c.
void yac_correct_weights | ( | size_t | N, |
double * | weight ) |
correct interpolation weights
Returns weights with a sum close to 1.0
[in] | N | number of source cells |
[out] | weight | list of N partial weights |
Definition at line 1447 of file clipping.c.