Several mesh smoothing/optimization methods with one simple interface. optimesh
- is fast,
- preserves submeshes,
- only works for triangular meshes (for now), and
- supports all mesh formats that meshio can handle.
pip install optimesh
optimesh in.e out.vtk --method lloyd -n 50
The left hand-side graph shows the distribution of angles (the grid line is at the optimal 60 degrees). The right hand-side graph shows the distribution of simplex quality, where quality is twice the ratio of circumcircle and incircle radius.
All command-line options are viewed with
|classical Laplace||linear solve (
Classical Laplacian mesh smoothing means moving all (interior) points into the average of their neighbors until an equilibrium has been reached. The method preserves the mesh density (i.e., small simplices are not blown up as part of the smoothing).
Instead of a fixed-point iteration, one can do a few linear solves, interleaved with facet-flipping. This approach converges much faster.
CVT (centroidal Voronoi tesselation)
Centroidal Voronoi tessellation smoothing, realized by Lloyd's algorithm, i.e., points are iteratively moved into the centroid of their Voronoi cell. If the topological neighbors of any node are also the geometrically closest nodes, this is exactly Lloyd's algorithm. That is fulfilled in many practical cases, but the algorithm can break down if it is not.
CPT (centroidal patch tessalation)
|fixed-point iteration (
A smooting method suggested by Chen and Holst, mimicking CVT but much more easily implemented. The density-preserving variant leads to the exact same equation system as Laplace smoothing, so optimesh only contains the the uniform-density variant.
Implemented once classically as a fixed-point iteration, once as a quasi-Newton method. The latter typically leads to better results.
ODT (optimal Delaunay tesselation)
|fixed-point iteration (
||nonlinear optimization (
Optimal Delaunay Triangulation (ODT) as suggested by Chen and Holst. Typically superior to CPT, but also more expensive to compute.
Implemented once classically as a fixed-point iteration, once as a nonlinear optimization method. The latter typically leads to better results.
Access from Python
All optimesh functions can also be accessed from Python directly, for example:
import optimesh X, cells = optimesh.odt(X, cells, 1.0e-2, 100, verbosity=1)
optimesh is available from the Python Package Index, so simply do
pip install -U optimesh
to install or upgrade. Use
sudo -H to install as root or the
pip to install in
- Long Chen, Michael Holst, Efficient mesh optimization schemes based on Optimal Delaunay Triangulations, Comput. Methods Appl. Mech. Engrg. 200 (2011) 967–984.
To run the optimesh unit tests, check out this repository and type
To create a new release
publish to PyPi and tag on GitHub:
$ make publish
optimesh is published under the MIT license.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size optimesh-0.2.0-py2.py3-none-any.whl (15.1 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size optimesh-0.2.0.tar.gz (13.1 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for optimesh-0.2.0-py2.py3-none-any.whl