-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdelete_ghost_triangles.jl
More file actions
32 lines (29 loc) · 1.3 KB
/
delete_ghost_triangles.jl
File metadata and controls
32 lines (29 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
delete_ghost_triangles!(tri::Triangulation)
Deletes all the ghost triangles from `tri`.
!!! warning "Ghost vertices"
Ghost vertices are still used in the `keys` of the [`Adjacent2Vertex`](@ref)
of `tri`, and are still present in the [`Graph`](@ref). If you want to delete the
ghost vertex `keys` from the [`Adjacent2Vertex`](@ref), you need to use
[`delete_adjacent2vertex!`](@ref). For deleting the ghost vertices from the
[`Graph`](@ref), you need [`delete_ghost_vertices_from_graph!`](@ref). Additionally,
edges in [`Adjacent`](@ref) can still map to ghost vertices. If you also want to delete
those, you need to filter through the `values` of the [`Adjacent`](@ref) map
that are ghost vertices, and use [`delete_adjacent!`](@ref).
"""
function delete_ghost_triangles!(tri::Triangulation)
T = get_triangles(tri)
for g in each_ghost_vertex(tri)
for uv in (each_edge ∘ get_adjacent2vertex)(tri, g)
u, v = edge_vertices(uv)
delete_adjacent!(tri, v, g)
delete_adjacent!(tri, g, u)
delete_adjacent2vertex!(tri, u, v, g)
delete_adjacent2vertex!(tri, v, g, u)
delete_triangle!(T, u, v, g)
end
end
empty!(get_boundary_vertex_to_ghost(tri))
set_has_ghosts!(tri, false)
return tri
end