Refactors MSW completion data extraction

- redirects export functions to use new MSW extraction code
- removes previous implementation
- fix missing parts of RigMswDataFormatter
This commit is contained in:
Magne Sjaastad committed 2025-11-24 12:47:26 +01:00
1 parent 331edd7784
commit e490d9ef87
11 files changed
+188 -3204

No files matched your search

@@ -24,7 +24,7 @@
#include "RicMswExportInfo.h"
#include "RicMswSegment.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "RicWellPathExportMswCompletionsImpl.h"
#include "RicWellPathExportMswTableData.h"
#include "RigActiveCellInfo.h"
#include "RigCompletionData.h"
@@ -88,7 +88,7 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
std::map<size_t, std::vector<WellBorePartForTransCalc>> wellBorePartsInCells; // wellBore = main bore or fishbone
// lateral
findFishboneLateralsWellBoreParts( wellBorePartsInCells, wellPath, settings );
findFishboneLateralsWellBoreParts( wellBorePartsInCells, wellPath, settings.caseToApply() );
const RigActiveCellInfo* activeCellInfo =
settings.caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
@@ -191,12 +191,12 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWellBoreParts(
std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings )
const RimEclipseCase* eclipseCase )
{
if ( !wellPath || !wellPath->wellPathGeometry() || wellPath->wellPathGeometry()->measuredDepths().size() < 2 ) return;
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
const RigEclipseCaseData* caseData = eclipseCase->eclipseCaseData();
auto mswParameters = wellPath->mswCompletionParameters();
RiaDefines::EclipseUnitSystem unitSystem = caseData->unitsType();
@@ -207,10 +207,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
mswParameters->lengthAndDepth().text(),
mswParameters->pressureDrop().text() );
RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfoForWell( settings.caseToApply(),
wellPath,
&exportInfo,
exportInfo.mainBoreBranch() );
RicWellPathExportMswTableData::generateFishbonesMswExportInfoForWell( eclipseCase, wellPath, &exportInfo, exportInfo.mainBoreBranch() );
bool isMainBore = false;
@@ -271,7 +268,14 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
endMD += 0.5;
}
appendMainWellBoreParts( wellBorePartsInCells, wellPath, settings, skinFactor, holeRadius, startMD, endMD, fishboneDefinition );
appendMainWellBoreParts( wellBorePartsInCells,
wellPath,
eclipseCase->eclipseCaseData(),
skinFactor,
holeRadius,
startMD,
endMD,
fishboneDefinition );
}
}
}
@@ -283,7 +287,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
void RicFishbonesTransmissibilityCalculationFeatureImp::appendMainWellBoreParts(
std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings,
const RigEclipseCaseData* eclipseCaseData,
double skinFactor,
double holeRadius,
double startMeasuredDepth,
@@ -300,7 +304,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::appendMainWellBoreParts(
wellPath->wellPathGeometry()->clippedPointSubset( startMeasuredDepth, endMeasuredDepth );
std::vector<WellPathCellIntersectionInfo> intersectedCellsIntersectionInfo =
RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( settings.caseToApply->eclipseCaseData(),
RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( eclipseCaseData,
wellPath->name(),
fishbonePerfWellPathCoords.first,
fishbonePerfWellPathCoords.second );
@@ -18,14 +18,12 @@
#pragma once
#include "cvfVector3.h"
#include <map>
#include <set>
#include <vector>
class RigCompletionData;
class RimWellPath;
class RimEclipseCase;
class RimFishbones;
class RicExportCompletionDataSettingsUi;
class RigEclipseCaseData;
@@ -44,11 +42,11 @@ public:
private:
static void findFishboneLateralsWellBoreParts( std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings );
const RimEclipseCase* eclipseCase );
static void appendMainWellBoreParts( std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings,
const RigEclipseCaseData* eclipseCaseData,
double skinFactor,
double holeRadius,
double startMeasuredDepth,
@@ -38,6 +38,8 @@ public:
, m_valid( false )
{
}
virtual ~RicMswValveAccumulator() = default;
virtual bool accumulateValveParameters( const RimWellPathValve* wellPathValve, double overlapLength, double perforationCompsegsLength ) = 0;
virtual void applyToSuperValve() = 0;
@@ -15,200 +15,21 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswBranch.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include "RicMswSegment.h"
#include <gsl/gsl>
#include <set>
class RicExportCompletionDataSettingsUi;
class RigActiveCellInfo;
class RimEclipseCase;
class RimFishbones;
class RimPerforationInterval;
class RimWellPath;
class RigMswTableData;
class RigMswUnifiedDataWIP;
class RimWellPathFracture;
class RimMswCompletionParameters;
class RigWellPath;
class RimModeledWellPath;
struct WellPathCellIntersectionInfo;
class QFile;
#include <vector>
//--------------------------------------------------------------------------------------------------
/// Most of the functionality in this class has been moved to RicWellPathExportMswTableData
/// This class is kept for compatibility with existing code that calls exportWellSegmentsForAllCompletions
//--------------------------------------------------------------------------------------------------
class RicWellPathExportMswCompletionsImpl
{
public:
static void exportWellSegmentsForAllCompletions( const RicExportCompletionDataSettingsUi& exportSettings,
const std::vector<RimWellPath*>& wellPaths );
static void exportWellSegmentsForFractures( RimEclipseCase* eclipseCase,
std::shared_ptr<QFile> exportFile,
std::shared_ptr<QFile> lgrExportFile,
const RimWellPath* wellPath,
bool exportDataSourceAsComment,
bool completionSegmentsAfterMainBore );
static void exportWellSegmentsForFishbones( RimEclipseCase* eclipseCase,
std::shared_ptr<QFile> exportFile,
std::shared_ptr<QFile> lgrExportFile,
const RimWellPath* wellPath,
bool exportDataSourceAsComment,
bool completionSegmentsAfterMainBore );
static void updateDataForMultipleItemsInSameGridCell( gsl::not_null<RicMswBranch*> branch );
static void exportWellSegmentsForPerforations( RimEclipseCase* eclipseCase,
std::shared_ptr<QFile> exportFile,
std::shared_ptr<QFile> lgrExportFile,
const RimWellPath* wellPath,
int timeStep,
bool exportDataSourceAsComment,
bool completionSegmentsAfterMainBore );
static void generateFishbonesMswExportInfoForWell( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
private:
static void generateFishbonesMswExportInfo( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static void generateFishbonesMswExportInfo( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
const std::vector<RimFishbones*>& fishbonesSubs,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static bool generateFracturesMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static bool generatePerforationsMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
int timeStep,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static std::vector<WellPathCellIntersectionInfo> generateCellSegments( const RimEclipseCase* eclipseCase, const RimWellPath* wellPath );
static double computeIntitialMeasuredDepth( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
const RimMswCompletionParameters* mswParameters,
const std::vector<WellPathCellIntersectionInfo>& allIntersections );
static std::vector<WellPathCellIntersectionInfo> filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections,
double initialMD,
gsl::not_null<const RigWellPath*> wellPathGeometry,
gsl::not_null<const RimEclipseCase*> eclipseCase );
static std::pair<double, double> calculateOverlapWithActiveCells( double startMD,
double endMD,
const std::vector<WellPathCellIntersectionInfo>& wellPathIntersections,
const RigActiveCellInfo* activeCellInfo );
static void createWellPathSegments( gsl::not_null<RicMswBranch*> branch,
const std::vector<WellPathCellIntersectionInfo>& cellSegmentIntersections,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
int timeStep,
const RimEclipseCase* eclipseCase,
bool* foundSubGridIntersections );
static void createValveCompletions( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
RiaDefines::EclipseUnitSystem unitSystem );
static void assignValveContributionsToSuperICDsOrAICDs( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const std::vector<WellPathCellIntersectionInfo>& wellPathIntersections,
const RigActiveCellInfo* activeCellInfo,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToICVs( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToSuperICDsOrAICDs( gsl::not_null<RicMswBranch*> branch );
static void assignFishbonesLateralIntersections( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
const RimFishbones* fishbonesSubs,
gsl::not_null<RicMswSegment*> segment,
bool* foundSubGridIntersections,
double maxSegmentLength,
RiaDefines::EclipseUnitSystem unitSystem );
static void assignFractureCompletionsToCellSegment( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
const RimWellPathFracture* fracture,
const std::vector<RigCompletionData>& completionData,
gsl::not_null<RicMswSegment*> segment,
bool* foundSubGridIntersections );
static std::vector<RigCompletionData> generatePerforationIntersections( gsl::not_null<const RimWellPath*> wellPath,
gsl::not_null<const RimPerforationInterval*> perforationInterval,
int timeStep,
gsl::not_null<const RimEclipseCase*> eclipseCase );
static void assignPerforationIntersections( const std::vector<RigCompletionData>& completionData,
gsl::not_null<RicMswCompletion*> perforationCompletion,
const WellPathCellIntersectionInfo& cellIntInfo,
double overlapStart,
double overlapEnd,
bool* foundSubGridIntersections );
static void assignBranchNumbersToPerforations( const RimEclipseCase* eclipseCase,
gsl::not_null<RicMswSegment*> segment,
gsl::not_null<int*> branchNumber );
static void assignBranchNumbersToOtherCompletions( const RimEclipseCase* eclipseCase,
gsl::not_null<RicMswSegment*> segment,
gsl::not_null<int*> branchNumber );
static void assignBranchNumbersToBranch( const RimEclipseCase* eclipseCase,
RicMswExportInfo* exportInfo,
gsl::not_null<RicMswBranch*> branch,
gsl::not_null<int*> branchNumber );
static std::unique_ptr<RicMswBranch> createChildMswBranch( const RimWellPath* childWellPath );
static std::vector<RimWellPath*> wellPathsWithTieIn( const RimWellPath* wellPath );
//--------------------------------------------------------------------------------------------------
// New data extraction functions
//--------------------------------------------------------------------------------------------------
static void exportExperimentalMswToSeparateFolder( const RicExportCompletionDataSettingsUi& exportSettings,
const std::vector<RimWellPath*>& wellPaths );
static void exportUnifiedMswData( const RicExportCompletionDataSettingsUi& exportSettings,
const QString& exportFolder,
const std::vector<RimWellPath*>& wellPaths );
static void exportSplitMswData( const RicExportCompletionDataSettingsUi& exportSettings,
const QString& exportFolder,
const std::vector<RimWellPath*>& wellPaths );
static RigMswUnifiedDataWIP extractUnifiedMswData( RimEclipseCase* eclipseCase, int timeStep, const std::vector<RimWellPath*>& wellPaths );
};
File diff suppressed because it is too large. Load diff
@@ -15,26 +15,26 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswBranch.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include "RicMswSegment.h"
#include "RiaDefines.h"
#include <gsl/gsl>
#include <expected>
#include <set>
class RicExportCompletionDataSettingsUi;
class RicMswCompletion;
class RigCompletionData;
class RicMswSegment;
class RicMswExportInfo;
class RicMswBranch;
class RigActiveCellInfo;
class RimEclipseCase;
class RimFishbones;
class RimPerforationInterval;
class RimWellPath;
class RigMswTableData;
class RigMswUnifiedDataWIP;
class RimWellPathFracture;
class RimMswCompletionParameters;
class RigWellPath;
@@ -42,98 +42,42 @@ class RimModeledWellPath;
struct WellPathCellIntersectionInfo;
class QFile;
//--------------------------------------------------------------------------------------------------
/// This class is responsible for exporting well path MSW table data
/// This class is based on RicWellPathExportMswCompletionsImpl
///
/// TODO
/// - remove all functions not used by extractSingleWellMswData()
//--------------------------------------------------------------------------------------------------
class RicWellPathExportMswTableData
{
public:
// The intention is to extract MSW data from a single well. Any handling of multiple wells is supposed to be managed in a different class
static std::expected<RigMswTableData, std::string> extractSingleWellMswData( RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
int timeStep,
bool exportCompletionsAfterMainBoreSegments = true );
static void generateFishbonesMswExportInfoForWell( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
RicMswExportInfo* exportInfo,
RicMswBranch* branch );
private:
static void exportWellSegmentsForAllCompletions( const RicExportCompletionDataSettingsUi& exportSettings,
const std::vector<RimWellPath*>& wellPaths );
static void exportWellSegmentsForFractures( RimEclipseCase* eclipseCase,
std::shared_ptr<QFile> exportFile,
std::shared_ptr<QFile> lgrExportFile,
const RimWellPath* wellPath,
bool exportDataSourceAsComment,
bool completionSegmentsAfterMainBore );
static void exportWellSegmentsForFishbones( RimEclipseCase* eclipseCase,
std::shared_ptr<QFile> exportFile,
std::shared_ptr<QFile> lgrExportFile,
const RimWellPath* wellPath,
bool exportDataSourceAsComment,
bool completionSegmentsAfterMainBore );
static void updateDataForMultipleItemsInSameGridCell( gsl::not_null<RicMswBranch*> branch );
static void exportWellSegmentsForPerforations( RimEclipseCase* eclipseCase,
std::shared_ptr<QFile> exportFile,
std::shared_ptr<QFile> lgrExportFile,
const RimWellPath* wellPath,
int timeStep,
bool exportDataSourceAsComment,
bool completionSegmentsAfterMainBore );
static void generateFishbonesMswExportInfoForWell( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
private:
static void exportUnifiedWellSegments( const RicExportCompletionDataSettingsUi& exportSettings, const std::vector<RimWellPath*>& wellPaths );
static void exportUnifiedMswData( const RicExportCompletionDataSettingsUi& exportSettings, const std::vector<RimWellPath*>& wellPaths );
static void exportSplitMswData( const RicExportCompletionDataSettingsUi& exportSettings, const std::vector<RimWellPath*>& wellPaths );
// New data extraction functions
static RigMswUnifiedDataWIP extractUnifiedMswData( const RicExportCompletionDataSettingsUi& exportSettings,
const std::vector<RimWellPath*>& wellPaths );
static void generateFishbonesMswExportInfo( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static bool generatePerforationsMswExportInfo( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
int timeStep,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static void appendFishbonesMswExportInfo( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static void generateFishbonesMswExportInfo( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
const std::vector<RimFishbones*>& fishbonesSubs,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static bool generateFracturesMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static bool appendFracturesMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
double initialMD,
@@ -141,14 +85,6 @@ private:
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static bool generatePerforationsMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
int timeStep,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static std::vector<WellPathCellIntersectionInfo> generateCellSegments( const RimEclipseCase* eclipseCase, const RimWellPath* wellPath );
static double computeIntitialMeasuredDepth( const RimEclipseCase* eclipseCase,
@@ -308,7 +308,14 @@ void RigMswDataFormatter::formatCompsegsTable( RifTextDataTableFormatter& format
if ( rows.empty() ) return;
formatter.keyword( "COMPSEGS" );
if ( isLgrData )
{
formatter.keyword( "COMPSEGL" );
}
else
{
formatter.keyword( "COMPSEGS" );
}
// Add well name
{
@@ -360,15 +367,18 @@ void RigMswDataFormatter::formatWsegaicdTable( RifTextDataTableFormatter& format
//--------------------------------------------------------------------------------------------------
/// Format WELSEGS table for unified data (multiple wells)
//--------------------------------------------------------------------------------------------------
void RigMswDataFormatter::formatWelsegsTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData )
void RigMswDataFormatter::formatWelsegsTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData )
{
// TODO: Handle multiple WELSEGS headers?
for ( const auto& wellData : unifiedData.wellDataList() )
{
formatWelsegsTable( formatter, wellData );
}
}
//--------------------------------------------------------------------------------------------------
/// Format WSEGVALV table for unified data (multiple wells)
//--------------------------------------------------------------------------------------------------
void RigMswDataFormatter::formatWsegvalvTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData )
void RigMswDataFormatter::formatWsegvalvTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData )
{
auto rows = unifiedData.getAllWsegvalvRows();
if ( rows.empty() ) return;
@@ -385,7 +395,7 @@ void RigMswDataFormatter::formatWsegvalvTable( RifTextDataTableFormatter& format
//--------------------------------------------------------------------------------------------------
/// Format WSEGAICD table for unified data (multiple wells)
//--------------------------------------------------------------------------------------------------
void RigMswDataFormatter::formatWsegaicdTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData )
void RigMswDataFormatter::formatWsegaicdTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData )
{
auto rows = unifiedData.getAllWsegaicdRows();
if ( rows.empty() ) return;
@@ -406,12 +416,9 @@ void RigMswDataFormatter::formatWsegaicdTable( RifTextDataTableFormatter& format
void RigMswDataFormatter::formatMswTables( RifTextDataTableFormatter& formatter, const RigMswTableData& tableData )
{
formatWelsegsTable( formatter, tableData );
formatCompsegsTable( formatter, tableData, false ); // Main grid
if ( tableData.hasLgrData() )
{
formatCompsegsTable( formatter, tableData, true ); // LGR data
}
bool isLgrData = false;
formatCompsegsTable( formatter, tableData, isLgrData ); // Main grid
formatWsegvalvTable( formatter, tableData );
formatWsegaicdTable( formatter, tableData );
@@ -420,7 +427,7 @@ void RigMswDataFormatter::formatMswTables( RifTextDataTableFormatter& formatter,
//--------------------------------------------------------------------------------------------------
/// Format all MSW tables for unified data (multiple wells)
//--------------------------------------------------------------------------------------------------
void RigMswDataFormatter::formatMswTables( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData )
void RigMswDataFormatter::formatMswTables( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData )
{
formatWelsegsTable( formatter, unifiedData );
@@ -19,7 +19,7 @@
class RifTextDataTableFormatter;
class RigMswTableData;
class RigMswUnifiedDataWIP;
class RigMswUnifiedData;
//==================================================================================================
/// Formatter functions that convert MSW data structures to file output using RifTextDataTableFormatter
@@ -29,15 +29,15 @@ namespace RigMswDataFormatter
// Consolidated data formatting - works with any compatible data source
void formatCompsegsTable( RifTextDataTableFormatter& formatter, const RigMswTableData& tableData, bool isLgrData = false );
void formatWsegvalvTable( RifTextDataTableFormatter& formatter, const RigMswTableData& tableData );
void formatWsegvalvTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData );
void formatWsegvalvTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData );
void formatWsegaicdTable( RifTextDataTableFormatter& formatter, const RigMswTableData& tableData );
void formatWsegaicdTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData );
void formatWsegaicdTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData );
void formatWelsegsTable( RifTextDataTableFormatter& formatter, const RigMswTableData& tableData );
void formatWelsegsTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData );
void formatWelsegsTable( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData );
void addWsegaicdHeader( RifTextDataTableFormatter& formatter );
// Complete MSW export
void formatMswTables( RifTextDataTableFormatter& formatter, const RigMswTableData& tableData );
void formatMswTables( RifTextDataTableFormatter& formatter, const RigMswUnifiedDataWIP& unifiedData );
void formatMswTables( RifTextDataTableFormatter& formatter, const RigMswUnifiedData& unifiedData );
} // namespace RigMswDataFormatter
@@ -23,7 +23,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMswUnifiedDataWIP::addWellData( RigMswTableData wellData )
void RigMswUnifiedData::addWellData( RigMswTableData wellData )
{
// Check if well name already exists
const std::string& wellName = wellData.wellName();
@@ -41,67 +41,20 @@ void RigMswUnifiedDataWIP::addWellData( RigMswTableData wellData )
// Add new data
m_wellDataList.push_back( std::move( wellData ) );
}
updateIndex();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMswUnifiedDataWIP::clear()
void RigMswUnifiedData::clear()
{
m_wellDataList.clear();
m_wellNameToIndex.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigMswTableData* RigMswUnifiedDataWIP::getWellData( const std::string& wellName ) const
{
auto it = m_wellNameToIndex.find( wellName );
if ( it != m_wellNameToIndex.end() && it->second < m_wellDataList.size() )
{
return &m_wellDataList[it->second];
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WelsegsHeader> RigMswUnifiedDataWIP::getAllWelsegsHeaders() const
{
std::vector<WelsegsHeader> allHeaders;
for ( const auto& wellData : m_wellDataList )
{
allHeaders.push_back( wellData.welsegsHeader() );
}
return allHeaders;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WelsegsRow> RigMswUnifiedDataWIP::getAllWelsegsRows() const
{
std::vector<WelsegsRow> allRows;
for ( const auto& wellData : m_wellDataList )
{
const auto& wellRows = wellData.welsegsData();
allRows.insert( allRows.end(), wellRows.begin(), wellRows.end() );
}
return allRows;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<CompsegsRow> RigMswUnifiedDataWIP::getAllCompsegsRows( bool lgrOnly ) const
std::vector<CompsegsRow> RigMswUnifiedData::getAllCompsegsRows( bool lgrOnly ) const
{
std::vector<CompsegsRow> allRows;
@@ -127,7 +80,7 @@ std::vector<CompsegsRow> RigMswUnifiedDataWIP::getAllCompsegsRows( bool lgrOnly
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WsegvalvRow> RigMswUnifiedDataWIP::getAllWsegvalvRows() const
std::vector<WsegvalvRow> RigMswUnifiedData::getAllWsegvalvRows() const
{
std::vector<WsegvalvRow> allRows;
@@ -143,7 +96,7 @@ std::vector<WsegvalvRow> RigMswUnifiedDataWIP::getAllWsegvalvRows() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WsegaicdRow> RigMswUnifiedDataWIP::getAllWsegaicdRows() const
std::vector<WsegaicdRow> RigMswUnifiedData::getAllWsegaicdRows() const
{
std::vector<WsegaicdRow> allRows;
@@ -159,7 +112,7 @@ std::vector<WsegaicdRow> RigMswUnifiedDataWIP::getAllWsegaicdRows() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigMswUnifiedDataWIP::hasAnyLgrData() const
bool RigMswUnifiedData::hasAnyLgrData() const
{
return std::any_of( m_wellDataList.begin(), m_wellDataList.end(), []( const RigMswTableData& wellData ) { return wellData.hasLgrData(); } );
}
@@ -167,7 +120,7 @@ bool RigMswUnifiedDataWIP::hasAnyLgrData() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RigMswUnifiedDataWIP::wellNames() const
std::vector<std::string> RigMswUnifiedData::wellNames() const
{
std::vector<std::string> names;
names.reserve( m_wellDataList.size() );
@@ -183,7 +136,7 @@ std::vector<std::string> RigMswUnifiedDataWIP::wellNames() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigMswUnifiedDataWIP::isValid() const
bool RigMswUnifiedData::isValid() const
{
return validationErrors().empty();
}
@@ -191,7 +144,7 @@ bool RigMswUnifiedDataWIP::isValid() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RigMswUnifiedDataWIP::validationErrors() const
std::vector<QString> RigMswUnifiedData::validationErrors() const
{
std::vector<QString> errors;
@@ -225,16 +178,3 @@ std::vector<QString> RigMswUnifiedDataWIP::validationErrors() const
return errors;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMswUnifiedDataWIP::updateIndex()
{
m_wellNameToIndex.clear();
for ( size_t i = 0; i < m_wellDataList.size(); ++i )
{
m_wellNameToIndex[m_wellDataList[i].wellName()] = i;
}
}
@@ -26,10 +26,10 @@
//==================================================================================================
/// Container class for unified MSW table data from multiple wells
//==================================================================================================
class RigMswUnifiedDataWIP
class RigMswUnifiedData
{
public:
RigMswUnifiedDataWIP() = default;
RigMswUnifiedData() = default;
// Data modification
void addWellData( RigMswTableData wellData );
@@ -37,14 +37,11 @@ public:
// Data access
const std::vector<RigMswTableData>& wellDataList() const { return m_wellDataList; }
const RigMswTableData* getWellData( const std::string& wellName ) const;
// Aggregated data access - combines data from all wells
std::vector<WelsegsHeader> getAllWelsegsHeaders() const;
std::vector<WelsegsRow> getAllWelsegsRows() const;
std::vector<CompsegsRow> getAllCompsegsRows( bool lgrOnly = false ) const;
std::vector<WsegvalvRow> getAllWsegvalvRows() const;
std::vector<WsegaicdRow> getAllWsegaicdRows() const;
std::vector<CompsegsRow> getAllCompsegsRows( bool lgrOnly = false ) const;
std::vector<WsegvalvRow> getAllWsegvalvRows() const;
std::vector<WsegaicdRow> getAllWsegaicdRows() const;
// Metadata and analysis
bool isEmpty() const { return m_wellDataList.empty(); }
@@ -56,15 +53,6 @@ public:
bool isValid() const;
std::vector<QString> validationErrors() const;
// Iterator support for range-based loops
auto begin() const { return m_wellDataList.begin(); }
auto end() const { return m_wellDataList.end(); }
auto begin() { return m_wellDataList.begin(); }
auto end() { return m_wellDataList.end(); }
private:
std::vector<RigMswTableData> m_wellDataList;
std::map<std::string, size_t> m_wellNameToIndex;
void updateIndex();
std::vector<RigMswTableData> m_wellDataList;
};