Helper classes and functions๏
These are helper functions for working with meshes. A RegionMarker
stores metadata about a region in a mesh. tetrahedralize()
and
triangulate()
are interfaces to generate meshes.
classes
|
Data class to store region info. |
functions
|
Tetrahedralize a surface mesh. |
|
Simple triangulation using |
|
Triangulate a contour mesh. |
Reference๏
- class nanomesh.RegionMarker(label: int, point: Union[Tuple[float, ...], ndarray[Any, dtype[ScalarType]]], name: Optional[str] = None, constraint: float = 0)[source]๏
Data class to store region info.
A region is typically an area or volume bounded by segments or cells.
- nanomesh.tetrahedralize(mesh: TriangleMesh, opts: str | dict = '-pAq', default_opts: dict = None) MeshContainer [source]๏
Tetrahedralize a surface mesh.
- Parameters
mesh (TriangleMesh) โ Input contour mesh
opts (str, optional) โ
Command-line options passed to tetgen.
More info: http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual005.html
Some useful flags:
-A: Assigns attributes to tetrahedra in different regions.
-p: Tetrahedralizes a piecewise linear complex (PLC).
-q: Refines mesh (to improve mesh quality).
-a: Applies a maximum tetrahedron volume constraint.
Can be passed as a raw string, opts=โ-pAq1.2โ, or dict, `opts=dict(โpโ= True, โAโ= True, โqโ=1.2).
default_opts (dict, optional) โ Dictionary with default options. These will be merged with opts.
- Returns
Tetrahedralized mesh.
- Return type
- nanomesh.triangulate(mesh: LineMesh, opts: Optional[str | dict] = None, default_opts: dict = None) MeshContainer [source]๏
Triangulate a contour mesh.
- Parameters
mesh (LineMesh) โ Input contour mesh
opts (str | dict, optional) โ
Triangulation options passed to triangle.triangulate documented here: https://rufat.be/triangle/API.html#triangle.triangulate
Can be passed as a raw string, opts=โpAq30โ, or dict, `opts=dict(โpโ= True, โAโ= True, โqโ=30).
default_opts (dict, optional) โ Dictionary with default options. These will be merged with opts.
- Returns
mesh โ Triangulated 2D mesh.
- Return type