Skip to content

ENH: compute rocket static margin lazily (#780) - #1135

Open
thatrandomasiandev wants to merge 1 commit into
RocketPy-Team:developfrom
thatrandomasiandev:enh/780-lazy-static-margin
Open

ENH: compute rocket static margin lazily (#780)#1135
thatrandomasiandev wants to merge 1 commit into
RocketPy-Team:developfrom
thatrandomasiandev:enh/780-lazy-static-margin

Conversation

@thatrandomasiandev

Copy link
Copy Markdown

Summary

  • Compute Rocket.static_margin lazily: a dirty flag is set when geometry/mass/surfaces change; the Function is rebuilt (including set_discrete) only on first access or an explicit evaluate_static_margin() call.
  • add_motor and add_surfaces invalidate instead of eagerly rebuilding; public API (rocket.static_margin as a Function) is unchanged.
  • Fixes ENH: Make Static Margin Calculation Lazy #780

Test plan

  • test_static_margin_lazy_until_accessed — SM not discretized until accessed after adding a surface
  • test_static_margin_rebuilds_after_adding_surface — adding a surface invalidates; access rebuilds once
  • Full tests/unit/rocket/test_rocket.py + tests/integration/test_rocket.py (77 passed)

@thatrandomasiandev
thatrandomasiandev requested a review from a team as a code owner August 11, 2026 01:57
@Gui-FernandesBR Gui-FernandesBR linked an issue Aug 12, 2026 that may be closed by this pull request
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.

ENH: Make Static Margin Calculation Lazy

1 participant