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 vtki
import tetgen
import numpy as np

sphere = vtki.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 = vtki.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.2.2.tar.gz (275.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.2.2-cp37-cp37m-win_amd64.whl (284.7 kB view details)

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.7m

tetgen-0.2.2-cp36-cp36m-win_amd64.whl (284.7 kB view details)

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.6m

tetgen-0.2.2-cp35-cp35m-win_amd64.whl (282.7 kB view details)

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.5m

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7m

File details

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

File metadata

  • Download URL: tetgen-0.2.2.tar.gz
  • Upload date:
  • Size: 275.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.3

File hashes

Hashes for tetgen-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f1a78c9ea2600ff7f8c727cd6a7878c3c712863649fb9f157428198fd9685b62
MD5 b360d2b2783531552b4f812e2ced097e
BLAKE2b-256 d471b3e86a7798fd168086840a2d4d2ea8a0392bd7e10724c274e933bfd56fc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 284.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for tetgen-0.2.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 6388e21391f1642b5a4b9a76dd4ee443b0f47398760bcc2b2b1e605b32e1096c
MD5 60b6d557458a8bf0b736ee83e8fd773d
BLAKE2b-256 916f321d83a25544a4715710bc39886b050fb6556c6e4e2388adcb342fce762c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.2-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.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.3

File hashes

Hashes for tetgen-0.2.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1045a78930fd7a8fa40e21b06975dc5a7a4e0d04d168a3f7974d22d47853bfd6
MD5 07adb6f9efb3dd649a2abe6a50d38271
BLAKE2b-256 15f5eb0ef70d81653cd1c64618c0cc687f8fa6b1321ca37fba07695803176c04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 284.7 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for tetgen-0.2.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c6d3a2d6075bb4881773c85244738d7db47086f2ebc75351b35ad741777e2d8c
MD5 43b92a38760af83398947ca33c0ce284
BLAKE2b-256 7b748f7bbc1c226822fe9e255be97e34abb384fbfdb556257fb4ee72e0343930

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.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.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.3

File hashes

Hashes for tetgen-0.2.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ae989f2d0a87baeb2d30791d1862c7a2ee42f1282a68a220c8e7b306559c7e96
MD5 3012199089566a6e53ae9791df86733f
BLAKE2b-256 75286307f844fd788c209f8087b3ed2e9a615e677bb88b0e16616c9d0acfcd4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 282.7 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for tetgen-0.2.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 8a8ef97a6ab29a9f7be5f7753175c44b4eaf95484f43ea901bad70bd6908602c
MD5 15f4f30f5be9f9f528d4f36c52648cb2
BLAKE2b-256 8ef689cecad101cf7b9440bffdca49a507c61461488020dee97be0dc7608005e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.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.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.3

File hashes

Hashes for tetgen-0.2.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c5cecac6e4ffdb914e9b9f515658ae27c32ed4846165b0bc9f2d39174646fa6d
MD5 9713ee0e505135dce15b222dd9f9643a
BLAKE2b-256 9f032345ec6e3cc555866f80acddf247a09a890cace4f09cabae47d44f29a63d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.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.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.3

File hashes

Hashes for tetgen-0.2.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f4a948256b493353f41ed2de3d5deea8c731c3124f91733e6ee1adf708989cb4
MD5 cb8733eef061d03ad8fc43a0b20b07b1
BLAKE2b-256 06c749f8d19288a7bfcd092af5d93575866829510744c854304ee077059f1cc4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tetgen-0.2.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.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.3

File hashes

Hashes for tetgen-0.2.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 54c1ff230041f3b186ea5e8aec4520f6ffd3f7f2c2f2f95f58c24abab517671d
MD5 80b3f1d7fc06ea8e702b7e4437eb03fc
BLAKE2b-256 774bb0278603a9323255b0e9cf0996a6358772414cd1460bf46c2ad211b7eab2

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