Skip to main content

Python interface to tetgen

Project description

https://img.shields.io/pypi/v/tetgen.svg?logo=python&logoColor=white

This Python library is an interface to Hang Si’s TetGen C++ software. This module combines speed of C++ with the portability and ease of installation of Python along with integration to PyVista for 3D visualization and analysis. See the TetGen GitHub page for more details on the original creator.

This Python library uses the C++ source from TetGen (version 1.6.0, released on August 31, 2020) hosted at libigl/tetgen.

Brief description from Weierstrass Institute Software:

TetGen is a program to generate tetrahedral meshes of any 3D polyhedral domains. TetGen generates exact constrained Delaunay tetrahedralization, boundary conforming Delaunay meshes, and Voronoi partitions.

TetGen provides various features to generate good quality and adaptive tetrahedral meshes suitable for numerical methods, such as finite element or finite volume methods. For more information of TetGen, please take a look at a list of features.

License (AGPL)

The original TetGen software is under AGPL (see LICENSE) and thus this Python wrapper package must adopt that license as well.

Please look into the terms of this license before creating a dynamic link to this software in your downstream package and understand commercial use limitations. We are not lawyers and cannot provide any guidance on the terms of this license.

Please see https://www.gnu.org/licenses/agpl-3.0.en.html

Installation

From PyPI

pip install tetgen

From source at GitHub

git clone https://github.com/pyvista/tetgen
cd tetgen
pip install .

Basic Example

The features of the C++ TetGen software implemented in this module are primarily focused on the tetrahedralization a manifold triangular surface. This basic example demonstrates how to tetrahedralize a manifold surface and plot part of the mesh.

import pyvista as pv
import tetgen
import numpy as np
pv.set_plot_theme('document')

sphere = pv.Sphere()
tet = tetgen.TetGen(sphere)
tet.tetrahedralize(order=1, mindihedral=20, minratio=1.5)
grid = tet.grid
grid.plot(show_edges=True)
https://github.com/pyvista/tetgen/raw/master/doc/images/sphere.png

Tetrahedralized Sphere

Extract a portion of the sphere’s tetrahedral mesh below the xy plane and plot the mesh quality.

# get cell centroids
cells = grid.cells.reshape(-1, 5)[:, 1:]
cell_center = grid.points[cells].mean(1)

# extract cells below the 0 xy plane
mask = cell_center[:, 2] < 0
cell_ind = mask.nonzero()[0]
subgrid = grid.extract_cells(cell_ind)

# advanced plotting
plotter = pv.Plotter()
plotter.add_mesh(subgrid, 'lightgrey', lighting=True, show_edges=True)
plotter.add_mesh(sphere, 'r', 'wireframe')
plotter.add_legend([[' Input Mesh ', 'r'],
                    [' Tessellated Mesh ', 'black']])
plotter.show()
https://github.com/pyvista/tetgen/raw/master/doc/images/sphere_subgrid.png

Here is the cell quality as computed according to the minimum scaled jacobian.

Compute cell quality

>>> cell_qual = subgrid.compute_cell_quality()['CellQuality']

Plot quality

>>> subgrid.plot(scalars=cell_qual, stitle='Quality', cmap='bwr', clim=[0, 1],
...              flip_scalars=True, show_edges=True)
https://github.com/pyvista/tetgen/raw/master/doc/images/sphere_qual.png

Acknowledgments

Software was originally created by Hang Si based on work published in TetGen, a Delaunay-Based Quality Tetrahedral Mesh Generator.

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

