zack3d bf1e547a8c feat(lungs): add breathing cycle and diaphragm kinematics
Introduce a time-based breathing cycle with phases and diaphragm
movement to improve realism and observability.

- Add BreathingPhase enum (Inhalation, Exhalation, Pause)
- Compute phase fractions/durations from RR and chemoreceptor drive
- Advance phases over time and update diaphragm position/velocity
- Call update_breath_cycle from Lungs::update
- Extend summary with phase and diaphragm position
- Re-export BreathingPhase and Lungs in lib and organs mod
- Add unit test for phase transitions and kinematics

No breaking changes; public API gains a new enum and fields.
2025-09-28 15:03:12 -07:00
dez
2025-09-22 00:24:27 -07:00
dez
2025-09-22 00:24:27 -07:00
wf
2025-09-21 22:47:43 -07:00
2025-09-21 02:14:44 -07:00
2025-09-21 02:14:44 -07:00
2025-09-21 02:14:44 -07:00
2025-09-21 02:14:44 -07:00
2025-09-21 02:14:44 -07:00

medicallib_rust

MedicalSim core library rewrite in Rust.

  • Safe, minimal API for medical simulation primitives
  • Optional serde feature for serialization
  • Optional ffi feature to expose a stable C ABI (cdylib)

Build

  • Build: cargo build (tests: cargo test)
  • FFI build: cargo build --features ffi --release
  • Format/Lint: cargo fmt --all and cargo clippy -D warnings

Examples

  • Rust: cargo run --example usage and cargo run --example patient
  • C FFI: see examples/c/ffi_example.c, header in ffi/medicallib.h

FFI ABI

  • Opaque MLPatient handle
  • Functions: medicallib_bmi, ml_patient_new/free/update, ml_patient_summary, ml_patient_organ_summary
  • All allocated strings must be freed with ml_string_free

Version Matrix

  • Rust 1.70+ (Edition 2021)
  • OS: Linux, macOS, Windows (see GitHub Actions CI)

Docs

  • Architecture: ARCHITECTURE.md
  • Migration (C++ -> Rust): MIGRATION.md
  • C/C++ install: INSTALL.md

Packaging (binary distribution)

  • Linux/macOS: run ../scripts/package.sh [target-triple] from medicallib_rust/ (or make package).
  • Windows: run ..\scripts\package.ps1 [target-triple] from medicallib_rust\.
  • Artifacts are placed in medicallib_rust/dist/ as both .tar.gz (Unix) and .zip.

CI: GitHub + Gitea

  • GitHub Actions workflow: .github/workflows/ci.yml
  • Gitea Actions workflow: .gitea/workflows/ci.yml
S
Description
No description provided
Readme 422 KiB
master Latest
2025-09-30 02:43:01 -07:00
Languages
Rust 98.7%
C 1.3%