Skip to main content

Python interface to tetgen

Project description

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
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/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.add_mesh(subgrid, 'lightgrey', lighting=True, show_edges=True)
plotter.add_mesh(sphere, 'r', 'wireframe')
plotter.add_legend([[' Input Mesh ', 'r'],
                    [' Tesselated Mesh ', 'black']])
plotter.show()
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', clim=[0,1],
             flip_scalars=True, show_edges=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.

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.3.4.tar.gz (326.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.3.4-cp37-cp37m-win_amd64.whl (296.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

tetgen-0.3.4-cp37-cp37m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7m

tetgen-0.3.4-cp37-cp37m-macosx_10_6_intel.whl (764.4 kB view details)

Uploaded CPython 3.7mmacOS 10.6+ Intel (x86-64, i386)

tetgen-0.3.4-cp36-cp36m-win_amd64.whl (296.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

tetgen-0.3.4-cp36-cp36m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6m

tetgen-0.3.4-cp36-cp36m-macosx_10_6_intel.whl (764.0 kB view details)

Uploaded CPython 3.6mmacOS 10.6+ Intel (x86-64, i386)

tetgen-0.3.4-cp35-cp35m-win_amd64.whl (294.0 kB view details)

Uploaded CPython 3.5mWindows x86-64

tetgen-0.3.4-cp35-cp35m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.5m

tetgen-0.3.4-cp35-cp35m-macosx_10_6_intel.whl (759.8 kB view details)

Uploaded CPython 3.5mmacOS 10.6+ Intel (x86-64, i386)

tetgen-0.3.4-cp27-cp27mu-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 2.7mu

tetgen-0.3.4-cp27-cp27m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 2.7m

tetgen-0.3.4-cp27-cp27m-macosx_10_6_intel.whl (769.9 kB view details)

Uploaded CPython 2.7mmacOS 10.6+ Intel (x86-64, i386)

File details

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

File metadata

  • Download URL: tetgen-0.3.4.tar.gz
  • Upload date:
  • Size: 326.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for tetgen-0.3.4.tar.gz
Algorithm Hash digest
SHA256 1a1e8fc80eaaa4bdc0b8470ed2689fe6956ade14a67e503edb3f4cb76f392863
MD5 b080053d9a3b35e9375cc15541a54552
BLAKE2b-256 3ff5946552b1b80bf93a94965fd2fab891420c5c0c525f815d65c50390a79979

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 296.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for tetgen-0.3.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8e4ad1c40a7443a5f6b1b4461765851ffcc0eeb08e792d4ef7ba245e44c61d53
MD5 e6628c35bc4527f505d339379613339c
BLAKE2b-256 3891c72afaa8239238a16fea045de6755d65857000cf9ee7a7abdc84417c3e74

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for tetgen-0.3.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 37921fdeede1ee0b4a4800fe45a23b1df6542d4b860c806c64297ef0f98322c5
MD5 e881c42fec9d68512f3719b464925cdf
BLAKE2b-256 6603f79f50ffaa39a91797be14c0f7a37e24ce74a8b4e9da95da65a898fa6aaf

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp37-cp37m-macosx_10_6_intel.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 764.4 kB
  • Tags: CPython 3.7m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.4-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 f5519dd83711e6509f1cafa2e917b9344167cd4b9eb88aa011008fc6f0f544d7
MD5 7a15d9bf60106c6dc97eac3bee617e20
BLAKE2b-256 80a32de5c09210dc44e5cd43d5549130dd460ce7aec40e4f116be7fb86788838

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.4-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 296.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for tetgen-0.3.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 138a62d27830474b604ff42baa5f34651daf0f17c87d691d0e132e1eb8e8902d
MD5 892deef4d3d675190c2ae3fd9ac1d6f7
BLAKE2b-256 308860dc11425f120b9b2e02f02a5ab18c65e4232d70f4c470f325388a992bad

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for tetgen-0.3.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 436291a64542dad545c04804d29660c6dc3d32b3e8871c396ce6b426b0f7292b
MD5 a1f599250069629f0e7f957e14fa762a
BLAKE2b-256 8a5d2b88cfd52c2ffe8711f695ff60466b401e046ecd4c17b33f6d1a9ef224e8

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 764.0 kB
  • Tags: CPython 3.6m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.4-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 21e4f145f54dabecf2a2c7abbf63066e7e8772db425f8568e25ed75ddb99ebe8
MD5 79209946d2456cbcf03287a631810415
BLAKE2b-256 5b7c519d6cb919de32a3ec1d46a713288d992098f54542bec13b245ec59f093d

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 294.0 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.4

File hashes

Hashes for tetgen-0.3.4-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 f2517bdf625fc831ee2b0ddba41bc1d129eaf4431c85b2eb25ea93e1ac7276a2
MD5 f6f1fe6690d0db55a958764aed29254e
BLAKE2b-256 a8d4861fe09662c7cea61dc011fe5ed80fb6cdf2ad14b30dfbdf8e8d844de06b

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for tetgen-0.3.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d234a9ab39ad2af56ef80cbfd14fe76a239785e41cde098bd6d854f1a87962ce
MD5 d907f06bc85c5feb22a5ab7eca377a30
BLAKE2b-256 2f3261defbc06448b2bc31358c9f3f7dc5d3ddb81b8c928f016518ff28d64d2f

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 759.8 kB
  • Tags: CPython 3.5m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.4-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 f833799d71ab7c9df4150046551e40f663bf2a31ecb8d22817658ae670b5dd77
MD5 30eacbca5a8e4cb7ac63a2e70315b5e5
BLAKE2b-256 c173eb54d8db071ac39b2dd71990c2201065cd4ef69102f882d22ec0a2cb6cd0

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for tetgen-0.3.4-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0aa147768b9b41819d0c0ad38a23406511a72d4e1aa12f2315d597376098aa4b
MD5 78f6a303d7a84367abddddc57c841987
BLAKE2b-256 034c44410d74dcd5ce4b2555709446bbfbd17d91e2115046d050622a0a56982c

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for tetgen-0.3.4-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9236ea2dd02f6d257997bab42493675becaf1ff25b8ea44bb4dd765faf271426
MD5 e9f2d19491ad9c335e101917eaafe85d
BLAKE2b-256 30816392aef2db7ef2c6027445cbd78e1a5dc26f359e163428c82748750af4b5

See more details on using hashes here.

File details

Details for the file tetgen-0.3.4-cp27-cp27m-macosx_10_6_intel.whl.

File metadata

  • Download URL: tetgen-0.3.4-cp27-cp27m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 769.9 kB
  • Tags: CPython 2.7m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.4-cp27-cp27m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 a31304ebab17387a069a1d99ccdf6492d5d625fef06bdaac90e1a6cbb7718197
MD5 a2ce43fd8d0d08a7ca763c253631c008
BLAKE2b-256 150e4d81a0d93ffd55dc267855d1fa2cd9086bbceb9eaea1103e369875e693f0

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