Skip to main content

rapidmesh

Conforming tetrahedral and surface meshes for electromagnetic FEM and MoM solvers. The mesher is written in Rust; this package is a thin layer over its API, so everything here is also available to Rust programs.

  • Primitives, CAD files and exact CSG: boxes, cylinders, spheres, cones, tori, prisms, sweeps, helices, lofts, fillets and chamfers, sheets, STEP files and STL/OBJ imports, united and cut by an exact arrangement. Material interfaces stay exactly conforming.
  • Bottom-up meshing: edges, then each face on its analytic surface, then each region on its own, with hierarchical sizing per region, geometric face and geometric edge. Thin layers take flat tets instead of being refined to their thickness.
  • Solver output: topology with orientation signs, the geometric entity of every face and edge, named sets, periodic point pairs, gmsh MSH 4.1 and VTU.

Install

pip install rapidmesh

Usage

import rapidmesh as rm

g = rm.Geometry(maxh=0.5)
air = g.box(10, 10, 13.6)
sub = g.box(10, 10, 1.6, maxh=0.8)
g.label(air, "air")
g.label(sub, "substrate")
g.xy_plate(6, 6, position=(2, 2, 1.6), tag=1)   # a PEC patch
g.label(1, "patch")

# a periodic unit cell, and a named port face
g.periodic(g.surf(normal=(-1, 0, 0)), g.surf(normal=(1, 0, 0)))
g.periodic(g.surf(normal=(0, -1, 0)), g.surf(normal=(0, 1, 0)))
g.surf(near=(5, 5, 13.6)).name = "port"

mesh = g.mesh()
print(mesh)                 # Mesh(... tets, ... points, min dihedral ... deg, ... ms)

mesh.points                 # (n_points, 3) float64
mesh.tets                   # (n_tets, 4)   uint64
mesh.tet_regions            # region tag per tet
mesh.topology               # edges, faces, incidence with signs, classification
mesh.sets()                 # {"cells": ..., "faces": ..., "edges": ...} by name
mesh.periodic_points        # (n, 2) point on a master face and its image
mesh.write_msh("cell.msh")  # physical groups from the labels and names

CAD files

g = rm.Geometry(maxh=2.0)
bodies = g.import_step("assembly.step")   # one solid per body of the file
mesh = g.mesh()                           # faces meshed on their true surfaces

STEP files (AP203 and AP214) bring planes, cylinders, cones, spheres, tori and B-spline surfaces; coordinates stay in the file's unit.

Sizing

g.maxh = 0.5                               # global target size
g.region(2).maxh = 0.2                     # one region
g.surf(normal=(0, 0, 1)).maxh = 0.1        # the faces facing +z
g.edge(near=(0, 0, 1)).maxh = 0.05         # the edge nearest a point
g.tol = 1e-3                               # chord tolerance of curved entities
g.refine_near_points([(1, 1, 1)], 0.02)    # point size sources
mesh = g.mesh(target_elements=50_000)      # an element budget

Surface meshes and planar meshes

g.surface_mesh() meshes only the surfaces (interfaces, outer boundary, sheets) and gives RWG edges and the same sets and file output. rm.mesh_2d and rm.mesh_layers mesh tagged 2D polygons for planar MoM.

What happened, how long, and where the quality is worst

print(mesh.report())     # stage timings, quality with location, warnings
mesh.timings             # seconds per stage
mesh.metrics             # predicate counts, point and tet counts
mesh.quality             # min_dihedral_deg, worst_location, worst_region, regions
mesh.diagnostics         # histogram, watertightness, fidelity, located defects
mesh.log                 # [{level, stage, message, at}, ...]

Set RAPIDMESH_LOG=1 to stream the log to stderr while meshing.

License

Dual licensed: GNU Affero General Public License v3.0, or a commercial license for use in proprietary products and services without the AGPL obligations (contact milanrother.com/consulting). Versions up to 0.6.0 were published under the MIT license.

Metadata

Release files for rapidmesh 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rapidmesh 1.0.0
File Size Uploaded
rapidmesh-1.0.0.tar.gz 1.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for rapidmesh 1.0.0
File
rapidmesh-1.0.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
rapidmesh-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
rapidmesh-1.0.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
rapidmesh-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 13.0 MB

Release files / rapidmesh-1.0.0.tar.gz

Download URL rapidmesh-1.0.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
45a65bf30dd70d636a6297ba0549bedf30495eff601bfdf28e64e8014fbe6e3f
BLAKE2b-256 checksum
How to use checksums
a4dbd34c309eccda876226b55387f80cf36c96adfff9c3ca82788d8479dac2bd
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 29, 2026.

Transparency log

Release files / rapidmesh-1.0.0-cp310-abi3-win_amd64.whl

Download URL rapidmesh-1.0.0-cp310-abi3-win_amd64.whl
Size 3.0 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
08369e253a157add079ff9a38933a62db2f5ff2410303819a61554c398b0a449
BLAKE2b-256 checksum
How to use checksums
9ebcd6addbaaacaf4334706f39d63baca35c663e5a56c8ea688cde2c48433096
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 29, 2026.

Transparency log

Release files / rapidmesh-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rapidmesh-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
05779aaf452d8886932f99009b6eba291250daa3655e11538be060b582bb224e
BLAKE2b-256 checksum
How to use checksums
f044890ec16f6158485c19f5611647cd3723928dc904397876580ed9a0f122a7
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 29, 2026.

Transparency log

Release files / rapidmesh-1.0.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL rapidmesh-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
Size 2.8 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
83db3a3afa08ae76990f03273e27071d15696fa54f01b9f06300a42a7bed1a6a
BLAKE2b-256 checksum
How to use checksums
0a845f18d7a488d5e31df54a96cd8de76542365b9a1647ee125e5f2622b59498
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 29, 2026.

Transparency log

Release files / rapidmesh-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL rapidmesh-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 3.0 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3685516017576496b65695e6447e7cf62d357585bb7ce3af63f7095eff5ec2cb
BLAKE2b-256 checksum
How to use checksums
13a4f05c1b6f3a254498ee91d57e976720670e64393ff45e1a2720eca89275ad
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 29, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.0

5 release files

This release

1.0.0 This release

5 release files

0.6.0

5 release files

0.4.0

5 release files

0.3.1

5 release files

0.3.0

5 release files

0.2.1

5 release files

0.2.0

5 release files

0.1.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page