Metadata-Version: 2.4
Name: pantr
Version: 0.6.0
Summary: Polynomial And NURBS Toolkit
Project-URL: Homepage, https://github.com/FELIGN/pantr
Project-URL: Documentation, https://pantr.readthedocs.io
Project-URL: Source, https://github.com/FELIGN/pantr
Project-URL: Issues, https://github.com/FELIGN/pantr/issues
Author-email: Pablo Antolin <pablo.antolin@epfl.ch>
License-Expression: MIT
License-File: LICENSE
Keywords: b-spline,bernstein,bezier,cad,geometric-modeling,isogeometric-analysis,nurbs,quadrature,scientific-computing,spline
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Requires-Python: <3.15,>=3.11
Requires-Dist: numba>=0.63
Requires-Dist: numpy<3,>=1.26
Requires-Dist: scipy<2,>=1.11
Requires-Dist: threadpoolctl>=3.0
Provides-Extra: dev
Requires-Dist: furo>=2024.1; extra == 'dev'
Requires-Dist: import-linter<3,>=2.0; extra == 'dev'
Requires-Dist: linkify-it-py<3,>=2.0; extra == 'dev'
Requires-Dist: matplotlib<4,>=3.7; extra == 'dev'
Requires-Dist: mpi4py<5,>=3.1; extra == 'dev'
Requires-Dist: mypy<2,>=1.10; extra == 'dev'
Requires-Dist: myst-parser<3,>=2.0; extra == 'dev'
Requires-Dist: nest-asyncio2<2,>=1; extra == 'dev'
Requires-Dist: pre-commit<4,>=3.6; extra == 'dev'
Requires-Dist: pymetis>=2025.2; extra == 'dev'
Requires-Dist: pytest-cov<6,>=4; extra == 'dev'
Requires-Dist: pytest-xdist<4,>=3; extra == 'dev'
Requires-Dist: pytest<9,>=7.4; extra == 'dev'
Requires-Dist: pyvista<1,>=0.43; extra == 'dev'
Requires-Dist: ruff<0.13,>=0.12.0; extra == 'dev'
Requires-Dist: sphinx-design<1,>=0.5; extra == 'dev'
Requires-Dist: sphinx-gallery<1,>=0.15; extra == 'dev'
Requires-Dist: sphinx<8,>=7.2; extra == 'dev'
Requires-Dist: sphinxcontrib-bibtex<2.7,>=2.6; extra == 'dev'
Requires-Dist: trame-vtk<3,>=2; extra == 'dev'
Requires-Dist: trame-vuetify<4,>=2; extra == 'dev'
Requires-Dist: trame<4,>=3; extra == 'dev'
Provides-Extra: docs
Requires-Dist: furo>=2024.1; extra == 'docs'
Requires-Dist: linkify-it-py<3,>=2.0; extra == 'docs'
Requires-Dist: matplotlib<4,>=3.7; extra == 'docs'
Requires-Dist: myst-parser<3,>=2.0; extra == 'docs'
Requires-Dist: nest-asyncio2<2,>=1; extra == 'docs'
Requires-Dist: pyvista<1,>=0.43; extra == 'docs'
Requires-Dist: sphinx-design<1,>=0.5; extra == 'docs'
Requires-Dist: sphinx-gallery<1,>=0.15; extra == 'docs'
Requires-Dist: sphinx<8,>=7.2; extra == 'docs'
Requires-Dist: sphinxcontrib-bibtex<2.7,>=2.6; extra == 'docs'
Requires-Dist: trame-vtk<3,>=2; extra == 'docs'
Requires-Dist: trame-vuetify<4,>=2; extra == 'docs'
Requires-Dist: trame<4,>=3; extra == 'docs'
Provides-Extra: metis
Requires-Dist: pymetis>=2025.2; extra == 'metis'
Provides-Extra: mpi
Requires-Dist: mpi4py<5,>=3.1; extra == 'mpi'
Provides-Extra: viz
Requires-Dist: pyvista<1,>=0.43; extra == 'viz'
Description-Content-Type: text/markdown

# PaNTr

[![PyPI version](https://img.shields.io/pypi/v/pantr.svg)](https://pypi.org/project/pantr/)
[![Python versions](https://img.shields.io/pypi/pyversions/pantr.svg)](https://pypi.org/project/pantr/)
[![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/FELIGN/pantr/blob/main/LICENSE)
[![Documentation Status](https://readthedocs.org/projects/pantr/badge/?version=latest)](https://pantr.readthedocs.io/en/latest/?badge=latest)

Polynomial and NURBS Toolkit (**PaNTr**) is a pure Python 3.11–3.14 library for geometric modeling and numerical analysis using [NumPy](https://numpy.org), [SciPy](https://scipy.org), and [Numba](https://numba.pydata.org).

**Documentation:** [pantr.readthedocs.io](https://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** — `THBSplineSpace` with 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](https://github.com/FEniCS/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.mpi` distributes spaces across
  ranks once [`mpi4py`](https://github.com/mpi4py/mpi4py) is installed, and `pantr.viz`
  renders exact higher-order geometry through [PyVista](https://docs.pyvista.org) /
  [VTK](https://vtk.org) once PyVista is installed. Both modules ship with PaNTr; only
  their backends are optional.

## Installation

```bash
pip install pantr
```

Requires Python 3.11–3.14. The serial core depends only on NumPy, SciPy,
Numba, and [threadpoolctl](https://github.com/joblib/threadpoolctl).

To install the latest development version from source:

```bash
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:

```python
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](https://pantr.readthedocs.io/en/latest/getting-started.html)
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`](https://docs.pyvista.org) (+ [VTK](https://vtk.org)) | `pip install "pantr[viz]"` · or `pip install pyvista` |
| Distributed (MPI) spaces | `pantr.mpi` | [`mpi4py`](https://github.com/mpi4py/mpi4py) (+ an MPI library) | `pip install "pantr[mpi]"` |
| METIS partitioning backend | `pantr.bspline.partition_graph` | [`pymetis`](https://github.com/inducer/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](https://www.sphinx-doc.org)) —
with `pip install -e ".[dev]"`.

## Development

```bash
pip install -e ".[dev]"   # includes all optional feature extras
```

## License

PaNTr is licensed under the MIT License. See `LICENSE` for details.
