Skip to main content

Python interface to tetgen

Project description

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.

This python module uses the C++ source from TetGen (version 1.5.1, released on August 18, 2018) hosted at ufz/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.

Installation

From PyPI

pip install tetgen

From source at GitHub

git clone https://github.com/pyvista/tetgen
cd tetgen
pip install -r requirements_build.txt
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'],
                    [' Tesselated 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 scaled jacobian. This example uses the ansys.mapdl.reader library to compute the quality.

Compute cell quality

>>> from ansys.mapdl.reader import quality
>>> cell_qual = quality(subgrid)

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.5.4.tar.gz (297.3 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.5.4-cp39-cp39-win_amd64.whl (301.2 kB view details)

Uploaded CPython 3.9Windows x86-64

tetgen-0.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

tetgen-0.5.4-cp39-cp39-macosx_10_14_x86_64.whl (422.6 kB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

tetgen-0.5.4-cp38-cp38-win_amd64.whl (301.3 kB view details)

Uploaded CPython 3.8Windows x86-64

tetgen-0.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

tetgen-0.5.4-cp38-cp38-macosx_10_14_x86_64.whl (420.4 kB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

tetgen-0.5.4-cp37-cp37m-win_amd64.whl (299.5 kB view details)

Uploaded CPython 3.7mWindows x86-64

tetgen-0.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

tetgen-0.5.4-cp37-cp37m-macosx_10_14_x86_64.whl (420.4 kB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

tetgen-0.5.4-cp36-cp36m-win_amd64.whl (299.6 kB view details)

Uploaded CPython 3.6mWindows x86-64

tetgen-0.5.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64manylinux: glibc 2.5+ x86-64

tetgen-0.5.4-cp36-cp36m-macosx_10_14_x86_64.whl (420.2 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: tetgen-0.5.4.tar.gz
  • Upload date:
  • Size: 297.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for tetgen-0.5.4.tar.gz
Algorithm Hash digest
SHA256 ceb2ad8f087377f8d96c03b881dc6c26e05164737169229ec8190518e49fac5f
MD5 50d8743e335785c7910ee21223fe52a3
BLAKE2b-256 cc41cec149549061f0fd99ac2c2e7bb69acf3bdf7f65dfde7226cc04c9dacbaf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.5.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 301.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for tetgen-0.5.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9f0eae127909989c2b33f71d155e75d4defed7384d9069e1c9a6c7fc4cb5ad1a
MD5 9b551423c762dc141d00751d9a5794b5
BLAKE2b-256 68d6e7dac1caa013a9e4d985c4477aee61f3cb2b90f60378ad99825a53247916

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 4248d41cb716b805043942487a6b68a08c75a382502c03d31f7d3ccda911c7d4
MD5 4dfd308ecc14fdf073bb419f3e9db2e7
BLAKE2b-256 73d0b93104ca8014169b2cb1a92897979e6dca0ef91d4e7f7750a7eb76bc20ed

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: tetgen-0.5.4-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 422.6 kB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for tetgen-0.5.4-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 5bdb6f14f3f367fbd7696823373c987666e9a377c52bbf82e1737ed0341dadbd
MD5 08d57c9a5e54ace692654f54a7c94f82
BLAKE2b-256 7996ca773954220cc83067d0cbdef77cb5d0164c6506d6079af118cda735bd71

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.5.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 301.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for tetgen-0.5.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 6219a29ba7af6ecab3f0043156269c1a571c37883a1b4ec854d15e56df4f64ef
MD5 1be34763d54c27dbea20193f9ba9f2fb
BLAKE2b-256 bf9a293a35e12c823d162fc3e35fe2c3c44b2cd09dea0ae717baa1864904bc0d

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 952116b8a890eab284dd5f2c52fe11469b2ee8531dd1798e10c5f56c762483c2
MD5 ccd5e8073f8dfd37e7bdefac7cc3f7e5
BLAKE2b-256 07909b70c3acf7a486fbf2a5eab6f592695ab0589d14280275937c253542fb2b

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: tetgen-0.5.4-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 420.4 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11

File hashes

Hashes for tetgen-0.5.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 11ee7af7d5e6ff6d9546779c992bde772e2bbaddfeb4ad80e458daecdd3697fb
MD5 301752a640240eccef6a7d45226f50c9
BLAKE2b-256 a2ebd8ac692439265d5f0f836f72c60de68383179cb9469b7d868a63076fab5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.5.4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 299.5 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9

File hashes

Hashes for tetgen-0.5.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f11d8acc9311fafee98381a8be59712271233d8a7b9bfcbff3cc0b31a66293be
MD5 4672b471d08f799922558e3484a73065
BLAKE2b-256 35d916cb5d4eeccfab52ada11f1117f2bd52272025c1262fd5ba1b167f3bd84f

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5bb1b2ee29a0903e81899949b08ac3a85a3c037569b5471e288448dc44232e43
MD5 d9d089953f2641a26ecd16c4db034150
BLAKE2b-256 4508a3830cfb0ee1fbeafe37477719ceaaee942251268eefd65ef618a61e63b2

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: tetgen-0.5.4-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 420.4 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.11

File hashes

Hashes for tetgen-0.5.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ad6c213d7d9a1c0464b93e7135cf42dd38c67a73c85c19373cae3110c86e43dc
MD5 57dc394678c3b69ef70f4f9e63a33402
BLAKE2b-256 e400937b53b757c333d1087d054e0fbba7ff8f96fce10246e7c377e6b40a662c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.5.4-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 299.6 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.8

File hashes

Hashes for tetgen-0.5.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 054a2dd42aba6630b862c79e4bf02fd235296e311a998333cad4ca9590e7b2ad
MD5 cd5734ee4215bfc993a36707511e558f
BLAKE2b-256 26fc507b0fa755a1aef29fba52b75695cdeac5537a8127c8ccb06d200b50bc3e

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for tetgen-0.5.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d0bd8529a2a4818dc0f0a9acd78218659837c7c800af82d350244bbfb77133f0
MD5 7cd7500ebd58232d8cf93f4a93f2d4a7
BLAKE2b-256 447d954942d9c3c9fc2a6ffa23fc666041873f653f1ab4565b7adbfb94f9f56e

See more details on using hashes here.

File details

Details for the file tetgen-0.5.4-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: tetgen-0.5.4-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 420.2 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.14

File hashes

Hashes for tetgen-0.5.4-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4b955b484b2298371813db4eca9e62da0ac4b3504dcebc1e7a668c575567a87d
MD5 bc08eaafb0628630de6df3bb2fea9e01
BLAKE2b-256 325dec205c34f240c610a1548ef560908dd3bc342005258690bb210ef92ec738

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