inla.mesh.segment: Constraint segments for inla.mesh

Description Usage Arguments Value Author(s) See Also Examples

View source: R/mesh.R

Description

Constructs inla.mesh.segment objects that can be used to specify boundary and interior constraint edges in calls to inla.mesh.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Create or join inla.mesh.segment objects.
inla.mesh.segment(...)
## Default S3 method:
inla.mesh.segment(loc = NULL, idx = NULL, grp = NULL,
  is.bnd = TRUE, crs = NULL, ...)
## S3 method for class 'inla.mesh.segment'
inla.mesh.segment(..., grp.default = 0)

inla.contour.segment(x = seq(0, 1, length.out = nrow(z)),
                     y = seq(0, 1, length.out = ncol(z)),
                     z,
                     nlevels = 10,
                     levels = pretty(range(z, na.rm = TRUE), nlevels),
                     groups = seq_len(length(levels)),
                     positive = TRUE,
                     eps = NULL,
                     crs = NULL)

Arguments

loc

Matrix of point locations.

idx

Segment index sequence vector or index pair matrix. The indices refer to the rows of loc. If loc==NULL, the indices will be interpreted as indices into the point specification supplied to inla.mesh.create. If is.bnd==TRUE, defaults to linking all the points in loc, as c(1:nrow(loc),1L), otherwise 1:nrow(loc).

grp

Vector of group labels for each segment. Set to NULL to let the labels be chosen automatically in a call to inla.mesh.create.

is.bnd

TRUE if the segments are boundary segments, otherwise FALSE.

grp.default

When joining segments, use this group label for segments that have grp=NULL.

x, y, z, nlevels, levels

Parameters specifying a set of surface contours, with syntax described in contour.

groups

Vector of group ID:s, one for each contour level.

positive

TRUE if the contours should encircle positive level excursions in a counter clockwise direction.

eps

Tolerance for inla.simplify.curve.

crs

An optional CRS or inla.CRS object

...

Additional parameters. When joining segments, a list of inla.mesh.segment objects.

Value

An inla.mesh.segment object.

Author(s)

Finn Lindgren finn.lindgren@gmail.com

See Also

inla.mesh.create, inla.mesh.2d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Create a square boundary and a diagonal interior segment
loc.bnd = matrix(c(0,0, 1,0, 1,1, 0,1), 4, 2, byrow=TRUE)
loc.int = matrix(c(0.9,0.1, 0.1,0.6), 2, 2, byrow=TRUE)
segm.bnd = inla.mesh.segment(loc.bnd)
segm.int = inla.mesh.segment(loc.int, is.bnd=FALSE)

## Points to be meshed
loc = matrix(runif(10*2),10,2)*0.9+0.05
mesh = inla.mesh.create(loc,
                        boundary=segm.bnd,
                        interior=segm.int,
                        refine=list())
plot(mesh)

## Not run: 
mesh = inla.mesh.create(loc, interior=list(segm.bnd, segm.int))
plot(mesh)

## End(Not run)

INBO-BMK/INLA documentation built on Dec. 4, 2019, 11:43 p.m.