ExtendableGrids.Adjacency
— TypeAdjacency type as union of FixedTargetAdjacency and VariableTargetAdjacency
ExtendableGrids.Adjacency
— MethodConstructors for Adjacency
ExtendableGrids.ElementInfo
— Typeconst ElementInfo{T}=Union{Vector{T},VectorOfConstants{T}}
Union type for element information arrays. If all elements have the same information, it can be stored in an economical form as a VectorOfConstants
.
ExtendableGrids.AT_NODES
— Typeabstract type AT_NODES <: AssemblyType
causes interpolation at vertices of the grid (only for H1-conforming interpolations)
ExtendableGrids.AbstractCoordinateSystem
— Typeabstract type AbstractCoordinateSystem <: AbstractExtendableGridApexType
Apex type for coordinate systems
ExtendableGrids.AbstractElementGeometries
— Typeabstract type AbstractElementGeometries <: AbstractGridComponent
Array of element geometry information.
ExtendableGrids.AbstractElementGeometry
— Typeabstract type AbstractElementGeometry <: AbstractExtendableGridApexType
ExtendableGrids.AbstractElementGeometry0D
— Typeabstract type AbstractElementGeometry0D <: AbstractElementGeometry
ExtendableGrids.AbstractElementGeometry1D
— Typeabstract type AbstractElementGeometry1D <: AbstractElementGeometry
ExtendableGrids.AbstractElementGeometry2D
— Typeabstract type AbstractElementGeometry2D <: AbstractElementGeometry
ExtendableGrids.AbstractElementGeometry3D
— Typeabstract type AbstractElementGeometry3D <: AbstractElementGeometry
ExtendableGrids.AbstractElementGeometry4D
— Typeabstract type AbstractElementGeometry4D <: AbstractElementGeometry
ExtendableGrids.AbstractElementRegions
— Typeabstract type AbstractElementRegions <: AbstractGridComponent
Array of element region number information.
ExtendableGrids.AbstractExtendableGridApexType
— Typeabstract type AbstractExtendableGridApexType
Apex type of all abstract types in this hierarchy.
ExtendableGrids.AbstractGridAdjacency
— Typeabstract type AbstractGridAdjacency <: AbstractGridComponent
Any kind of adjacency between grid components
ExtendableGrids.AbstractGridComponent
— Typeabstract type AbstractGridComponent <: AbstractExtendableGridApexType
Apex type for grid components.
ExtendableGrids.AbstractGridFloatArray1D
— Typeabstract type AbstractGridFloatArray1D <: AbstractGridComponent
1D Array of floating point data
ExtendableGrids.AbstractGridFloatArray2D
— Typeabstract type AbstractGridFloatArray2D <: AbstractGridComponent
2D Array of floating point data
ExtendableGrids.AbstractGridFloatConstant
— Typeabstract type AbstractGridFloatConstant <: AbstractGridComponent
Floating point number
ExtendableGrids.AbstractGridIntegerArray1D
— Typeabstract type AbstractGridIntegerArray1D <: AbstractGridComponent
1D Array of interger data
ExtendableGrids.AbstractGridIntegerArray2D
— Typeabstract type AbstractGridIntegerArray2D <: AbstractGridComponent
2D Array of integer data
ExtendableGrids.AbstractGridIntegerConstant
— Typeabstract type AbstractGridIntegerConstant <: AbstractGridComponent
Integer number
ExtendableGrids.AbstractPartitioningAlgorithm
— Typeabstract type AbstractPartitioningAlgorithm
Abstract super type for partitioning algorithms
ExtendableGrids.BEdgeRegions
— Typeabstract type BEdgeRegions <: AbstractElementRegions
Boundary edge region number per boundary edge
ExtendableGrids.BFaceCells
— Typeabstract type BFaceCells <: AbstractGridAdjacency
Adjacency describing cells per boundary or interior face
ExtendableGrids.BFaceEdges
— Typeabstract type BFaceEdges <: AbstractGridAdjacency
Adjacency describing edges per boundary or interior face
ExtendableGrids.BFaceGeometries
— TypeDescription of boundary face geometries
abstract type BFaceGeometries <: AbstractElementGeometries
ExtendableGrids.BFaceNodes
— Typeabstract type BFaceNodes <: AbstractGridAdjacency
Adjacency describing nodes per grid boundary face
ExtendableGrids.BFaceNormals
— Typeabstract type BFaceNormals <: AbstractGridComponent
Adjacency describing outer normals to boundary faces
ExtendableGrids.BFaceParents
— Typeabstract type BFaceParents <: AbstractGridIntegerArray1D
Grid component key type for storing parent bfaces
ExtendableGrids.BFaceRegions
— Typeabstract type BFaceRegions <: AbstractElementRegions
Boundary region number per boundary face
ExtendableGrids.BinnedPointList
— Typemutable struct BinnedPointList{T}
Binned point list structure allowing for fast check for already existing points.
This provides better performance for indendifying already inserted points than the naive linear search.
OTOH the implementation is still quite naive - it dynamically maintains a cuboid binning region with a fixed number of bins.
Probably tree based adaptive methods (a la octree) will be more efficient, however they will be harder to implement.
In an ideal world, we would maintain a dynamic Delaunay triangulation, which at once could be the starting point of mesh generation which will follow here anyway.
dim::Int32
: Space dimension
tol::Any
: Point distance tolerance. Points closer than tol (in Euclidean distance) will be identified, i.e. are collapsed to the first inserted.
binning_region_min::Vector
: " The union of all bins is the binning region - a cuboid given by two of its corners. It is calculated dynamically depending on the inserted points.
binning_region_max::Vector
binning_region_increase_factor::Any
: Increase factor of binning region (with respect to the cuboid defined by the coordinates of the binned points)
points::ElasticArrays.ElasticArray{T, 2, M, V} where {T, M, V<:DenseVector{T}}
: The actual point list
bins::Array{Vector{Int32}}
: The bins are vectors of indices of points in the point list We store them in a dim-dimensional array of length "numberofdirectional_bins^dim"
number_of_directional_bins::Int32
: Number of bins in each space dimension
unbinned::Vector{Int32}
: Some points will fall outside of the binning region. We collect them in vector of ubinned point indices
num_allowed_unbinned_points::Int32
: Number of unbinned points tolerated without rebinning
max_unbinned_ratio::Any
: Maximum ratio of unbinned points in point list
current_bin::Vector{Int32}
: Storage of current point bin
ExtendableGrids.BinnedPointList
— MethodBinnedPointList(dim; kwargs...)
Create and initialize binned point list
ExtendableGrids.BinnedPointList
— Method BinnedPointList(::Type{T}, dim;
tol = 1.0e-12,
number_of_directional_bins = 10,
binning_region_increase_factor = 0.01,
num_allowed_unbinned_points = 5,
max_unbinned_ratio = 0.05) where {T}
Create and initialize binned point list
ExtendableGrids.Cartesian1D
— Typeabstract type Cartesian1D <: AbstractCoordinateSystem
1D cartesion coordinate system (unknown x
)
ExtendableGrids.Cartesian2D
— Typeabstract type Cartesian2D <: AbstractCoordinateSystem
2D cartesion coordinate system (unknowns x,y
)
ExtendableGrids.Cartesian3D
— Typeabstract type Cartesian3D <: AbstractCoordinateSystem
2D cartesion coordinate system (unknowns x,y,z
)
ExtendableGrids.CellFinder
— Typestruct CellFinder{Tv, Ti}
CellFinder supports finding cells in grids.
ExtendableGrids.CellFinder
— MethodCellFinder(grid)
Create a cell finder on grid.
ExtendableGrids.CellGeometries
— Typeabstract type CellGeometries <: AbstractElementGeometries
Description of cell geometries
ExtendableGrids.CellNodes
— Typeabstract type CellNodes <: AbstractGridAdjacency
Adjacency describing nodes per grid cell
ExtendableGrids.CellParents
— Typeabstract type CellParents <: AbstractGridIntegerArray1D
Grid component key type for storing parent cells
ExtendableGrids.CellRegions
— Typeabstract type CellRegions <: AbstractElementRegions
Cell region number per cell
ExtendableGrids.Circle2D
— Typeabstract type Circle2D <: AbstractElementGeometry2D
ExtendableGrids.CoordinateSystem
— Typeabstract type CoordinateSystem <: AbstractGridComponent
Coordinate system
ExtendableGrids.Coordinates
— Typeabstract type Coordinates <: AbstractGridFloatArray2D
Node coordinates
ExtendableGrids.Cylindrical2D
— Typeabstract type Cylindrical2D <: AbstractCoordinateSystem
2D cylindrical coordinate system (unknowns r,z
)
ExtendableGrids.Cylindrical3D
— Typeabstract type Cylindrical3D <: AbstractCoordinateSystem
3D cylindrical coordinate system (unknowns r,ϕ,z
)
ExtendableGrids.Edge1D
— Typeabstract type Edge1D <: AbstractElementGeometry1D
ExtendableGrids.ExtendableGrid
— Typemutable struct ExtendableGrid{Tc, Ti}
Grid type wrapping Dict
ExtendableGrids.FaceParents
— Typeabstract type FaceParents <: AbstractGridIntegerArray1D
Grid component key type for storing parent faces (only for SubGrid relation when FaceNodes is instantiated)
ExtendableGrids.FixedTargetAdjacency
— Typemutable struct Array{T, 2} <: DenseArray{T, 2}
Use Matrix to store fixed target adjacency
ExtendableGrids.Hexagon2D
— Typeabstract type Hexagon2D <: Polygon2D
ExtendableGrids.Hexahedron3D
— Typeabstract type Hexahedron3D <: Polyhedron3D
ExtendableGrids.HyperCube4D
— Typeabstract type HyperCube4D <: AbstractElementGeometry4D
ExtendableGrids.L2GTransformer
— TypeL2GTransformer
Transforms reference coordinates to global coordinates
ExtendableGrids.NodeParents
— Typeabstract type NodeParents <: AbstractGridIntegerArray1D
Grid component key type for storing node parents (=ids of nodes in ParentGrid) in an array
ExtendableGrids.NodePermutation
— Typeabstract type NodePermutation <: AbstractGridIntegerArray1D
Key type describing the permutation of the nodes of a partitioned grid with respect to the unpartitioned origin.
If pgrid
is the partitioned grid and grid
is the unpartitioned origin, then
pgrid[Coordinates][:,pgrid[NodePermutation]]==grid[Coordinates]
ExtendableGrids.NumBEdgeRegions
— Typeabstract type NumBEdgeRegions <: ExtendableGrids.AbstractGridIntegerConstant
Number of boundary edge regions
ExtendableGrids.NumBFaceRegions
— Typeabstract type NumBFaceRegions <: ExtendableGrids.AbstractGridIntegerConstant
Number of boundary face regions
ExtendableGrids.NumCellRegions
— Typeabstract type NumCellRegions <: ExtendableGrids.AbstractGridIntegerConstant
Number of cell regions
ExtendableGrids.ON_BEDGES
— Typeabstract type ON_BEDGES <: AssemblyType
causes assembly/interpolation on boundary edges of the grid (only in 3D)
ExtendableGrids.ON_BFACES
— Typeabstract type ON_BFACES <: AssemblyType
causes assembly/interpolation on boundary faces of the grid
ExtendableGrids.ON_CELLS
— Typeabstract type ON_CELLS <: AssemblyType
causes assembly/interpolation on cells of the grid
ExtendableGrids.ON_EDGES
— Typeabstract type ON_EDGES <: AssemblyType
causes assembly/interpolation on edges of the grid (only in 3D)
ExtendableGrids.ON_FACES
— Typeabstract type ON_FACES <: AssemblyType
causes assembly/interpolation on faces of the grid
ExtendableGrids.ON_IFACES
— Typeabstract type ON_IFACES <: ON_FACES
causes assembly/interpolation on interior faces of the grid
ExtendableGrids.PColorPartitions
— Typeabstract type PColorPartitions <: AbstractGridIntegerArray1D
Key type describing colors of partitions. These correspond to a coloring of the neigborhood graphs of partitions such that operations (e.g. FEM assembly) on partitions of a given color can be performed in parallel.
grid[PColorPartitions]
returns an integer vector describing the partition colors ("pcolors") of a grid. Let p=grid[PColorPartitions]
. Then all partitions with numbers i ∈ p[c]:p[c+1]-1
have "color" c
. See also pcolors
.
ExtendableGrids.Parallelepiped3D
— Typeabstract type Parallelepiped3D <: Hexahedron3D
ExtendableGrids.Parallelogram2D
— Typeabstract type Parallelogram2D <: Quadrilateral2D
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.PartitionBFaces
— Typeabstract type PartitionBFaces <: AbstractGridIntegerArray1D
Key type describing the bondary faces of a given partition.
grid[PartitionBFaces]
returns an integer vector describing the boundary faces of a partition given by its number. Let pc=grid[PartitionCells]
. Then all cells with index i ∈ pc[p]:pc[p+1]-1
belong to partition p.
ExtendableGrids.PartitionCells
— Typeabstract type PartitionCells <: AbstractGridIntegerArray1D
Key type describing the cells of a given partition.
grid[PartitionCells]
returns an integer vector describing the cells of a partition given by its number. Let pc=grid[PartitionCells]
. Then all cells with index i ∈ pc[p]:pc[p+1]-1
belong to partition p.
ExtendableGrids.PartitionEdges
— Typeabstract type PartitionEdges <: AbstractGridIntegerArray1D
Key type describing the edges of a given partition.
grid[PartitionEdges]
returns an integer vector describing the edges of a partition given by its number. Let pe=grid[PartitionEdges]
. Then all edges with index i ∈ pe[p]:pe[p+1]-1
belong to partition p.
ExtendableGrids.PartitionNodes
— Typeabstract type PartitionNodes <: AbstractGridIntegerArray1D
Key type describing the nodes of a given partition.
grid[PartitionNodes]
returns an integer vector describing the nodes of a partition given by its number. Let pn=grid[PartitionNodes]
. Then all nodes with index i ∈ pn[p]:pn[p+1]-1
belong to partition p.
ExtendableGrids.Pentagon2D
— Typeabstract type Pentagon2D <: Polygon2D
ExtendableGrids.PlainMetisPartitioning
— Typestruct PlainMetisPartitioning <: AbstractPartitioningAlgorithm
Subdivide grid into npart
partitions using Metis.partition
and color the resulting partition neigborhood graph. This requires to import Metis.jl in order to trigger the corresponding extension.
This algorithm allows to control the overall number of partitions. The number of partitions per color comes from the subsequent partition graph coloring and in the moment cannot be controled.
Parameters:
npart::Int64
: Number of partitions (default: 20)
ExtendableGrids.Polar1D
— Typeabstract type Polar1D <: AbstractCoordinateSystem
1D polar coordinate system (unknown r
)
ExtendableGrids.Polar2D
— Typeabstract type Polar2D <: AbstractCoordinateSystem
2D polar coordinate system (unknowns r,ϕ
)
ExtendableGrids.Polychoron4D
— Typeabstract type Polychoron4D <: AbstractElementGeometry4D
ExtendableGrids.Polygon2D
— Typeabstract type Polygon2D <: AbstractElementGeometry2D
ExtendableGrids.Polyhedron3D
— Typeabstract type Polyhedron3D <: AbstractElementGeometry3D
ExtendableGrids.Prism3D
— Typeabstract type Prism3D <: Polyhedron3D
ExtendableGrids.Quadrilateral2D
— Typeabstract type Quadrilateral2D <: Polygon2D
ExtendableGrids.Rectangle2D
— Typeabstract type Rectangle2D <: Parallelogram2D
ExtendableGrids.RectangularCuboid3D
— Typeabstract type RectangularCuboid3D <: Parallelepiped3D
ExtendableGrids.RecursiveMetisPartitioning
— Typestruct RecursiveMetisPartitioning <: AbstractPartitioningAlgorithm
Subdivide grid into npart
partitions using Metis.partition
and calculate cell separators from this partitioning. The initial partitions get color 1, and the separator gets color 2. This is continued recursively with partitioning of the separator.
This algorithm allows to control the number of partitions in color 1 which coorespond to the bulk of the work.
Parameters:
npart::Int64
: Number of color 1 partitions (default: 4)maxdepth::Int64
: Recursion depth (default: 1)separatorwidth::Int64
: Separator width (default: 2)
ExtendableGrids.RefinedGrid
— Typeabstract type RefinedGrid <: ParentGridRelation
Grid component key type for indicating that grid is a refinement of the parentgrid
ExtendableGrids.SerialVariableTargetAdjacency
— MethodSerialVariableTargetAdjacency(
) -> SerialVariableTargetAdjacency{Int64}
Create an empty SerialVariableTargetAdjacency with default type
ExtendableGrids.SerialVariableTargetAdjacency
— MethodSerialVariableTargetAdjacency(
t::Type{T}
) -> SerialVariableTargetAdjacency
Create an empty SerialVariableTargetAdjacency
ExtendableGrids.Sphere3D
— Typeabstract type Sphere3D <: AbstractElementGeometry3D
ExtendableGrids.Spherical1D
— Typeabstract type Spherical1D <: AbstractCoordinateSystem
1D spheriacal coordinate system (unknown r
)
ExtendableGrids.Spherical3D
— Typeabstract type Spherical3D <: AbstractCoordinateSystem
3D spheriacal coordinate system (unknowns r,ϕ,θ
)
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
ExtendableGrids.Tetrahedron3D
— Typeabstract type Tetrahedron3D <: Polyhedron3D
ExtendableGrids.TokenStream
— Typemutable struct TokenStream
Tokenstream allows to read tokenized data from file without keeping the file ocntent in memory.
input::IOStream
: Input stream
tokens::Vector{SubString{String}}
: Array of current tokens kept in memory.
itoken::Int64
: Position of actual token in tokens array
lineno::Int64
: Line number in IOStream
comment::Char
: Comment character
dlm::Function
: Function telling if given character is a delimiter.
ExtendableGrids.TokenStream
— MethodTokenStream(input::IOStream; comment, dlm) -> TokenStream
Create Tokenstream with IOStream argument.
ExtendableGrids.TokenStream
— MethodTokenStream(filename::String; comment, dlm) -> TokenStream
Create Tokenstream with file name argument.
ExtendableGrids.Triangle2D
— Typeabstract type Triangle2D <: Polygon2D
ExtendableGrids.TrianglePrism3D
— Typeabstract type TrianglePrism3D <: Prism3D
ExtendableGrids.TrivialPartitioning
— Typestruct TrivialPartitioning <: AbstractPartitioningAlgorithm
Trivial partitioning: all grid cells belong to single partition number 1.
ExtendableGrids.UnexpectedTokenError
— Typestruct UnexpectedTokenError <: Exception
Error thrown when the token expected in expect! is not there.
found::String
expected::String
lineno::Int64
ExtendableGrids.VariableTargetAdjacency
— Typestruct VariableTargetAdjacency{T}
Adjacency struct. Essentially, this is the sparsity pattern of a matrix whose nonzero elements all have the same value in the CSC format.
ExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency() -> VariableTargetAdjacency{Int64}
Create an empty VariableTargetAdjacency with default type
ExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
m::Array{T, 2}
) -> VariableTargetAdjacency
Create a VariableTargetAdjacency from Matrix
ExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
m::SparseArrays.SparseMatrixCSC{Tv<:Integer, Ti<:Integer}
) -> VariableTargetAdjacency{Ti} where Ti<:Integer
Create variable target adjacency from adjacency matrix
ExtendableGrids.VariableTargetAdjacency
— MethodVariableTargetAdjacency(
t::Type{T}
) -> VariableTargetAdjacency
Create an empty VariableTargetAdjacency
ExtendableGrids.VectorOfConstants
— Typestruct VectorOfConstants{T, Tl} <: AbstractArray{T, 1}
Vector with constant value
ExtendableGrids.Vertex0D
— Typeabstract type Vertex0D <: AbstractElementGeometry0D
ExtendableGrids.VoronoiFaceCenters
— Typeabstract type VoronoiFaceCenters <: AbstractGridFloatArray2D
Centers of voronoi cell facets (currently 1D, 2D).
AbstractTrees.children
— Methodchildren(T::Type) -> Union{Vector{Type}, Vector{Any}}
Define children for types.
Base.:==
— Method==(a, b)
Comparison of two adjacencies
Base.:==
— Method==(a, b)
Comparison of two adjacencies
Base.append!
— Methodappend!(adj::SerialVariableTargetAdjacency, len) -> Vector
Append a column to adjacency.
Base.append!
— Methodappend!(adj::VariableTargetAdjacency, column) -> Vector
Append a column to adjacency.
Base.delete!
— Methoddelete!(
grid::ExtendableGrid,
T::Type{<:AbstractGridComponent}
) -> Dict{Type{<:AbstractGridComponent}, Any}
Remove grid component
Base.eof
— Methodeof(tks::TokenStream) -> Bool
Check if all tokens have been consumed.
Base.get!
— Methodget!(
grid::ExtendableGrid,
T::Type{<:AbstractGridComponent}
) -> Any
To be called by getindex. This triggers lazy creation of non-existing gridcomponents
Base.getindex
— MethodBase.getindex(grid::ExtendableGrid,T::Type{<:AbstractGridComponent})
Generic method for obtaining grid component.
This method is mutating in the sense that non-existing grid components are created on demand.
Due to the fact that components are stored as Any the return value triggers type instability. To prevent this, specialized methods must be (and are) defined.
Base.getindex
— Methodgetindex(
aview::ExtendableGrids.SubgridVectorView,
inode::Integer
) -> Any
Accessor method for subgrid vector view.
Base.getindex
— Methodgetindex(
adj::SerialVariableTargetAdjacency,
i,
isource
) -> Any
Access adjacency as if it is a 2D Array
Base.getindex
— Methodgetindex(adj::VariableTargetAdjacency, i, isource) -> Any
Access adjacency as if it is a 2D Array
Base.getindex
— Methodgetindex(v::VectorOfConstants, i) -> Any
Access
Base.haskey
— Methodhaskey(g::ExtendableGrid, k) -> Bool
Check if key is in grid
Base.insert!
— Method Base.insert!(binnedpointlist,p)
If another point with distance less the tol from p is in pointlist, return its index. Otherwise, insert point into pointlist. p
may be a vector or a tuple.
Base.insert!
— Method Base.insert!(binnedpointlist,x,y,z)
Insert 3D point via coordinates.
Base.insert!
— Method Base.insert!(binnedpointlist,x)
Insert 1D point via coordinate.
Base.iterate
— Methoditerate(
v::VectorOfConstants,
state
) -> Union{Nothing, Tuple{Any, Any}}
Iterator
Base.iterate
— Methoditerate(v::VectorOfConstants) -> Tuple{Any, Int64}
Iterator
Base.keys
— Methodkeys(
g::ExtendableGrid
) -> Base.KeySet{Type{<:AbstractGridComponent}, Dict{Type{<:AbstractGridComponent}, Any}}
Keys in grid
Base.length
— Methodlength(v::VectorOfConstants) -> Any
Length
Base.map
— Methodmap(f::Function, grid::ExtendableGrid) -> Any
Map a function onto node coordinates of grid
Base.setindex!
— Methodsetindex!(
grid::ExtendableGrid,
v,
T::Type{<:AbstractGridComponent}
) -> Any
Set new grid component
Base.setindex!
— Methodsetindex!(
aview::ExtendableGrids.SubgridVectorView,
v,
inode::Integer
) -> ExtendableGrids.SubgridVectorView
Accessor method for subgrid vector view.
Base.show
— Methodshow(io::IO, adj::SerialVariableTargetAdjacency)
Show adjacency (in trasposed form; preliminary)
Base.show
— Methodshow(io::IO, adj::VariableTargetAdjacency)
Show adjacency (in trasposed form; preliminary)
Base.size
— Methodsize(a::ExtendableGrids.SubgridVectorView) -> Tuple{Int64}
Return size of vector view.
Base.size
— Methodsize(v::VectorOfConstants) -> Tuple{Any}
Size
Base.unique
— Methodunique(v::VectorOfConstants) -> Vector
Shortcut for unique
Base.view
— Methodview(
a::AbstractVector,
subgrid::ExtendableGrid
) -> ExtendableGrids.SubgridVectorView
Create a view of the vector on a subgrid.
Base.write
— Methodwrite(fname::String, g::ExtendableGrid; format, kwargs...)
Write grid to file. Supported formats:
- "*.sg": pdelib sg format. See
simplexgrid(::String;kwargs...)
ExtendableGrids.RGB_refine
— MethodRGB_refine(
source_grid::ExtendableGrid{T, K},
facemarkers::Vector{Bool};
store_parents
) -> ExtendableGrid
generates a new ExtendableGrid by red-green-blue mesh refinement of triangular meshes, see e.g.
Carstensen, C. –An Adaptive Mesh-Refining Algorithm Allowing for an H^1 Stable L^2 Projection onto Courant Finite Element Spaces– Constr Approx 20, 549–564 (2004). https://doi.org/10.1007/s00365-003-0550-5
The bool array facemarkers determines which faces should be bisected. Note, that a closuring is performed such that the first face in every triangle with a marked face is also refined.
ExtendableGrids._bin_of_point!
— Method_bin_of_point!(binnedpointlist, p)
Calculate the bin of the point. Result is stored in bpl.current_bin
ExtendableGrids._copytransform!
— Method_copytransform!(a::AbstractArray, b::AbstractArray)
Default transform for subgrid creation
ExtendableGrids._findpoint
— Method_findpoint(binnedpointlist, index, p)
Find point in index list (by linear search) Return its index, or zero if not found
ExtendableGrids._rebin_all_points!
— Method_rebin_all_points!(bpl)
Re-calculate binning if there are too many unbinned points This amounts to two steps:
- Enlarge binning area in order to include all points
- Re-calculate all point bins
ExtendableGrids.asparse
— Methodasparse(a::Matrix) -> SparseArrays.SparseMatrixCSC{Int64}
Create sparse incidence matrix from adjacency
ExtendableGrids.asparse
— Methodasparse(
a::VariableTargetAdjacency
) -> SparseArrays.SparseMatrixCSC{Int64}
Create sparse incidence matrix from adjacency
ExtendableGrids.assemble_bfaces
— Methodfunction assemble_bfaces(simplices, dim, nn, Ti)
Assemble the BoundaryFaces corresponding to the simplices passed. In this function, the faces are encoded for performance reasons. If a large grid with many nodes is used, Ti
has to be chosen accordingly (e.g. Int128
), or encode=false
has to be passed to seal!
. simplices
is a $(dim+1) x 'number cells'$ matrix and nn
is the total number of nodes. We can not guarantee, that the orientation of the BoundaryFaces is correct.
ExtendableGrids.assemble_bfaces_direct
— Methodfunction assemble_bfaces_direct(simplices, dim, Ti)
Assemble the BoundaryFaces corresponding to the simplices passed. In this function, the faces are not encoded. This may make sense for grids with many nodes. For smaller grids it can lead to performance losses. simplices
is a $(dim+1) x 'number cells'$ matrix and nn is the total number of nodes. We can not guarantee, that the orientation of the BoundaryFaces is correct.
ExtendableGrids.atranspose
— MethodTranspose adjacency
ExtendableGrids.barycentric_refine
— Methodbarycentric_refine(
source_grid::ExtendableGrid{T, K};
store_parents
) -> ExtendableGrid
generates a new ExtendableGrid by barycentric refinement of each cell in the source grid
barycentric refinement is available for these ElementGeometries
- Quadrilateral2D (first split into Triangle2D)
- Triangle2D
ExtendableGrids.bedgemask!
— Methodbedgemask!(
grid::ExtendableGrid,
xa,
xb,
ireg::Int64;
tol
) -> ExtendableGrid
Edit region numbers of grid boundary edges via line mask. This only works for 3D grids.
ExtendableGrids.bfacemask!
— Methodbfacemask!(grid::ExtendableGrid,
maskmin,
maskmax,
ireg;
allow_new=true,
tol=1.0e-10)
Edit region numbers of grid boundary facets via rectangular mask. If allow_new
is true (default), new facets are added.
ireg may be an integer or a function ireg(current_region)
.
A zero region number removes boundary faces.
Examples: Rectangle-with-multiple-regions
ExtendableGrids.cellmask!
— Methodcellmask!(
grid::ExtendableGrid,
maskmin,
maskmax,
ireg::Int64;
tol
) -> ExtendableGrid
Edit region numbers of grid cells via rectangular mask.
Examples: Rectangle-with-multiple-regions
ExtendableGrids.check_partitioning
— Methodcheck_partitioning(grid;
verbose=true,
cellpartonly=false)
Check correctness of cell partitioning, necessesary for parallel assembly:
- Check if every node belongs to one of the cell partitions
- Check if no node belongs to two cell partitions of the same color at once
If cellpartonly==false
check correctness of node partitioning necessary for parallel sparse matrix multiplication and ILU preconditioning
- Check if no node belongs to two node partitions of the same color at once
- Check if no node is a neighbor of nodes from two node partitions of the same color
ExtendableGrids.codim1_coordinatesystem
— Methodcodim1_coordinatesystem(CoordinateSystem)
Return coordinate system for codimension 1 subgrid.
ExtendableGrids.coord_type
— Methodcoord_type(grid)
Type of coordinates in grid
ExtendableGrids.coordinatesystems
— Methodcoordinatesystems()
List possible coordinate systems. These describe the meaning of the grid coordinates.
ExtendableGrids.decode
— Methodfunction decode(y::Integer, nn::Integer, dim::Integer)
Decode y
to the vector x
. x
has the length dim
. The en/-decoding is similar to using the base-nn
number system. For details of the encoding, see the documentation of the function encode
.
ExtendableGrids.destruct!
— Methoddestruct!(tks::TokenStream)
Tokenstream destructor should close input
ExtendableGrids.dim_element
— Methoddim_element(_::Type{<:AbstractElementGeometry0D}) -> Int64
ExtendableGrids.dim_element
— Methoddim_element(_::Type{<:AbstractElementGeometry1D}) -> Int64
ExtendableGrids.dim_element
— Methoddim_element(_::Type{<:AbstractElementGeometry2D}) -> Int64
ExtendableGrids.dim_element
— Methoddim_element(_::Type{<:AbstractElementGeometry3D}) -> Int64
ExtendableGrids.dim_element
— Methoddim_element(_::Type{<:AbstractElementGeometry4D}) -> Int64
ExtendableGrids.dim_grid
— Methoddim_grid(grid)
Grid dimension dimension of grid (larges element dimension)
ExtendableGrids.dim_space
— Methoddim_space(grid)
Space dimension of grid
ExtendableGrids.dopartition
— Methoddopartition(grid, alg)
(Internal utility function) Core function for partitioning grid cells which dispatches over partitioning algorithms. Partitioning extensions should add methods to this function.
ExtendableGrids.elementgeometries
— Methodelementgeometries()
List supported element geometries.
ExtendableGrids.encode
— Methodfunction encode(x::Vector, nn::Integer)
Encode th vector x
into an Int y
. The en/-decoding is similar to using the base-nn
number system. Example: $[x₁, x₂, x₃] → (x₁-1) + (x₂-1)*nn + (x₃-1)*nn²$``
ExtendableGrids.expecttoken
— Methodexpecttoken(tks::TokenStream, expected::String) -> Bool
Expect keyword token.
If token is missing, an UnexpectedTokenError is thrown If the token has been found, reading will continue at the position after the token found.
ExtendableGrids.faces_of_ndim_simplex
— Methodfunction faces_of_ndim_simplex(x::Vector, dim::Integer, nn::Integer)
Return all faces of a n-dim simplex. The orientation is not guaranteed to be right. x
contains the nodes of the simplex. nn
is the total number of nodes. The faces (=the nodes contained in the face), are encoded to Integers (of nn
's type).
ExtendableGrids.faces_of_ndim_simplex_direct
— Methodfunction faces_of_ndim_simplex(x::Vector, dim::Integer, nn::Integer)
Return all faces of a n-dim simplex. The orientation is not guaranteed to be right. x
contains the nodes of the simplex. nn
is the total number of nodes. The faces (=the nodes contained in the face), are not encoded to Integers.
ExtendableGrids.facetype_of_cellface
— Methodfacetype_of_cellface(_, k)
Geometries of faces of 1D edge
ExtendableGrids.facetype_of_cellface
— Methodfacetype_of_cellface(_, k)
Geometries of faces of 3D hexahedron
ExtendableGrids.facetype_of_cellface
— Methodfacetype_of_cellface(_, k)
Geometries of faces of 3D parallelepiped
ExtendableGrids.facetype_of_cellface
— Methodfacetype_of_cellface(_, k)
Geometries of faces of 2D quadrilateral
ExtendableGrids.facetype_of_cellface
— Methodfacetype_of_cellface(_, k)
Geometries of faces of 3D tetrahedron
ExtendableGrids.facetype_of_cellface
— Methodfacetype_of_cellface(_, k)
Geometries of faces of 2D triangle
ExtendableGrids.findpoint
— Methodfindpoint(binnedpointlist, p)
Find point in binned point list. Return its index in the point list if found, otherwise return 0.
ExtendableGrids.gFindBruteForce!
— Methodicellfound=gFindBruteForce!(xref,cellfinder,p; icellstart=1,eps=1.0e-14)
Find cell containing point p
starting with cell number icellstart
.
Returns cell number if found, zero otherwise. Upon return, xref contains the barycentric coordinates of the point in the sequence dim+1, 1...dim
Currently implemented for simplex grids only.
ExtendableGrids.gFindLocal!
— Methodicellfound=GFindLocal!(xref,cellfinder,p; icellstart=1,eps=1.0e-14, trybrute=true)
Find cell containing point p
starting with cell number icellstart
.
Returns cell number if found, zero otherwise. If trybrute==true
try gFindBruteForce!
before giving up. Upon return, xref contains the barycentric coordinates of the point in the sequence dim+1, 1...dim
Currently implemented for simplex grids only.
ExtendableGrids.geomspace
— Methodgeomspace(a, b, ha, hb; tol, maxiterations) -> Any
(Try to) create a subdivision of interval (a,b) stored in the returned array X such that
X[1]==a, X[end]==b
(X[2]-X[1])<=ha+tol*(b-a)
(X[end]-X[end-1])<=hb+tol*(b-a)
- There is a number q such that
X[i+1]-X[i] == q*(X[i]-X[i-1])
- X is the array with the minimal possible number of points with the above property
Caveat: the algorithm behind this is tested for many cases but unproven.
Returns an Array containing the points of the subdivision.
ExtendableGrids.gettoken
— Methodgettoken(
tks::TokenStream
) -> Union{Nothing, SubString{String}}
Get next token from tokenstream.
ExtendableGrids.glue
— Methodc=glue(a,b)
Glue together two vectors a
and b resulting in a vector c. They last element of a
shall be equal (up to tol) to the first element of b. The result fulfills length(c)=length(a)+length(b)-1
ExtendableGrids.glue
— Methodglue(g1,g2;
g1regions=1:num_bfaceregions(g1),
g2regions=1:num_bfaceregions(g2),
interface=0,
warnonly = false,
tol=1.0e-10,
naive=false)
Merge two grids along their common boundary facets.
- g1: First grid to be merged
- g2: Second grid to be merged
- g1regions: boundary regions to be used from grid1. Default: all.
- g2regions: boundary regions to be used from grid2. Default: all.
- interface: if nonzero, create interface region in new grid, otherwise, ignore
- strict: Assume all bfaces form specfied regions shall be matched, throw error on failure
- tol: Distance below which two points are seen as identical. Default: 1.0e-10
- naive: use naive quadratic complexity matching (for checking backward compatibility). Default: false
Deprecated:
- breg: old notation for interface
ExtendableGrids.grid_lshape
— Methodgrid_lshape(::Type{<:Triangle2D}; scale = [1,1], shift = [0,0])
Lshape domain
ExtendableGrids.grid_triangle
— Methodgrid_triangle(coords::AbstractArray{T,2}) where {T}
Generates a single triangle with the given coordinates, that should be a 2 x 3 array with the coordinates of the three vertices, e.g. coords = [0.0 0.0; 1.0 0.0; 0.0 1.0]'.
ExtendableGrids.grid_unitcube
— Methodgrid_unitcube(EG::Type{<:Hexahedron3D}; scale = [1,1,1], shift = [0,0,0])
Unit cube as one cell with six boundary regions (bottom, front, right, back, left, top)
ExtendableGrids.grid_unitcube
— Methodgrid_unitcube(::Type{Tetrahedron3D}; scale = [1,1,1], shift = [0,0,0])
Unit cube as six tets with six boundary regions (bottom, front, right, back, left, top)
ExtendableGrids.grid_unitsquare
— Methodgrid_unitsquare(EG::Type{<:Quadrilateral2D}; scale = [1,1], shift = [0,0])
Unit square as one cell with four boundary regions (bottom, right, top, left)
ExtendableGrids.grid_unitsquare
— Methodgrid_unitsquare(::Type{<:Triangle2D}; scale = [1,1], shift = [0,0])
Unit square as two triangles with four boundary regions (bottom, right, top, left)
ExtendableGrids.grid_unitsquare_mixedgeometries
— Methodgrid_unitsquare_mixedgeometries()
Unit suqare as mixed triangles and squares with four boundary regions (bottom, right, top, left)
ExtendableGrids.gridcomponents
— Methodgridcomponents()
Print the hierarchy of grid component key types (subtypes of AbstractGridComponent
. This includes additionally user defined subptypes.
ExtendableGrids.index_type
— Methodindex_type(grid)
Type of indices
ExtendableGrids.induce_edge_partitioning!
— Methodinduce_edge_partitioning!(grid; trivial)
(internal) Induce edge partitioning from cell partitioning of grid
. The algorithm assumes that nodes get the partition number from the partition numbers of the cells having this node in common. If these are differnt, the highest number is taken.
This method triggers creation of rather complex edge information and should be called only if this information is really necessary.
ExtendableGrids.induce_node_partitioning!
— Methodinduce_node_partitioning!(
grid,
cn,
nc;
trivial,
keep_nodepermutation
)
(internal) Induce node partitioning from cell partitioning of grid
. The algorithm assumes that nodes get the partition number from the partition numbers of the cells having this node in common. If these are differnt, the highest number is taken.
Node partitioning should support parallel matrix-vector products with SparseMatrixCSC
. The current algorithm assumes that nodes get the partition number from the partition numbers of the cells having this node in common. If these are differnt, the highest number is taken.
Simply inducing node partition numbers from cell partition numbers does not always fulfill the condition that there is no node which is neigbour of nodes from two different partition with the same color.
This situation is detected and corrected by joining respective critical partitions, sacrificing a bit of parallel efficiency for correctness.
ExtendableGrids.instantiate
— Function"Hook" for methods instantiating lazy components.
ExtendableGrids.instantiate
— Methodinstantiate(grid, _::Type{NumBEdgeRegions}) -> Any
Instantiate number of boundary edge regions
ExtendableGrids.instantiate
— Methodinstantiate(grid, _::Type{NumBFaceRegions}) -> Any
Instantiate number of bface regions
ExtendableGrids.instantiate
— Methodinstantiate(grid, _::Type{NumCellRegions}) -> Any
Instantiate number of cell regions
ExtendableGrids.instantiate
— Methodinstantiate(grid::ExtendableGrid, ::Type{PColorPartitions})
If not given otherwise, instantiate partition data with trivial partitioning.
ExtendableGrids.instantiate
— Methodinstantiate(grid::ExtendableGrid, ::Type{PartitionBFaces})
If not given otherwise, instantiate partition data with trivial partitioning.
ExtendableGrids.instantiate
— Methodinstantiate(grid::ExtendableGrid, ::Type{PartitionCells})
If not given otherwise, instantiate partition data with trivial partitioning.
ExtendableGrids.instantiate
— Methodinstantiate(grid::ExtendableGrid, ::Type{PartitionNodes})
If not given otherwise, instantiate partition data with trivial partitioning.
ExtendableGrids.instantiate
— Methodinstantiate(grid::ExtendableGrid, ::Type{PartitionEdges})
If not given otherwise, instantiate partition data with trivial partitioning.
ExtendableGrids.interpolate!
— Methodinterpolate!(u_to,grid_to, u_from, grid_from;eps=1.0e-14,trybrute=true)
Mutating form of interpolate
ExtendableGrids.interpolate
— Methodu_to=interpolate(grid_to, u_from, grid_from;eps=1.0e-14,trybrute=true)
Piecewise linear interpolation of function u_from
on grid grid_from
to grid_to
. Works for matrices with second dimension corresponding to grid nodes and for vectors.
May be slow on non-convex domains. If trybrute==false
it may even fail.
Currently implemented for simplex grids only.
ExtendableGrids.isconsistent
— Methodisconsistent(grid; warnonly=false)
Check consistency of grid: a grid is consistent if
- Grid has no dangling nodes
- ... more to be added
If grid is consistent, return true, otherwise throw an error, or, if warnoly==true
, return false.
ExtendableGrids.linspace
— Methodlinspace(a, b, n) -> Any
Resurrect linspace despite https://github.com/JuliaLang/julia/pull/25896#issuecomment-363769368
ExtendableGrids.local_celledgenodes
— Methodlocal_celledgenodes(_)
Cell-edge node numbering for 1D edge
ExtendableGrids.local_celledgenodes
— Methodlocal_celledgenodes(_)
Cell-edge node numbering for 3D hexahedron
ExtendableGrids.local_celledgenodes
— Methodlocal_celledgenodes(_)
Cell-edge node numbering for 2D quadrilateral
ExtendableGrids.local_celledgenodes
— Methodlocal_celledgenodes(_)
Cell-edge node numbering for 3D tetrahedron
ExtendableGrids.local_celledgenodes
— Methodlocal_celledgenodes(_)
Cell-edge node numbering for 2D triangle
ExtendableGrids.local_celledgenodes
— Methodlocal_celledgenodes(_)
Cell-edge node numbering for 1D edge
ExtendableGrids.local_cellfacenodes
— Methodlocal_cellfacenodes(_)
Cell-face node numbering for 1D edge
ExtendableGrids.local_cellfacenodes
— Methodlocal_cellfacenodes(_)
Cell-face node numbering for 3D hexahedron
ExtendableGrids.local_cellfacenodes
— Methodlocal_cellfacenodes(_)
Cell-face node numbering for 2D quadrilateral
ExtendableGrids.local_cellfacenodes
— Methodlocal_cellfacenodes(_)
Cell-face node numbering for 3D tetrahedron
ExtendableGrids.local_cellfacenodes
— Methodlocal_cellfacenodes(_)
Cell-face node numbering for 2D triangle
ExtendableGrids.makevar
— Methodmakevar(a::Array{T, 2}) -> VariableTargetAdjacency
Turn fixed target adjacency into variable target adjacency
ExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(adj::Matrix) -> Int64
Maximum number of targets per source
ExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(
adj::SerialVariableTargetAdjacency
) -> Any
Maximum number of targets per source
ExtendableGrids.max_num_targets_per_source
— Methodmax_num_targets_per_source(
adj::VariableTargetAdjacency
) -> Any
Maximum number of targets per source
ExtendableGrids.naiveinsert!
— Methodnaiveinsert(binnedpointlist, p)
Insert via linear search, without any binning. Just for being able to check of all of the above was worth the effort...
ExtendableGrids.num_bedgeregions
— Methodnum_bedgeregions(grid::ExtendableGrid) -> Any
Maximum boundary edge region numbers
ExtendableGrids.num_bedges
— Methodnum_bedges(grid::ExtendableGrid) -> Int64
Number of boundary edges in grid.
ExtendableGrids.num_bfaceregions
— Methodnum_bfaceregions(grid::ExtendableGrid) -> Any
Maximum boundary face region numbers
ExtendableGrids.num_bfaces
— Methodnum_bfaces(grid::ExtendableGrid) -> Int64
Number of boundary faces in grid.
ExtendableGrids.num_cellregions
— Methodnum_cellregions(grid::ExtendableGrid) -> Any
Maximum cell region number
ExtendableGrids.num_cells
— Methodnum_cells(grid::ExtendableGrid) -> Int64
Number of cells in grid
ExtendableGrids.num_cells_per_color
— Methodnum_cells_per_color(grid)
Return a vector containing the number of cells for each of the colors of the grid partitioning.
ExtendableGrids.num_edges
— Methodnum_edges(grid)
Number of edges in grid.
ExtendableGrids.num_edges
— Methodnum_edges(_)
Number of edges of 0D vertex
ExtendableGrids.num_edges
— Methodnum_edges(_)
Number of edges for 1D edge
ExtendableGrids.num_edges
— Methodnum_edges(_)
Number of edges in 2D quadrilateral
ExtendableGrids.num_edges
— Methodnum_edges(_)
Number of edges in 3D tetrahedron
ExtendableGrids.num_edges
— Methodnum_edges(_)
Number of edges in 2D triangle
ExtendableGrids.num_edges
— Methodnum_edges(_)
Number of edges of 1D edge
ExtendableGrids.num_edges_per_partition
— Methodnum_edges_per_partition(grid)
Return a vector containing the number of nodes for each of the partitions of the grid partitioning.
ExtendableGrids.num_faces
— Methodnum_faces(_)
Number of faces of 0D vertex
ExtendableGrids.num_faces
— Methodnum_faces(_)
Number of faces for 1D edge
ExtendableGrids.num_faces
— Methodnum_faces(_)
Number of faces in 2D quadrilateral
ExtendableGrids.num_faces
— Methodnum_faces(_)
Number of faces in 3D tetrahedron
ExtendableGrids.num_faces
— Methodnum_faces(_)
Number of faces in 2D triangle
ExtendableGrids.num_links
— Methodnum_links(adj::Matrix) -> Int64
Number of entries
ExtendableGrids.num_links
— Methodnum_links(adj::VariableTargetAdjacency) -> Int64
Number of links
ExtendableGrids.num_nodes
— Methodnum_nodes(grid)
Number of nodes in grid
ExtendableGrids.num_nodes
— Methodnum_nodes(_)
Number of nodes of 0D vertex
ExtendableGrids.num_nodes
— Methodnum_nodes(_)
Number of nodes for 1D edge
ExtendableGrids.num_nodes
— Methodnum_nodes(_)
Number of nodes in 3D hexahedron
ExtendableGrids.num_nodes
— Methodnum_nodes(_)
Number of nodes in 2D quadrilateral
ExtendableGrids.num_nodes
— Methodnum_nodes(_)
Number of nodes in 3D tetrahedron
ExtendableGrids.num_nodes
— Methodnum_nodes(_)
Number of nodes in 2D triangle
ExtendableGrids.num_nodes_per_partition
— Methodnum_nodes_per_partition(grid)
Return a vector containing the number of nodes for each of the partitions of the grid partitioning.
ExtendableGrids.num_partitions
— Methodnum_partitions(grid)
Return number of partitions based on grid[
PartitionCells
]
.
ExtendableGrids.num_partitions_per_color
— Methodnum_partitions_per_color(grid)
Return a vector containing the number of partitions for each of the colors of the grid partitioning. These define the maximum number of parallel threads for each color.
ExtendableGrids.num_pcolors
— Methodnum_pcolors(grid)
Return number of partition colors based on grid[
PColorPartitions
]
.
ExtendableGrids.num_sources
— Methodnum_sources(adj::Matrix) -> Int64
Number of sources in adjacency
ExtendableGrids.num_sources
— Methodnum_sources(adj::SerialVariableTargetAdjacency) -> Int64
Number of sources in adjacency
ExtendableGrids.num_sources
— Methodnum_sources(adj::VariableTargetAdjacency) -> Int64
Number of sources in adjacency
ExtendableGrids.num_targets
— Methodnum_targets(adj::Matrix, isource) -> Int64
Number of targets per source if adjacency is a matrix
ExtendableGrids.num_targets
— Methodnum_targets(adj::Matrix) -> Any
Overall number of targets
ExtendableGrids.num_targets
— Methodnum_targets(
adj::SerialVariableTargetAdjacency,
isource
) -> Any
Number of targets for given source
ExtendableGrids.num_targets
— Methodnum_targets(adj::VariableTargetAdjacency, isource) -> Any
Number of targets for given source
ExtendableGrids.num_targets
— Methodnum_targets(adj::VariableTargetAdjacency) -> Any
Number of targeta
ExtendableGrids.partgraph
— Methodpartgraph(cellpartitions, ncellpartitions, cellcelladj)
(internal) Create neigbourhood graph for given partitioning.
ExtendableGrids.partition
— Method partition(grid::ExtendableGrid,
alg::AbstractPartitioningAlgorithm;
nodes = false,
keep_nodepermutation = false,
edges = false )
Partition cells of grid
according to alg
, such that the neigborhood graph of partitions is colored in such a way, that all partitions with a given color can be worked on in parallel. Cells are renumbered such that cell numbers for a given partition are numbered contiguously.
Return the resulting grid.
Useful for parallel FEM assembly and cellwise FVM assembly.
Keyword arguments:
nodes
: if true, induce node partitioning from cell partitioning. Used for node/edgewise FVM assembly. In addition the resulting partitioning supports parallel matrix-vector products withSparseMatrixCSC
. Nodes are renumbered compared to the original grid.keep_nodepermutation
: if true, keep the node permutation with respect to the original grid ingrid[
NodePermutation
]
.edges
: if true, induce partitioning of edges from cell partitioning. Used for node/edgewise FVM assembly. This step creates a number of relatively expensive additional adjacencies.
Access:
pcolors
returns the range of partition colorspcolor_partitions
returns the range of partition numbers for a given colorpartition_cells
provides the range of cell numbers of a given partitionpartition_nodes
provides the range of node numbers of a given partitionpartition_edges
provides the range of edge numbers of a given partition
A parallel loop over grid cells thus looks like
for color in pcolors(grid)
@threads for part in pcolor_partitions(grid, color)
for cell in partition_cells(grid, part)
...
end
end
end
Without a call to partition
, all these functions return trivial data such that the above sample code stays valid.
partition
must be called before obtaining any other adjacencies of a grid.
Currently, partitioning does not cover the boundary, boundary cells belong to one big trivial partition.
ExtendableGrids.partition_bfaces
— Methodpartition_bfaces(grid, part)
Return range of boundary faces belonging to a given partition based on grid[
PartitionBFaces
]
.
ExtendableGrids.partition_cells
— Methodpartition_cells(grid, part)
Return range of cells belonging to a given partition grid[
PartitionCells
]
.
ExtendableGrids.partition_edges
— Methodpartition_edges(grid, part)
Return range of edges belonging to a given partition based on grid[
PartitionEdges
]
.
ExtendableGrids.partition_nodes
— Methodpartition_nodes(grid, part)
Return range of nodes belonging to a given partition based on grid[
PartitionNodes
]
.
ExtendableGrids.pcolor_partitions
— Methodpcolor_partitions(grid, color)
Return range of partitions for given pcolor based on grid[
PColorPartitions
]
.
ExtendableGrids.pcolors
— Methodpcolors(grid)
Return range of all pcolors based on grid[
PColorPartitions
]
.
ExtendableGrids.prepare_edges!
— Methodprepare_edges!(grid)
Prepare edge adjacencies (celledges, edgecells, edgenodes)
Currently depends on ExtendableSparse, we may want to remove this adjacency.
ExtendableGrids.rect!
— Methodrect!(grid,maskmin,maskmax;
region=1,
bregion=1,
bregions=nothing,
tol=1.0e-10)
Place a rectangle into a rectangular grid. It places a cellmask according to maskmin
and maskmax
, and introduces boundary faces via `bfacesmask! at all sides of the mask area. It is checked that the coordinate values in the mask match (with tolerance) corresponding directional coordinates of the grid.
If bregions
is given it is assumed to be a vector corresponding to the number of sides, im the sequence w,e
in 1D. s,e,n,w
in 2D and s,e,n,w,b,t
in 3D.
bregion
or elements of bregions
can be numbers or functions ireg(current_region)
.
Examples: Subgrid-from-rectangle, Rect2d-with-bregion-function, Cross3d
ExtendableGrids.refcoords_for_geometry
— Methodrefcoords_for_geometry(_)
Coordinates of reference geometry of 0D vertex
ExtendableGrids.refcoords_for_geometry
— Methodrefcoords_for_geometry(_)
Coordinates of reference geometry of 1D edge
ExtendableGrids.refcoords_for_geometry
— Methodrefcoords_for_geometry(_)
Coordinates of reference geometry of 3D hexahedron
ExtendableGrids.refcoords_for_geometry
— Methodrefcoords_for_geometry(_)
Coordinates of reference geometry of 2D quadrilateral
ExtendableGrids.refcoords_for_geometry
— Methodrefcoords_for_geometry(_)
Coordinates of reference geometry of 3D tetrahedron
ExtendableGrids.refcoords_for_geometry
— Methodrefcoords_for_geometry(_)
Coordinates of reference geometry of 2D triangle
ExtendableGrids.reference_domain
— Function reference_domain(EG::Type{<:AbstractElementGeometry}, T::Type{<:Real} = Float64; scale = [1,1,1], shift = [0,0,0]) -> ExtendableGrid{T,Int32}
Generates an ExtendableGrid{T,Int32} for the reference domain of the specified Element Geometry. With scale and shift the coordinates can be manipulated.
ExtendableGrids.reorder_cells
— Methodreorder_cells(
grid,
cellpartitions,
ncellpartitions,
colpart
)
(Internal utility function) Create cell permutation such that all cells belonging to one partition are numbered contiguously, return grid with reordered cells.
ExtendableGrids.ringsector
— Methodringsector(rad,ang; eltype=Triangle2D)
Sector of ring or full ring (if ang[begin]-ang[end]≈2π
)
ExtendableGrids.seal!
— Methodfunction seal!(grid::ExtendableGrid; bfaceregions=[], encode=true, Ti=Int64)
Take an (simplex-) ExtendableGrid and compute and add the BoundaryFaces. A so called incomplete ExtendableGrid can e.g. be read from an msh file using the Gmsh.jl-extension of the ExtendableGrids package and the function $simplexgrid_from_gmsh(filename::String; incomplete=true)$. If a non empty vector is passed as bfaceregions, this vector is used for the 'BFaceRegions'. If bfaceregions is empty, all BoundaryFaces get the region number 1.
For performance reasons, the faces (=the nodes contained in the face) can be encoded (see the function $encode(x::Vector, nn::Integer)$) to Integers encoding_type
. To do this, encode=true
is used. But for each encoding_type
there is a limit on the number of nodes:
- For Int64 and a 2d grid: 3*10^9 nodes
- For Int64 and a 3d grid: 2*10^6 nodes
- For Int128 and a 2d grid: 1.3*10^19 nodes
- For Int128 and a 3d grid: 5.5*10^12 nodes
If encode=false
is passed, there is no limit (besides the MaxValue of the Integer type used).
ExtendableGrids.seemingly_equal
— Methodseemingly_equal(array1, array2)
Check for seeming equality of two arrays by random sample.
ExtendableGrids.seemingly_equal
— Methodseemingly_equal(grid1, grid2; sort=false, confidence=:full
Recursively check seeming equality of two grids. Seemingly means that long arrays are only compared via random samples.
Keyword args:
sort
: if true, sort grid pointsconfidence
: Confidence level:- :low : Point numbers etc are the same
- :full : all arrays are equal (besides the coordinate array, the arrays only have to be equal up to permutations)
ExtendableGrids.simplexgrid
— Methodsimplexgrid(X,Y,Z; bregions=[1,2,3,4,5,6],cellregion=1)
Constructor for 3D grid from coordinate arrays. Boundary region numbers:
location | number |
---|---|
south | 1 |
east | 2 |
north | 3 |
west | 4 |
bottom | 5 |
top | 6 |
The keyword arguments allow to overwrite the default region numbers.
ExtendableGrids.simplexgrid
— Methodsimplexgrid(X,Y; bregions=[1,2,3,4],cellregion=1)
Constructor for 2D grid from coordinate arrays.
Boundary region numbers count counterclockwise:
location | number |
---|---|
south | 1 |
east | 2 |
north | 3 |
west | 4 |
The keyword arguments allow to overwrite the default region numbers.
ExtendableGrids.simplexgrid
— Methodsimplexgrid(X; bregions=[1,2],cellregion=1)
Constructor for 1D grid.
Construct 1D grid from an array of node cordinates. It creates two boundary regions with index 1 at the left end and index 2 at the right end by default.
The keyword arguments allow to overwrite the default region numbers.
Primal grid holding unknowns: marked by o
, dual grid marking control volumes: marked by |
.
o-----o-----o-----o-----o-----o-----o-----o-----o
|--|-----|-----|-----|-----|-----|-----|-----|--|
ExtendableGrids.simplexgrid
— Methodsimplexgrid(grid2d::ExtendableGrid, coordZ; bot_offset=0,cell_offset=0,top_offset=0, bface_offset=0)
Create tensor product of 2D grid and 1D coordinate array.
Cellregions and outer facet regions are taken over from 2D grid and added to cell_offset
and bface_offset
, respectively. Top an bottom facet regions are detected from the cell regions and added to bot_offset
resp. top_offset
.
ExtendableGrids.simplexgrid
— Methodsimplexgrid(
file::String;
format,
kwargs...
) -> ExtendableGrid{Float64, Int32}
Read grid from file. Supported formats:
- "*.sg": pdelib sg files. Format versions:
format=v"2.0"
: long version with some unnecessary dataformat=v"2.1"
: shortened version only with cells, cellnodes, cellregions, bfacenodes, bfaceregionsformat=v"2.2"
: like 2.1, but additional info on cell and node partitioning. Edge partitioning is not stored in the file and may be re-established byinduce_edge_partitioning!
.
- "*.geo": gmsh geometry description (requires
using Gmsh
) - "*.msh": gmsh mesh (requires
using Gmsh
)
ExtendableGrids.simplexgrid
— Methodfunction simplexgrid(coord::Array{Tc,2},
cellnodes::Array{Ti,2},
cellregions,
bfacenodes,
bfaceregions
) where {Tc,Ti}
Create d-dimensional simplex grid from five arrays.
coord: d ``\times`` n_points matrix of coordinates
- cellnodes: d+1 $\times$ n_tri matrix of triangle - point incidence
- cellregions: n_tri vector of cell region markers
- bfacenodes: d $\times$ n_bf matrix of boundary facet - point incidences
- bfaceregions: n_bf vector of boundary facet region markers
Coordinate type Tc
index type Ti
are detected from the first two parameters. cellregions
, bfaceregions
, bfacenodes
are converted to have the same element type as cellnodes
.
ExtendableGrids.simplexgrid
— Methodfunction simplexgrid(coord::Array{Tc,2},
cellnodes::Array{Ti,2},
cellregions,
bfacenodes,
bfaceregions,
bedgenodes,
bedgeregions
) where {Tc,Ti}
Create simplex grid from coordinates, cell-nodes-adjancency, cell-region-numbers, boundary-face-nodes adjacency, boundary-face-region-numbers, boundary-edge-nodes, and boundary-edge-region-numbers arrays.
The index type Ti
is detected from cellnodes
, all other arrays besides coord
are converted to this index type.
ExtendableGrids.split_grid_into
— Methodsplit_grid_into(
source_grid::ExtendableGrid{T, K},
targetgeometry::Type{<:AbstractElementGeometry};
store_parents
) -> ExtendableGrid
generates a new ExtendableGrid by splitting each cell into subcells of the specified targetgeometry
split rules exist for
- Quadrilateral2D into Triangle2D
- Hexahedron3D into Tetrahedron3D
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
ExtendableGrids.tricircumcenter!
— Methodtricircumcenter!(circumcenter, a, b, c)
Find the circumcenter of a triangle.
Derived from C source of Jonathan R Shewchuk <jrs@cs.cmu.edu>
Modified to return absolute coordinates.
ExtendableGrids.trivial_partitioning!
— Methodtrivial_partitioning!(grid)
(internal) Create trivial partitioning: the whole grid is partition #1 with just one color.
ExtendableGrids.trivial_partitioning
— Methodtrivial_partitioning(npart, nitems)
(internal) Create a trivial partitioning such that all items fall in the first of nparts
ExtendableGrids.tryfix
— Methodtryfix(
a::Union{Array{T, 2}, VariableTargetAdjacency{T}}
) -> Any
Try to turn variable target adjacency into fixed target adjacency
ExtendableGrids.trytoken
— Methodtrytoken(tks::TokenStream, expected::String) -> Bool
Try for keyword token.
It token is missing, the token read is put back into stream, a value of false is returned and the next try/gettoken command continues at the same position,
Otherwise, true is returned, and reading continues after the token found.
ExtendableGrids.typehierarchy
— Methodtypehierarchy()
Print complete type hierachy for ExtendableGrids
ExtendableGrids.uniform_refine
— Methoduniform_refine(
source_grid::ExtendableGrid{T, K};
store_parents
) -> ExtendableGrid
generates a new ExtendableGrid by uniform refinement of each cell in the given grid
uniform refinement rules are available for these AbstractElementGeometries:
- Line1D (bisection into two subsegments)
- Triangle2D (red refinement into four subtriangles)
- Quadrilateral2D (into four subquadrilaterals)
- Tetrahedron (into eight subtetrahedrons)
- Hexahedron (into eight subhexahedrons)
if multiple geometries are in the mesh uniform refinement will only work if all refinement rules refine faces and edges (in 3D) equally (so no hanging nodes are created)
ExtendableGrids.update!
— Methodupdate!(
grid::ExtendableGrid,
T::Type{<:AbstractGridComponent}
) -> Any
Reinstantiate grid component (only if it exists)
ExtendableGrids.veryform
— Methodveryform(
grid::ExtendableGrid,
v,
_::Type{<:AbstractGridComponent}
) -> Any
Default veryform method.
"veryform" means "verify and/or transform" and is called to check and possibly transform components to be added to the grid via setindex!
.
The default method just passes data through.
ExtendableGrids.veryform
— Methodveryform(grid::ExtendableGrid{Tc,Ti},v,T::Type{<:AbstractGridAdjacency}) where{Tc,Ti}
Check proper type of adjacencies upon insertion
ExtendableGrids.writeVTK
— MethodwriteVTK(
filename::String,
grid::ExtendableGrid{Tc, Ti};
kwargs...
) -> Vector{String}
exports grid and optional provided data as a vtk file
filename
: filename of the exported filegrid
: grid
Each '(key, value)' pair adds another data entry to the vtk file via WriteVTK functionality.