Skip to content

1388 crash when usind draw fused aircraft triangulation#1389

Open
joergbrech wants to merge 5 commits into
mainfrom
1388-crash-when-usind-draw-fused-aircraft-triangulation
Open

1388 crash when usind draw fused aircraft triangulation#1389
joergbrech wants to merge 5 commits into
mainfrom
1388-crash-when-usind-draw-fused-aircraft-triangulation

Conversation

@joergbrech

Copy link
Copy Markdown
Contributor

Note: This PR was AI-generated (Claude Code) and reviewed/verified by me before submission.

Description

Fixes #1388.

Fusing the whole aircraft (Draw -> Aircraft -> Fused aircraft triangulation (slow) in TiGLCreator) crashed with:

terminate called after throwing an instance of 'tigl::CTiglError'
  what():  No geometry primitives defined for uID="ceiling_PanelingElements_0000"

This had two causes, both fixed here:

  1. Fuse aborted on components without geometry. CTiglElementGeometryBuilder::BuildShape() threw whenever a system or deck component (e.g. a lavatory or ceiling panel) had no <geometry> primitives defined. This is a perfectly valid CPACS state — all primitive lists inside <geometry> are optional, so an element can legitimately be described by mass properties only. BuildShape()now returns a null shape in that case instead of throwing, consistent with how the rest of the codebase already treats "no shape" (e.g. ducts, mirrored lofts, far field,CFuseShapes/CGroupShapes` already skip null shapes when aggregating).

    The two call sites that genuinely need a shape to do their job —
    CCPACSComponent::GetCentroidLocal() and the BuildMass() implementations in
    CCPACSComponent and CCPACSDeckComponentBase (for volume-based mass/CoG) — now explicitly
    check for the missing geometry and report a precise error there instead, rather than the fuse
    algorithm blowing up mid-way through an unrelated multi-minute operation.

2.Uncaught exception in TiGLCreator. TIGLCreatorDocument::drawFusedAircraftTriangulation() never caught exceptions from the fusing algorithm, so any remaining CTiglError (or any other exception) would terminate the whole application. It now wraps the fuse call in the same try/catch used by drawFusedAircraft(), showing an error dialog instead of crashing.

How Has This Been Tested?

  • Added InvalidSystems.ElementWithoutGeometryHasNoLoft (tests/unittests/tiglSystems.cpp): confirms GetLoft() on a system component without geometry returns a null shape instead of throwing.
  • Updated InvalidSystems.InvalidSystemMassProperties: the "no geometry" case now surfaces as a precise "zero volume" error from the mass computation (which genuinely needs a shape) instead of an opaque "no geometry primitives" error from loft building.
  • Added Decks.ComponentWithoutGeometryHasNoLoft and, most importantly, Decks.FusingToleratesComponentWithoutGeometry (tests/unittests/tiglDecks.cpp), an end-to-end regression test that fuses a small aircraft (TestData/simpletest-decks.cpacs.xml, extended with a new mass-only lavatory element/instance) via CCPACSConfiguration::AircraftFusingAlgo()->FusedPlane() and asserts it no longer throws.
  • Verified both new tests actually catch the regression: temporarily reverted the CTiglElementGeometryBuilder::BuildShape() fix and confirmed both tests fail with the original No geometry primitives defined for uID="..." exception, then restored the fix and confirmed they pass again.
  • Ran the full unit test suite (pixi run -e default unittests): 901/901 tests pass, no regressions.

Screenshots, that help to understand the changes(if applicablable):

N/A (backend/logic fix, no UI changes)

Checklist for PR Author:

  • Unit or integration test added (if applicable)
  • Python interface updated (if applicable) — not needed, no public API change
  • Python test added (if Python interface updated) — not need
  • Doxygen docstrings added — not needed (no new public API), added a code comment explaining the new null-return behavior
  • ChangeLog.md updated

@joergbrech joergbrech linked an issue Jul 17, 2026 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown
Contributor

PR Reminders

This PR has changes in src/, TIGLCreator/, and tests/unittests/ but not in tests/integrationtests/, tests/python/, or bindings/python_internal/. ChangeLog.md has changes.

  • 💡 Tip: Please check if new classes need to be added to the Python bindings

This is an automated reminder from CI

@joergbrech
joergbrech requested a review from MarAlder July 17, 2026 12:57
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.23%. Comparing base (76802f0) to head (1b8e941).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1389      +/-   ##
==========================================
+ Coverage   73.21%   73.23%   +0.01%     
==========================================
  Files         324      324              
  Lines       28556    28563       +7     
==========================================
+ Hits        20908    20918      +10     
+ Misses       7648     7645       -3     
Flag Coverage Δ
unittests 73.23% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/decks/CCPACSDeckComponentBase.cpp 96.74% <100.00%> (+0.05%) ⬆️
src/geometry/CTiglElementGeometryBuilder.cpp 100.00% <100.00%> (ø)
src/systems/CCPACSComponent.cpp 92.98% <100.00%> (+0.52%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Crash: When usind Draw Fused aircraft triangulation

1 participant