Skip to content

Delta Ensemble: Refresh calculated addresses for all realizations - #14576

Merged
magnesj merged 2 commits into
devfrom
fix-14559-delta-ensemble-calculated-vector
Aug 21, 2026
Merged

Delta Ensemble: Refresh calculated addresses for all realizations#14576
magnesj merged 2 commits into
devfrom
fix-14559-delta-ensemble-calculated-vector

Conversation

@magnesj

@magnesj magnesj commented Aug 21, 2026

Copy link
Copy Markdown
Member

Fixes #14559

A delta ensemble creates summary addresses for all realizations of the source ensembles, unlike a plain ensemble where addresses are created lazily. RimDeltaSummaryCase::values() uses hasAddress() on both source readers to detect vectors present in only one of the source ensembles, and this check is authoritative once the address set is non-empty.

When a calculation was created after the delta ensemble, RimSummaryCalculationCollection::updateDataDependingOnCalculations() recreated the addresses only for the cases showing tree nodes and for the case with most data objects in each ensemble. The remaining realizations never got the calculated address, so the delta case discarded the vector and only realization 0 was plotted. Reloading the project rebuilt the readers from scratch, which is why all realizations were present after a save and reload.

  • Add RifSummaryReaderInterface::refreshCalculatedAddresses(), recreating the addresses of the calculated readers while leaving the native readers untouched. Does nothing if no addresses have been created, so lazily loaded realizations stay lazy.
  • RimDeltaSummaryCase rebuilds the union of the source addresses and discards cached values for calculated vectors, as the values may have changed.
  • RimSummaryEnsemble::onCalculationUpdated() refreshes the calculated addresses for all cases in the ensemble. No additional file access, as caseWithMostDataObjects() already touches the reader of every case.
  • Delta ensembles are updated after the other ensembles, as a delta case derives its addresses from the source cases.

A delta ensemble creates summary addresses for all realizations of the source ensembles. When a calculation was created after this, only the realizations showing tree nodes had their addresses recreated. The other realizations had no calculated address, and RimDeltaSummaryCase::values() discarded the vector as being present in only one of the source ensembles. Only realization 0 was plotted until the project was reloaded.

Add RifSummaryReaderInterface::refreshCalculatedAddresses() to recreate the addresses of the calculated readers without touching the native readers, and call it for all cases in an ensemble when calculations are updated.
@magnesj
magnesj requested a review from kriben August 21, 2026 10:48

@kriben kriben left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.

Agent found this:

  • [P2] Deleting the final calculation leaves stale calculated addresses — ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp:54
    deleteCalculation() calls rebuildCaseMetaData() after removing the calculation, but updateDataDependingOnCalculations() immediately returns when the collection becomes empty. Consequently, the newly added ensemble refresh never runs, leaving deleted calculated addresses in readers and delta-case caches until another refresh or project reload. The test masks this by manually calling refreshCalculatedAddresses() after deletion at ApplicationLibCode/UnitTests/RifMultipleSummaryReaders-Test.cpp:93. Remove or adjust the early return and add an integration-level test for deleting the last calculation.

…ation is deleted

deleteCalculation() removes the calculation before rebuildCaseMetaData() is called, and updateDataDependingOnCalculations() returned early for an empty collection. The addresses created by the last calculation were then left behind in the readers until the next refresh or a reload of the project.

Perform one more update after the last calculation is deleted, and keep the early return for the case where no calculations have been present.
@magnesj

magnesj commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

Thanks — the P2 finding was correct. deleteCalculation() removes the calculation from the collection before calling rebuildCaseMetaData(), so updateDataDependingOnCalculations() saw an empty collection and returned early. Deleting the last calculation left its addresses behind in the readers until the next refresh or a reload of the project. This was the case before this PR as well, the new ensemble refresh just inherited it.

Removing the early return altogether would force reader creation for every realization of every ensemble on project load when no calculations are present, so the collection now remembers whether the previous update had calculations, and performs one more update after the last one is deleted.

Added RimSummaryCalculationCollection-Test.cpp covering this through the collection, using a call counter on RimMockSummaryCase. Verified that it fails with the original early return and passes with the fix.

@magnesj
magnesj merged commit 135ed69 into dev Aug 21, 2026
19 of 20 checks passed
@magnesj
magnesj deleted the fix-14559-delta-ensemble-calculated-vector branch August 21, 2026 13:54
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.

Summary Calculator: Plotting of calculated vector for Delta-Ensemble only show realization-0

2 participants