eqiora.meshing
Plan and generate meshes from geometry.
View sourceExample: mesh the rectangle
Section titled “Example: mesh the rectangle”Continue with geometry from the geometry example:
from eqiora import meshing
mesh_plan = meshing.resolve(geometry, meshing.CartesianMesher(cells=(8, 4)))mesh = meshing.generate(mesh_plan)print(mesh.dimension, mesh.cell_count, mesh.vertex_count)print(mesh.coordinates.shape)The rectangle becomes 32 cells with 45 vertices in two dimensions.
coordinates contains the vertex positions. Use this same mesh when resolving
a spatial model bound to this geometry; see modeling.
AffineTriangleMesher
Section titled “AffineTriangleMesher”Mesh a rectangle with a structured grid of affine triangles.
Each grid cell is split along its lower-left to upper-right diagonal. You choose only the (positive) number of subdivisions in each direction.
@finalclass AffineTriangleMesher: def __new__(cls, *, cells: tuple[int, int]) -> Self: ... @property def cells(self) -> tuple[int, int]: ... @property def diagonal(self) -> str: ... def __eq__(self, other: object, /) -> bool: ... def __repr__(self) -> str: ...CartesianMesher
Section titled “CartesianMesher”Mesh a Cartesian domain with a structured grid.
@finalclass CartesianMesher: def __new__(cls, *, cells: tuple[int] | tuple[int, int] | tuple[int, int, int]) -> Self: ... @property def cells(self) -> tuple[int] | tuple[int, int] | tuple[int, int, int]: ... def __eq__(self, other: object, /) -> bool: ... def __repr__(self) -> str: ...GmshMesher
Section titled “GmshMesher”Generate the mesh with Gmsh (requires the gmsh extra).
@finalclass GmshMesher: def __new__(cls, *, maximum_boundary_error: float=..., maximum_target_size: float | None=..., minimum_mean_ratio: float=..., maximum_boundary_facets: int=...) -> Self: ... @property def maximum_boundary_error(self) -> float: ... @property def maximum_target_size(self) -> float | None: ... @property def minimum_mean_ratio(self) -> float: ... @property def maximum_boundary_facets(self) -> int: ... def __eq__(self, other: object, /) -> bool: ... def __repr__(self) -> str: ...Immutable mesh, linked to the geometry and plan that produced it.
@finalclass Mesh: @staticmethod def coordinate_factors(model: Model, domain: DomainRef, cells_per_factor: list[int]) -> Mesh: ... @staticmethod def from_bytes(data: bytes) -> Mesh: ... def to_bytes(self) -> bytes: ... def refine(self, marked_cells: Iterable[int], /, *, maximum_cells: int) -> Mesh: ... @property def source_digest(self) -> str: ... @property def realized_geometry_digest(self) -> str | None: ... @property def digest(self) -> str: ... @property def correspondence_digest(self) -> str | None: ... @property def production_lineage_bytes(self) -> bytes: ... @property def production_lineage_digest(self) -> str: ... @property def canonical_bytes(self) -> bytes: ... @property def dimension(self) -> int: ... @property def vertex_count(self) -> int: ... @property def cell_count(self) -> int: ... @property def coordinates(self) -> npt.NDArray[np.float64]: ... @property def cells(self) -> npt.NDArray[np.uint32]: ... def entity_vertices(self, entity: tuple[int, int]) -> tuple[int, ...]: ... @property def minimum_mean_ratio(self) -> float: ... @property def selection_names(self) -> tuple[str, ...]: ... def selection_entity_count(self, name: str | GeometrySelection) -> int: ... def selection_entities(self, name: str | GeometrySelection) -> tuple[tuple[int, int], ...]: ... def __repr__(self) -> str: ...MeshPlan
Section titled “MeshPlan”Fully resolved meshing plan for one geometry.
@finalclass MeshPlan: @property def source_digest(self) -> str: ... @property def provider(self) -> AffineTriangleMesher | CartesianMesher | GmshMesher: ... def __repr__(self) -> str: ...generate
Section titled “generate”Run a resolved meshing plan and return the mesh.
def generate(plan: MeshPlan, /) -> Mesh: ...resolve
Section titled “resolve”Resolve a meshing request into a plan for the given geometry.
def resolve(geometry: Geometry, provider: AffineTriangleMesher | CartesianMesher | GmshMesher, /) -> MeshPlan: ...