fem.hexmesh.HexMesh

fem.hexmesh.HexMesh(
    points,
    cells,
    boundary_faces,
    base_points=None,
    snap_mask=None,
    max_step=0.0,
    grid=None,
    table=None,
    incidence=None,
)

A HEX8 volume mesh extracted from an SDF.

Attributes

Name Type Description
points np.ndarray Vertex positions after snapping, shaped (N, 3) float64.
cells np.ndarray HEX8 connectivity in VTK/meshio corner order, (C, 8) int32.
boundary_faces dict[str, FaceGroup] Outer quads (faces used by exactly one cell) grouped by the dominant SDF-gradient axis at their centers, keyed "+x"/"-x"/… — so e.g. all faces of a box lying on its +x side land in one group.
base_points np.ndarray Unsnapped lattice positions of the same vertices, (N, 3). Together with snap_mask this freezes the topology so :func:~cadjoint.fem.motion.recompute_points can rebuild points differentiably for a traced SDF.
snap_mask np.ndarray Boolean (N,) mask of vertices that were projected onto the zero set (after the inversion guard).
max_step float Projection displacement clamp used for snapping (half the cell diagonal).
grid GridSpec | None The sampling grid the mesh was extracted from.

Methods

Name Description
all_boundary_faces All boundary quads concatenated across gradient-axis groups.
elastic Linear elasticity through the backend registry (jaxfem by default).
face_patch The union of the corners of the boundary quads the selection spans, and no faces.
moved Node positions under the design: snapped vertices re-projected, the lattice frozen.
thermal Steady conduction through the backend registry (jaxfem by default).

all_boundary_faces

fem.hexmesh.HexMesh.all_boundary_faces()

All boundary quads concatenated across gradient-axis groups.

elastic

fem.hexmesh.HexMesh.elastic(problem, *, placement=None, backend=None)

Linear elasticity through the backend registry (jaxfem by default).

face_patch

fem.hexmesh.HexMesh.face_patch(selection)

The union of the corners of the boundary quads the selection spans, and no faces.

A backend applies an area-integrated condition to exactly the faces all of whose corners are in the set.

moved

fem.hexmesh.HexMesh.moved(field, *, smooth_passes=0, design=None)

Node positions under the design: snapped vertices re-projected, the lattice frozen.

With a table and the design’s parameters, each snapped vertex is solved onto the census surfaces it was classified on — a crease vertex onto both faces at once — which is the derivative a single field’s Newton gets wrong there. Without, the single field’s.

thermal

fem.hexmesh.HexMesh.thermal(problem, *, placement=None, backend=None)

Steady conduction through the backend registry (jaxfem by default).