sparseSpatialSampling.geometry.geometry_STL_3d module
Implements a class for using an STL file (3D) as geometry object.
- class sparseSpatialSampling.geometry.geometry_STL_3d.GeometrySTL3D(name, keep_inside, path_stl_file, refine=False, min_refinement_level=None, reduce_by=0)[source]
Bases:
GeometryObjectImplement a class for using an STL file as a geometry object representing the numerical domain or geometries inside the domain (3D case).
Note
pyVista requires the STL file to have a closed surface.
- Parameters:
name (str) – Name of the geometry object.
keep_inside (bool) – If
True, the points inside the object are kept; ifFalse, they are masked out.path_stl_file (str) – Path to the STL file.
refine (bool) – If
True, the mesh around the geometry object is refined after \(S^3\) generates the mesh.min_refinement_level (int or None) – Minimum refinement level for resolving the geometry. If
Noneandrefine=True, the geometry will be resolved with the maximum refinement level present at its surface after \(S^3\) has generated the grid.reduce_by (Union[int, float]) – Factor to reduce the STL file. Recommended for larger STL files, as the number of points increases runtime significantly. A value of 0 means no compression; values between 0.9 and 0.98 typically work for most STL files. Must satisfy
0 <= reduce_by < 1.
- property center: torch.Tensor
Return the center coordinates based on the main width of the cube.
- Returns:
center coordinates of the cube.
- Return type:
pt.Tensor
- check_cell(cell_nodes, refine_geometry=False)[source]
Check if a cell is valid or invalid based on the specified settings.
- Parameters:
cell_nodes (pt.Tensor) – Vertices of the cell to be checked.
refine_geometry (bool) – If
False, cells are masked out while generating the grid. IfTrue, checks whether a cell is located in the vicinity of the geometry surface to refine it subsequently. This parameter is provided by \(S^3\).
- Returns:
Trueif the cell is invalid,Falseif the cell is valid.- Return type:
bool
- property main_width: float
Return the width of the main dimension of the cube.
- Returns:
Main width of the cube.
- Return type:
float
- pre_check_cell(cell_nodes, refine_geometry=False)[source]
Pre-check if a cell is within the rectangular bounding box of the geometry object.
This method is faster than checking the polygon directly and is especially useful when generating large numbers of cells outside the bounding box.
- Parameters:
cell_nodes (pt.Tensor) – Vertices of the cell to be checked.
refine_geometry (bool) – If
False, cells are masked out while generating the grid. IfTrue, checks whether a cell is located in the vicinity of the geometry surface to refine it subsequently. This parameter is provided by \(S^3\).
- Returns:
Trueif the cell is invalid,Falseif the cell is valid.- Return type:
bool
- property type: str
Return the name of the geometry object.
- Returns:
Name of the geometry object.
- Return type:
str