Reduce dependencies from Rif to Rim#857
Conversation
Add virtual isCalculated() to RifSummaryReaderInterface (defaults false), override in RifCalculatedSummaryCurveReader to return true. Replace dynamic_cast<RifCalculatedSummaryCurveReader*> checks with isCalculated(), removing the Rim header dependency from RifMultipleSummaryReaders.
…actureDefinition directly Remove RimThermalFractureTemplate dependency by accepting const RigThermalFractureDefinition& instead. Caller extracts fractureDefinition() before calling the exporter.
…xporters AsymmetricFrkExporter: accept 5 primitives instead of RimStimPlanModel*. DeviationFrkExporter: accept const RigWellPath* and use RigWellPath overload. PerfsFrkExporter: accept primitives + const RigWellPath*; computeMeasuredDepthForPosition and calculateTopAndBottomMeasuredDepth now take RigWellPath* directly. StimPlanModelExporter (orchestrator): extracts data from RimStimPlanModel and passes to updated sub-exporters. RimWellPath dependency reduced to orchestrator only.
…lipseCase writeCache takes RigCaseCellResultsData* and RigEclipseCaseData* directly. ensureDataIsReadFromCache takes RigCaseCellResultsData* directly. Caller (RimRegularGridCase) extracts the Rig objects before calling.
…vector instead of RimSummaryEnsemble* Store pre-collected RFT readers instead of the ensemble. All iteration methods now operate on m_rftReaders directly, removing the RimSummaryCase and RimSummaryEnsemble dependencies from the Rif class. The Rim caller (RimWellRftEnsembleCurveSet) extracts non-null readers before constructing.
Review Summary by QodoReduce Rim dependencies from Rif file interface layer
WalkthroughsDescription• Remove Rim dependencies from Rif file interface layer • Replace dynamic_cast checks with virtual isCalculated() method • Accept Rig types directly instead of Rim model objects • Extract data at Rim caller level before passing to Rif exporters • Simplify RFT reader ensemble to use pre-collected reader vector Diagramflowchart LR
A["Rim Model Objects"] -->|Extract Data| B["Primitive Types & Rig Objects"]
B -->|Pass to Exporters| C["Rif File Interface"]
D["RifSummaryReaderInterface"] -->|Virtual Method| E["isCalculated()"]
E -->|Replace| F["dynamic_cast Checks"]
G["RimSummaryEnsemble"] -->|Pre-collect| H["RifReaderRftInterface Vector"]
H -->|Pass to| I["RifReaderEnsembleStatisticsRft"]
File Changes1. ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.cpp
|
Code Review by Qodo
1. RKB offset dropped
|
| double mdStepSize = 5.0; | ||
| double rkbOffset = 0.0; | ||
| std::vector<double> xValues; | ||
| std::vector<double> yValues; | ||
| std::vector<double> tvdValues; | ||
| std::vector<double> mdValues; | ||
| RigWellPathGeometryExporter::computeWellPathDataForExport( wellPath, mdStepSize, xValues, yValues, tvdValues, mdValues, showTextMdRkb ); | ||
| RigWellPathGeometryExporter::computeWellPathDataForExport( *wellPath, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); | ||
| convertFromMeterToFeet( mdValues ); |
There was a problem hiding this comment.
1. Rkb offset dropped 🐞 Bug ≡ Correctness
RifStimPlanModelDeviationFrkExporter::writeToFile hard-codes rkbOffset=0.0 when exporting, so MD values in Deviation.frk no longer include the airGap/RKB offset that RigWellPathGeometryExporter applied for RimWellPath exports.
Agent Prompt
### Issue description
`RifStimPlanModelDeviationFrkExporter::writeToFile` currently exports measured depths with `rkbOffset = 0.0`, which changes output for well paths where the RimWellPath-based exporter would apply airGap/RKB.
### Issue Context
`RigWellPathGeometryExporter::computeWellPathDataForExport(gsl::not_null<const RimWellPath*>)` computes `rkbOffset` from the top-level well path (e.g., modeled well path airGap) and applies it by adding it to exported MD values.
### Fix Focus Areas
- ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.{h,cpp}[TBD]
- ApplicationLibCode/FileInterface/RifStimPlanModelExporter.cpp[32-52]
### Proposed fix
- Extend `RifStimPlanModelDeviationFrkExporter::writeToFile(...)` to accept `double rkbOffset` (and optionally a `bool showTextMdRkb` if needed).
- In `RifStimPlanModelExporter::writeToDirectory`, compute `rkbOffset` using `RimWellPath` (replicating the logic from `RigWellPathGeometryExporter`’s RimWellPath overload: use top-level modeled well path airGap; file well paths may also imply MD RKB display) and pass it into the deviation exporter.
- Use that `rkbOffset` when calling `computeWellPathDataForExport(*wellPathGeom, mdStepSize, rkbOffset, ...)`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| auto [perforationTop, perforationBottom] = | ||
| RifStimPlanModelPerfsFrkExporter::calculateTopAndBottomMeasuredDepth( stimPlanModel, stimPlanModel->wellPath() ); | ||
| RifStimPlanModelPerfsFrkExporter::calculateTopAndBottomMeasuredDepth( stimPlanModel->wellPath()->wellPathGeometry(), | ||
| stimPlanModel->perforationLength(), | ||
| stimPlanModel->anchorPosition() ); |
There was a problem hiding this comment.
2. Null wellpath deref 🐞 Bug ☼ Reliability
RifStimPlanModelGeologicalFrkExporter dereferences stimPlanModel->wellPath() without checking for null, which can crash during export because wellPath() is optional elsewhere and the exporter pipeline already passes nullptr to other exporters.
Agent Prompt
### Issue description
`RifStimPlanModelGeologicalFrkExporter::writeToFile` dereferences `stimPlanModel->wellPath()` unconditionally. If the StimPlan model has no well path (a supported state elsewhere), export will crash.
### Issue Context
Other exporters in the same pipeline already tolerate missing well path by passing `nullptr` and returning `false`. Geological export should fail gracefully in the same scenario.
### Fix Focus Areas
- ApplicationLibCode/FileInterface/RifStimPlanModelGeologicalFrkExporter.cpp[159-163]
- ApplicationLibCode/FileInterface/RifStimPlanModelExporter.cpp[32-52]
### Proposed fix
- In `RifStimPlanModelGeologicalFrkExporter::writeToFile`, add:
- `auto* wp = stimPlanModel->wellPath();`
- `if (!wp || !wp->wellPathGeometry()) return false;`
- then pass `wp->wellPathGeometry()` into `calculateTopAndBottomMeasuredDepth(...)`.
- Optionally, add an early `if (!stimPlanModel || !stimPlanModel->wellPath() || !stimPlanModel->wellPath()->wellPathGeometry()) return false;` in `RifStimPlanModelExporter::writeToDirectory` to keep all export steps consistent.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.