DistMeshPy
DistMeshPy is a Python implementation of the DistMesh algorithm based on the original MATLAB implementation.
Features
- Generate 2D, 3D, and surface meshes with a simple interface.
- Flexible distance functions for custom geometries.
- Robust mesh size control through a size function.
- Backend utility compiled via C++ code.
Installation
pip install distmeshpy
Note: A working C++11 order higher compiler is required.
Usage
Here's a quick example of how to generate a 2D mesh:
from distmeshpy import distmesh2d
from distmeshpy.utils import dcircle, huniform
p, t = distmesh2d(
lambda p: dcircle(p, 0.0, 0.0, 1.0), # Distance function
huniform, # Uniform size function
0.2, # Initial edge size
((-1.1, 1.1), (-1.1, 1.1)), # Bounding box
)
and the mesh can be plotted via matplotlib:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.triplot(p[:, 0], p[:, 1], t)
ax.set_aspect("equal")
plt.show()
For more examples, see the examples directory.
Contributing
Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.
License
Following the original work, this project is licensed under the GNU General Public License. See the LICENSE file for details.
Acknowledgments
DistMeshPy is inspired by the original MATLAB DistMesh implementation by Per-Olof Persson and Gilbert Strang.
Metadata
Release files for distmeshpy 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| distmeshpy-1.1.4.tar.gz | 308.3 kB | Details |
Release files / distmeshpy-1.1.4.tar.gz
| Download URL | distmeshpy-1.1.4.tar.gz |
|---|---|
| Size | 308.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d6937d884b8dd89bef4546f9123592d779040deb87f2faa17abdb08bf7c5834
|
|
BLAKE2b-256 checksum How to use checksums |
3c85e4c5ebe9ecf87d03c5f9f4a558491b535d949aefde688d7ff185f0d010ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|