Expand description
GPU-accelerated kernels for physics simulations.
When compiled with the gpu feature, this module exposes dispatchers that
attempt to offload finite-element stress assembly, the Navier-Stokes
pressure-Poisson solve, and heat-diffusion stencil updates onto a GPU
compute backend supplied by scirs2_core. When the gpu feature is
disabled (the default), every dispatcher returns
GpuError::BackendUnavailable immediately so callers can fall back to
the existing CPU paths without conditional compilation at the call site.
This mirrors the SAMM W3-S12 GPU pattern: feature-gated, default off,
pure-Rust default surface, opt-in C/Fortran via the gpu feature.
§Layout
stress_assembly— element stiffness and mass matrix assembly.navier_stokes_kernel— pressure-Poisson and Jacobi pressure solves.heat_kernel— explicit and ADI heat-diffusion stencils.
§Feature gate
Enable via Cargo.toml:
[dependencies]
oxirs-physics = { version = "*", features = ["gpu"] }§Example
use oxirs_physics::gpu::{GpuElementDescriptor, GpuError, StressAssemblyDispatcher};
let dispatcher = StressAssemblyDispatcher::new();
let elements = vec![GpuElementDescriptor::default(); 8];
let result = dispatcher.dispatch_stiffness_assembly(&elements);
// Without `gpu` feature: Err(GpuError::BackendUnavailable)Re-exports§
pub use heat_kernel::HeatKernelDispatcher;pub use stress_assembly::FemElementKind;pub use stress_assembly::GpuElementContribution;pub use stress_assembly::GpuElementDescriptor;pub use stress_assembly::StressAssemblyDispatcher;
Modules§
- heat_
kernel - GPU-accelerated heat-diffusion stencil dispatcher.
- navier_
stokes_ kernel - GPU-accelerated Navier-Stokes pressure-Poisson dispatcher.
- stress_
assembly - GPU-accelerated FEM stress assembly dispatcher.
Enums§
- GpuError
- Errors that can arise when using a GPU dispatch path.
Functions§
- backend_
available - Whether the underlying compute backend is available at runtime.
Type Aliases§
- GpuResult
- Result type for GPU dispatch operations.