Skip to contents

[Experimental] Collection function spaces. Nested collections are allowed. The interface and object storage model is experimental and may change.

Usage

fm_collect(x, ...)

Arguments

x

list of function space objects, such as fm_mesh_2d(), all of the same type.

...

Currently unused

Value

A fm_collect or fm_collect_list object. Elements of fm_collect:

fun_spaces

fm_list of function space objects

fun_spaces_lengths

integer with the length of the fun_spaces list. For nested collections, a list with elements of the same type, including potentially nested lists for multiple nesting layers.

manifold

character; manifold type summary, obtained from the function spaces.

Details

Coordinate input is of the form of a list or tibble with columns loc and index. The loc column contains the coordinates of the evaluation points in the format of the contained spaces, and the index column is a vector or matrix (for nested collections) that contains the index of the function space in the collection to which each point belongs. For nested collections, the index column is a matrix with one column per nesting level.

Examples

m <- fm_collect(list(
  A = fmexample$mesh,
  B = fmexample$mesh
))
m2 <- fm_as_collect(m)
m3 <- fm_as_collect_list(list(m, m))
c(fm_dof(m$fun_spaces[[1]]) + fm_dof(m$fun_spaces[[2]]), fm_dof(m))
#> [1] 584 584
fm_basis(m, loc = tibble::tibble(
  loc = fmexample$loc_sf,
  index = c(1, 1, 2, 2, 1, 2, 2, 1, 1, 2)
), full = TRUE)
#> fm_basis object
#>   Projection matrix (A): 10-by-584
#>   Valid evaluations (ok): 10 out of 10
#>   Additional information: 
fm_basis(m, loc = tibble::tibble(
  loc = rbind(c(0, 0), c(0.1, 0.1)),
  index = c("B", "A")
), full = TRUE)
#> fm_basis object
#>   Projection matrix (A): 2-by-584
#>   Valid evaluations (ok): 2 out of 2
#>   Additional information: 
fm_evaluator(m, loc = tibble::tibble(loc = cbind(0, 0), index = 2))
#> fm_evaluator object
#>   proj:
#>     fm_basis object
#>       Projection matrix (A): 1-by-584
#>       Valid evaluations (ok): 1 out of 1
#>       Additional information: 
#>   Additional evaluator information: 
names(fm_fem(m))
#> [1] "cc" "c0" "c1" "va" "ta" "g1" "g2"
fm_diameter(m)
#> [1] 10.51699

m_nested <- fm_collect(list(
  A = fm_collect(list(
    A1 = fmexample$mesh,
    A2 = fmexample$mesh
  )),
  B = fm_collect(list(
    B1 = fmexample$mesh,
    B2 = fmexample$mesh,
    B3 = fmexample$mesh
  ))
))

fm_evaluator(
  m_nested,
  loc = tibble::tibble(loc = cbind(0, 0), index = cbind(3,2))
)
#> fm_evaluator object
#>   proj:
#>     fm_basis object
#>       Projection matrix (A): 1-by-1460
#>       Valid evaluations (ok): 0 out of 1
#>       Additional information: 
#>   Additional evaluator information: 
names(fm_fem(m))
#> [1] "cc" "c0" "c1" "va" "ta" "g1" "g2"

fm_diameter(m)
#> [1] 10.51699
fm_bbox(m)
#> Bounding box: (-5.345477, 4.083580) x (-3.997839, 5.415519)
fm_diameter(m, multi = TRUE)
#>        A        B 
#> 10.51699 10.51699 
fm_bbox(m, multi = TRUE)
#> (-5.345477, 4.083580) x (-3.997839, 5.415519)
#> (-5.345477, 4.083580) x (-3.997839, 5.415519)

fm_int(m_nested, name = "geometry")
#> # A tibble: 1,460 × 5
#>    weight .block                   geometry geometry.index[,1]  [,2]
#>     <dbl>  <int>                    <POINT>              <int> <int>
#>  1  0.349      1 Z (-5.180541 -0.8956538 0)                  1     1
#>  2  0.254      1  Z (-4.924679 -1.465076 0)                  1     1
#>  3  0.144      1  Z (-4.644074 -1.860313 0)                  1     1
#>  4  0.361      1  Z (-4.242024 -2.255549 0)                  1     1
#>  5  0.143      1  Z (-3.620028 -2.650785 0)                  1     1
#>  6  0.449      1   Z (-3.202318 -2.82668 0)                  1     1
#>  7  0.868      1   Z (-1.61974 -3.713512 0)                  1     1
#>  8  0.742      1  Z (-0.8284506 -3.89906 0)                  1     1
#>  9  0.198      1  Z (0.3584832 -3.997839 0)                  1     1
#> 10  0.202      1  Z (0.7541278 -3.960901 0)                  1     1
#> # ℹ 1,450 more rows
#> # ℹ 1 more variable: .block_origin <int[,1]>