morphogen.io.medit

Medit ASCII meshes (.mesh) and solutions (.sol), as used by MMG.

morphogen.io.medit.write_mesh(path, nodes, tetrahedra=None, triangles=None, *, edges=None, node_refs=None, tet_refs=None, tri_refs=None, edge_refs=None, required_triangles=None, required_edges=None, required_vertices=None, corners=None, ridges=None, comments=()) → Path[source]

Write vertices, tetrahedra, triangles and edges (0-based indices) with references.

Nodes with two coordinates make a 2D mesh (Dimension 2, for mmg2d). required_* (0-based indices) are written as RequiredVertices, RequiredEdges and RequiredTriangles: MMG keeps them unchanged. corners (vertices) and ridges (edges) mark sharp features. comments are written as # lines after the header.

morphogen.io.medit.write_sol(path, values, dimension: int = 3) → Path[source]

Scalar solution at the vertices (e.g. a level-set function, or the sizes of the elements) of a mesh of dimension 3 or 2.

morphogen.io.medit.read_sol(path) → ndarray[source]

The scalar solution at the vertices of a .sol file (as written by MMG).

morphogen.io.medit.read_mesh(path) → dict[str, ndarray][source]

Vertices (n, 3), vertex refs, and for each element block its 0-based connectivity and references (keys Tetrahedra, Tetrahedra_refs…); the entities that the file marks, as 0-based indices (Ridges and RequiredEdges among the edges, Corners and RequiredVertices among the vertices, RequiredTriangles).