Skip to main content

Python interface to tetgen

Project description

https://travis-ci.org/akaszynski/tetgen.svg?branch=master

This python module is a python interface to Hang Si’s tetgen C++ software. This module combines speed of C++ with the portability and ease of installation of Python along integration with the visualization toolkit VTK . See the tetgen GitHub page for more details on the 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 --user

From source at GitHub

git clone https://github.com/akaszynski/tetgen
cd tetgen
pip install . --user

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/akaszynski/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/akaszynski/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/akaszynski/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.2.tar.gz (327.9 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.2-cp37-cp37m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m

tetgen-0.3.2-cp37-cp37m-macosx_10_6_intel.whl (764.3 kB view details)

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

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

Uploaded CPython 3.6m

tetgen-0.3.2-cp36-cp36m-macosx_10_6_intel.whl (763.9 kB view details)

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

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

Uploaded CPython 3.5m

tetgen-0.3.2-cp35-cp35m-macosx_10_6_intel.whl (759.7 kB view details)

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

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7m

tetgen-0.3.2-cp27-cp27m-macosx_10_6_intel.whl (769.7 kB view details)

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

File details

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

File metadata

  • Download URL: tetgen-0.3.2.tar.gz
  • Upload date:
  • Size: 327.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for tetgen-0.3.2.tar.gz
Algorithm Hash digest
SHA256 d5d22a7332d809ba34ae9c1f4af42da792de279eedc5098bb7bfe9b3c291b7d3
MD5 e08ab3b80dbb9cb0dda37b260acedcf0
BLAKE2b-256 a53b3782112ab0ccb28a7ac47574cc7c5b1f56eb03015a0547d627abae3fa7be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 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/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for tetgen-0.3.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fb0fd492a37d4015da6cec270b39da0fe48dd5cb6f58cf7c5fcae11584bf2741
MD5 46d1b635092c517b2472965bdccf1bf6
BLAKE2b-256 710f6994b613a789649269b0d4591c148696a2ab71da456c1131ef1dd525c9fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 764.3 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.1 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.2-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 481fcd10ec60ae9412fae41de16f5a56563c9e1dc78e4e35669f13dfd77a1563
MD5 ce8e00c762236d8b8f319531ac00efa6
BLAKE2b-256 ed191863ba1a82a2a6f5a9f144fcc57acf21df87c1b005c3ea4fc2f57b4acf1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-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/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for tetgen-0.3.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 26650d1105ee2079705a418247e3e0679f813c97f2c7b01225074e6c4c5933a0
MD5 5ab4b6767cb42efab2d88382c1d62435
BLAKE2b-256 fef4b4dcf72b90dcc461f6bf0a2a73694f3e701f7ea23cdcaf444f9a3ed68234

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 763.9 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.1 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 e284915050d0cc9fb31111a636020df0cf8df93c0249fc0963ec0f62f07df4d1
MD5 49f636b64fb80cd718addc1381a66b04
BLAKE2b-256 eddcc9a65c7891569fdb5db2df587f659c499a35b1fe6decae0fc77947034271

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-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/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for tetgen-0.3.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ac9322d8bfc0ced6ff449db930ecf49154d2e4e5c77f376a7c680a440af44051
MD5 564c2a30b7f2f6cde54a57da916ebc45
BLAKE2b-256 5cf38129dc752b5b981e6beed994790a8458ce2f05e0f039625081bb6185e01b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 759.7 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.1 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 1b127d50bf7561dea207850d183d2d8167569c915f453081090dc6d7339080f5
MD5 4b27fe6d04eaf5fb7ec03103afa7c7d4
BLAKE2b-256 87e03c08e3b785e55da48572af3c06eddf019cf3a4577f4004def5a370e47cf6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-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/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for tetgen-0.3.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3337c2a2b9f4538f34e73968fc2d09cd7e79f9f29d115004eedd3da79d740923
MD5 332e08aa77181a95ba2126108a1e6f75
BLAKE2b-256 3ecce8195a7665e8b64c97076d1a253963c024a241b73c251fcb6f103cef87c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-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/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for tetgen-0.3.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c7ace49009a92c09edbe920fd420d282b8ff3cb59bfc290791ec83391291d3f6
MD5 237e2cdd75ce3ffb4d03a8228870b12d
BLAKE2b-256 400b9a2d2856084104873385033e98c27edf46b1be7f03656f415b14ce5d726e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.3.2-cp27-cp27m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 769.7 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.1 CPython/3.7.2

File hashes

Hashes for tetgen-0.3.2-cp27-cp27m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 4f766db1426c202de5c833c1809595d6f92db6d03a653ec65e360040ed6d0631
MD5 37cbb17d73e72b80d1ee441989aeef97
BLAKE2b-256 fb721ce398929b4e8083da3f1e43d5ac0a0d664bd086219b78316dfcde1560e5

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