-
Notifications
You must be signed in to change notification settings - Fork 1
/
RcppExports.R
161 lines (152 loc) · 6.43 KB
/
RcppExports.R
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' @title Globe points
#'
#' @description
#' Create points on a globe
#'
#' @param globe integer; the number of edge subdivision segments, 1 or higher.
#' @returns A matrix of points on a unit radius globe
#' @examples
#' fmesher_globe_points(1)
#' @export
fmesher_globe_points <- function(globe) {
.Call(`_fmesher_fmesher_globe_points`, globe)
}
#' @title Refined Constrained Delaunay Triangulation
#'
#' @description
#' (...)
#'
#' @param options list of triangulation options
#' @param loc numeric matrix; initial points to include
#' @param tv 3-column integer matrix with 0-based vertex indices for each triangle
#' @param boundary 2-column integer matrix with 0-based vertex indices for each
#' boundary edge constraint
#' @param interior 2-column integer matrix with 0-based vertex indices for each
#' interior edge constraint
#' @param boundary_grp integer vector with group labels
#' @param interior_grp integer vector with group labels
#' @examples
#' m <- fmesher_rcdt(list(cet_margin = 1), matrix(0, 1, 2))
#' @returns A list of information objects for a generated triangulation
#' @export
fmesher_rcdt <- function(options, loc, tv = NULL, boundary = NULL, interior = NULL, boundary_grp = NULL, interior_grp = NULL) {
.Call(`_fmesher_fmesher_rcdt`, options, loc, tv, boundary, interior, boundary_grp, interior_grp)
}
#' @title Barycentric coordinate computation
#'
#' @description
#' Locate points and compute triangular barycentric coordinates
#'
#' @param loc numeric matrix; coordinates of points to locate in the mesh
#' @param mesh_loc numeric matrix; mesh vertex coordinates
#' @param mesh_tv 3-column integer matrix with 0-based vertex indices for each triangle
#' @param options list of triangulation options
#' @examples
#' m <- fmesher_rcdt(list(cet_margin = 1), matrix(0, 1, 2))
#' b <- fmesher_bary(m$s,
#' m$tv,
#' matrix(c(0.5, 0.5), 1, 2),
#' list())
#' @returns A list with vector `t` and matrix `bary`
#' @export
fmesher_bary <- function(mesh_loc, mesh_tv, loc, options) {
.Call(`_fmesher_fmesher_bary`, mesh_loc, mesh_tv, loc, options)
}
#' @title Rotationally invariant spherical B-splines
#'
#' @description
#' Compute rotationally invariant spherical B-splines on the unit sphere
#'
#' @param loc numeric vector/matrix; coordinates of points to locate in the mesh,
#' only the z-coordinates are used (`sin(latitude)`)
#' @param n The number of basis functions
#' @param degree The polynomial basis degree
#' @param uniform logical; If `TRUE`, the knots are spaced uniformly by latitude,
#' if `FALSE`, the knots are spaced uniformly by `sin(latitude)`
#' @rdname fmesher_spherical_bsplines
#' @examples
#' m <- fm_rcdt_2d(globe = 1)
#' fmesher_spherical_bsplines(m$loc, n = 3, degree = 2, uniform = FALSE)
#' fmesher_spherical_bsplines1(m$loc[, 3], n = 3, degree = 2, uniform = FALSE)
#' @export
#' @keywords internal
#' @returns A matrix of evaluated b-spline basis functions
fmesher_spherical_bsplines1 <- function(loc, n, degree, uniform) {
.Call(`_fmesher_fmesher_spherical_bsplines1`, loc, n, degree, uniform)
}
#' @rdname fmesher_spherical_bsplines
#' @export
fmesher_spherical_bsplines <- function(loc, n, degree, uniform) {
.Call(`_fmesher_fmesher_spherical_bsplines`, loc, n, degree, uniform)
}
#' @title Finite element matrix computation
#'
#' @description
#' Construct finite element structure matrices
#'
#' @param mesh_loc numeric matrix; mesh vertex coordinates
#' @param mesh_tv 3-column integer matrix with 0-based vertex indices for each triangle
#' @param fem_order_max integer; the highest operator order to compute
#' @param aniso If non-NULL, a `list(gamma, v)`. Calculates anisotropic structure
#' matrices (in addition to the regular) for \eqn{\gamma}{gamma} and \eqn{v}{v} for
#' an anisotropic operator \eqn{\nabla\cdot H \nabla}{div H grad}, where
#' \eqn{H=\gamma I + v v^\top}{H = gamma I + v v'}.
#' Currently (2023-08-05) the fields need to be given per vertex.
#' @param options list of triangulation options (`sphere_tolerance`)
#' @examples
#' m <- fmesher_rcdt(list(cet_margin = 1), matrix(0, 1, 2))
#' b <- fmesher_fem(m$s, m$tv, fem_order_max = 2, aniso = NULL, options = list())
#' @returns A list of matrices
#' @export
fmesher_fem <- function(mesh_loc, mesh_tv, fem_order_max, aniso, options) {
.Call(`_fmesher_fmesher_fem`, mesh_loc, mesh_tv, fem_order_max, aniso, options)
}
#' @title Split lines at triangle edges
#'
#' @description
#' Split a sequence of line segments at triangle edges
#'
#' @param mesh_loc numeric matrix; mesh vertex coordinates
#' @param mesh_tv 3-column integer matrix with 0-based vertex indices for each triangle
#' @param loc numeric coordinate matrix
#' @param idx 2-column integer matrix
#' @param options list of triangulation options (`sphere_tolerance`)
#' @export
#' @returns A list of line splitting information objects
#' @seealso [fm_split_lines()]
#' @examples
#' mesh <- fm_mesh_2d(
#' boundary = fm_segm(rbind(c(0,0), c(1,0), c(1,1), c(0, 1)), is.bnd = TRUE)
#' )
#' splitter <- fm_segm(rbind(c(0.8, 0.2), c(0.2, 0.8)))
#' segm_split <- fm_split_lines(mesh, splitter)
fmesher_split_lines <- function(mesh_loc, mesh_tv, loc, idx, options) {
.Call(`_fmesher_fmesher_split_lines`, mesh_loc, mesh_tv, loc, idx, options)
}
#' @title Split triangles
#'
#' @description
#' Subdivide a mesh with congruent subtriangles
#'
#' @param mesh_loc numeric matrix; mesh vertex coordinates
#' @param mesh_tv 3-column integer matrix with 0-based vertex indices for each triangle
#' @param mesh_boundary 2-column integer matrix with 0-based vertex indices for
#' boundary constraints
#' @param mesh_interior 2-column integer matrix with 0-based vertex indices for
#' interior constraints
#' @param subdivisions integer; number of new points along each edge.
#' @param options list of triangulation options (`sphere_tolerance`)
#' @export
#' @returns A list of line splitting information objects
#' @seealso [fm_split_lines()]
#' @examples
#' mesh <- fm_mesh_2d(
#' boundary = fm_segm(rbind(c(0,0), c(1,0), c(1,1), c(0, 1)), is.bnd = TRUE)
#' )
#' splitter <- fm_segm(rbind(c(0.8, 0.2), c(0.2, 0.8)))
#' segm_split <- fm_split_lines(mesh, splitter)
fmesher_subdivide <- function(mesh_loc, mesh_tv, mesh_boundary, mesh_interior, subdivisions, options) {
.Call(`_fmesher_fmesher_subdivide`, mesh_loc, mesh_tv, mesh_boundary, mesh_interior, subdivisions, options)
}