Private functions
Base.epsBase.splitGridap.ReferenceFEs.get_polytopeGridapEmbedded.Interfaces.cutSTLCutters._group_verticesSTLCutters._map_equal_vertices_from_cloudSTLCutters.bisector_planeSTLCutters.bisector_planeSTLCutters.bounding_boxes_intersectSTLCutters.centerSTLCutters.clipSTLCutters.closest_pointSTLCutters.closest_pointSTLCutters.closest_point!STLCutters.closest_point_to_boundarySTLCutters.collapse_small_facets!STLCutters.complete_in_or_out!STLCutters.compute_boundary_cellsSTLCutters.compute_cartesian_descriptorSTLCutters.compute_cell_to_facetsSTLCutters.compute_cell_to_facetsSTLCutters.compute_cell_to_facetsSTLCutters.compute_cell_to_facetsSTLCutters.compute_cell_to_isboundarySTLCutters.compute_distances!STLCutters.compute_face_neighbor_to_inoutcutSTLCutters.compute_face_neighborsSTLCutters.compute_gridSTLCutters.compute_interior_cellsSTLCutters.compute_modelSTLCutters.compute_stl_modelSTLCutters.contains_projectionSTLCutters.delete_repeated_verticesSTLCutters.displaceSTLCutters.distanceSTLCutters.distance_to_boundarySTLCutters.distance_to_infinite_faceSTLCutters.expand_faceSTLCutters.expand_planesSTLCutters.find_root_partSTLCutters.get_cellSTLCutters.get_cell!STLCutters.get_cell_cacheSTLCutters.get_cell_planesSTLCutters.get_dfaceSTLCutters.get_dface!STLCutters.get_dface_cacheSTLCutters.has_intersectionSTLCutters.has_intersection_pointSTLCutters.intersection_pointSTLCutters.is_open_surfaceSTLCutters.istouchedSTLCutters.max_lengthSTLCutters.measureSTLCutters.measureSTLCutters.merge_and_collapseSTLCutters.merge_nodesSTLCutters.min_heightSTLCutters.min_heightSTLCutters.normalSTLCutters.normalSTLCutters.originSTLCutters.orthogonalSTLCutters.preprocess_small_facetsSTLCutters.projectionSTLCutters.propagate_inout!STLCutters.read_stlSTLCutters.save_as_stlSTLCutters.save_as_stlSTLCutters.set_in_or_out!STLCutters.signed_distanceSTLCutters.simplex_faceSTLCutters.simplexify_boundarySTLCutters.split_disconnected_partsSTLCutters.surfaceSTLCutters.volumeSTLCutters.voxel_intersection
Base.eps — MethodBase.eps(T::Type{<:AbstractFloat},grid::Grid)Return the machine roundoff error of a Grid. It returns eps() of the maximum length of the bounding box of the Grid.
Base.split — Functionsplit(p::Polyhedron,plane;kwargs...)It splits a polyhedron by a plane into two polyhedra.
It returns a tuple of Union{Polyhedron,Nothing}. If one side is empty, it returns nothing for that side.
Optional keyword arguments
side::Symbol=:both: It returns:bothsides, the:leftside, or the:rightsideinvert::Bool=false: It inverts the plane
Gridap.ReferenceFEs.get_polytope — Methodget_polytope(f::Face)It returns the Gridap Polytope that defines the Face f.
GridapEmbedded.Interfaces.cut — Methodcut([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._group_vertices — Method_group_vertices(grid::Grid;atol)Group a list of vertices which are closer than atol. It returns a vector of vectors with the indices of grouped vertices.
To perform the classification, this function utilizes an auxiliar CartesianGrid of size h>atol.
STLCutters._map_equal_vertices_from_cloud — Method_map_equal_vertices_from_cloud(stl::DiscreteModel;atol])Find vertices closer than a tolerance atol. It returns a vector from each vector to the index of a vertex which is closer than atol.
In order to find the vertices without quadratic complexity, it requires to group the vertices in a grid with an arbitrary tolerance > atol.
STLCutters.bisector_plane — Methodbisector_plane(e::Face,Π1::AbstractPlane,Π2::AbstractPlane)It returns the bisector plane between two planes. The bisector contains the edge e.
STLCutters.bisector_plane — Methodbisector_plane(stl::STL,d::Integer,dface::Integer,Πf::AbstractArray)Compute the bisector plane of two facets in a STL model. The two facets must be connected by a STL edge (dface).
Arguments
stl::STL: The surface model.d::Integer: The dimension of the edge (0 for 2D, 1 for 3D).dface::Integer: The index of the edge.Πf::AbstractArray: The array of planes of the facets of the STL
STLCutters.bounding_boxes_intersect — Methodboundingboxesintersect(a::Face,b::Face)
Predicate that checks if the bounding boxes of two Face intersect.
STLCutters.center — Methodcenter(a::Face)It returns the centroid of a face as the average of its vertices.
STLCutters.clip — Methodclip(p::Polyhedron,planes;kwargs...) -> PolyhedronIt clips a polyhedron by the halfspace of a plane or a set of planes.
Optional keyword arguments
inside::Bool=true: It clips the polyhedron by the inside ourside of the union of halfspace.inout::Vector{Bool}=trues(length(planes)): In reverses the halfspaces withinside[i]=false.boundary::nothing:- If
boundary=true, it preserves the vertices on the planes (zero distance) - If
boundary=false, it removes the vertices on the planes (zero distance) - If
boundary=nothing, it preserves the vertices on the planes if the normal of the plane points inwards.
- If
STLCutters.closest_point! — Functionclosest_point!(cache,point::Point,stl::DiscreteModel,[faces])It returns the closest point to point in the stl.
Optional arguments
faces::Vector{Int}: List of faces to search the closest point.
STLCutters.closest_point — Methodclosest_point(points,stl::DiscreteModel)It returns an array of Point which are the closest_point! in the stl for each element in points .
Optional arguments
point_to_faces: Vector of vectors of thestlfaces to search for each point.
STLCutters.closest_point — Methodclosest_point(p::Point,f::Face)It returns the closest point in a face to a point. It returns the projection if it is inside the face, otherwise it returns the projection to the boundary.
STLCutters.closest_point_to_boundary — Methodclosestpointto_boundary(p::Point,f::Face)
It returns the closest point in in the boundary of f to a point p.
STLCutters.collapse_small_facets! — Methodcollapse_small_facets!(stl::DiscreteModel)Convert small facets of the stl into edges or points.
STLCutters.complete_in_or_out! — Methodcomplete_in_or_out!(a::AbstractEmbeddedDiscretization,b::AbstractEmbeddedDiscretization,acells,bcells)This function considers two discretizations of the same background model on the cells acells and bcells. These sets of cells have null intersection. If only one of the discretizations is not cut it sets the other one as in or out.
STLCutters.compute_boundary_cells — Methodcompute_boundary_cells(model::DiscreteModel,indices[,d=0])It returns the list of of own cells touching the subdomain interface. See compute_cell_to_isboundary for more details.
STLCutters.compute_cartesian_descriptor — Methodcompute_cartesian_descriptor(pmin,pmax;nmin,nmax)Compute CartesianDescriptor in a bounding box with the same cell size (h) in all directions:
h = min( max((pmin-pmax)/nmax), min((pmax-pmin)/nmin) )
STLCutters.compute_cell_to_facets — Functioncompute_cell_to_facets(a::CartesianGrid,b::Grid[,a_mask,b_mask])compute_cell_to_facets computes the cells in b colliding each cell in a using optimizations for a CartesianGrid. The output is a vector of vectors.
!!! note This function allows false positives.
STLCutters.compute_cell_to_facets — Functioncompute_cell_to_facets(a::UnstructuredGrid,b::Grid[,a_mask])compute_cell_to_facets computes the cells in b colliding each cell in a:UnstructuredGrid. The output is a vector of vectors.
STLCutters.compute_cell_to_facets — Methodcompute_cell_to_facets(a::DiscreteModel,b::Grid,args...)Compute a map of cells in a to the cells in b which potentially intersect. It is designed to filter the STL faces (in b) colliding each background cell in a. The output is a vector of vectors.
STLCutters.compute_cell_to_facets — Methodcompute_cell_to_facets(a::CartesianPortion,b::Grid)compute_cell_to_facets computes the cells in b colliding each cell in a:CartesianPortion. The output is a vector of vectors.
STLCutters.compute_cell_to_isboundary — Functioncompute_cell_to_isboundary(model::DiscreteModel,indices[,d=0])It returns a mask whether a cell touches the subdomain interface.
Arguments
model::DiscreteModel: Model of the subdomain.indices::AbstractLocalIndices: Partition indicesd::Integer=0: Dimemension of the d-faces touching the subdomain interface.
STLCutters.compute_distances! — Methodcompute_distances!(p::Polyhedron,planes,plane_ids[;atol=0])Compute the distances from the vertices of the polyhedron to each plane of the list planes. If the distance is below atol, it sets the distance to zero.
STLCutters.compute_face_neighbor_to_inoutcut — Functioncompute_face_neighbor_to_inoutcut(model::DiscreteModel,indices,d,face_to_inoutcut[,face_neighbors])It returns a whether interfaces of dimension $d$ are in, out, cut or undefined.
The number of interfaces coincides with the number of neigbors given by compute_face_neighbors
STLCutters.compute_face_neighbors — Methodcompute_face_neighbors(model::DiscreteModel,indices,d)It returns a neighboring graph of the subdomain's neighbors through the interfaces of dimension d.
STLCutters.compute_grid — Methodcompute_grid(coordinates,connectivity,polytope)Compute a Grid from coordinates, connectivity and polytope. It assumes that all the cells of the grid have the same polytope.
STLCutters.compute_interior_cells — Methodcompute_interior_cells(model::DiscreteModel,indices[,d=0])It returns the list of of own cells not touching the subdomain interface. See compute_cell_to_isboundary for more details.
STLCutters.compute_model — Methodcompute_model(coordinates,connectivity,polytope)Compute a DiscreteModel from coordinates, connectivity and polytope. It assumes that all the cells of the model have the same polytope.
STLCutters.compute_stl_model — Methodcompute_stl_model(coordinates,connectivity)Compute a DiscreteModel from coordinates and connectivity. It assumes that the model is surface composed of simplex faces.
STLCutters.contains_projection — Methodcontains_projection(f::Face,p::Point)Check is the projection of a point p is inside a face f.
STLCutters.delete_repeated_vertices — Methoddelete_repeated_vertices(stl::DiscreteModel [,atol])Find vertices closer than a tolerance atol and delete the repeated ones.
STLCutters.displace — Functiondisplace(plane::AbstractPlane,dist[,oriented=true])Move a plane a distance dist along its normal vector. If oriented is false, move a distance -dist.
STLCutters.distance — Methoddistance(a,b)It returns the minimum absolute distance between two entities (Face or Point).
STLCutters.distance_to_boundary — Methoddistance_to_infinite_face(f::Face,p::Point)It returns the minimum distance between a point and the boundary of a face.
STLCutters.distance_to_infinite_face — Methoddistance_to_infinite_face(f::Face,p::Point)It returns the minimum distance between a point and the space where the face belongs.
STLCutters.expand_face — Methodexpand_face(f::Face,dist)Move the vertices of the face f a distance dist from the center of f
STLCutters.expand_planes — Methodexplan_planes(planes::AbstractVector{<:AbstractPlane},mask,dist)Move a list of planes a distance dist along their normal vectors. If the mask entries are false, the planes are moved a distance -dist.
STLCutters.find_root_part — Methodfind_root_part(cuts::AbstractArray{<:AbstractEmbeddedDiscretization},cells)This functions sets the root processor to a potentially idling processor. It returns the first non-cut part.
STLCutters.get_cell! — Methodget_cell!(cache,stl::STL,i::Integer)Get a cell as a Face. It requires get_cell_cache to be allocate the cache.
STLCutters.get_cell — Methodget_cell(stl::STL,i::Integer)Get a cell as a Face.
STLCutters.get_cell_cache — Methodget_cell_cache(stl::STL)Allocate cache for get_cell!.
STLCutters.get_cell_planes — Methodget_cell_planes(p::Polytope,coords::AbstractVector{<:Point})It returns a list of planes bounding a cell. The cell is defind by a Polytope and a list of coordinates. If the cell is a voxel, the bounding planes are CartesianPlane.
STLCutters.get_dface! — Methodget_dface!(cache,stl::STL,i::Integer,::Val{d})Get a face as a Face
STLCutters.get_dface — Methodget_dface(f::Face,i::Integer,::Val{d})It returns the ith d-face of a face f. E.g., vertex, edge, facet, cell.
STLCutters.get_dface_cache — Methodget_dface_cache(stl::STL,d::Integer)Allocate cache for get_dface!.
STLCutters.has_intersection — Methodhas_intersection(a::Face,b::Face)Predicate that checks if two faces intersect.
STLCutters.has_intersection_point — Methodhas_intersection(a::Face,b::Face)Predicate that checks if two faces intersect in a point.
STLCutters.intersection_point — Methodintersection_point(a,b)It returns the intersection point of two faces, or a face and a plane. The intersection point is only well defined if num_dims(a)+num_dims(b)-D=0, where D is the dimension of the space.
STLCutters.is_open_surface — Methodis_open_surface(topo::GridTopology)Predicate to check if a surface is water tight.
STLCutters.istouched — Functionistouched(cut::AbstractEmbeddedDiscretization[,cells])Check is an embedded discretization cut (or a set of cells) have information about the geometry. In other words, it checks if any cell is cut.
STLCutters.max_length — Methodmax_length(grid::Grid)Compute the maximum of maximum length of the cells of a grid.
STLCutters.measure — Methodmeasure(a::Grid,mask)Compute the sum of the cell measures of a grid. It only considers the cells which are true in the mask.
STLCutters.measure — Methodmeasure(f::Face)It returns the measure of a face. E.g., the length, the area or the volume.
STLCutters.merge_and_collapse — Methodmerge_and_collapse(stl::DiscreteModel)Merge close nodes and collapse small facets (convert into points or edges) of the stl.
STLCutters.merge_nodes — Methodmerge_nodes(stl::DiscreteModel [,atol])Merge close nodes of the stl which are closer than a tolerance atol.
STLCutters.min_height — Methodmin_height(grid::Grid)Compute the minimum of minimum heights of the cells of a grid.
STLCutters.min_height — Methodmin_height(f::Face)It returns the minimum height of a face, i.e., the minimum distance between two opposite entities of the face.
STLCutters.normal — Methodnormal(a::Plane)It returns the normal vector of a plane
STLCutters.normal — Methodnormal(a::Face[,i])It returns the normal vector of a face (or its i-th facet). Note, that the normal is only defined for D-1 faces.
STLCutters.origin — Methodorigin(a::Plane)It returns the origin point of a plane
STLCutters.orthogonal — Methodorthogonal(a::VectorValue{D}...)It returns the orthogonal vector to a list of D-1 vectors.
STLCutters.preprocess_small_facets — Methodpreprocess_small_facets(stl::DiscreteModel;atol)Fix small facet problems of a quasi-degenerated stl.
If an edge and an opposite vertes are closer than atol, the edge and the face are split. The conformity is kept in the surrounding faces.
STLCutters.projection — Methodprojection(p::Point,f::Face)It returns the projection of a point p to the infinite space of f.
STLCutters.propagate_inout! — Methodpropagate_inout!(bgmocel,bgcell_to_inoutcut,bgnode_to_inoutcut,in_or_out)Propagates IN or OUT (in_or_out) label of each backgroun cell (bgcell_to_inoutcut) through the nodes of the background model (bgnode_to_inoutcut). It overwrites bgcell_to_inoutcut`.
It is implemented with a deep-first search algorithm that stops at CUT cells.
STLCutters.read_stl — Methodread_stl(filename)Read STL file with MeshIO.jl and Gridap.jl arrays:
vertex_to_coordinatesis a vector ofPoint{3,Float64}facet_to_verticesis aGridap.TableofIntfacet_to_normalsis a vector ofVectorValue{3,Float64}
STLCutters.save_as_stl — Methodsave_as_stl(stl::Vector{<:DiscreteModel},filename)Save a list of DiscreteModel{2,3} into STL files. It save the files as filename_1.stl, filename_2.stl,..., filename_n.stl`.
STLCutters.save_as_stl — Methodsave_as_stl(stl::DiscreteModel,filename)Save DiscreteModel{2,3} into a STL file.
STLCutters.set_in_or_out! — Methodset_in_or_out!(cut::DistributedEmbeddedDiscretization,in_or_out[,cells,facets])Sets all the background cells and facets (or a set of cells and facets) as in or out.
STLCutters.signed_distance — Methodsigned_distance(p::Point,Π::AbstractPlane)It returns the signed distance between a point and a plane.
STLCutters.simplex_face — Methodsimplex_face(x::Point...)It returns a simplex face from a list (or a tuple) of points. The dimension of the simplex is N+1, where N is the number of points.
STLCutters.simplexify_boundary — Methodsimplexify_boundary(p::Polyhedron,t::GridTopology)It generates a simplex mesh of the surface of the polyhedron that touches the grid topology.
It returns the coordinates of the vertices, the connectivities and a mapping to the topology facets.
STLCutters.split_disconnected_parts — Methodsplit_disconnected_parts(stl::DiscreteModel)Given a stl with disconnected parts, it returns an array of DiscreteModel.
STLCutters.surface — Methodsurface(a::Grid)Compute the surface of a grid. It returns the measure of a surface grid, i.e-, Dc=D-1.
STLCutters.volume — Methodvolume(a::Grid)Compute the volume of a grid. It returns the measure of the grid.
STLCutters.voxel_intersection — Methodvoxel_intersection(f::Face,pmin::Point,pmax::Point,p::Polytope)Predicate that checks if a face intersects by a voxel. Here, a voxel is a hypercube defined by its extrema (pmin and pmax).