1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! # Blast Stress Solver
//!
//! Rust library wrapping the NVIDIA Blast stress solver for destructible structures.
//!
//! ## Features
//!
//! - **Core solver**: `ExtStressSolver` — manages nodes, bonds, actors, fracture detection and splitting
//! - **Low-level solver**: `StressProcessor` — direct conjugate-gradient solver access
//! - **Bond stress analysis**: `compute_bond_stress` — decompose impulses into compression/tension/shear
//! - **Scenarios** (feature `scenarios`): Pre-built wall, tower, and bridge scenario builders
//! - **Rapier integration** (feature `rapier`): `DestructionRuntime` for existing Rapier apps and
//! `DestructibleSet` as the low-level escape hatch
//! - **Authoring** (feature `authoring`): Auto-generate bonds from pre-fractured triangle chunks and
//! assemble `ScenarioDesc` values from piece meshes
//!
//! `DestructionRuntime` is the recommended integration point when you already
//! own a Rapier world and want normal Rapier contacts to drive fracture while
//! still keeping `PhysicsPipeline::step(...)` in your app.
//!
//! ## Quick Start (without Rapier)
//!
//! ```no_run
//! use blast_stress_solver::*;
//!
//! let nodes = vec![
//! NodeDesc { centroid: Vec3::new(0.0, 0.0, 0.0), mass: 0.0, volume: 1.0 }, // support
//! NodeDesc { centroid: Vec3::new(0.0, 1.0, 0.0), mass: 10.0, volume: 1.0 }, // dynamic
//! ];
//! let bonds = vec![
//! BondDesc {
//! centroid: Vec3::new(0.0, 0.5, 0.0),
//! normal: Vec3::new(0.0, 1.0, 0.0),
//! area: 1.0,
//! node0: 0,
//! node1: 1,
//! },
//! ];
//! let settings = SolverSettings::default();
//! let mut solver = ExtStressSolver::new(&nodes, &bonds, &settings).unwrap();
//!
//! solver.add_gravity(Vec3::new(0.0, -9.81, 0.0));
//! solver.update();
//!
//! let overstressed = solver.overstressed_bond_count();
//! ```
// On `wasm32-unknown-unknown` the Blast C++ backend references dozens
// of libc symbols (malloc, fwrite, abort, …) through libc++'s STL
// helpers. We provide pure-Rust stubs for all of them in
// `wasm_runtime_shims`, so the final wasm module imports neither
// `env.*` libc functions nor `wasi_snapshot_preview1.*` wasi calls
// — it is a pure library module.
// `-fno-exceptions` is not enough to strip every mention of
// `__cxa_allocate_exception` / `__cxa_throw` from libc++ — STL
// containers still emit them behind `throw_bad_alloc`-style helpers.
// Provide trapping stubs so the wasm module stays self-contained.
// Re-export primary types at crate root for convenience
pub use ;
pub use compute_bond_stress;
pub use ExtStressSolver;
pub use ;
pub use *;