This project is under heavy development and not yet ready for production use.
A constrained Delaunay triangulation library for 2D and 3D mesh generation with OpenCASCADE CAD support, written in C++20.
| Component | Status |
|---|---|
| 2D constrained Delaunay mesher | Working |
| 3D surface mesher | Under development |
| 3D volume mesher | Not yet started |
OpenLoom is designed with extensibility as a core principle. The architecture makes it straightforward to add new meshing algorithms, refinement strategies, and import/export formats without touching the existing pipeline. Key extension points are defined as interfaces (IMesher, ICorner, IEdge, ISurface), and the context pattern cleanly separates geometry, topology, and mesh data.
The current meshing and refinement implementation is based on Shewchuk's algorithm — a quality Delaunay refinement method that guarantees well-shaped elements by iteratively inserting Steiner points to eliminate poorly-conditioned triangles and tetrahedra. This is used in both the 2D and 3D meshers.
- 2D constrained Delaunay triangulation (CDT)
- OpenCASCADE integration for importing STEP/IGES CAD geometry
- VTK export (
.vtu) for visualization in ParaView - Quality-driven mesh refinement (Shewchuk-style)
- Mesh verification and debug utilities
| Library | Purpose | Required |
|---|---|---|
| Eigen3 | Linear algebra | Yes |
| VTK | Mesh export | Yes |
| spdlog | Logging | Yes |
| fmt | String formatting | Yes |
| GoogleTest | Testing | Yes |
| OpenCASCADE | CAD geometry import | Optional |
| OpenMP | Parallel mesh verification | Optional |
sudo dnf install clang clang-tools-extra cmake
sudo dnf install vtk-devel eigen3-devel spdlog-devel fmt-devel gtest-develcmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j$(nproc)# Enable OpenMP for parallel mesh verification
cmake -S . -B build -DOPENLOOM_USE_OPENMP=ON
# Point to a custom OpenCASCADE installation
cmake -S . -B build -DOpenCASCADE_DIR=$HOME/local/opencascade/lib/cmake/opencascadectest --test-dir build/tests --output-on-failure
# or directly:
./build/tests/runTests
# Run a specific test
./build/tests/runTests --gtest_filter="TestClass.TestName"After building, executables are in build/src/Examples2D/ and build/src/Examples3D/. Output .vtu files can be opened with ParaView.
| Executable | Description |
|---|---|
SimpleDelaunay2D |
Basic 2D Delaunay triangulation |
RectangleWithHole2D |
Rectangle mesh with a hole constraint |
RectangleWithCrack |
Mesh with crack/slit constraints |
SquareWithCircularHole |
Square domain with a circular cutout |
SquareWithInternalCircles |
Multiple internal circle constraints |
MeshStepFile2D |
Mesh a 2D profile loaded from a STEP file |
| Executable | Description |
|---|---|
CreateBox |
Basic 3D box mesh |
BoxWithHole |
3D box with a through-hole |
ShewchukBox |
Quality-refined 3D box mesh |
ShewchukBoxWithHole |
Quality refinement with hole constraints |
ConstrainedBoxExample |
3D constrained mesh example |
# Run an example and view the result
./build/src/Examples2D/RectangleWithHole2D
paraview output.vtusrc/
├── Common/ # Types, BoundingBox, Exceptions
├── Geometry/ # CAD geometry entities (ICorner, IEdge, ISurface interfaces)
├── Topology/ # Topological relationships (3D)
├── Topology2D/ # Topological relationships (2D)
├── Meshing/
│ ├── Core/ # Delaunay algorithms (2D, 3D, Bowyer-Watson, constraint recovery)
│ └── Data/ # MeshData2D/3D, Node, TriangleElement, TetrahedralElement
├── Readers/ # OpenCASCADE STEP/IGES import
└── Export/ # VtkExporter (VTU format)
Key design patterns:
- Strategy:
IMesherinterface with pluggable algorithm implementations - Context:
MeshingContext2D/3Dmanages geometry, topology, and mesh lifecycle - Controlled mutation:
MeshDataexposes mutation only throughMeshMutator
Runtime logging level is controlled via environment variable:
SPDLOG_LEVEL=debug ./build/src/Examples2D/RectangleWithHole2D
# levels: trace, debug, info, warn, errorIf you need STEP file support and your distribution doesn't package OpenCASCADE:
cd ~/software/OCCT-7_8_1/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$HOME/local/opencascade \
-DBUILD_LIBRARY_TYPE=Shared \
-DBUILD_MODULE_DataExchange=ON \
-DBUILD_MODULE_ApplicationFramework=OFF \
-DBUILD_MODULE_Draw=OFF \
-DBUILD_MODULE_Visualization=OFF \
-DUSE_TK=OFF
make -j$(nproc)
make installThen configure OpenLoom with:
cmake -S . -B build -DOpenCASCADE_DIR=$HOME/local/opencascade/lib/cmake/opencascade- doc/Terminology.md - CAD and mesh terminology glossary
- doc/Meshing_Core_Overview.md - Architecture overview
- doc/Error_Handling.md - Error handling guide
Contributions are welcome. Please open an issue before starting significant work so we can discuss the approach. Bug reports and feedback are equally appreciated.
The meshing and refinement algorithms are based on the work of J.R. Shewchuk:
J.R. Shewchuk, "Delaunay Refinement Algorithms for Triangular Mesh Generation," Computational Geometry: Theory and Applications, 22(1-3):21-74, 2002.
OpenLoom is developed by Sandbricius Consulting AB. We offer consulting services for tailored mesh generation solutions — contact us if you need custom adaptations, integration support, or domain-specific extensions.
MIT — see LICENSE for the full text. This software is provided as-is, without warranty of any kind.