Skip to content

feat: add the cabledyn.project object model - #4

Closed
SMI-Lab-Inha wants to merge 5 commits into
devfrom
feat/studio-s1
Closed

SMI-Lab-Inha wants to merge 5 commits into
devfrom
feat/studio-s1

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Summary

Adds cabledyn.project, an object model of a CableDyn analysis that does not depend on any GUI toolkit. It is the single source of truth for the forthcoming CableDyn Studio application and can also be used from scripts. Every model element is a typed object with unit-aware properties, references to other objects, validation and change events; edits go through reversible commands with undo and redo. Decks and project files are adapters around the model.

What is included

  • Objects: project, environment (waves, spectra, currents), flat seabed and bathymetry, line-type, rod-type and floater-type libraries, lines with ordered sections, end connections (including torsional restraints) and attachments, points of every kind, Rigid6 and Point3 bodies, floaters, turbines, rods, failures, control, external loads, output requests and analysis settings. Physics, construction and appearance properties are kept apart on the same objects.
  • Floaters: the API uses "floater" throughout; decks keep their Vessel keywords and vesselMotion/vesselRAO options, which the adapter maps. Floater types have an optional slot for a future hydrodynamic database.
  • Units: SI internally, with display presets.
  • Commands: set property, add, remove (with cascade), reconnect, move in collection, split section, replace strategy, grouping into macros, clean-state tracking.
  • Validation: three layers; the last one writes the deck and runs the existing deck checks, so no deck rule is duplicated.
  • Adapters: deck reader and writer built on the existing DeckModel; a versioned .cdproj project file (JSON) that is loaded strictly, saved atomically and keeps unknown content unchanged.

Checks

  • Round trip: all 99 decks in examples/, tests/data and validation/ that DeckModel accepts read, write back to identical deck text, re-read to the same object graph and survive a project-file save and load; also a hint-free round trip, 20 generated object graphs and a hand-written deck with asserted values.
  • An independent review (1 P1, 8 P2, 17 P3) was applied before this pull request, each behavioural fix with a regression test.
  • pytest: 2115 passed; coverage 95.7 % overall and 99 % for cabledyn.project. ruff, ruff format and mypy --strict (also for Python 3.10 on Linux) are clean; Sphinx -W -n builds clean.
  • No solver or Fortran code is changed.

The DeckModel methods named their row classes (Line, Point, Body, ...) by
bare name, which Sphinx resolved to the live solver views in
cabledyn.objects. Name them as cabledyn.builder classes so the links stay
unambiguous as more classes with these names are documented.
…ters

A GUI-independent model of a complete CableDyn model: ModelObject classes
with typed, unit-aware property descriptors (physics, construction,
appearance and meta roles), references between objects with refusing or
cascading removal, change events that bubble to the project, undoable
commands on a CommandStack, an SI units layer with display preferences,
and three validation layers whose last one writes the deck and applies
the native DeckFile rules. Numeric property limits come from the deck
reader's own constants.

DeckReader and DeckWriter go through DeckModel and keep deck ids, keyword
spellings and option order as hints, so every repository deck that
DeckModel accepts (99 of 105 .dat files) reads and writes back to its
canonical text and re-reads to the same object graph. ProjectStore writes
the .cdproj archive or folder with a versioned schema and keeps objects of
unknown type verbatim. Floaters have a shared FloaterType with a slot for
a hydrodynamic database; the deck's Vessel keywords map to them.
Add a developer page for cabledyn.project (design, deck and project-file
adapters, extension, API reference) and a changelog entry.
- Number EXTERNAL LOADS rows 1..N in collection order on write, so removing
  or adding a load keeps the deck valid (the other numbered tables already
  tolerate gaps or are renumbered by DeckModel).
- An ExtraOption that sets a typed option never overrides it: the writer
  places it before the typed row and validation warns about it.
- Removal cascades follow conditionally required references
  (ModelObject.required_references: a body rod's body, a turbine point's
  turbine); weak references such as group memberships never block a
  removal, are cleared, and are left out of "used by".
- uids are unique within a project: insertion of a used uid and ownership
  cycles are refused, from_dict gives copies fresh uids by default (with
  within= to keep references for a paste), and a project file with
  duplicate uids is rejected.
- Axial damping keeps its units apart: a damping in N s or a
  dimensionless damping ratio (written as the negative BA), plus the
  dynamic damping.
- Turbine points refer to their Turbine; rod endpoints are read-only.
- The project file is strict JSON (non-finite numbers refused, JSON-safe
  GUI data), model.dat is written only for a valid project with its side
  files rebased to the project folder (missing ones listed), deck_path is
  stored relative to the project folder, saves are atomic, loader errors
  are ProjectFormatError, and unknown objects, properties, values and
  references are written back unchanged and in place.
- The command stack refuses re-entrant pushes and keeps its index on a
  failed undo or redo; ImportDeck moves objects (and option hints) only
  when applied; AddObject appends at apply time.
- Unregistered subclasses cannot be written as their parent; the abstract
  flag is per class; describe() reports numeric limits; malformed hints
  are ignored.

Tests: a regression per finding, a hint-free write/read check over every
repository deck, seeded generated graphs and a hand-written deck with
asserted values; test-only types no longer leak into the registry.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T13:05:40.046017Z d3e8a62 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #34898761 | 📁 Comparing d3e8a62 against latest (c0a88eb)

  🔍 Preview build  

18 files changed · + 1 added · ± 17 modified

+ Added

± Modified

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

Closed without merging: this work continues outside this repository.

@SMI-Lab-Inha
SMI-Lab-Inha deleted the feat/studio-s1 branch October 2, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant