Build status

SimplexGridFactory

Contains convenience interfaces to triangle (via Triangulate.jl) and TetGen via TetGen.jl. Code using it needs to pass the Triangulate or the TetGen modules as parameters to the constructor of SimplexGridBuilder and thus needs to adhere to their corresponding license conditions.

API Documentation

Mesh generator interface

ExtendableGrids.simplexgridMethod
simplexgrid(::Type{SimplexGridFactory.TriangulateType}, Triangulate::Any, input::Any; kwargs...) -> ExtendableGrid{_A,_B} where _B where _A

Create Grid from Triangle input data.

See default_options for available kwargs.

SimplexGridFactory.triangulateioMethod
triangulateio(Triangulate::Any; points, bfaces, bfaceregions, regionpoints, regionnumbers, regionvolumes) -> Any

Create a TriangulateIO structure from a number of input arrays. The 2D input arrays are transposed if necessary and converted to the proper data types for Triangulate.

This conversion is not performed if the data types are those indicated in the defaults and the leading dimension of 2D arrays corresponds to the space dimension.

ExtendableGrids.simplexgridMethod
simplexgrid(::Type{SimplexGridFactory.TetGenType}, TetGen::Any, input::Any; kwargs...) -> ExtendableGrid{_A,_B} where _B where _A

Create Grid from TetGen data.

See default_options for available kwargs.

SimplexGridFactory.tetgenioMethod
tetgenio(TetGen::Any; points, bfaces, bfaceregions, regionpoints, regionnumbers, regionvolumes) -> Any

Create a RawTetGenIO structure from a number of input arrays. The 2D input arrays are transposed if necessary and converted to the proper data types for TetGen.

This conversion is not performed if the data types are those indicated in the defaults and the leading dimension of 2D arrays corresponds to the space dimension.

SimplexGridFactory.tetgenioMethod
tetgenio(this::SimplexGridBuilder) -> Any

Create tetgen input from the current state of the builder.

SimplexGridFactory.default_optionsMethod
default_options()

Create dictionary of mesh generation options with default values. These at once describe the keyword arguments available to the methods of the package and are listed in the following table:

keyworddefault2D3DExplanation
PLCtrue-p-pTriangulate/tetraheralize PLSG/PLC
refinefalse-r-rRefines a previously generated mesh.
qualitytrue-q-qQuality mesh generation
minangle20Minimum angle for quality
volumecontroltrue-a-aMaximum area constraint
maxvolumeInfValue of area/volume constraint if less than Inf
attributestrue-A-ARegional attribute to each simplex.
confdelaunaytrue-DEnsure that all circumcenter lie within the domain.
nosteinerfalse-Y-YProhibits insertion of Steiner points on the mesh boundary
quiettrue-Q-QSuppress all output unless an error occurs.
verbosefalse-V-VGive detailed information.
debugfacetstrue-dDetects self-intersections of facets of the PLC.
checkfalse-C-CChecks the consistency of the final mesh.
optlevel1-OSpecifies the level of mesh optimization.
unsuitablenothingUnsuitable function
addflags""Additional flags
flagsnothingSet flags, overwrite all other options

For mesh generation, these are turned into mesh generator control flags. This process can be completely ovewritten by specifying the flags parameter.

For the flags parameter in 2D see the short resp. long documentation of the Triangle control flags.

For the 3D case, see the corresponding TetGen flags

The unsuitable parameter should be a function, see triunsuitable .

ExtendableGrids.simplexgridMethod
function simplexgrid(Generator;
                     points=Array{Cdouble,2}(undef,0,0),
                     bfaces=Array{Cint,2}(undef,0,0),
                     bfaceregions=Array{Cint,1}(undef,0),
                     regionpoints=Array{Cdouble,2}(undef,0,0),
                     regionnumbers=Array{Cint,1}(undef,0),
                     regionvolumes=Array{Cdouble,1}(undef,0);
                     kwargs...
                  )

