This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
SCIRun uses a two-level CMake Superbuild. The outer Superbuild (in Superbuild/) downloads and compiles all external dependencies, then builds SCIRun itself (in src/). In-source builds are explicitly forbidden — always use a separate build directory (conventionally bin/).
Windows (PowerShell):
.\build.ps1 # Release build (default)
.\build.ps1 -Debug # Debug build
.\build.ps1 -Headless # No Qt/GUI required
.\build.ps1 -WithTetgen # Include Tetgen mesh generation
.\build.ps1 -Jobs 8 # Parallel jobs
.\build.ps1 -BuildDir "C:\MyBuild" # Custom build dirLinux/macOS:
./build.sh # Release build
./build.sh --debug
./build.sh --with-tetgen
./build.sh -DBUILD_HEADLESS=ONDirect CMake:
mkdir bin && cd bin
cmake ../Superbuild -G "Visual Studio 17 2022" # Windows
cmake ../Superbuild # Linux/macOS
cmake --build . --config Release -j 8Key CMake options (pass as -DOPTION=VALUE to the Superbuild):
BUILD_TESTING=ON— enables unit and regression tests (off by default)BUILD_WITH_PYTHON=ON— Python API support (on by default)BUILD_HEADLESS=ON— skip Qt/GUIWITH_TETGEN=ON— Tetgen mesh libraryWITH_OSPRAY=ON— OSPRay ray-tracing renderer
First build requires ~15 GB disk space and 30–90 minutes.
Tests require BUILD_TESTING=ON during CMake configuration. Run from the inner build directory (bin/SCIRun/):
cd bin/SCIRun
ctest --output-on-failure # all tests
ctest -R "\.Test\." --output-on-failure # unit tests only
ctest -R "ModuleName" --output-on-failure # filter by nameRegression tests also require the SCIRunTestData repo:
# Clone test data:
git clone https://github.com/CIBC-Internal/SCIRunTestData
# Configure with test data path:
cmake ../Superbuild -DBUILD_TESTING=ON -DSCIRUN_TEST_RESOURCE_DIR=/path/to/SCIRunTestData
# Run regression tests:
scripts/run-regression-tests.sh bin/SCIRun -- -j3
scripts/run-regression-tests.sh bin/SCIRun -- -j3 -R RendererSCIRun is a dataflow-based scientific visualization and computation platform. Users connect modules (computational nodes) via ports into a network; execution flows through that graph. Network files use the .srn5 extension.
src/Core/ — Foundation layer. Everything else depends on this.
Datatypes/— Core data representations:Field,Mesh,Matrix(dense/sparse),Geometry,ColorGeometryPrimitives/— 3D math: vectors, points, transformsAlgorithms/— Algorithm implementations consumed by modules (separated from UI and dataflow concerns)Dataflow/andsrc/Dataflow/— Execution engine and module network graphPython/— Python interpreter integration and datatype conversion between Python and SCIRun typesLogging/— Spdlog-backed logging
src/Dataflow/ — The dataflow execution engine.
Engine/— Scheduler and executorNetwork/— Module/port graph managementSerialization/—.srn5network file format read/writeState/— Module state management
src/Modules/ — The computational units (modules) users connect in the GUI. Organized by domain:
Fields/,Math/,DataIO/,Visualization/,FiniteElements/,Forward/,Inverse/,BrainStimulator/,Python/,Render/,Basic/- Module logic is split:
Modules/holds the dataflow glue;Core/Algorithms/holds the actual computation.
src/Interface/ — Qt-based GUI layer.
Application/— Main window and application shellModules/— Per-module dialog implementations (mirrorssrc/Modules/hierarchy);.uifiles alongside.h/.cc
src/Graphics/ — OpenGL rendering and scene management.
src/Main/ — Entry point (scirunMain.cc) and macOS bundle setup.
src/Externals/ — Vendored third-party code (e.g., GoogleTest).
- Module/Algorithm split: Module classes (
src/Modules/) handle dataflow ports and state; heavy computation lives in a corresponding*Algoclass undersrc/Core/Algorithms/. This keeps algorithms testable independent of the network engine. - Factory-generated boilerplate: Each module requires a config file in
src/Modules/Factory/Config/. After editing these, regenerate CMake to get updated factory code. - Superbuild external dependencies: Boost, Eigen, Qt (5.15 or 6.3.1+), GoogleTest, Teem, Zlib, Spdlog, GLEW, Qwt, and others are all fetched and built by the Superbuild; do not expect them pre-installed.
See docs/dev_doc/SCIRun5ModuleGeneration.md for the full guide. Summary:
- Add a
.moduleconfig file insrc/Modules/Factory/Config/ - Implement
ModuleName.h/.ccin the appropriatesrc/Modules/<Domain>/directory - Implement
ModuleNameAlgo.h/.ccin the correspondingsrc/Core/Algorithms/<Domain>/directory - Add GUI dialog
ModuleNameDialog.h/.cc/.uiundersrc/Interface/Modules/<Domain>/(if UI needed) - Re-run CMake to regenerate the factory
- C++17 throughout (
CMAKE_CXX_STANDARD 17) - Qt 5.15 or Qt 6.3.1+ for GUI components
- Python 3.x (when
BUILD_WITH_PYTHON=ON) - Unit tests use GoogleTest/GoogleMock