Description Usage Value Author(s) See Also Examples
Compute subsets of vertices and triangles in an inla.mesh object that are connected by edges.
1 | inla.mesh.components(mesh)
|
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. |
Finn Lindgren finn.lindgren@gmail.com
inla.mesh.2d, inla.mesh.create
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.