Create Grid from a number of input arrays. The 2D input arrays are transposed if necessary and converted to the proper data types for Triangulate or TetGen

This conversion is not performed if the data types are those indicated in the defaults and the leading dimension of 2D arrays corresponds to the space dimension.

See default_options for available kwargs.

SimplexGridBuilder

SimplexGridFactory.SimplexGridBuilderType
mutable struct SimplexGridBuilder

Simplex grid builder: wrapper around array based mesh generator interface. It allows to build up the input data incrementally.

Up to now the implementation complexity is far from optimal.

ExtendableGrids.simplexgridMethod
simplexgrid(this::SimplexGridBuilder; kwargs...) -> ExtendableGrid{_A,_B} where _B where _A

Build simplex grid from the current state of the builder. See default_options for available kwargs.

SimplexGridFactory.cellregion!Method
cellregion!(this::SimplexGridBuilder, i::Any) -> Any

Set the current cell region (acts on subsequent regionpoint() calls)

SimplexGridFactory.facet!Method
facet!(this::SimplexGridBuilder, i1::Any, i2::Any, i3::Any, i4::Any) -> Int64

Add a facet via the corresponding point indices.

SimplexGridFactory.facet!Method
facet!(this::SimplexGridBuilder, i1::Any, i2::Any, i3::Any) -> Int64

Add a facet via the corresponding point indices.

SimplexGridFactory.facet!Method
facet!(this::SimplexGridBuilder, i1::Any, i2::Any) -> Int64

Add a facet via the corresponding point indices.

SimplexGridFactory.facet!Method
facet!(this::SimplexGridBuilder, p::Union{Tuple, Array{T,1} where T}) -> Int64

Add a facet via the corresponding point indices.

SimplexGridFactory.facet!Method
facet!(this::SimplexGridBuilder) -> Int64

Add a facet via the corresponding point indices.

SimplexGridFactory.facetregion!Method
facetregion!(this::SimplexGridBuilder, i::Any) -> Any

Set the current cell region (acts on subsequent regionpoint() calls)

SimplexGridFactory.holepoint!Method
holepoint!(this::SimplexGridBuilder, p::Union{Tuple, Array{T,1} where T})

Add a point marking a hole region

SimplexGridFactory.maxvolume!Method
maxvolume!(this::SimplexGridBuilder, vol::Any) -> Any

Set the current cell volume (acts on subsequent regionpoint() calls)

SimplexGridFactory.point!Method
point!(this::SimplexGridBuilder, x::Any, y::Any, z::Any) -> Any

Add point or merge with already existing point. Return its index.

SimplexGridFactory.point!Method
point!(this::SimplexGridBuilder, p::Union{Tuple, AbstractArray{T,1} where T}) -> Any

Add point or merge with already existing point. Return its index.

SimplexGridFactory.regionpoint!Method
regionpoint!(this::SimplexGridBuilder, x::Any, y::Any, z::Any) -> Array{Int32,1}

Add a region point marking a region, using current cell volume an cell region

SimplexGridFactory.regionpoint!Method
regionpoint!(this::SimplexGridBuilder, x::Any, y::Any) -> Array{Int32,1}

Add a region point marking a region, using current cell volume an cell region

SimplexGridFactory.regionpoint!Method
regionpoint!(this::SimplexGridBuilder, p::Union{Tuple, Array{T,1} where T}) -> Any

Add a region point marking a region, using current cell volume an cell region

BinnedPointList

SimplexGridFactory.BinnedPointListType
mutable 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 bining 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.

SimplexGridFactory.BinnedPointListMethod
BinnedPointList(, dim; tol, number_of_directional_bins, binning_region_increase_factor, num_allowed_unbinned_points, max_unbinned_ratio)
BinnedPointList(dim; kwargs...)

Create and initialize binned point list

Base.insert!Method
insert!(bpl, p)

If another point with distance less the tol from p is in pointlist, return its index. Otherwise, insert point into pointlist.