Skip to main content

Crate carapace_wasm

Crate carapace_wasm 

Source
Expand description

JavaScript interface to the Carapace engine. Binding glue and TypeScript definitions are generated during the wasm build.

Modules§

input_v1
CarapaceInputV1 — the pysees ↔ Carapace wire format and its decoder, (see docs/input-format.md). Header/table DTOs, the hand-written per-table decoder into a carapace-core Domain/Analysis, and the stepped Session/advance API. Every type here derives serde’s Serialize/Deserialize so ../boundary.rs can hand them across wasm_bindgen via serde-wasm-bindgen — but that boundary today accepts plain JS objects/arrays, not the structured-clone-plus- transferable-typed-array shapes postMessage will eventually carry. That optimization is deferred until pysees’s compiler exists to actually produce CarapaceInputV1 bytes; see each table’s doc comment for the exact correspondence once it does.
material_probe
Uniaxial material probe: one persistent unit zero-length spring driven by prescribed displacement (Analysis::step_prescribed), the equivalent of OpenSees’ sp-constrained zeroLength model. Strain is the relative displacement node2.x - node1.x and stress is the material’s tensile resisting force, Domain::reaction at node 2 (OpenSees’ -nodeReaction(1, 1)). Unit area and gauge length are implicit.

Structs§

WasmMaterialProbe
Opaque handle to a persistent uniaxial material probe (material_probe). Material state persists across applyStrain calls; cancel between points by simply not calling it again.
WasmSession
Opaque handle to a decoded, steppable analysis session — the Session enum itself can’t cross the boundary directly, since wasm_bindgen requires an exported type to be a plain struct.

Functions§

create_material_probe
decode_input
Decodes a CarapaceInputV1-shaped JS value (see input_v1’s table doc comments for the exact field names — #[serde(rename_all = "camelCase")] throughout) into a steppable WasmSession. Rejects with a { kind: "...", ... }-shaped JS error object on any input_v1::DecodeError, the same tagged shape a Rust caller would match on.