Public API

GridapEmbedded.Interfaces.cutFunction
cut([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)
source
STLCutters.subtriangulateFunction
subtriangulate(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 the stl 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: (default false) if true it uses a kdtree as a first step
  • tolfactor: (default 1e3) relative tolerance with respect to machine precision (e.g., 1e-16*max_length(bgmodel))
  • surfacesource: (default :skin) source of the face_grid.
    • :skin: the face_grid is the intersection of the stl surface
    • :interior: the face_grid is extracted of the interior cell_grid
    • :exterior: the face_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: (default true) show progress bar
  • all_defined: (default true) if true all cells are defined as IN, OUT or CUT. If false undefined cells are allowed (only used for distributed meshes)
  • cell_to_facets: (default compute_cell_to_facets) precomputed cell to stl facets mapping.
source
STLCutters.STLGeometryType
struct STLGeometry <: GridapEmbedded.CSG.Geometry

Object that stores the SLT geometry.

Example

julia> filename = download_thingi10k(293137)
julia> geo = STLGeometry(filename)
julia> writevtk(geo,"geo")
source
STLCutters.check_requisitesFunction
check_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)
source