dataio.meshtools

Shared mesh convention and surface-extraction tools for SimData.

class MeshConventionCheck(is_zero_based, has_ccw_winding, is_right_handed, has_valid_connectivity, has_row_major_connectivity, failed_checks, connectivity_failures)[source]

Bases: object

Structured report describing mesh convention compliance.

is_zero_based
has_ccw_winding
is_right_handed
has_valid_connectivity
has_row_major_connectivity
failed_checks
connectivity_failures
property is_valid
__init__(is_zero_based, has_ccw_winding, is_right_handed, has_valid_connectivity, has_row_major_connectivity, failed_checks, connectivity_failures)
check_mesh_convention(mesh_in)[source]

Checks a mesh against the shared pyvale mesh convention.

enforce_mesh_convention(mesh_in)[source]

Normalises a mesh to the pyvale mesh convention: - 0-based indexing - CCW node ordering when viewed from the outward/visible side - Right-handed geometry conventions - Check that all indices in the connectivity table map to a row in coords

check_cw_winding(mesh_in)[source]

Checks whether all supported surface/2D elements are wound clockwise.

check_ccw_winding(mesh_in)[source]

Checks whether all supported surface/2D elements are wound counter-clockwise.

enforce_cw_winding(mesh_in)[source]

Returns a copy of mesh_in with supported 2D/surface elements wound CW.

enforce_ccw_winding(mesh_in)[source]

Returns a copy of mesh_in with supported 2D/surface elements wound CCW.

extract_surf_mesh(mesh_in, enforce_convention=True)[source]

Extracts the external surface mesh from supported 3D volume elements.

extract_surf_between(mesh_in, point, normal, distance=None, tolerance=1e-06, enforce_convention=True)[source]

Extracts a surface mesh between two planes defined by point, normal, and distance.

Parameters:
  • mesh_in (SimData) – The input simulation data/mesh.

  • point (np.ndarray | list[float] | tuple[float, ]) – A point on the first plane.

  • normal (np.ndarray | list[float] | tuple[float, ]) – The normal vector of the planes.

  • distance (float | None, optional) – The distance along the normal to the second plane. If None, the surface is extracted at +/- tolerance about the first plane.

  • tolerance (float, optional) – Numerical tolerance for checking if nodes lie between the planes. Defaults to 1.0e-6.

  • enforce_convention (bool, optional) – If True, normalizes the output mesh to the pyvale convention. Defaults to True.

Returns:

SimData – The extracted surface mesh.