upxo.meshing.gbconformant.pipeline.mesh_regions module

Where the grain boundary surface, the junction lines and the junction points of a mesh are, and how many layers of elements every element and surface face lies from each of them.

The mesh is made of linear tetrahedra ((T, 4), faces are triangles) or linear hexahedra ((T, 8), for example one per voxel, faces are quadrilaterals); the type is told by the shape of the connectivity array. Names below say tetrahedron and triangle; for a hexahedral mesh read hexahedron and quadrilateral.

A feature is one of three things a grain structure has:

  • gb_surface: the faces that separate two grains,

  • junction_lines: the mesh edges shared by three or more regions (grains, and the box exterior when asked),

  • junction_points: the nodes where junction lines end, branch or change the set of regions they separate (for a generic grain structure, the points where four grains meet).

The layer of an element is 1 when it touches the feature, 2 when it shares a node with a layer-1 element and is not itself in layer 1, 3 when it shares a node with a layer-2 element and is not in layers 1 or 2, and so on; 0 when it is farther than the asked-for order. What counts as touching is a choice (TOUCH_CHOICES): sharing a face (with the grain boundary surface) or an edge (with a junction line), or sharing any node. Junction points are always touched by a node. Triangles are only ever grown along the surface they belong to.

class upxo.meshing.gbconformant.pipeline.mesh_regions.MeshSurface(nodes: ndarray, grains: ndarray, tets: ndarray, between_grains: ndarray, nonmanifold: int = 0)[source]

Bases: object

The triangles that separate regions: faces between two grains and, when asked, faces on the box exterior.

nodes: ndarray

(F, 3) node indices of every triangle, ascending in each row; (F, 4) quadrilaterals in cyclic order.

grains: ndarray

(F, 2) the two grain labels of a grain boundary triangle (lower first); (0, grain) on the exterior.

tets: ndarray

(F, 2) the tetrahedra on either side; -1 where there is none.

between_grains: ndarray

(F,) True for a triangle that separates two grains.

nonmanifold: int = 0

Faces shared by more than two tetrahedra (a broken mesh; they are left out).

class upxo.meshing.gbconformant.pipeline.mesh_regions.RegionLayers(order: int, touch: str, include_rve_faces: bool, surface: MeshSurface, tet: dict = <factory>, triangle: dict = <factory>, edges: ndarray = <factory>, line_nodes: ndarray = <factory>, point_nodes: ndarray = <factory>, counts: dict = <factory>)[source]

Bases: object

The layer of every tetrahedron and surface triangle for each feature (0 = beyond the asked-for order).

order: int
touch: str
include_rve_faces: bool
surface: MeshSurface
tet: dict

(T,) int8}

Type:

{feature

triangle: dict

(F,) int8}

Type:

{feature

edges: ndarray

(E, 2) node pairs of the junction edges.

line_nodes: ndarray
point_nodes: ndarray
counts: dict
upxo.meshing.gbconformant.pipeline.mesh_regions.tet_faces(tetrahedra, n_nodes)[source]

Every distinct face of the mesh: (nodes (F,3), first tet, second tet or -1, number of tets on the face).

Hexahedra (T, 8) give (F, 4) quadrilaterals (see element_faces()).

upxo.meshing.gbconformant.pipeline.mesh_regions.mesh_surface(tetrahedra, grains, n_nodes, include_rve_faces=False) → MeshSurface[source]

The grain boundary triangles of a mesh, with the box exterior’s triangles when include_rve_faces.

upxo.meshing.gbconformant.pipeline.mesh_regions.feature_layers(points, tetrahedra, grains, *, order=1, touch='face or edge', include_rve_faces=False, features=('gb_surface', 'junction_lines', 'junction_points')) → RegionLayers[source]

Layer of every tetrahedron and surface triangle for each of features up to order layers away.

upxo.meshing.gbconformant.pipeline.mesh_regions.select_layers(layer, order, mode_only: bool)[source]

Elements in layers 1..order (or only in layer order when mode_only).