simdesign.utils.mesh

This module provides the classes used for defining structural meshes with varying geometries.

class simdesign.utils.mesh.Shape(tag)[source]

Bases: ABC

Abstract base class for geometric shapes.

Variables:

tag (Optional[int]) – Unique identifier for the shape.

Parameters:

tag (int | None)

tag: int | None
abstract property ndim: int

Return the number of dimensions of the shape.

Returns:

Number of dimensions.

Return type:

int

class simdesign.utils.mesh.Point(grid, coordinates, tag)[source]

Bases: Shape

Point in 3D space defined by grid IDs and coordinates.

Variables:
  • grid_ids (List[Union[int, float]]) – Point grid identifiers (x, y, z).

  • coordinates (List[float]) – Point coordinates (x, y, z).

Parameters:
  • grid (List[int | float])

  • coordinates (List[float])

  • tag (int | None)

grid_ids: List[int | float]
coordinates: List[float]
property ndim: int

Return the number of dimensions (always 0 for a point).

Returns:

Number of dimensions (always 0 for a point).

Return type:

int

class simdesign.utils.mesh.Line(points, tag=None)[source]

Bases: Shape

Straight line segment defined by two points.

Variables:

points (List[Point]) – List of points defining the line.

Parameters:
  • points (List[Point])

  • tag (int | None)

points: List[Point]
property direction_vector: ndarray

Return the direction vector of the line.

Returns:

Direction vector of the line.

Return type:

np.ndarray

property unit_vector: ndarray

Return the unit vector of the line.

Returns:

Unit vector of the line.

Return type:

np.ndarray

property ndim: int

Return the number of dimensions (always 1 for a line).

Returns:

Number of dimensions (always 1 for a line).

Return type:

int

property length: float64

Return the line length.

Returns:

Line length.

Return type:

np.float64

sort_points_xyz()[source]

Sort points in increasing (x, y, z) lexicographic order.

Return type:

None

class simdesign.utils.mesh.Polygon(points, lines=None, tag=None)[source]

Bases: Shape

Flat polygon defined by an ordered list of coplanar points.

Variables:
  • points (List[Point]) – List of points defining the polygon.

  • lines (List[Line], optional) – List of lines composing the polygon.

Parameters:
  • points (List[Point])

  • lines (List[Line] | None)

  • tag (int | None)

points: List[Point]
lines: List[Line] | None
property ndim: int

Return the number of dimensions (always 2 for a polygon).

Returns:

Number of dimensions (always 2 for a polygon).

Return type:

int

property vertices: ndarray

Return the vertices of the polygon as a 2D array.

Returns:

Vertices of the polygon.

Return type:

np.ndarray

property centroid: ndarray

Return the centroid coordinates of the polygon.

Returns:

Coordinates of the centroid of the polygon.

Return type:

np.ndarray

property normal_vector: ndarray

Return the normal vector of the polygon.

Returns:

Normal vector of the polygon.

Return type:

np.ndarray

property unit_normal_vector: ndarray

Return the unit normal vector of the polygon.

Returns:

Unit normal vector of the polygon.

Return type:

np.ndarray

property perimeter: float

Return the perimeter of the polygon.

Returns:

Polygon perimeter.

Return type:

float

property area: float

Return the area of the polygon.

Returns:

Polygon area.

Return type:

float

sort_points_xyz_ccw()[source]

Sort the polygon’s points counter-clockwise starting from the lowest (x, y, z) point.

Return type:

None

sort_lines()[source]

Sort Line objects to match the current ordered points in the polygon.

Return type:

None

create_lines_from_points()[source]

Create Line objects from the current ordered points in the polygon.

Return type:

None

class simdesign.utils.mesh.Quadrilateral(points, lines=None, tag=None)[source]

Bases: Polygon

Quadrilateral defined as a polygon with exactly four sides and four vertices.

Parameters:
  • points (List[Point])

  • lines (List[Line] | None)

  • tag (int | None)

class simdesign.utils.mesh.Parallelogram(points, lines=None, tag=None)[source]

Bases: Quadrilateral

Parallelogram defined as a quadrilateral with both pairs of opposite sides parallel.

Parameters:
  • points (List[Point])

  • lines (List[Line] | None)

  • tag (int | None)

class simdesign.utils.mesh.Rectangle(points, lines=None, tag=None)[source]

Bases: Parallelogram

Rectangled defined as a parallelogram whose four interior angles are all right angles.

Parameters:
  • points (List[Point])

  • lines (List[Line] | None)

  • tag (int | None)

class simdesign.utils.mesh.Square(points, lines=None, tag=None)[source]

Bases: Rectangle

Square defined as a rectangle whose four sides are all of equal length.

Parameters:
  • points (List[Point])

  • lines (List[Line] | None)

  • tag (int | None)

class simdesign.utils.mesh.Trapezoid(points, lines=None, tag=None)[source]

Bases: Quadrilateral

Trapezoid defined as a quadrilateral with at least one pair of parallel opposite sides.

Parameters:
  • points (List[Point])

  • lines (List[Line] | None)

  • tag (int | None)