tetgen-0.6.1.tar.gz (459.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tetgen-0.6.1-cp310-cp310-win_amd64.whl (319.1 kB view details)

Uploaded CPython 3.10Windows x86-64

tetgen-0.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

tetgen-0.6.1-cp310-cp310-macosx_10_9_x86_64.whl (458.1 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

tetgen-0.6.1-cp310-cp310-macosx_10_9_universal2.whl (843.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

tetgen-0.6.1-cp39-cp39-win_amd64.whl (321.1 kB view details)

Uploaded CPython 3.9Windows x86-64

tetgen-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

tetgen-0.6.1-cp39-cp39-macosx_10_9_x86_64.whl (457.3 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

tetgen-0.6.1-cp39-cp39-macosx_10_9_universal2.whl (841.2 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

tetgen-0.6.1-cp38-cp38-win_amd64.whl (321.3 kB view details)

Uploaded CPython 3.8Windows x86-64

tetgen-0.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

tetgen-0.6.1-cp38-cp38-macosx_10_9_x86_64.whl (455.8 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

tetgen-0.6.1-cp38-cp38-macosx_10_9_universal2.whl (837.9 kB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)

tetgen-0.6.1-cp37-cp37m-win_amd64.whl (320.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

tetgen-0.6.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

tetgen-0.6.1-cp37-cp37m-macosx_10_9_x86_64.whl (455.6 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

tetgen-0.6.1-cp36-cp36m-win_amd64.whl (319.8 kB view details)

Uploaded CPython 3.6mWindows x86-64

tetgen-0.6.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

tetgen-0.6.1-cp36-cp36m-macosx_10_9_x86_64.whl (455.6 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file tetgen-0.6.1.tar.gz.

File metadata

  • Download URL: tetgen-0.6.1.tar.gz
  • Upload date:
  • Size: 459.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tetgen-0.6.1.tar.gz
Algorithm Hash digest
SHA256 aa05ec493844d47d45322aae36e11a6961c2e1e4cefdd085118d1592b2d5e487
MD5 cc82b94fd8c352b82c6aa994dd0cac49
BLAKE2b-256 e9facabf91cf692df092abb5820a5bc2fb8c5575570d15a9867c3c2ddd399fba

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: tetgen-0.6.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 319.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tetgen-0.6.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 534d1b6194af74670f50d39259677edf26835fee2765437291e180ca4deb486a
MD5 ef0c794ec71481ab51c0dbe19a90b19b
BLAKE2b-256 df42822b741b2a5381af76e932199a05d057ee6628cab3d1edaacfee4e646ad4

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4333da22c6a8cb21d25c6ad39046cd6d7853c3e8a0040600f81c73d745f8732f
MD5 51373796a212eea9b18c03d99efd9938
BLAKE2b-256 1f0660b0450d370c58112c15138c0275f8e4f6191aa5b855925a655396410272

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f15c6748c8eda604310310677e0d24fe1a054e26425a22a707a4478f8a7dcd84
MD5 c01dd263a7b7758d177cf9d27022e86e
BLAKE2b-256 33826f12c0b1bbc9d9e5e7bfc34af9804b6b17cf48f45a737e1106d3e4d1c2c7

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8d3a5cc1a286a463b949a160f529d79db94d10f2a9f26dc1ddbf221cb2f76eb9
MD5 f0453dcc4de573c92278546f0161cec0
BLAKE2b-256 45803c86d160a4b02b6bdaf3665024886066109a76592342d6e5bec855d9fd9c

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: tetgen-0.6.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 321.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tetgen-0.6.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cfbc22bcd6412049a7b0acbe3d4fcff25a087eda1a7b9032fb2588c0b0f20619
MD5 ee98341ba480a39e25f90c93c1fa4b24
BLAKE2b-256 09d5e09ea66b2edb71b3002c4dc437fc576da56bf05a5cbe9d320c6f700c079a

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88e8cda8054d7bd0f13d99385ae4173a917dcbb01610da4a337f0098943e2b56
MD5 d5d41f5c949dd152357b4e5ebffe1982
BLAKE2b-256 c9c216addb2bec86fdc08c0b2ec0bcb9682ff0eb41f8e89f853c8c81f83d72a8

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 15134cd7906e68c9bbceb42fdf606ace1cbb36d61d888b1645b9b0336be9bdf2
MD5 e569b6be985c3888c4e51d76e5f04c84
BLAKE2b-256 3cab6263b2724b43d959fc99364f8d4c65709ba113e1b8fcb7af44bc0b3ef260

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d17bf1f916743d61ef49795288c2a391ba11e853f61780ad230d77ce7db8a35a
MD5 3766b1a982ff627f5b8f98b727c7ea17
BLAKE2b-256 f19b22cbfa58f0c5b6111bf2c3d8be3cc3260b31eb81dfd3b499a55ce1374f6a

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: tetgen-0.6.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 321.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tetgen-0.6.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 67721c437e23180ff32f91d15fbe6d7171c7a60bd39a5be424df603960e5ca4d
MD5 158e9400d109c6fdbca52667e2fff585
BLAKE2b-256 e3bab0cb9d7dd40f6471efe19a1667a357383c9d8dec14ce14f26971fcd8667d

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0062e475a7d2ac35eb4b52028f48820171f9ade4994e072b7e1825778131ca4e
MD5 202ce3aac095e879756720267808614c
BLAKE2b-256 bddaab4764c9d6c914b6540cdf652b3e23a71468c4dd31be3e5669155452a27f

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 68ebc2698486955c552ab04021b4f74ed7800a03c16528e339735717170153a3
MD5 cf1a769e71821beb348e4103849a721a
BLAKE2b-256 0313275a98477b69051a29b8d2bf6228aae978d499369557e10e1cbe4f9f631d

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp38-cp38-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 efe13b09c1a65a74cde03a1a9cd212dc04e7a4329887b1658064636314760ab7
MD5 16e21a8fc6484f9b2948bd8bbfeaa943
BLAKE2b-256 bdb295c157b35f1921ca7ecd500764aeb31a09e4228e4d5e690beda2b6f283bf

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: tetgen-0.6.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 320.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tetgen-0.6.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 79f669550a3dec7ece4d840b9236a6a11adf72b0900af4e053ad9c84ff539346
MD5 85a4717e1cbf89fc9dca26ef8bf4c5b2
BLAKE2b-256 3ffb4cea14398b598e74c2ddee059ae27ff72145b9c3434e870fe40b54c1c2ea

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04d25436ab8ef586d107bf4fbf12583ba700c421643b8ea22b82de02397a317a
MD5 ebac041216c1540633ea30a8dea730d8
BLAKE2b-256 a735fb35cc51fca9c2f345544e61f25e848002d48ca64035b0223b646068cdc8

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ed1eabd953680e9c1ab056544aa0d1a8ae9f5c214415c1220d5026cbcfff4b58
MD5 0833034e815379758b12f34a3d92d2c1
BLAKE2b-256 da0026589e2db270ceb314bb71310d534f748c9b94b0f0061a09a581d0c0b9a9

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: tetgen-0.6.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 319.8 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tetgen-0.6.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 2105d35ee001ce44abdb905a13f2bbd15d9d5ea4cf3d944bb6328d272a7cdac6
MD5 5040e00747aaa814e02b8d1acfa23f17
BLAKE2b-256 44a27a158007c6ab09ad567778e75ec0d1f7ffc9a46824caea9513389d47ecb9

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25c3ba051e3d9f508625863a1e43d0649bcde5463352f3473528eec3af24e0c4
MD5 51459c74021347578edcdb8294ab7b51
BLAKE2b-256 46232e205ee6b11d06110e2e724348c4c1cd667e4a9ff25807384270696ab886

See more details on using hashes here.

File details

Details for the file tetgen-0.6.1-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a99c5f9a9a9a24d934d9096d641f0cb0b28c3f6eccab908206a9ca1f18eaed25
MD5 9531a85107c0f875e006a5ebd0d40506
BLAKE2b-256 4c459a96673035404ef188b491a7b5eaa7e84ac35619ce775a416c3cfc811bc5

See more details on using hashes here.

Supported by

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