Subgrid

Subgrids of an ExtendableGrid are again of the same type ExtendableGrid and unse the typed Dict mechanism to store linkage to the parent grid.

grid=simplexgrid([1,2,3], [4,5,6])
sub=subgrid(grid,[2],boundary=true, transform=(a,b) -> (a[1]=10*b[2]))
println(keys(sub))
println(sub[Coordinates])
Type{<:AbstractGridComponent}[Coordinates, ParentGrid, CellNodes, CoordinateSystem, ParentGridRelation, CellGeometries, NumBFaceRegions, BFaceGeometries, CellParents, BFaceNodes, CellRegions, BFaceRegions, NodeParents]
[40 50 60]

Given a vector on the parent grid, one can create a view of this vecotor on the subgrid:

grid=simplexgrid([1,2,3], [4,5,6])
sub=subgrid(grid,[2],boundary=true, transform=(a,b) -> (a[1]=10*b[2]))
v=[i for i=1:num_nodes(grid)]
subv=view(v,sub)
println(subv)
[3, 6, 9]

API

ExtendableGrids.BoundarySubGridType
abstract type BoundarySubGrid <: ParentGridRelation

Grid component key type for indicating that grid is a boundary subgrid of the parentgrid

source
ExtendableGrids.FaceParentsType
abstract type FaceParents <: AbstractGridIntegerArray1D

Grid component key type for storing parent faces (only for SubGrid relation when FaceNodes is instantiated)

source
ExtendableGrids.NodeParentsType
abstract type NodeParents <: AbstractGridIntegerArray1D

Grid component key type for storing node parents (=ids of nodes in ParentGrid) in an array

source
ExtendableGrids.RefinedGridType
abstract type RefinedGrid <: ParentGridRelation

Grid component key type for indicating that grid is a refinement of the parentgrid

source
ExtendableGrids.SubGridType
abstract type SubGrid <: ParentGridRelation

Grid component key type for indicating that grid is a subgrid of the parentgrid

source
Base.getindexMethod
getindex(
    aview::ExtendableGrids.SubgridVectorView,
    inode::Integer
) -> Any

Accessor method for subgrid vector view.

source
Base.setindex!Method
setindex!(
    aview::ExtendableGrids.SubgridVectorView,
    v,
    inode::Integer
) -> ExtendableGrids.SubgridVectorView

Accessor method for subgrid vector view.

source
Base.sizeMethod
size(a::ExtendableGrids.SubgridVectorView) -> Tuple{Int64}

Return size of vector view.

source
Base.viewMethod
view(a::AbstractVector, subgrid::ExtendableGrid)

Create a view of the vector on a subgrid.

source
ExtendableGrids.subgridMethod
subgrid(parent,                                                             
        subregions::AbstractArray;                                          
        transform::T=function(a,b) @views a.=b[1:length(a)] end,                                      
        boundary=false,                                                     
        coordinatesystem=codim1_coordinatesystem(parent[CoordinateSystem]), 
        project=true) where T

Create subgrid from list of regions.

  • parent: parent grid
  • subregions: Array of subregions which define the subgrid
  • boundary: if true, create codimension 1 subgrid from boundary regions.
  • transform (kw parameter): transformation function between grid and subgrid coordinates acting on one point.
  • coordinatesystem: if boundary==true, specify coordinate system for the boundary. Default: if parent coordinatesystem is cartesian, just the cooresponding codim1 coordinatesystem, otherwise: nothing, requiring user specification for use of e.g. CellFinder with the subgrid.
  • project: project coordinates onto subgrid dimension

A subgrid is of type ExtendableGrid and stores two additional components: ParentGrid and NodeParents

source