Repository navigation
feat: add the cabledyn.project object model - #4
Closed
SMI-Lab-Inha wants to merge 5 commits into
Closed
SMI-Lab-Inha wants to merge 5 commits into
SMI-Lab-Inha wants to merge 5 commits into
Conversation
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.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
Author
|
Closed without merging: this work continues outside this repository. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Vesselkeywords andvesselMotion/vesselRAOoptions, which the adapter maps. Floater types have an optional slot for a future hydrodynamic database.DeckModel; a versioned.cdprojproject file (JSON) that is loaded strictly, saved atomically and keeps unknown content unchanged.Checks
examples/,tests/dataandvalidation/thatDeckModelaccepts 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.cabledyn.project. ruff, ruff format and mypy--strict(also for Python 3.10 on Linux) are clean; Sphinx-W -nbuilds clean.