Make_Movement_Mesh: Make a triangulated mesh for the domain of a population, to...

Usage Arguments Value Examples

View source: R/Make_Movement_Mesh.R

Usage

1
Make_Movement_Mesh(loc_orig, MeshType = "Samples", Cutoff = 1e-12, Refine = FALSE, ...)

Arguments

loc_orig
MeshType
Cutoff
Refine
...

Optional, additional arguments passed to 'inla.mesh.create' when creating movement mesh

Value

n_r

Number of triangles in movement mesh

mesh_domain

Description of movement mesh in INLA mesh format

loc_r

Location of centroids of triangles in movement mesh

mesh_gmrf

SPDE INLA mesh for centroids of movement mesh

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (loc_orig, MeshType = "Samples", Cutoff = 1e-12, Refine = FALSE, 
    ...) 
{
    mesh_discard = inla.mesh.create(loc_orig, plot.delay = NULL, 
        extend = list(n = 8, offset = -0.15), refine = FALSE)
    loc_discard = mesh_centers(mesh_discard)
    mesh_domain = inla.mesh.create(loc_discard, plot.delay = NULL, 
        extend = list(n = 8, offset = -0.15), refine = Refine, 
        cutoff = Cutoff, ...)
    loc_v = mesh_domain$loc[, 1:2]
    loc_r = mesh_centers(mesh_domain)
    n_v = nrow(loc_v)
    n_r = nrow(loc_r)
    colnames(loc_v) = colnames(loc_r) = colnames(loc_orig)
    if (MeshType == "Samples") 
        mesh_gmrf = inla.mesh.create(loc_r, plot.delay = NULL, 
            extend = list(n = 8, offset = -0.15), refine = FALSE)
    if (MeshType == "Refined") 
        mesh_gmrf = inla.mesh.create(loc_r, plot.delay = NULL, 
            extend = list(n = 8, offset = -0.15), refine = list(min.angle = 26))
    spde_gmrf = inla.spde2.matern(mesh_gmrf, alpha = 2)
    n_g = mesh_gmrf$n
    Return = list(n_g = n_g, n_v = n_v, n_r = n_r, loc_v = loc_v, 
        loc_r = loc_r, mesh_domain = mesh_domain, spde_gmrf = spde_gmrf, 
        mesh_gmrf = mesh_gmrf)
    return(Return)
  }

James-Thorson/movement_tools documentation built on May 7, 2019, 10:19 a.m.