Skip to content

Library to compute intersections between mesh cells and implicit functions

License

Notifications You must be signed in to change notification settings

sclaus2/CutCells

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CutCells

CutCells CI

a library to compute intersections between mesh cells and implicit (level set) functions using marching cubes/tetrahedra algorithms.

The current version supports intervals, triangles and tetrahedra. Future versions will include quadrilaterals, hexahedra, pyramids and prisms.

The library contains utility functions to cut through vtk meshes using pyvista. It is also used as a basis to generate run time quadrature rules in immersed boundary methods/cut finite element methods (see CutFEMx).

The images below show a cut through a vtk mesh using pyvista and CutCells. The corresponding demonstration code is located in python/demo/cut_vtk_mesh.

Regular mesh cut by zero contour line of a circular level set function Regular mesh cut by zero contour line of a popcorn level set function

Installation

To install the CutCells library, first install the C++ library and then build the python interface

C++ library

In the cpp/ directory:

cmake -DCMAKE_BUILD_TYPE=Release -B build-dir -S .
cmake --build build-dir
cmake --install build-dir

You may need to use sudo for the final install step. Using the CMake build type Release is recommended for performance.

Python interface

After installing the C++ library, install the Python interface by running in the directory python/:

cmake -DCMAKE_BUILD_TYPE=Release -B build-dir -S .
cmake --build build-dir
cmake --install build-dir

and then

python3 -m pip install .

Running demons

There are demons for both the C++ and the python interface. For the C++ interface the demos are located in cpp/demo. The C++ demos are built with

cmake -DCMAKE_BUILD_TYPE=Release -B build-dir -S .
cmake --build build-dir
cmake --install build-dir

in the corresponding demo folder, e.g. cpp/demo/cut_triangle

The python demos are located in python/demo.

Dependencies

CutCells requires a C++20 compiler and depends on the C++ standard template library. For the python interface, CutCells requires nanobind.

At runtime for the python examples, CutCells requires numpy and pyvista for visualizations.

The library contains python pytest tests in python/tests.

About

Library to compute intersections between mesh cells and implicit functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published