Metadata-Version: 2.4
Name: cutcells
Version: 0.5.0
Summary: Cut-cell geometry and quadrature for level set meshes (CutFEM, unfitted FEM)
Keywords: cut cells,level set,CutFEM,unfitted finite elements,quadrature
Author-Email: Susanne Claus <susanne.claus@onera.fr>
License-Expression: MIT AND BSD-3-Clause
License-File: LICENSE
License-File: third_party/Basix-LICENSE.txt
License-File: third_party/THIRD_PARTY_NOTICES.md
License-File: third_party/VTK-Copyright.txt
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
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 :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Project-URL: Homepage, https://github.com/sclaus2/CutCells
Project-URL: Documentation, https://sclaus2.github.io/CutCells/
Project-URL: Source, https://github.com/sclaus2/CutCells
Project-URL: Issues, https://github.com/sclaus2/CutCells/issues
Requires-Python: >=3.10
Requires-Dist: numpy>=1.21
Provides-Extra: docs
Requires-Dist: markdown; extra == "docs"
Provides-Extra: lint
Requires-Dist: ruff; extra == "lint"
Provides-Extra: optional
Requires-Dist: pyvista; extra == "optional"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: numpy; extra == "test"
Provides-Extra: ci
Requires-Dist: mypy; extra == "ci"
Requires-Dist: pytest-xdist; extra == "ci"
Requires-Dist: cutcells[test]; extra == "ci"
Description-Content-Type: text/markdown

# CutCells

CutCells cuts the cells of a mesh by one or more level sets `phi(x)` and
returns the inside, outside and interface pieces with explicit connectivity and
quadrature rules. It is a geometry kernel for unfitted finite element methods
(CutFEM): the C++20 core has no dependencies beyond a compiler, and the Python
interface passes arrays to and from NumPy without copying where the layout
allows.

```console
pip install cutcells
```

Wheels are published for Linux and macOS. Other platforms build from the source
distribution, which needs a C++20 compiler and CMake.

## Example

Cut a triangle mesh by a circle and integrate the inside and the interface:

```python
import numpy as np
import cutcells

mesh = cutcells.rectangle_mesh(-1.0, -1.0, 1.0, 1.0, 41, 41, cell_type="triangle")

def phi(X):
    # X has shape (gdim, num_points)
    return np.sqrt(X[0] ** 2 + X[1] ** 2) - 0.55

level_set = cutcells.create_level_set(mesh, phi, degree=2, name="phi")
result = cutcells.cut(mesh, level_set)

inside = result[level_set < 0]
interface = result[level_set == 0]

print("area     ", inside.quadrature(order=4, mode="full").weights.sum())
print("perimeter", interface.quadrature(order=4, mode="cut_only").weights.sum())
```

Parent cells can be intervals, triangles, quadrilaterals, tetrahedra,
hexahedra, prisms and pyramids, with any number of level sets per cell. Level
sets are interpolated (any degree) or analytic.

## Links

- Documentation and tutorials: <https://sclaus2.github.io/CutCells/>
- Source, issues and the C++ library: <https://github.com/sclaus2/CutCells>
- Licence: MIT. Third-party notices for generated VTK-derived tables and
  Basix-generated quadrature tables ship with the package.
