Skip to content

Commit

Permalink
Mesh-Templates: Add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
adtzlr committed Aug 31, 2023
1 parent 6ddb32b commit 4fdbfdc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/felupe/mesh/_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@


class Line(Mesh):
"A line shaped 1d-mesh with lines between ``a`` and ``b`` with ``n`` points."

def __init__(self, a=0, b=1, n=2):
self.a = a
self.b = b
Expand All @@ -35,6 +37,9 @@ def __init__(self, a=0, b=1, n=2):


class Rectangle(Mesh):
"""A rectangular 2d-mesh with quads between ``a`` and ``b`` with ``n``
points per axis."""

def __init__(self, a=(0, 0), b=(1, 1), n=(2, 2)):
self.a = a
self.b = b
Expand All @@ -46,6 +51,9 @@ def __init__(self, a=(0, 0), b=(1, 1), n=(2, 2)):


class Cube(Mesh):
"""A cube shaped 3d-mesh with hexahedrons between ``a`` and ``b`` with ``n``
points per axis."""

def __init__(self, a=(0, 0, 0), b=(1, 1, 1), n=(2, 2, 2)):
self.a = a
self.b = b
Expand All @@ -57,6 +65,9 @@ def __init__(self, a=(0, 0, 0), b=(1, 1, 1), n=(2, 2, 2)):


class Grid(Mesh):
"""A grid shaped 3d-mesh with hexahedrons. Basically a wrapper for
:func:`numpy.meshgrid` with default ``indexing="ij"``."""

def __init__(self, *xi, indexing="ij", **kwargs):
shape = np.array([len(x) for x in xi])
n = shape if len(shape) > 1 else shape[0]
Expand All @@ -76,6 +87,9 @@ def __init__(self, *xi, indexing="ij", **kwargs):


class RectangleArbitraryOrderQuad(Mesh):
"""A rectangular 2d-mesh with arbitrary order quads between ``a`` and ``b`` with
``n`` points per axis."""

def __init__(self, a=(0, 0), b=(1, 1), order=2):
yv, xv = np.meshgrid(
np.linspace(a[1], b[1], order + 1),
Expand Down Expand Up @@ -128,6 +142,9 @@ def search_edge(p, a, x):


class CubeArbitraryOrderHexahedron(Mesh):
"""A cube shaped 3d-mesh with arbitrary order hexahedrons between ``a`` and ``b``
with ``n`` points per axis."""

def __init__(self, a=(0, 0, 0), b=(1, 1, 1), order=2):
zv, yv, xv = np.meshgrid(
np.linspace(a[2], b[2], order + 1),
Expand Down Expand Up @@ -218,6 +235,9 @@ def search_face(p, a, x, vertices, edges):


class Circle(Mesh):
"""A circular shaped 2d-mesh with quads and ``n`` points in the rectangular
center. 90-degree ``sections`` are placed at given angles in degree."""

def __init__(
self,
radius=1,
Expand Down

0 comments on commit 4fdbfdc

Please sign in to comment.