| inla.mesh.components {INLA} | R Documentation |
Compute connected mesh subsets
Description
Compute subsets of vertices and triangles in an inla.mesh object that are connected by edges.
Usage
inla.mesh.components(mesh)
Arguments
mesh |
An |
Value
A list with elements vertex and triangle, vectors of
integer labels for which connected component they belong, and info, a
data.frame with columns
component |
Connected component integer label. |
nV |
The number of vertices in the component. |
nT |
The number of triangles in the component. |
area |
The surface area associated with the component. Component lables are not comparable across different meshes, but some ordering stability is guaranteed by initiating each component from the lowest numbered triangle whenever a new component is initiated. |
Author(s)
Finn Lindgren finn.lindgren@gmail.com
See Also
inla.mesh.2d(), inla.mesh.create()
Examples
# Construct two simple meshes:
loc <- matrix(c(0, 1, 0, 1), 2, 2)
mesh1 <- inla.mesh.2d(loc = loc, max.edge = 0.1)
bnd <- inla.nonconvex.hull(loc, 0.3)
mesh2 <- inla.mesh.2d(boundary = bnd, max.edge = 0.1)
# Compute connectivity information:
conn1 <- inla.mesh.components(mesh1)
conn2 <- inla.mesh.components(mesh2)
# One component, simply connected mesh
conn1$info
# Two disconnected components
conn2$info
# Extract the subset mesh for the largest component:
# (Note: some information is lost, such as fixed segments,
# and boundary edge labels.)
maxi <- conn2$info$component[which.max(conn2$info$area)]
mesh3 <- inla.mesh.create(
loc = mesh2$loc,
tv = mesh2$graph$tv[conn2$triangle == maxi, , drop = FALSE]
)
[Package INLA version 24.10.29 Index]