O_o_Reader¶
Read, edit and query finite element models in .oos and HDF5 .ooh5 format with the same C++20 library from JavaScript (WebAssembly) or Python (native C++).
Sphinx documentation · Model input reference · Model construction · API reference
Install¶
Interface |
Install |
|---|---|
JavaScript / WebAssembly |
Extract the Reader ZIP into |
Python / native C++ |
Run |
Read, query and save a model¶
Create a model with one node at (1, 2, 3), count its nodes and write a model-only HDF5 archive. Save the JavaScript example as example.mjs and run node example.mjs, or save the Python example as example.py and run python example.py.
JavaScript / WebAssembly
import { writeFile } from "node:fs/promises";
import { loadOorReader } from "./reader/index.js";
const reader = await loadOorReader();
reader.writeFile("/work/point.oos", "[model]\nNode;1;;1.;2.;3.\n");
const deck = reader.readModel("/work/point.oos");
const nodes = reader.runQuery("nodesTable", { deck });
try {
console.log(nodes.rowCount()); // 1
deck.writeArchive("/work/point.ooh5");
await writeFile("point.ooh5", reader.readFile("/work/point.ooh5"));
} finally {
nodes.delete();
deck.delete();
}
Python / native C++
from pathlib import Path
from oo_reader import read_model
Path("point.oos").write_text("[model]\nNode;1;;1.;2.;3.\n", encoding="utf-8")
deck = read_model("point.oos")
print(len(deck.query("nodesTable"))) # 1
deck.write_archive("point.ooh5")
Both scripts create point.ooh5 in the current directory. The Node.js script copies the archive from WASM memory to disk; Python writes the host file directly.
Model queries cover geometry, mesh quality, mass, loads and connections. The JavaScript results API also queries stresses, margins and section cuts. Query and export guide
The Reader also edits card fields and applies design points in both languages. JavaScript additionally supports constructing models from objects, combining models with result tables and exporting Excel workbooks. Model construction · Archive format
Documentation¶
Optimization with JavaScript and Python: design interfaces, derivatives and accepted model updates.
Read Sphinx documentation · Architecture with diagrams · Documentation index
The Documentation workflow publishes the HTML site and provides a downloadable archive. See read, download and build instructions.
New .ooh5 files use archive version 4, with native model schema 1. Version 3 result archives remain
readable. See choosing a format and
archive compatibility before updating an existing viewer.
Layout of the repository¶
Folder |
What |
|---|---|
|
the library, in modules that each use only the ones before them: |
|
Native Python extension, public package and installed-wheel tests |
|
the WebAssembly module: the embind interface ( |
|
the C++ tests (Catch2), run natively |
|
model files written for the project, read by the tests |
|
the archive format, JavaScript and Python interfaces, and architecture |
|
the build scripts |
|
the layering check and the generator of the card catalogue ( |
|
the card layout catalogue of the model format ( |
Start reading at docs/architecture.md.
Build¶
For the JavaScript distribution, use the WebAssembly build below. For a Python wheel, see the native build and installation guide.
Native (development and tests)¶
Needs a C++20 compiler (GCC 12+ or Clang 16+), CMake 3.25+, Ninja and libhdf5 (on Windows: MSYS2 UCRT64 with
mingw-w64-ucrt-x86_64-hdf5).
cmake --preset release # build/release
cmake --build --preset release
ctest --test-dir build/release -j 1 --timeout 1 --output-on-failure
or scripts/check.sh (build, tests, layering check).
Each native test has a one-second timeout; validation corpora run in small independent cases.
WebAssembly¶
The module is 64-bit WebAssembly (Memory64, up to 16 GB of memory). Needs the Emscripten SDK
(emsdk install latest && emsdk activate latest, then its emsdk_env script) and a static libhdf5 built for 64-bit
WebAssembly, made once by scripts/build_hdf5_wasm.sh <work folder>.
scripts/build_wasm.sh <work folder of build_hdf5_wasm.sh> # build/wasm/dist: the npm package
node --test wasm/test/*.test.mjs # the end-to-end test, in Node.js 24+
Each WebAssembly test checks its own duration against the same one-second limit.
The WebAssembly workflow builds the package on every push to main that changes the sources, runs these tests and
publishes it as O_o_Reader-wasm.zip in two releases:
wasm-latest, a pre-release that follows the branch, and one release kept for each version of wasm/package.json
(v0.2.0, …), made by the first build of that version and not changed afterwards; the newest of these is the
latest release of the repository. Raise the version in wasm/package.json to keep a new one. Each run also keeps the
package 90 days as its O_o_Reader-wasm artifact.
Licence¶
MIT (see LICENSE). The WebAssembly package includes HDF5 (BSD-style licence) and zlib (zlib licence).