GRIDMAN
grid managment library
|
Select part of 2D grid cut by polygon. More...
Go to the source code of this file.
Functions/Subroutines | |
subroutine | gridman_grid2d_cut (CUTGRID, GRID, XP, YP, NP, LEX, IERR) |
Select part of a 2D grid cut by polygon. More... | |
subroutine | check_polygon (XP, YP, NP, IERR) |
subroutine | gridman_grid2d_polygon_trajectory (NPOL, NPEDGE, ICELL_POL, IEDGE_POL, X_POL, Y_POL, INDVERT, INDSEG, XP, YP, NP, GRID, IERR) |
subroutine | find_closest_edge (IEDGE_OUT, X_OUT, Y_OUT, X1, Y1, X2, Y2) |
subroutine | find_closest_boundary (IEDGE_OUT, X_OUT, Y_OUT, IEDGE0, X1, Y1, X2, Y2) |
Select part of 2D grid cut by polygon.
Definition in file cut.f.
subroutine gridman_grid2d_cut | ( | type(gridman_grid) | CUTGRID, |
type(gridman_grid) | GRID, | ||
real(gridman_dp), dimension(np), intent(in) | XP, | ||
real(gridman_dp), dimension(np), intent(in) | YP, | ||
integer(gridman_sp), intent(in) | NP, | ||
logical, intent(in) | LEX, | ||
integer, intent(out) | IERR | ||
) |
Select part of a 2D grid cut by polygon.
Take cells which lie inside or outside of a closed polygon.
Current implementation cannot handle the case where polygon edges intersect the grid nodes, or grid edges intersect the polygon vertices
Normally those conditions, as well as the codition that the polygon has no self intersections, are not checked because it may require too long time. The checks are enforced when GRIDMAN_CHECK=.TRUE.
If polygon segments are added to the grid, then an edge index with indexes of the segments is added
cutgrid | Resulting grid with eliminated and cut cells | |
grid | Initial grid | |
[in] | np | Number of points in the polygon |
[in] | xp | X-coordinates of the polygon vertices, in METER First and last points must be same - closed polygon |
[in] | yp | Y-coordinates of the polygon vertices, in METER First and last points must be same - closed polygon |
[in] | lex | Defines if points inside the polygon are included or excluded If .FALSE. then points are included If .TRUE. then points are excluded |
[out] | ierr | Error code |
Definition at line 38 of file cut.f.
References check_polygon(), gridman::gridman_dp, gridman_grid2d_check(), gridman_grid2d_polygon_trajectory(), gridman_grid_allocate(), gridman_index_allocate(), gridman_index_transform(), gridman_point_in_polygon(), gridman::gridman_sp, and gridman::gridman_unit.
subroutine gridman_grid2d_cut::check_polygon | ( | real(gridman_dp), dimension(np), intent(in) | XP, |
real(gridman_dp), dimension(np), intent(in) | YP, | ||
integer(gridman_sp), intent(in) | NP, | ||
integer, intent(out) | IERR | ||
) |
Definition at line 796 of file cut.f.
References gridman_close2interval2d(), gridman_grid_deallocate(), gridman_indlist_deallocate(), gridman_intersect2d(), and gridman::gridman_unit.
Referenced by gridman_grid2d_cut().
subroutine gridman_grid2d_polygon_trajectory | ( | integer(gridman_sp), intent(out) | NPOL, |
integer(gridman_sp), dimension(grid%nedges), intent(out) | NPEDGE, | ||
integer(gridman_sp), dimension(:), allocatable | ICELL_POL, | ||
integer(gridman_sp), dimension(:), allocatable | IEDGE_POL, | ||
real(gridman_dp), dimension(:), allocatable | X_POL, | ||
real(gridman_dp), dimension(:), allocatable | Y_POL, | ||
integer(gridman_sp), dimension(np), intent(out) | INDVERT, | ||
integer(gridman_sp), dimension(:), allocatable | INDSEG, | ||
real(gridman_dp), dimension(np) | XP, | ||
real(gridman_dp), dimension(np) | YP, | ||
integer(gridman_sp), intent(in) | NP, | ||
type(gridman_grid) | GRID, | ||
integer, intent(out) | IERR | ||
) |
IEDGE_POL | 0 IF INSIDE THE CELL |
Definition at line 1002 of file cut.f.
References find_closest_boundary(), find_closest_edge(), gridman::gridman_dp, gridman_grid2d_chains(), gridman_grid_cells(), gridman::gridman_sp, and gridman::gridman_unit.
Referenced by gridman_grid2d_cut().
subroutine gridman_grid2d_polygon_trajectory::find_closest_edge | ( | integer(gridman_sp), intent(out) | IEDGE_OUT, |
real(gridman_dp), intent(out) | X_OUT, | ||
real(gridman_dp), intent(out) | Y_OUT, | ||
real(gridman_dp), intent(in) | X1, | ||
real(gridman_dp), intent(in) | Y1, | ||
real(gridman_dp), intent(in) | X2, | ||
real(gridman_dp), intent(in) | Y2 | ||
) |
[out] | iedge_out | 0 IF NO EDGE IS INTERSECTED |
Definition at line 1351 of file cut.f.
References gridman_intersect2d().
Referenced by gridman_grid2d_polygon_trajectory().
subroutine gridman_grid2d_polygon_trajectory::find_closest_boundary | ( | integer(gridman_sp), intent(out) | IEDGE_OUT, |
real(gridman_dp), intent(out) | X_OUT, | ||
real(gridman_dp), intent(out) | Y_OUT, | ||
integer(gridman_sp), intent(in) | IEDGE0, | ||
real(gridman_dp), intent(in) | X1, | ||
real(gridman_dp), intent(in) | Y1, | ||
real(gridman_dp), intent(in) | X2, | ||
real(gridman_dp), intent(in) | Y2 | ||
) |
[out] | iedge_out | 0 IF NO EDGE IS INTERSECTED |
Definition at line 1393 of file cut.f.
References gridman_cross2d(), gridman_indlist_deallocate(), gridman_point_in_polygon(), and gridman::gridman_unit.
Referenced by gridman_grid2d_polygon_trajectory().