mesh.components: Compute connected mesh subsets

Description Usage Value Author(s) See Also Examples

Description

Compute subsets of vertices and triangles in an inla.mesh object that are connected by edges.

Usage

1

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

 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])

inbo/INLA documentation built on Dec. 6, 2019, 9:51 a.m.