submesh.mesh: Extract a part of a mesh

Description Usage Arguments Value Note Author(s) Examples

View source: R/geometry.R

Description

Extracts a part of a mesh

Usage

1
submesh.mesh(z, mesh)

Arguments

z

A matrix with values indicating which nodes that should be present in the submesh.

mesh

An inla.mesh object.

Value

An inla.mesh object.

Note

This function requires the INLA package, which is not a CRAN package. See http://www.r-inla.org/download for easy installation instructions.

Author(s)

Finn Lindgren finn.lindgren@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
if (require(INLA)) {
nxy = 30
x=seq(from=0,to=4,length.out=nxy)
lattice=inla.mesh.lattice(x=x,y=x)
mesh=inla.mesh.create(lattice=lattice, extend=FALSE, refine=FALSE)

#extract a part of the mesh inside a circle
xy.in <- rowSums((mesh$loc[,1:2]-2)^2)<1
submesh <- excursions:::submesh.mesh(matrix(xy.in,nxy,nxy),mesh)
plot(mesh$loc[,1:2])
lines(2+cos(seq(0,2*pi,length.out=100)), 2+sin(seq(0,2*pi,length.out=100)))
plot(submesh,add=TRUE)
points(mesh$loc[xy.in,1:2],col="2")
}
## End(Not run)

finnlindgren/excursions documentation built on Jan. 17, 2021, 12:20 a.m.