Skip to main content

tetgen

https://travis-ci.org/pyvista/tetgen.svg?branch=master https://img.shields.io/pypi/v/tetgen.svg?logo=python&logoColor=white

This Python module 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.

The last update to the original C++ software was on 19 January 2011, but the software remains relevant today. 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.

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

sphere = pv.Sphere()
tet = tetgen.TetGen(sphere)
tet.tetrahedralize(order=1, mindihedral=20, minratio=1.5)
grid = tet.grid
grid.plot()
https://github.com/pyvista/tetgen/raw/master/docs/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.set_background('w')
plotter.add_mesh(subgrid, 'lightgrey', lighting=True)
plotter.add_mesh(sphere, 'r', 'wireframe')
plotter.add_legend([[' Input Mesh ', 'r'],
                    [' Tesselated Mesh ', 'black']])
plotter.plot()
https://github.com/pyvista/tetgen/raw/master/docs/images/sphere_subgrid.png

Cell quality scalars can be obtained and plotted with:

cell_qual = subgrid.quality

# plot quality
subgrid.plot(scalars=cell_qual, stitle='quality', cmap='bwr', flip_scalars=True)
https://github.com/pyvista/tetgen/raw/master/docs/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.

Release files for tetgen 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tetgen 0.4.0
File Size Uploaded
tetgen-0.4.0.tar.gz 328.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for tetgen 0.4.0
File
tetgen-0.4.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
tetgen-0.4.0-cp37-cp37m-macosx_10_6_intel.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.6+ Intel (x86-64, i386) Details
tetgen-0.4.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
tetgen-0.4.0-cp36-cp36m-macosx_10_6_intel.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) Details
tetgen-0.4.0-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
tetgen-0.4.0-cp35-cp35m-macosx_10_6_intel.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) Details
tetgen-0.4.0-cp27-cp27m-macosx_10_6_intel.whl CPython 2.7 CPython 2.7 pymalloc macOS 10.6+ Intel (x86-64, i386) Details

Total release size: 4.3 MB

Release files / tetgen-0.4.0.tar.gz

Download URL tetgen-0.4.0.tar.gz
Size 328.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ec2200f3aede2d9089e0089751420dbb62c2b89ba131a7baae15499893b592b8
BLAKE2b-256 checksum
How to use checksums
5a20b422b1b568253392500b735586a0d1adb3e36aac9a186c6e6fdbcce8e407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.2

Release files / tetgen-0.4.0-cp37-cp37m-win_amd64.whl

Download URL tetgen-0.4.0-cp37-cp37m-win_amd64.whl
Size 295.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
3df262e8ed4a120912dbe0c784708ab5760c5e63a22fbe3934aa3b7b2ab4f61f
BLAKE2b-256 checksum
How to use checksums
d0920a11bad1b0208748d9b3a4b8318b0f0d83742abe36de9719cd0579855e5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.4

Release files / tetgen-0.4.0-cp37-cp37m-macosx_10_6_intel.whl

Download URL tetgen-0.4.0-cp37-cp37m-macosx_10_6_intel.whl
Size 763.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
3bbbd5f023c341128c9c4c4c63a3b122317bf08c57e37191eb98a0767bc76efd
BLAKE2b-256 checksum
How to use checksums
88f9152bb87bdfc6f96b7c603d7c4efde037e84988604f21a787a3afb7c08d87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.2

Release files / tetgen-0.4.0-cp36-cp36m-win_amd64.whl

Download URL tetgen-0.4.0-cp36-cp36m-win_amd64.whl
Size 295.7 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
e96549aa2e25998ca6a3aeed2c37be7f139091a6bb47f3bb50530db45f3d2a25
BLAKE2b-256 checksum
How to use checksums
323a75077f11282b33c8a55c6ce1d2c8d82d73ad6e4a0bde48b400eaa23587a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.4

Release files / tetgen-0.4.0-cp36-cp36m-macosx_10_6_intel.whl

Download URL tetgen-0.4.0-cp36-cp36m-macosx_10_6_intel.whl
Size 763.5 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
7d03059a677941fd150fcb8bdc9b3021e0e8315ef1c4b3719ae22c47bf0468ef
BLAKE2b-256 checksum
How to use checksums
734fe0edfd70b5aec72b7c9ef84506c5028d894676dccd9782701d30b0e85845
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.2

Release files / tetgen-0.4.0-cp35-cp35m-win_amd64.whl

Download URL tetgen-0.4.0-cp35-cp35m-win_amd64.whl
Size 293.5 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
6556e344dcea65d1b0e108fc8688d83a0f5842a2226e229b5052d1dbf41db3f9
BLAKE2b-256 checksum
How to use checksums
48e72732d5f42e6020ea3cdf2d17a291ec8052b3f8e0e6b4e16ee7c9fa73eb01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.4

Release files / tetgen-0.4.0-cp35-cp35m-macosx_10_6_intel.whl

Download URL tetgen-0.4.0-cp35-cp35m-macosx_10_6_intel.whl
Size 759.3 kB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
c5950d34e5a91914fe8d942ffe19d2f7f5de4cfcbdf5195f10bc860a21ed260d
BLAKE2b-256 checksum
How to use checksums
df8bcf5141c4518756c92f1bbcc9494df560d113fe5a83ff3efeb88fb23dcfc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.2

Release files / tetgen-0.4.0-cp27-cp27m-macosx_10_6_intel.whl

Download URL tetgen-0.4.0-cp27-cp27m-macosx_10_6_intel.whl
Size 769.4 kB
Tags CPython 2.7 CPython 2.7 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
d771c390fa33b8cb954614922374fd09ec590c40089e1f70615da38e9d7b8ab4
BLAKE2b-256 checksum
How to use checksums
414d94c95acd74992e450c6b916960b3deb28772e90e58648fbc2b14a7f5100e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.2

Release history Release notifications | RSS feed

0.8.3

16 release files

0.8.2

16 release files

0.8.1

21 release files

0.8.0

21 release files

0.7.0

13 release files

0.6.7

17 release files

0.6.5

17 release files

0.6.4

15 release files

0.6.3

20 release files

0.6.2

20 release files

0.6.0

13 release files

0.5.5

13 release files

0.5.4

13 release files

0.5.3

13 release files

0.5.2

13 release files

0.5.1

9 release files

0.4.4

8 release files

0.4.3

8 release files

0.4.2

13 release files

This release

0.4.0 This release

8 release files

0.3.3

13 release files

0.3.2

10 release files

0.3.1

13 release files

0.3.0

9 release files

0.2.2

9 release files

0.2.1

9 release files

0.2.0

6 release files

0.1.2

7 release files

0.1.1

7 release files

0.1.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page