Public API
STLCutters.STLCutter
STLCutters.STLGeometry
GridapEmbedded.Interfaces.cut
STLCutters.check_requisites
STLCutters.download_thingi10k
STLCutters.subtriangulate
GridapEmbedded.Interfaces.cut
— Functioncut([cutter::STLCutter,]model::DiscreteModel,geo::STLGeometry)
Main interface of GridapEmbedded. It intersect each cell in model
with the geometry geo
. It returns an embedded discretization.
Usage
The basic usage is to call cut
with a model and a geometry.
cutgeo = cut(model,geo)
We can also set custom keyword arguments, see subtriangulate
.
cutter = STLCutter(;tolfactor=1e3)
cutgeo = cut(cutter,model,geo)
Then we can extract the domain and the boundary of the embedded discretization.
Ω = Triangulation(cutgeo)
Γ = EmbeddedBoundary(cutgeo)
STLCutters.subtriangulate
— Functionsubtriangulate(bgmodel::DiscreteModel,stl::DiscreteModel;kwargs...)
Intersection of each background cell in bgmodel
with domain bounded by the stl
surface.
It returns a three grids and set of lables:
cell_grid
: cell-wise volume grid of the intersection of each background cell and the interior of the domain.face_grid
: cell-wise surface grid of the intersection of each background cell and thestl
surface.bface_grid
: facet-wise surface grid of the intersection of each background (d-1)-face and the interior of the domain.labels
:SubtriangulationLabels
label IN/OUT/CUT, background cell, background face or STL face.
Optional keywords arguments:
kdtree
: (defaultfalse
) iftrue
it uses a kdtree as a first steptolfactor
: (default1e3
) relative tolerance with respect to machine precision (e.g.,1e-16*max_length(bgmodel)
)surfacesource
: (default:skin
) source of theface_grid
.:skin
: theface_grid
is the intersection of thestl
surface:interior
: theface_grid
is extracted of the interiorcell_grid
:exterior
: theface_grid
is extracted of the exterior `cell_grid:both
: retunrs boths:interior
and:exterior
face_grid
. It must be filtered (only used for debugging purposes).
showprogress
: (defaulttrue
) show progress barall_defined
: (defaulttrue
) iftrue
all cells are defined asIN
,OUT
orCUT
. Iffalse
undefined cells are allowed (only used for distributed meshes)cell_to_facets
: (defaultcompute_cell_to_facets
) precomputed cell to stl facets mapping.
STLCutters.STLCutter
— Typestruct STLCutter <: GridapEmbedded.Interfaces.Cutter
Cutter type for STLGeometries, it stores the keyword arguments of subtriangulate
.
STLCutters.STLGeometry
— Typestruct STLGeometry <: GridapEmbedded.CSG.Geometry
Object that stores the SLT geometry.
Example
julia> filename = download_thingi10k(293137)
julia> geo = STLGeometry(filename)
julia> writevtk(geo,"geo")
STLCutters.download_thingi10k
— Functiondownload_thingi10k(id;path"")
Dowloads surface model from thingiverse indexed by FileID at Thingi10K.
It returns the path to the downloaded file.
Example
julia> download_thingi10k(293137)
"293137.stl"
STLCutters.check_requisites
— Functioncheck_requisites(stl::DiscreteModel,bgmodel::DiscreteModel)
Check if the stl
meets the requirements to be used in the cutter.
Keyword arguments
verbose::Bool=false
: Print the results of the check.max_num_facets::Int=10000
: Maximum number of facets per background cell.
The requirements are the following:
- Is a surface
- Is vertex manifold
- Is edge manifold
- Is water tight
- Has no sharp edges
- Has number of STL faces per background cell less than a
max_num_facets
(default is 10000)