Skip to main content

The easiest way to call Netgen from Python

Project description

ngsimple

PyPI

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)

Netgen output mesh

Changelog

0.2.0

  • Update to a working container image
  • Allow specifying image and tag in generate

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ngsimple-0.2.0.tar.gz (13.0 kB view hashes)

Uploaded Source

Built Distribution

ngsimple-0.2.0-py3-none-any.whl (13.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page