Skip to content

Reduce dependency on Rim objects from Rif objects #856

Description

@magnesj

Description

Rif (file I/O) objects currently have direct dependencies on Rim (PDM model) objects, creating unwanted coupling between the data layer and the model layer. The goal is to decouple Rif classes so they work with plain data structs or Rig (data) objects instead of Rim (model) objects.

General rule: If a Rif function only reads data from a Rim object to produce output, it should accept a plain struct. If a Rif function returns data that Rim will consume, it should return a plain struct. Rim is responsible for the translation at both ends.

Current State

21 Rif files include Rim headers, grouped into 5 coupling patterns:

Group Files Pattern Fix
A — Exporters RifStimPlanModel*Exporter (4), RifThermalFracture* (2), RifEventKeywordFormatter, RifWellIAFileWriter Receive Rim*, call property getters only Extract data to plain struct in Rim caller
B — Readers creating Rim objects RifParameterXmlReader, RifInputPropertyLoader, RifEclipseInputPropertyLoader Parse files and directly create/populate Rim objects Return intermediate plain struct; Rim layer converts
C — Pass Rig directly RifReaderRegularGridModel, RifRoffFileTools, RifReaderEnsembleStatisticsRft Receive Rim objects but only need underlying Rig data Change signatures to accept Rig types directly
D — Stored Rim pointers RifDataSourceForRftPlt Stores caf::PdmPointer<Rim*> for 6+ types Replace with plain struct { SourceType, caseId, name, filePath }
E — Dynamic cast RifMultipleSummaryReaders Uses dynamic_cast<RimCalculatedSummaryCurveReader*> Add virtual isCalculated() to reader interface

Steps

Group A — Exporters: extract data structs (highest impact)

  • A1 RifStimPlanModelAsymmetricFrkExporter: extract { formationDip, hasBarrier, distanceToBarrier, barrierDip, wellPenetrationLayer } into struct; update caller
  • A2 RifStimPlanModelDeviationFrkExporter: pass computed depth vectors instead of RimStimPlanModel* / RimWellPath*
  • A3 RifStimPlanModelPerfsFrkExporter: extract { fractureOrientation, perforationLength, anchorPosition } into struct; update caller
  • A4 RifStimPlanModelGeologicalFrkExporter: create StimPlanGeologicalExportData struct populated by calculator in Rim layer
  • A5 RifStimPlanModelExporter: orchestrator — extract all sub-exporter inputs into structs; update dispatcher
  • A6 RifThermalFractureTemplateSurfaceExporter: pass RigThermalFractureDefinition* directly instead of RimThermalFractureTemplate*
  • A7 RifThermalToStimPlanFractureXmlOutput: extract { fractureGrid, resultNames, resultValues, timeStepIndex } into struct
  • A8 RifEventKeywordFormatter: create RifWellEventData POD struct; Rim layer populates it from RimWellEvent* before calling formatter
  • A9 RifWellIAFileWriter: extract { outputDir, parameters, modelBoxVertices } into struct; update caller in Rim layer

Group B — Readers: intermediate data model

  • B1 RifParameterXmlReader: return std::vector<RifParameterDefinition> instead of creating Rim objects; add factory in Rim layer
  • B2 RifInputPropertyLoader: return property metadata structs; move Rim collection insertion to caller
  • B3 RifEclipseInputPropertyLoader: pass RigEclipseCaseData* and metadata directly; remove Rim property creation

Group C — Pass Rig objects directly

  • C1 RifReaderRegularGridModel: change signature to accept RigEclipseCaseData* instead of RimEclipseCase*
  • C2 RifRoffFileTools: pass RigEclipseCaseData* and color legend collection directly; remove RimProject::current() singleton access
  • C3 RifReaderEnsembleStatisticsRft: pass vector of RFT reader interfaces instead of RimSummaryEnsemble*

Group D — RifDataSourceForRftPlt

  • D1 Replace caf::PdmPointer<Rim*> members with plain struct { SourceType type; int caseId; QString name; QString filePath; }; update all callers

Group E — Dynamic cast fix (minimal)

  • E1 RifMultipleSummaryReaders: add virtual isCalculated() to reader interface; remove dynamic_cast and Rim include

Links

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions