Adjacent elements of a Vertex in Meshes.jl

Coboundary{0,3} gives you all the elements (Hexahedron’s in this case) that share a given vertex i.

You can confirm this by:

julia> ver = vertex(g,4)
Point with Spherical{NoDatum} coordinates
├─ r: 2.1082115173339844 m
├─ θ: 0.0 rad
└─ ϕ: 0.0 rad

julia> Coboundary{0,3}(topology(g))(4) # returns element id's
(3, 4)

julia> g[3]
Hexahedron
├─ Point(r: 1.9230155944824219 m, θ: 0.0 rad, ϕ: 0.0 rad)
├─ Point(r: 2.1082115173339844 m, θ: 0.0 rad, ϕ: 0.0 rad)  # vertex 4
├─ ...

julia> g[4]
Hexahedron
├─ Point(r: 2.1082115173339844 m, θ: 0.0 rad, ϕ: 0.0 rad) # vertex 4
├─ ...

julia> # do any elements besides 3 and 4 have vertex 4?
julia> any(e -> e ∉ [3,4] && any(v -> v === ver, vertices(g[e])), 1:nelements(g))
false

Coboundary{0,2} will give you the 2d elements that share a given vertex.

2 Likes