Skip to main content

Module input_v1

Module input_v1 

Source
Expand description

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.

Re-exports§

pub use error::DecodeError;
pub use materials::MaterialSpec;

Modules§

error
DecodeError — decode’s own diagnostic type, in AnalysisError’s style (tagged variants carrying context, not sentinel codes. This is defense in depth against what pysees’s compiler can’t see (engine/schema version skew, a stale snapshot run against a newer/older wasm build) — the compiler is expected to catch entity-level problems (missing tags, unsupported materials, …) first.
materials
Wire-format material arena and its resolution into core::Material values. Composite materials reference other arena entries by index rather than duplicating them inline, mirroring core’s own arena-of-indices philosophy.
sequence
Wire-format AnalysisSequence — mirrors the PySees AnalysisStage discriminated union: Static (pushover-style), Modal (eigenvalue), and Transient (Newmark time-history, optionally driven by GroundMotionSpec).
tables
Bulk per-(entity-kind) tables of the wire format (docs/input-format.md), one set for both profiles (header.ndm 2 or 3). Dimension-agnostic entities (nodes, trusses, zero-lengths, fibers, constraints, loads) have one table; formulations that differ between 2D and 3D (beam-columns) have one table each, suffixed 2d/3d, and the table of the other profile must be empty (DecodeError::TableNotInProfile).

Structs§

CarapaceInputV1
The full wire payload: header plus one table per entity kind, mirroring core’s closed-enum element/material catalog.
ContinuationDetail
core::ArcStepInfo for the last accepted arc-length step of an advance() call (StepOutcome::continuation).
ContinuationStopDetail
Header
Small structured-clone header fields — everything else in CarapaceInputV1 is a bulk table.
ModalResultsReport
Session::modal_results’s payload: every Modal stage that has finished so far, in order.
ModalStageResult
Everything a finished Modal stage computed.
ModeResult
One computed mode of a finished Modal stage. shape is node-major over every node in the input’s node-table order (shape[node * ndf + dof], fixed DOFs 0.0), M-normalized and sign-fixed so its largest-magnitude entry is positive. participation[d] is the modal participation factor phi^T M r_d for global translation direction d, and mass_ratio[d] the effective modal mass participation^2 as a fraction of ModalStageResult::total_mass[d].
RecorderBatch
One recorder’s new samples from a single advance() call. first_sample plus samples.len() gives the sample range this batch covers, so a caller can retry a failed persist without renumbering — the “each advance() batch deterministic and identifies its first sample/count” contract from results-storage-indexeddb.md’s “Failure and cancellation contract”. Scalar-only ((pseudo_time, value) pairs, one channel) until a vector recorder needs more.
StepOutcome
advance’s result — { done, stageComplete, stepsTaken, progressSnapshot, recorderBatch? }, minus the parts that are the worker/JS boundary’s job (progressSnapshot’s throttling, recorderBatch’s response_blocks byte layout): load_factor here is the raw signal those would be built from — for a Static stage the integrator’s load factor, for a Transient stage the elapsed time (TransientAnalysis::time), and for a Modal stage always 0.0 (a single eigensolve has no comparable incremental progress scalar; read Mode::frequency from a ModeShape recorder’s batch instead). error, once set, is sticky — later stages are not attempted, matching “a stage’s AnalysisError stops the sequence”.

Enums§

AnalysisErrorDetail
AnalysisError’s fields, restated so advance’s result doesn’t need to name carapace_core’s error type directly — kept in the same tagged- variant style.
ArcFailureDetail
core::ArcFailure, restated for the wire.
Session
One opaque handle exposed to the caller, chosen once from ndm at decode time.
StopReasonDetail

Functions§

decode

Type Aliases§

Session2
Session3