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}[CellParents, CellNodes, NodeParents, BFaceGeometries, CoordinateSystem, BFaceNodes, ParentGrid, CellRegions, ParentGridRelation, Coordinates, BFaceRegions, CellGeometries, NumBFaceRegions]
[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.BFaceParents
— Typeabstract type BFaceParents <: AbstractGridIntegerArray1D
Grid component key type for storing parent bfaces
ExtendableGrids.CellParents
— Typeabstract type CellParents <: AbstractGridIntegerArray1D
Grid component key type for storing parent cells
ExtendableGrids.FaceParents
— Typeabstract type FaceParents <: AbstractGridIntegerArray1D
Grid component key type for storing parent faces (only for SubGrid relation when FaceNodes is instantiated)
ExtendableGrids.NodeParents
— Typeabstract type NodeParents <: AbstractGridIntegerArray1D
Grid component key type for storing node parents (=ids of nodes in ParentGrid) in an array
ExtendableGrids.ParentGrid
— Typeabstract type ParentGrid <: AbstractGridComponent
Grid component key type for storing parent grid
ExtendableGrids.ParentGridRelation
— Typeabstract type ParentGridRelation <: AbstractGridComponent
Grid component key type for storing parent grid relationship
ExtendableGrids.RefinedGrid
— Typeabstract type RefinedGrid <: ParentGridRelation
Grid component key type for indicating that grid is a refinement of the parentgrid
ExtendableGrids.SubGrid
— Typeabstract type SubGrid{support} <: ParentGridRelation
Grid component key type for indicating that grid is a subgrid of the parentgrid
ExtendableGrids.SubgridVectorView
— Typestruct SubgridVectorView{Tv, Ti} <: AbstractArray{Tv, 1}
Vector view on subgrid
sysarray::AbstractVector
node_in_parent::Vector
Base.getindex
— Methodgetindex(
aview::ExtendableGrids.SubgridVectorView,
inode::Integer
) -> Any
Accessor method for subgrid vector view.
Base.setindex!
— Methodsetindex!(
aview::ExtendableGrids.SubgridVectorView,
v,
inode::Integer
) -> ExtendableGrids.SubgridVectorView
Accessor method for subgrid vector view.
Base.size
— Methodsize(a::ExtendableGrids.SubgridVectorView) -> Tuple{Int64}
Return size of vector view.
Base.view
— Methodview(a::AbstractVector, subgrid::ExtendableGrid) -> Any
Create a view of the vector on a subgrid.
ExtendableGrids._copytransform!
— Method_copytransform!(a::AbstractArray, b::AbstractArray)
Default transform for subgrid creation
ExtendableGrids.subgrid
— Methodsubgrid(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 gridsubregions
: Array of subregions which define the subgrid- 'support': support of subgrid, default is ONCELLS but can be also ONFACES or ON_BFACES to create codimension 1 subgrid from face/bfaces region
boundary
: if true, create codimension 1 subgrid from boundary regions (same as support = ON_BFACES)transform
(kw parameter): transformation function between grid and subgrid coordinates acting on one point.coordinatesystem
: ifboundary==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