Recipes#

sigmaepsilon.mesh.recipes.circular_disk(nangles: int, nradii: int, rmin: float, rmax: float, frame: CartesianFrame | None = None) TriMesh[source]#

Returns the triangulation of a circular disk.

Parameters:
  • nangles (int) – Number of subdivisions in radial direction.

  • nradii (int) – Number of subdivisions in circumferential direction.

  • rmin (float) – Inner radius. Can be zero.

  • rmax (float) – Outer radius.

Return type:

TriMesh

Examples

>>> from sigmaepsilon.mesh.recipes import circular_disk
>>> mesh = circular_disk(120, 60, 5, 25)
sigmaepsilon.mesh.recipes.circular_helix(a: Number | None = None, b: Number | None = None, *, slope: Number | None = None, pitch: Number | None = None) Callable[[Number], Tuple[float, float, float]][source]#

Returns the function \(f(t) = [a \cdot cos(t), a \cdot sin(t), b \cdot t]\), which describes a circular helix of radius a and slope a/b (or pitch 2πb).

sigmaepsilon.mesh.recipes.cylinder(shape, size: tuple | float | int | None = None, *, regular: bool = True, voxelize: bool = False, celltype: PolyCellProtocol | None = None, frame: CartesianFrame | None = None, **kwargs) PolyData[source]#

Returns the coordinates and the topology of cylinder as numpy arrays.

Parameters:
  • shape (tuple or int, Optional) – A 2-tuple or a float, describing the shape of the cylinder.

  • size (Union[tuple, float, int], Optional) –

    Parameter controlling the density of the mesh. Default is None.

    If voxelize is False, size must be a tuple of three integers, describing the number of angular, radial, and vertical divions in this order.

    If voxelize is True and size is a float, the parameter controls the size of the individual voxels.

    If voxelize is True and size is an int, the parameter controls the size of the individual voxels according to \(edge \, length = (r_{ext} - r_{int})/shape\).

  • regular (bool, Optional) – If True and voxelize is False, the mesh us a result of an extrusion applied to a trianglarion, and as a consequence it returns a more or less regular mesh. Otherwise the cylinder is created from a surface trangulation using the tetgen package. Default is True.

  • voxelize (bool, Optional) – If True, the cylinder gets voxelized to a collection of H8 cells. In this case the size of a voxel can be controlled by specifying a flaot or an integer as the second parameter size. Default is False.

  • celltype – Specifies the celltype to be used.

Return type:

PolyData

sigmaepsilon.mesh.recipes.perforated_cube(lx: float, ly: float, lz: float, radius: float, *, nangles: int | None = None, lmax: float | None = None, order: int = 1, prismatic: bool = True) PolyData[source]#

Returns a cube of side lengths ‘lx’, ‘ly’ and ‘lz’, with a circular hole along the ‘z’ axis.

Return type:

PolyData

sigmaepsilon.mesh.recipes.ribbed_plate(lx: float, ly: float, t: float, *, wx: float | None = None, wy: float | None = None, hx: float | None = None, hy: float | None = None, ex: float | None = None, ey: float | None = None, lmax: float | None = None, order: int = 1, tetrahedralize: bool = False) PolyData[source]#

Creates a ribbed plate.

Parameters:
  • lx (float) – The length of the plate along the X axis.

  • ly (float) – The length of the plate along the Y axis.

  • t (float) – The thickness of a plate.

  • wx (float, Optional) – The width of the ribs running in X direction. Must be defined alongside hx. Default is None.

  • hx (float, Optional) – The height of the ribs running in X direction. Must be defined alongside wx. Default is None.

  • ex (float, Optional) – The eccentricity of the ribs running in X direction.

  • wy (float, Optional) – The width of the ribs running in Y direction. Must be defined alongside hy. Default is None.

  • hy (float, Optional) – The height of the ribs running in Y direction. Must be defined alongside wy. Default is None.

  • ey (float, Optional) – The eccentricity of the ribs running in Y direction.

  • lmax (float, Optional) – Maximum edge length of the cells in the resulting mesh. Default is None.

  • order (int, Optional) – Determines the order of the cells used. Allowed values are 1 and 2. If order is 1, either H8 hexahedra or TET4 tetrahedra are returned. If order is 2, H27 hexahedra or TET10 tetrahedra are returned.

  • tetrahedralize (bool, Optional) – If True, a mesh of 4-noded tetrahedra is returned. Default is False.

Example

>>> from sigmaepsilon.mesh.recipes import ribbed_plate
>>> mesh = ribbed_plate(lx=5.0, ly=5.0, t=1.0,
>>>                     wx=1.0, hx=2.0, ex=0.05,
>>>                     wy=1.0, hy=2.0, ey=-0.05)
Return type:

PolyData

sigmaepsilon.mesh.recipes.sphere(radius: float, n_azimuthal_divisions: int, n_polar_divisions: int | None = None) PolyData[source]#

Generate a triangulated mesh representing a sphere.

Parameters:
  • radius (float) – Radius of the sphere.

  • n_azimuthal_divisions (int) – Number of divisions for azimuthal angle (longitude).

  • n_polar_divisions (int, Optional) – Number of divisions for polar angle (latitude). If not provided it is equal to ‘n_azimuthal_divisions’.

Return type:

PolyData

Notes

This function generates a triangulated mesh of a sphere using separate divisions for azimuthal and polar angles. The resulting mesh represents a sphere with given radius and resolution.

Examples

>>> from sigmaepsilon.mesh import PolyData
>>> from sigmaepsilon.mesh.recipes import sphere
>>> mesh: PolyData = sphere(1.0, 20, 10)