This document defines the target architecture for CUTKIT.
Current code is intentionally small. The structure below is the direction we will enforce as functionality grows.
CUTKIT provides a topology-aware geometry and integration layer for trimmed
domains, designed to work with meshmode, modepy, and boundary-integral
workflows.
For CAD-native geometry handling, CUTKIT uses OpenCascade bindings as the primary CAD core (with polygonized adapters retained as fallback workflows).
- Keep geometry handling explicit and testable.
- Prefer CAD-native exact geometry over pre-polygonized approximations.
- Separate topology, clipping, and quadrature concerns.
- Preserve predictable data flow from CAD trims to integration outputs.
- Make behavior legible to both human and agent contributors.
src/cutkit/
geometry/ # patch maps, Jacobians, boundary curves, evaluators
topology/ # loop orientation, nesting, seam and connectivity logic
clipping/ # inside/outside/cut classification and cut-cell extraction
quadrature/ # cut-cell moments, rule generation, integration drivers
diagnostics/ # quality metrics, invariants, debug exports
io/ # optional adapters for external formats/tooling
Dependencies should move forward only:
geometry -> topology -> clipping -> quadrature
Additional rules:
diagnosticsmay depend on any layer for read-only analysis.iomay depend on any layer, but core layers must not depend onio.- No reverse dependencies across core layers.
- Geometry adapters expose patch parameterizations and trim curves. OpenCascade-backed adapters are the default source for exact trims.
- Topology normalizes loops (outer/hole orientation, nesting, seam handling).
- Clipping computes active regions and cut cells in parameter space.
- Quadrature evaluates integrals on resulting cut panels/cells.
- Diagnostics reports quality and failure modes.
- Unit tests for each layer with deterministic fixtures.
- Cross-layer integration tests for representative trimmed cases.
- Regression fixtures for slivers, holes, near-degenerate cuts, and seam cases.
scripts/check_architecture.pyvalidates layer dependency direction.tests/test_architecture_contract.pyfails when architecture rules are broken.- CI runs these checks via the standard quality gate.
This file captures architecture intent. If code and architecture diverge, update both code and this document in the same change.