pointmesh

0-D container (PointMesh) – the ladder’s bottom rung.

Deliberately thin: a point cloud is not something this toolkit meshes, only something the rungs above index into. There are no factories, no shape model and no lift / lower here; what it carries is the coordinates and the tags on them, which LineMesh reads as its own point tags.

class nekmeshpy.pointmesh.PointMesh[source]

Bases: object

The ladder’s bottom rung: an (N,3) point array and the tags on those points.

A point has no interior, no orientation and no connectivity – its “incidence” is the identity, so element i is point i. That leaves only the two fields every rung has: the coordinates, and an Tags naming whichever of them are named.

It exists so the rule that holds between every other pair of rungs – a mesh’s side tags are its rung-below’s element tags – holds at the bottom too, rather than the line rung carrying a table of its own shape. Almost nothing constructs one directly: LineMesh promotes a bare (N,3) array into an untagged one, which is what a factory building fresh geometry wants. Reach for it when you need the tags to survive – a transform rebuilding a mesh around moved coordinates, or a point group named before there is a line to hang it on. There are deliberately no factories and no shape model here: a point cloud is not something this toolkit meshes, only something the rungs above index into.

__init__(points, element_tags=None)[source]

Construct from points (N,3) (must be 3-D) and an optional Tags over point ids.

Parameters:
  • points (NDArray[float64])

  • element_tags (Tags | None)

Return type:

None

property n_points: int

Number of points.

property n_elements: int

Number of elements – the same number, since a point is an element.

property element_group_tags: list[str]

Sorted unique non-empty per-point tags present on the mesh.

nekmeshpy.pointmesh.mirror(mesh, normal, point=array([0., 0., 0.]))[source]

The points reflected through the plane with normal through point.

A point has no orientation to re-wind, so unlike the rungs above this is only the coordinate map – the same exception linemesh.morph.mirror documents for the line rung, one rung further down.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.retag_element(mesh, tags)[source]

The same mesh with its element_tags changed, by what tags is: a mapping renames the existing names (a tag the map does not name is left alone, the map applies simultaneously, a key naming nothing raises, a rename to NO_TAG untags); a string names every element; a Tags or per-element sequence replaces the table. Geometry and the side tags are untouched.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.rotate(mesh, angle, axis=array([0., 0., 1.]), center=array([0., 0., 0.]))[source]

The points rotated by angle radians about the line through center along axis (right-handed, axis need not be normalized).

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.scale(mesh, factor, center=array([0., 0., 0.]))[source]

The points scaled about center by factor – a scalar (uniform) or a (3,) per-axis vector. Every factor must be positive.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.transform(mesh, matrix, offset=array([0., 0., 0.]))[source]

The points mapped through the affine p @ matrix.T + offset.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.transform_fn(mesh, fn)[source]

The points mapped through an arbitrary fn – transform for a warp that is not affine. fn is called once with the whole (N, 3) point array and must return (N, 3). Tags ride through verbatim.

A point has no orientation and no signed measure, so – like mirror() at this rung – this is only the coordinate map: an fn that folds space is not caught here, though quadmesh.morph.transform_fn and the hex rung above do warn once there is a Jacobian to check.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.translate(mesh, vector)[source]

The points shifted rigidly by vector (3,). Bit-exact: the offset is added without a matmul, so translating by 0 returns the identical coordinates.

Parameters:
Return type:

PointMesh

pointmesh.pointmesh

0-D mesh container: the (N,3) point array the whole ladder is built on.

class nekmeshpy.pointmesh.pointmesh.PointMesh[source]

Bases: object

The ladder’s bottom rung: an (N,3) point array and the tags on those points.

A point has no interior, no orientation and no connectivity – its “incidence” is the identity, so element i is point i. That leaves only the two fields every rung has: the coordinates, and an Tags naming whichever of them are named.

It exists so the rule that holds between every other pair of rungs – a mesh’s side tags are its rung-below’s element tags – holds at the bottom too, rather than the line rung carrying a table of its own shape. Almost nothing constructs one directly: LineMesh promotes a bare (N,3) array into an untagged one, which is what a factory building fresh geometry wants. Reach for it when you need the tags to survive – a transform rebuilding a mesh around moved coordinates, or a point group named before there is a line to hang it on. There are deliberately no factories and no shape model here: a point cloud is not something this toolkit meshes, only something the rungs above index into.

__init__(points, element_tags=None)[source]

Construct from points (N,3) (must be 3-D) and an optional Tags over point ids.

Parameters:
  • points (NDArray[float64])

  • element_tags (Tags | None)

Return type:

None

property n_points: int

Number of points.

property n_elements: int

Number of elements – the same number, since a point is an element.

property element_group_tags: list[str]

Sorted unique non-empty per-point tags present on the mesh.

Operations

Fixed-arity, rung-preserving PointMesh operations (delta 0).

A point has no interior and no connectivity to re-wind, so this is the affine family alone – linemesh.morph and the rungs above build their own transform / translate / … on top of these for the shared points, then map their private interior nodes through the same affine pair.

nekmeshpy.pointmesh.morph.mirror(mesh, normal, point=array([0., 0., 0.]))[source]

The points reflected through the plane with normal through point.

A point has no orientation to re-wind, so unlike the rungs above this is only the coordinate map – the same exception linemesh.morph.mirror documents for the line rung, one rung further down.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.morph.rotate(mesh, angle, axis=array([0., 0., 1.]), center=array([0., 0., 0.]))[source]

The points rotated by angle radians about the line through center along axis (right-handed, axis need not be normalized).

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.morph.scale(mesh, factor, center=array([0., 0., 0.]))[source]

The points scaled about center by factor – a scalar (uniform) or a (3,) per-axis vector. Every factor must be positive.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.morph.transform(mesh, matrix, offset=array([0., 0., 0.]))[source]

The points mapped through the affine p @ matrix.T + offset.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.morph.transform_fn(mesh, fn)[source]

The points mapped through an arbitrary fn – transform for a warp that is not affine. fn is called once with the whole (N, 3) point array and must return (N, 3). Tags ride through verbatim.

A point has no orientation and no signed measure, so – like mirror() at this rung – this is only the coordinate map: an fn that folds space is not caught here, though quadmesh.morph.transform_fn and the hex rung above do warn once there is a Jacobian to check.

Parameters:
Return type:

PointMesh

nekmeshpy.pointmesh.morph.translate(mesh, vector)[source]

The points shifted rigidly by vector (3,). Bit-exact: the offset is added without a matmul, so translating by 0 returns the identical coordinates.

Parameters:
Return type:

PointMesh

Vocabulary-only PointMesh operations: rename the tags, touch nothing else.

nekmeshpy.pointmesh.tag.retag_element(mesh, tags)[source]

The same mesh with its element_tags changed, by what tags is: a mapping renames the existing names (a tag the map does not name is left alone, the map applies simultaneously, a key naming nothing raises, a rename to NO_TAG untags); a string names every element; a Tags or per-element sequence replaces the table. Geometry and the side tags are untouched.

Parameters:
Return type:

PointMesh