Polynomial And NURBS Toolkit
Project description
PaNTr
Polynomial and NURBS Toolkit (PaNTr) is a pure Python 3.11–3.14 library for geometric modeling and numerical analysis using NumPy, SciPy, and Numba.
Documentation: pantr.readthedocs.io
Features
- B-spline & NURBS spaces — univariate and tensor-product
BsplineSpace, exact rational (NURBS) geometry, evaluation and derivatives, knot insertion/removal, degree elevation, and splitting. - Bézier toolkit — Bernstein/Bézier curves and patches, composition, products, degree reduction, and Bernstein-polynomial root finding.
- Truncated hierarchical B-splines —
THBSplineSpacewith local refinement, mirroring the tensor-product API. - Constructive geometry (
pantr.cad) — lines, circles and arcs, disks, cylinders, extrusion, revolution, sweep, ruled and Coons surfaces/volumes. - Structured grids (
pantr.grid) — tensor-product and hierarchical grids, BVH spatial queries, dolfinx-style cell/facet tags, and cell quadrature. - Quadrature and change of basis — Gauss–Legendre and tensor-product rules, plus exact change of basis operators between Bernstein, Lagrange, monomial, and cardinal B-spline bases.
- Fast and typed — Numba-JIT kernels parallelized over CPU cores, with strict type hints across the public API.
- Dependency-gated MPI and visualization —
pantr.mpidistributes spaces across ranks oncempi4pyis installed, andpantr.vizrenders exact higher-order geometry through PyVista / VTK once PyVista is installed. Both modules ship with PaNTr; only their backends are optional.
Installation
pip install pantr
Requires Python 3.11–3.14. The serial core depends only on NumPy, SciPy, Numba, and threadpoolctl.
To install the latest development version from source:
git clone https://github.com/FELIGN/pantr.git
cd pantr
pip install .
Quick start
A geometry is a function space plus control points; build one and evaluate it:
import numpy as np
from pantr.bspline import Bspline, BsplineSpace, BsplineSpace1D
# Quadratic 1-D space on the knot vector [0, 0, 0, 1, 2, 3, 3, 3]
space = BsplineSpace([BsplineSpace1D([0, 0, 0, 1, 2, 3, 3, 3], 2)])
# Five 2-D control points -> a planar curve
control_points = np.array(
[[0.0, 0.0], [1.0, 2.0], [2.0, -1.0], [3.0, 1.0], [4.0, 0.0]]
)
curve = Bspline(space, control_points)
# Evaluate at 50 parameters spanning the domain [0, 3]
points = curve.evaluate(np.linspace(0.0, 3.0, 50)) # shape (50, 2)
See the getting-started guide for a full walkthrough from this first curve to NURBS, CAD modeling, and refinement.
Optional features
Every install of PaNTr includes all of its modules — pantr.viz and pantr.mpi
among them. Those two stay dormant until their third-party backend is importable, and
activate automatically once it is; until then, calling into them raises a clear,
actionable error (nothing else is affected). The "extras" below add no PaNTr code —
they are just a convenience that installs the backend for you, so pip install "pantr[viz]" and pip install pyvista are equivalent.
| Capability | Module | Backend it needs | Install (extra or direct) |
|---|---|---|---|
| Visualization & VTK export | pantr.viz |
pyvista (+ VTK) |
pip install "pantr[viz]" · or pip install pyvista |
| Distributed (MPI) spaces | pantr.mpi |
mpi4py (+ an MPI library) |
pip install "pantr[mpi]" |
| METIS partitioning backend | pantr.bspline.partition_graph |
pymetis |
pip install "pantr[metis]" |
The serial core (pantr.grid, pantr.bspline, …) never imports pantr.mpi, so a plain
pip install pantr behaves identically with or without these backends. Contributors can
grab everything — including the docs toolchain (Sphinx) —
with pip install -e ".[dev]".
Development
pip install -e ".[dev]" # includes all optional feature extras
License
PaNTr is licensed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pantr-0.6.0.tar.gz.
File metadata
- Download URL: pantr-0.6.0.tar.gz
- Upload date:
- Size: 707.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2a7813534a392f3c6e8a09dbf152dfd030de088f3b90c1c6449786c4d73431d
|
|
| MD5 |
3fccc19458d4960936364abb2e4eb424
|
|
| BLAKE2b-256 |
40d85dd887c573d55c465306136ad612a9196cd675de65bdbad41fa428c63384
|
Provenance
The following attestation bundles were made for pantr-0.6.0.tar.gz:
Publisher:
release.yaml on FELIGN/pantr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pantr-0.6.0.tar.gz -
Subject digest:
e2a7813534a392f3c6e8a09dbf152dfd030de088f3b90c1c6449786c4d73431d - Sigstore transparency entry: 1938928990
- Sigstore integration time:
-
Permalink:
FELIGN/pantr@8cf2082f209608c5f51bc0d5bfbc8226778e5a5a -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/FELIGN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@8cf2082f209608c5f51bc0d5bfbc8226778e5a5a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pantr-0.6.0-py3-none-any.whl.
File metadata
- Download URL: pantr-0.6.0-py3-none-any.whl
- Upload date:
- Size: 450.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b681b48440071246ed9b9529faf660dc379388b490478197ed9319bdf831aea7
|
|
| MD5 |
fc94207d6f34e7822f2b123c7f58994f
|
|
| BLAKE2b-256 |
c9a03697bfc8b7bea7cb3cc3d9f6418bbfc8583101ede04df163ed0593c61c3c
|
Provenance
The following attestation bundles were made for pantr-0.6.0-py3-none-any.whl:
Publisher:
release.yaml on FELIGN/pantr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pantr-0.6.0-py3-none-any.whl -
Subject digest:
b681b48440071246ed9b9529faf660dc379388b490478197ed9319bdf831aea7 - Sigstore transparency entry: 1938929089
- Sigstore integration time:
-
Permalink:
FELIGN/pantr@8cf2082f209608c5f51bc0d5bfbc8226778e5a5a -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/FELIGN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@8cf2082f209608c5f51bc0d5bfbc8226778e5a5a -
Trigger Event:
push
-
Statement type: