Suppose you wanted to use Netgen in a Python script to generate tetrahedral meshes but did not want to spend time installing the entire Netgen/NGSolve package which ships with it's own Python interpreter. This is a simple wrapper for running Netgen mesh generator inside a container and functions for calling it transparently from any Python interpreter.
This is work-in-progress. Currently using the following container: https://hub.docker.com/r/ngsxfem/ngsolve. In future, plan is to use a dedicated more lightweight container.
Install with
pip install ngsimple
ngsimple requires Docker and docker-py for pulling container images and interacting with the mesh generator. The output mesh is read back to Python using meshio.
from ngsimple import generate
mesh = generate("""algebraic3d
solid main = sphere (0, 0, 0; 1);
tlo main;
point (0, 0, 0);
""", verbose=True)
from vedo import show
show(mesh)
- Update to a working container image
- Allow specifying
image
andtag
ingenerate