The easiest way to call Netgen from Python
Project description
ngsimple
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.
Installation
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.
Example
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)
Changelog
0.2.0
- Update to a working container image
- Allow specifying
image
andtag
ingenerate
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.