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.2.tar.gz (451.7 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.2-cp311-cp311-win_amd64.whl (319.2 kB view details)

Uploaded CPython 3.11Windows x86-64

tetgen-0.6.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

tetgen-0.6.2-cp311-cp311-macosx_10_9_x86_64.whl (455.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

tetgen-0.6.2-cp311-cp311-macosx_10_9_universal2.whl (843.4 kB view details)

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

tetgen-0.6.2-cp310-cp310-win_amd64.whl (319.6 kB view details)

Uploaded CPython 3.10Windows x86-64

tetgen-0.6.2-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.2-cp310-cp310-macosx_10_9_x86_64.whl (457.9 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

tetgen-0.6.2-cp310-cp310-macosx_10_9_universal2.whl (849.1 kB view details)

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

tetgen-0.6.2-cp39-cp39-win_amd64.whl (321.9 kB view details)

Uploaded CPython 3.9Windows x86-64

tetgen-0.6.2-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.2-cp39-cp39-macosx_10_9_x86_64.whl (456.9 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

tetgen-0.6.2-cp39-cp39-macosx_10_9_universal2.whl (846.8 kB view details)

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

tetgen-0.6.2-cp38-cp38-win_amd64.whl (322.0 kB view details)

Uploaded CPython 3.8Windows x86-64

tetgen-0.6.2-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.2-cp38-cp38-macosx_10_9_x86_64.whl (455.6 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

tetgen-0.6.2-cp38-cp38-macosx_10_9_universal2.whl (844.0 kB view details)

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

tetgen-0.6.2-cp37-cp37m-win_amd64.whl (320.7 kB view details)

Uploaded CPython 3.7mWindows x86-64

tetgen-0.6.2-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.2-cp37-cp37m-macosx_10_9_x86_64.whl (455.9 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tetgen-0.6.2.tar.gz
  • Upload date:
  • Size: 451.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tetgen-0.6.2.tar.gz
Algorithm Hash digest
SHA256 c25812c969875375cd1913dff1b0b593d5b5ad5627a67effc574896bb66e97fc
MD5 397662be9f2f7c9783ffb1e51f287be4
BLAKE2b-256 283f00bf3045d0e0d9b9a3a0fa16c58ec683c1a4ac8b4d7544ecaab5324db96d

See more details on using hashes here.

File details

Details for the file tetgen-0.6.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: tetgen-0.6.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 319.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tetgen-0.6.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eb985c32336e6e2638d2ed0772ca1aed0d7eaf2b5e634e3264c6b7c4f367bb5c
MD5 ddcfa675177487feb1aab44eec1b479e
BLAKE2b-256 a1ba6d0e6c60a20323e6d3e7ad4bff5445a3471babf3de68f02257e2b46ba628

See more details on using hashes here.

File details

Details for the file tetgen-0.6.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fbbdef84120c729a1f3ed0d0cbb1a967adc8f0996371a087ebf3f8c0e7ff7d0
MD5 1ed4d3953a9868105865b77f23b674ff
BLAKE2b-256 212ddefa904442b73436162f8d743cddf67932c04b929e228ccc0e083599d7a3

See more details on using hashes here.

File details

Details for the file tetgen-0.6.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.6.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 46567b2d7125280a2656d5c3af25d97a3ac92f07323b63e682be3aadd81310a5
MD5 1b043683c037373ec958dba61c1c096e
BLAKE2b-256 685c77a6f33e57d221a5a3695a9a70347876412818f529914b45bd3e1a8f8fc8

See more details on using hashes here.

File details

Details for the file tetgen-0.6.2-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tetgen-0.6.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 076f89c4b7e9f4e80eda63f92f82188a879e8b9080bd57cf722ac5b2d9adae6a
MD5 662476806154d95c958e576cff8406c5
BLAKE2b-256 7bcebcb67d8c6f27edaa34b91acaf1738afdb063c9870e08cea568930ba2639d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.6.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 319.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tetgen-0.6.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c04a2ffb583983082db08d90a6ea12b3b8e3f73f0fa304b60b7f1af398b1e655
MD5 f1598db46be44de95ec715c0458d4f86
BLAKE2b-256 3f4f880f37f4040a4e9e9b5954f191c472c5af3768507dfa118307293e651be9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f30fd398e1ab5774baa4d0c4e51327ac28eb6fe2e247f1d01b6ead7eb946a57e
MD5 dcd3dece2e0da0949699b08874cd497f
BLAKE2b-256 25c9f8e21314d1094eddad45e91ef0b17f523c3aba2f921a2dea23d5dd2451ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7540c6aeb291ba7b45d3f8ff8773ee1181056052d50e8f98bc1c7a9fec96a993
MD5 40879fd4f4fadd8a46d461e73b237c95
BLAKE2b-256 af094b2ab4b6fbff599a30d01d79d8645667208eac07d6e12551b6e070adee93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f37d801330536b2ef079a01640b850479bf2c11a3c582a73243ce21d0728887c
MD5 35d940b0b9768d1bd3ea2182007eff0b
BLAKE2b-256 82a77ad3c74f2fcc253cdd56c907fe32d0761528e860ef78f91cb22bdee14d2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.6.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 321.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tetgen-0.6.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c2b8dd9607a549c0538459685cb1da82e64fa45061f078373899fddd1c0e8a46
MD5 81e0a782f904f0c9bf5d64eea7c7c925
BLAKE2b-256 85ce2f8821977f5bb1b5c816a929f7bed54c442317374a081d5af10b2319826f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88e5798d3c7f86735305617b908b78f27759c28a086241cce0b739e8a04593a1
MD5 3ea0f6fcbc5e65f57a76915eff356bca
BLAKE2b-256 996499628581f41ec582524dceb5ba51092b5da187a9fcf4958be9057f803361

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c0b4fac2e095109940c8f348268b7e300063d9d1e53f5b7a91f0a77b20b05625
MD5 4a8159b05028710cb4c4181a2eb84645
BLAKE2b-256 988f3a545092384b8920598bc4297bcf4519d69958941cc8715e488962d66e6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f09d6e04ea5d718ef328fecda4fb846c041c017f53a638c39a1a3d95c8660ed1
MD5 f7402e939acdd1a7b8429fff3e2cad30
BLAKE2b-256 080adb6e44203a1db6e2d64e924710954673833841e5e2af4af8b3b4af082366

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.6.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 322.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tetgen-0.6.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 24940c0ee1628af298ef3d4ae47fcfdffabebb69384da002afa14de5f76051ab
MD5 4249e1ec2a726becb10703ce716a0db5
BLAKE2b-256 4eef64d865760096ce670c7bb2e8f74b0f3dbc3e0f14f894bda09a23d459d371

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21a3cfd9b2cb06731383ddb7595ffb92df102ba02e927ce3db322fb426d3d7c1
MD5 6b5f7890674a8e0cbf4b7c818e1e4690
BLAKE2b-256 c5e18be93bde4dd5eeff14a09cd7b9edd84c43422a6dc6c327ee910a6b330fc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 16111e9c558f9e818c292bfa5a6f5ccaf4d628ba3e261c151113d1497b4f4e8a
MD5 94512a8ad900b9a80b0bb3033feb9e7e
BLAKE2b-256 a3ed6d13a0decfc96380dae723e5968fdb1b285f900a3992d6ad7aba83e6846a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a4d0d4fe4ec77b48e95f93d9761e1804651bc3d0d458f286d3c25eca2d97801c
MD5 75dc8896580acad210208692ed2f5db6
BLAKE2b-256 94108306ea8f9c58573d6d1caccd3bd457bf70e1ebf499e300ddc98cdc483169

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tetgen-0.6.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a0ee9bf9c797ae1b03d7ec48b3ec766f473e39e04c15fb8b76260407c0f9f53d
MD5 24aba63dd26af003df7e9322b5535a41
BLAKE2b-256 e4fd1709a0d176ebb654744efb4ed121d6f75295c2d99d305d5246fc26d93608

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f92416410437e1b682f9402682976ae6e579937c6afe8b192a4dc6ee1780c6d
MD5 6e0c9bb85932264b66202e922be9c5de
BLAKE2b-256 2204dc5d10a0acd92b339a9d7c68e2a223d59eca5041cdd1cd119f6fa51efc5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tetgen-0.6.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9a0812c4455249806f720647bb83c028a0bafe6b041eab6cf26933905a3a1b4d
MD5 f663c8905b1990bc231d2a79ab79a952
BLAKE2b-256 5d9e2ae262667cea89db2c2e5abcf01828183430e383100e18a428776a7ca959

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