How hballington12/goad works
Project Type and Purpose
This is a hybrid scientific simulation toolkit centered on a Rust core library for geometric‐optics light scattering (GOAD). It ships as:
• A Rust CLI binary for batch/terminal use.
• A Python extension (via PyO3/maturin) plus a GUI application.
• A Blender add-on that embeds the Python extension into Blender.
High-Level File Structure
• Cargo.toml, src/… – Rust library and binary (main.rs + modules: beam, clip, geom, output, params, etc.)
• examples/… – Rust example programs & sample .obj geometry data.
• tests/… – Rust unit/integration tests with sample data.
• config/… – default.toml configuration and a helper script (config_editor.sh).
• goad-py/… – Python package:
– src/lib.rs – PyO3 wrapper around the Rust core, built via maturin.sh/pyproject.toml.
– app/… – Python GUI (main_window.py, panels, OpenGL view).
• blender/addon/… – Blender add-on in Python, bundles goad_py for in-Blender use + build.sh.
Key Components and Their Interactions
[Rust Core Library]
• Contains all physics and numeric computation modules (.rs files).
[CLI Binary]
• Rust main.rs uses Rust Core to parse CLI args, read config/default.toml, load .obj, run simulation, write results.
[Python Extension (goad_py)]
• PyO3‐based native module exposing core APIs to Python.
[Python GUI App]
• Imports goad_py; builds a desktop UI with panels, triggers simulations, visualises via OpenGL.
[Blender Add-On]
• Registers UI panels in Blender; imports goad_py to drive simulations inside Blender’s Python runtime.
Architectural Patterns and Principles
• Layered Architecture:
– Core computation (Rust library)
– API layers (Rust CLI, Python binding)
– Clients (Terminal, Desktop GUI, Blender)
• FFI Boundary: Clean separation at PyO3 interface.
• Configuration-over-code: TOML files (config/) overridden by CLI args/env.
• Modularity: Each major feature (beam tracing, clipping, diffraction) in its own Rust module.
– Clear component labels (e.g., “GOAD Core (Rust Library)”).
– Call out config layer (TOML) and sample data (.obj) feeding into CLI and Python layers.