jaxdem.writers.vtk_facets_writer#

VTK writer for facet geometry.

Classes

VTKFacetsWriter()

A VTKBaseWriter that writes facets as thickened VTK cells.

class jaxdem.writers.vtk_facets_writer.VTKFacetsWriter#

Bases: VTKBaseWriter

A VTKBaseWriter that writes facets as thickened VTK cells.

The writer gathers each unique facet incidence and unwraps its vertices in one domain displacement call using each facet’s first vertex. In 2D it expands each 2-vertex facet into a convex-hull polygon that covers the facet plus its thickness, or a quad when the hull is not available. In 3D it expands each 3-vertex facet into a convex-hull triangle mesh, or a flat prism when the hull is not available. It also attaches per-vertex State fields and quaternion components as PointData arrays. Each expanded point inherits the fields of its source vertex. The expansion radius is state.rad at each face’s first vertex, matching the facet contact law.

classmethod is_active(state: State, system: System) → bool[source]#

Check whether this writer has data to write for the given state and system.

classmethod write(state: State, system: System, filename: Path, binary: bool) → None[source]#

Write information from a simulation snapshot to a VTK PolyData file.

Concrete writers implement this method. The caller converts all JAX arrays to NumPy arrays before it calls write.

Parameters:
  • state (State) – The simulation jaxdem.State snapshot to write.

  • system (System) – The simulation jaxdem.System configuration.

  • filename (Path) – Target path of the VTK file. The caller guarantees that the parent directory exists.

  • binary (bool) – If True, write the VTK file in binary mode. If False, write it in ASCII (human-readable) mode.