When generating meshes for FEM/FVM computations, sometimes your geometry is so simple that you don't need a complex mesh generator (like pygmsh, MeshPy, mshr, pygalmesh, dmsh), but something simple and fast that makes use of the structure of the domain. Enter meshzoo.
Installation
Install meshzoo from PyPI with
pip install meshzoo
on your machine and you're good to go.
Examples
All generators return the points as a (num_points, dim) float64 array and the
cells as a (num_cells, nodes_per_cell) int64 array.
Triangle
import meshzoo
bary, cells = meshzoo.triangle(8)
# corners = np.array(
# [
# [0.0, -0.5 * numpy.sqrt(3.0), +0.5 * numpy.sqrt(3.0)],
# [1.0, -0.5, -0.5],
# ]
# )
# points = np.dot(corners, bary).T
# Process the mesh, e.g., write it to a file using meshio
# meshio.write_points_cells("triangle.vtk", points, {"triangle": cells})
Rectangle
import meshzoo
import numpy as np
points, cells = meshzoo.rectangle_tri(
np.linspace(0.0, 1.0, 11),
np.linspace(0.0, 1.0, 11),
variant="zigzag", # or "up", "down", "center"
)
points, cells = meshzoo.rectangle_quad(
np.linspace(0.0, 1.0, 11),
np.linspace(0.0, 1.0, 11),
cell_type="quad4", # or "quad8", "quad9"
)
Regular polygon
meshzoo.ngon(4, 8) |
meshzoo.ngon(6, 8) |
meshzoo.ngon(9, 8) |
import meshzoo
points, cells = meshzoo.ngon(5, 11)
Disk
meshzoo.disk(4, 8) |
meshzoo.disk(6, 8) |
meshzoo.disk(9, 8) |
The disk meshes are inflations of regular polygons.
import meshzoo
points, cells = meshzoo.disk(6, 11)
points, cells = meshzoo.disk_quad(10, cell_type="quad4") # or "quad8", "quad9"
Annulus
import meshzoo
import numpy as np
points, cells = meshzoo.annulus_tri(
np.linspace(0.5, 1.0, 6), # radii of the circles of points
40, # points per circle
variant="zigzag", # or "up", "down"
)
points, cells = meshzoo.annulus_quad(
np.linspace(0.5, 1.0, 6), 40, cell_type="quad4" # or "quad8", "quad9"
)
L-shape
The domain [-1, 1]^2 without the quadrant (0, 1]^2, with the re-entrant
corner at the origin.
import meshzoo
points, cells = meshzoo.lshape_tri(10, variant="zigzag") # or "up", "down", "center"
points, cells = meshzoo.lshape_quad(10, cell_type="quad4") # or "quad8", "quad9"
Möbius strip
import meshzoo
points, cells = meshzoo.moebius(num_twists=1, nl=60, nw=11)
Sphere (surface)
import meshzoo
points, cells = meshzoo.uv_sphere(num_points_per_circle=20, num_circles=10, radius=1.0)
points, tri, quad = meshzoo.geo_sphere(
num_points_per_circle=20, num_circles=10, radius=1.0
)
Spheres can also be generated by refining the faces of platonic solids and then "inflating" them. meshzoo implements a few of them. The sphere generated from the icosahedron has the highest-quality (most equilateral) triangles.
All cells are oriented such that their normals point outwards.
meshzoo.tetra_sphere(10) |
meshzoo.octa_sphere(10) |
meshzoo.icosa_sphere(10) |
Ball (solid)
import meshzoo
points, cells = meshzoo.ball_tetra(10)
points, cells = meshzoo.ball_hexa(10)
Tube
import meshzoo
points, cells = meshzoo.tube(length=1.0, radius=1.0, n=30)
Torus
import meshzoo
points, cells = meshzoo.torus(
num_points_major=60, num_points_minor=20, major_radius=1.0, minor_radius=0.3
)
Cube
import meshzoo
import numpy as np
points, cells = meshzoo.cube_tetra(
np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11)
)
points, cells = meshzoo.cube_hexa(
np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11), np.linspace(0.0, 1.0, 11)
)
Extrusion
Any planar mesh can be extruded along the z-axis: triangles become wedges or tetrahedra, quadrilaterals become hexahedra. This gives, e.g., cylinders and pipes.
import meshzoo
import numpy as np
z = np.linspace(0.0, 2.0, 11)
points, tri = meshzoo.disk(6, 10)
points, wedges = meshzoo.extrude(points, tri, z) # cylinder
points, tets = meshzoo.extrude(points, tri, z, cell_type="tetra")
points, quads = meshzoo.annulus_quad(np.linspace(0.5, 1.0, 6), 40)
points, hexa = meshzoo.extrude(points, quads, z) # pipe
Metadata
Release files for meshzoo 0.13.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| meshzoo-0.13.1-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for meshzoo-0.13.1-cp310-abi3-win_amd64.whl |
| meshzoo-0.13.1-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for meshzoo-0.13.1-cp310-abi3-manylinux_2_28_aarch64.whl |
| meshzoo-0.13.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for meshzoo-0.13.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| meshzoo-0.13.1-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for meshzoo-0.13.1-cp310-abi3-macosx_11_0_arm64.whl |
| meshzoo-0.13.1-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for meshzoo-0.13.1-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 1.8 MB
Release files / meshzoo-0.13.1-cp310-abi3-win_amd64.whl
| Download URL | meshzoo-0.13.1-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 261.1 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8be20865219880f9d541acb7cf8bb6429752790c23c355e1c1aa34a9264f97fa
|
|
BLAKE2b-256 checksum How to use checksums |
aa68bc44bb12d6f7b3023a9bb187bf18e6de167cd63eae89fce3df72db7b43d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / meshzoo-0.13.1-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | meshzoo-0.13.1-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 400.5 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
dd1cfe6bca5942aa3ca55ce3a1957738fbb8137f332f4c45a5e68f407eab5785
|
|
BLAKE2b-256 checksum How to use checksums |
de519530d61d1f356c5609b47bb22880456c4b71c54b8733a5f045583fef754b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / meshzoo-0.13.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | meshzoo-0.13.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 418.9 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
58abee95ba7b78c636bca77fadea9c1925d14ed2b23f82461bf8742de9061bf0
|
|
BLAKE2b-256 checksum How to use checksums |
207142517f9aefda38f6b51ca393167dcfe30205c034e1d26ef9e2ee5e121ee8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / meshzoo-0.13.1-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | meshzoo-0.13.1-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 365.2 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b2cf951db740bc384b6675e6ce86e670f4d84b267819b2a3511bd0575137e328
|
|
BLAKE2b-256 checksum How to use checksums |
2b0543c91891ad13538246d5db8c8e67644bea5838654cc1ab149f95f86b1f3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / meshzoo-0.13.1-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | meshzoo-0.13.1-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 371.2 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
7cc537b4d2e560688cd94336b28bb2bad35b5b183acbd6cb008d61159e397599
|
|
BLAKE2b-256 checksum How to use checksums |
e8acabe16bed63e2169486f4b7bb1a2044a3366e7dcc2f3dd171b0182944198a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logSecurity for meshzoo 0.13.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for meshzoo-0.13.1-cp310-abi3-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.