YetAnotherCoupler 3.2.0_a
Loading...
Searching...
No Matches
Functions
clipping.h File Reference
#include "grid_cell.h"
Include dependency graph for clipping.h:
This graph shows which files directly or indirectly include this file:

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_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)
 

Function Documentation

◆ yac_cell_clipping()

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.

Parameters
[in]Nnumber of source cells
[in]source_celllist of source cells
[in]target_celltarget cell
[in]overlap_bufferbuffer for the overlaps between the target and the source cells
Remarks
source cells can be either convex or concave
target cell has to be convex
cells in overlap_buffer can be concave (even if source cell was convex)
overlap_buffer must contain valid grid_cells (have to be initialised using yac_init_grid_cell; initialisation have to be done only once, in consecutive calls, the cells can be reused with have to be reinitialised)

Definition at line 1078 of file clipping.c.

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

◆ yac_cell_lat_clipping()

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.

Parameters
[in]Nnumber of cells
[in]cellslist of cells
[in]lat_boundslatitude bounds in radiant
[in]overlap_bufferbuffer for the overlaps between the cells and latitude band
Remarks
cells in overlap_buffer can be concave
overlap_buffer must contain valid grid_cells (have to be initialised using yac_init_grid_cell; initialisation have to be done only once, in consecutive calls, the cells can be reused with have to be reinitialised)
this routine is currently not being used within YAC but potentially used within the CDOs

Definition at line 1315 of file clipping.c.

Here is the call graph for this function:

◆ yac_circle_compare()

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)

Parameters
[in]ayac circle a
[in]byac circle b
Returns
-1, 0, or 1 depending on the circles (lat circles always come last)

Definition at line 332 of file clipping.c.

Here is the caller graph for this function:

◆ yac_circle_compare_distances()

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

Parameters
[in]apoint a
[in]bpoint b
[in]circleyac circle
Returns
-1 if point a is closer to the circle than point b
0 if point a and b have the same distance to the circle
1 if point b is closer to the circle than point a

Definition at line 497 of file clipping.c.

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

◆ yac_circle_contains_north_pole()

int yac_circle_contains_north_pole ( struct yac_circle circle)

Determines whether the provided yac circle contains the north pole

Parameters
[in]circleyac circle
Returns
1 if the circle contains the north pole, 0 otherwise

Definition at line 551 of file clipping.c.

Here is the caller graph for this function:

◆ yac_circle_generate()

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

Parameters
[in]apoint a
[in]bpoint b
[in]typetyp of edge connecting points a and b
[in]edge_orderingordering of the points a and b
[out]circleyac circle

Definition at line 403 of file clipping.c.

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

◆ yac_circle_point_is_inside()

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

Parameters
[in]pointpoint to be checked
[in]circleyac circle
Returns
0 if the point is not inside
1 if the point is inside
2 if the point is on the plane

Definition at line 459 of file clipping.c.

Here is the caller graph for this function:

◆ yac_compute_overlap_areas()

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.

Parameters
[in]Nnumber of source cells
[in]source_celllist of source cells
[in]target_celltarget cell
[out]partial_areaslist of N partial weights, one weight for each source-target intersection

Definition at line 263 of file clipping.c.

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

◆ yac_compute_overlap_info()

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.

Parameters
[in]Nnumber of source cells
[in]source_celllist of source cells
[in]target_celltarget cell
[out]overlap_areaslist of N partial weights, one weight for each source-target intersection
[out]overlap_barycenterscoordinates of the barycenters of the overlap cell

Definition at line 109 of file clipping.c.

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

◆ yac_correct_weights()

void yac_correct_weights ( size_t  N,
double *  weight 
)

correct interpolation weights

Returns weights with a sum close to 1.0

Parameters
[in]Nnumber of source cells
[out]weightlist of N partial weights

Definition at line 1435 of file clipping.c.

Here is the caller graph for this function: