hertzforge.core.tetmesh¶
tetmesh
¶
Tetrahedral meshing of a geometry's solids, from their recipe.
Mesh Solids meshes an extrusion into bricks (solids.extrusion_mesh).
A part that is not one, a hole drilled at an angle, cylinders along
three axes, is meshed here into tetrahedra, from the recipe's signed
distance (solids.distance) alone: nothing about the shape is assumed
beyond where its surface is and which way is out.
The method is the one of Persson and Strang (2004). Points are laid on a body-centered lattice inside the solid, with points fixed along its sharp edges and at its corners; every edge of their Delaunay triangulation pushes its ends apart when shorter than the length aimed at; a point pushed out of the solid is put back onto its surface along the distance's gradient; and the triangulation is made again when the points have moved enough to need it. The relaxation ends when the points have settled, and the tetrahedra whose centroids fall outside the solid are dropped.
Sharp edges are found from the recipe: each block gives six planes, each cylinder a wall and two caps, and an edge is a curve where two of them cross on the solid's surface, a corner a point where three do. Points are placed along the curves a mesh size apart and held there, so the mesh keeps every edge the recipe has and rounds nothing off.
The elements are ten-node tetrahedra (type 118): the corners, then the midside nodes of edges 1-2, 2-3, 1-3, 1-4, 2-4, 3-4, those on a curved wall moved onto it. Four-node ones (type 111) are made on request.
Functions:
| Name | Description |
|---|---|
tet_count |
About how many tetrahedra |
tet_mesh |
The parts as tetrahedra, ready to join to a geometry |
sharp_edges |
The points |
Classes¶
Functions:¶
tet_count
¶
About how many tetrahedra tet_mesh would make for these parts
at size: their volume, read by sampling, over the cube of the
size, times what a relaxed lattice packs into that. Within a
quarter or so; the pane reads it to decide whether to preview.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
Geometry
|
Whose solids. |
required |
ids
|
sequence of int
|
The parts, by id. |
required |
size
|
float
|
The element size, as the geometry holds its coordinates. |
required |
Returns:
| Type | Description |
|---|---|
int
|
|
tet_mesh
¶
tet_mesh(geometry: Any, ids: Sequence[int], size: float, quadratic: bool = True, progress: Any = None, keep_slivers: bool = False) -> tuple[Any, dict]
The parts as tetrahedra, ready to join to a geometry
(mesh.join).
Each part gets one element group, named for it (or for its kind and id when it has no name); an element goes to the part whose recipe holds its centroid, the later part where parts overlap. Parts that touch share their nodes there.
Refused: a solid that is part of another, a size that is not
positive, and a mesh of more than MESH_LIMIT tetrahedra by
tet_count's estimate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
Geometry
|
Whose solids. |
required |
ids
|
sequence of int
|
The parts, by id; each a solid nothing else uses. |
required |
size
|
float
|
The element size aimed at, as the geometry holds its coordinates: the edge length the relaxation settles to. |
required |
quadratic
|
bool
|
Ten-node tetrahedra; False for four-node ones. |
True
|
progress
|
callable
|
Told |
None
|
keep_slivers
|
bool
|
Keep the slivers that lie in the surface rather than remove
them. Removed, each leaves a shallow dimple, and the surface
pinches along an edge there; kept, the mesh's outer faces are
the surface whole, which is what a shell mesh of it wants
( |
False
|
Returns:
| Type | Description |
|---|---|
(Geometry, dict)
|
The tetrahedra, in the geometry's length unit; and what was made: 'tets' and 'nodes', the counts; 'steps', how many the relaxation took; 'quality', the least radius ratio (1 for a regular tetrahedron, 0 for a flat one); 'poor', how many are under 0.3; 'slivers', how many were removed from the surface; and 'shortest', the shortest edge. |
sharp_edges
¶
The points tet_mesh holds fixed: the parts' corners, and points
about size apart along every sharp edge of their surface.
The surfaces are read from the recipe, each block's six planes and each cylinder's wall and caps, unbounded; a sharp edge is where two of them cross on the solid's surface, a corner where three do. Points seeded on one surface are moved onto the other and back until they sit on both, kept where the solid's distance is zero there, and thinned to the size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geometry
|
Geometry
|
Whose solids. |
required |
ids
|
sequence of int
|
The parts, by id. |
required |
size
|
float
|
The mesh size: the spacing along an edge. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
(n, 3), the corners first. |