mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7727 Performance : Reduce amount of work
Use objectsWithReferringPtrFields to find tieIn wells Avoid using descendantsOfType
This commit is contained in:
parent
afb293db52
commit
33ac79d856
@ -113,16 +113,18 @@ void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompl
|
|||||||
|
|
||||||
std::vector<RimWellPath*> allLaterals;
|
std::vector<RimWellPath*> allLaterals;
|
||||||
{
|
{
|
||||||
std::set<RimWellPath*> laterals;
|
std::set<RimWellPath*> lateralSet;
|
||||||
|
|
||||||
for ( auto t : topLevelWells )
|
for ( auto t : topLevelWells )
|
||||||
{
|
{
|
||||||
auto laterals = t->wellPathLateralsRecursively();
|
auto laterals = t->allWellPathLaterals();
|
||||||
for ( auto l : laterals )
|
for ( auto l : laterals )
|
||||||
{
|
{
|
||||||
allLaterals.push_back( l );
|
lateralSet.insert( l );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allLaterals.assign( lateralSet.begin(), lateralSet.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto w : allLaterals )
|
for ( auto w : allLaterals )
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::vector<RimWellPath*>& topLevelWellPaths,
|
void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::vector<RimWellPath*>& wellPaths,
|
||||||
const std::vector<RimSimWellInView*>& simWells,
|
const std::vector<RimSimWellInView*>& simWells,
|
||||||
const RicExportCompletionDataSettingsUi& exportSettings )
|
const RicExportCompletionDataSettingsUi& exportSettings )
|
||||||
{
|
{
|
||||||
@ -142,21 +142,21 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
std::vector<RigCompletionData> completions;
|
std::vector<RigCompletionData> completions;
|
||||||
|
|
||||||
{
|
{
|
||||||
caf::ProgressInfo progress( topLevelWellPaths.size(), "Extracting Completion Data For Well Paths" );
|
caf::ProgressInfo progress( wellPaths.size(), "Extracting Completion Data For Well Paths" );
|
||||||
|
|
||||||
for ( RimWellPath* topLevelWellPath : topLevelWellPaths )
|
for ( RimWellPath* wellPath : wellPaths )
|
||||||
{
|
{
|
||||||
std::vector<RimWellPath*> allWellPathLaterals;
|
std::vector<RimWellPath*> allWellPathLaterals;
|
||||||
if ( topLevelWellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType() )
|
if ( wellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType() )
|
||||||
{
|
{
|
||||||
allWellPathLaterals = topLevelWellPath->wellPathLateralsRecursively();
|
allWellPathLaterals = wellPath->allWellPathLaterals();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int caseId = exportSettings.caseToApply->caseId();
|
int caseId = exportSettings.caseToApply->caseId();
|
||||||
QString format = QString(
|
QString format = QString(
|
||||||
"Unit systems for well path \"%1\" must match unit system of chosen eclipse case \"%2\"" );
|
"Unit systems for well path \"%1\" must match unit system of chosen eclipse case \"%2\"" );
|
||||||
QString errMsg = format.arg( topLevelWellPath->name() ).arg( caseId );
|
QString errMsg = format.arg( wellPath->name() ).arg( caseId );
|
||||||
RiaLogging::error( errMsg );
|
RiaLogging::error( errMsg );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,15 +165,15 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
std::map<size_t, std::vector<RigCompletionData>> completionsPerEclipseCellFracture;
|
std::map<size_t, std::vector<RigCompletionData>> completionsPerEclipseCellFracture;
|
||||||
std::map<size_t, std::vector<RigCompletionData>> completionsPerEclipseCellPerforations;
|
std::map<size_t, std::vector<RigCompletionData>> completionsPerEclipseCellPerforations;
|
||||||
|
|
||||||
for ( auto wellPath : allWellPathLaterals )
|
for ( auto wellPathLateral : allWellPathLaterals )
|
||||||
{
|
{
|
||||||
// Generate completion data
|
// Generate completion data
|
||||||
|
|
||||||
if ( exportSettings.includePerforations )
|
if ( exportSettings.includePerforations )
|
||||||
{
|
{
|
||||||
std::vector<RigCompletionData> perforationCompletionData =
|
std::vector<RigCompletionData> perforationCompletionData =
|
||||||
generatePerforationsCompdatValues( wellPath,
|
generatePerforationsCompdatValues( wellPathLateral,
|
||||||
wellPath->perforationIntervalCollection()->perforations(),
|
wellPathLateral->perforationIntervalCollection()->perforations(),
|
||||||
exportSettings );
|
exportSettings );
|
||||||
|
|
||||||
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, perforationCompletionData );
|
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, perforationCompletionData );
|
||||||
@ -184,7 +184,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
{
|
{
|
||||||
std::vector<RigCompletionData> fishbonesCompletionData =
|
std::vector<RigCompletionData> fishbonesCompletionData =
|
||||||
RicFishbonesTransmissibilityCalculationFeatureImp::
|
RicFishbonesTransmissibilityCalculationFeatureImp::
|
||||||
generateFishboneCompdatValuesUsingAdjustedCellVolume( wellPath, exportSettings );
|
generateFishboneCompdatValuesUsingAdjustedCellVolume( wellPathLateral, exportSettings );
|
||||||
|
|
||||||
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, fishbonesCompletionData );
|
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, fishbonesCompletionData );
|
||||||
appendCompletionData( &completionsPerEclipseCellFishbones, fishbonesCompletionData );
|
appendCompletionData( &completionsPerEclipseCellFishbones, fishbonesCompletionData );
|
||||||
@ -196,7 +196,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
std::vector<RicWellPathFractureReportItem>* reportItems = &fractureDataReportItems;
|
std::vector<RicWellPathFractureReportItem>* reportItems = &fractureDataReportItems;
|
||||||
|
|
||||||
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::
|
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::
|
||||||
generateCompdatValuesForWellPath( wellPath,
|
generateCompdatValuesForWellPath( wellPathLateral,
|
||||||
exportSettings.caseToApply(),
|
exportSettings.caseToApply(),
|
||||||
reportItems,
|
reportItems,
|
||||||
fractureTransmissibilityExportInformationStream.get(),
|
fractureTransmissibilityExportInformationStream.get(),
|
||||||
@ -281,7 +281,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
}
|
}
|
||||||
else if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL )
|
else if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL )
|
||||||
{
|
{
|
||||||
for ( auto wellPath : topLevelWellPaths )
|
for ( auto wellPath : wellPaths )
|
||||||
{
|
{
|
||||||
std::vector<RigCompletionData> completionsForWell;
|
std::vector<RigCompletionData> completionsForWell;
|
||||||
for ( const auto& completion : completions )
|
for ( const auto& completion : completions )
|
||||||
@ -324,7 +324,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
|
|
||||||
for ( const auto& completionType : completionTypes )
|
for ( const auto& completionType : completionTypes )
|
||||||
{
|
{
|
||||||
for ( auto wellPath : topLevelWellPaths )
|
for ( auto wellPath : wellPaths )
|
||||||
{
|
{
|
||||||
std::vector<RigCompletionData> completionsForWell;
|
std::vector<RigCompletionData> completionsForWell;
|
||||||
for ( const auto& completion : completions )
|
for ( const auto& completion : completions )
|
||||||
@ -408,7 +408,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
|||||||
|
|
||||||
if ( exportSettings.includeMsw )
|
if ( exportSettings.includeMsw )
|
||||||
{
|
{
|
||||||
RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions( exportSettings, topLevelWellPaths );
|
RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions( exportSettings, wellPaths );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,18 +1012,11 @@ std::vector<const RimWellPathComponentInterface*> RimWellPath::allCompletionsRec
|
|||||||
{
|
{
|
||||||
std::vector<const RimWellPathComponentInterface*> allCompletions;
|
std::vector<const RimWellPathComponentInterface*> allCompletions;
|
||||||
|
|
||||||
auto tieInWells = wellPathLateralsRecursively();
|
auto laterals = allWellPathLaterals();
|
||||||
tieInWells.push_back( const_cast<RimWellPath*>( this ) );
|
for ( auto w : laterals )
|
||||||
|
|
||||||
for ( auto w : tieInWells )
|
|
||||||
{
|
{
|
||||||
std::vector<const RimWellPathCompletions*> completionCollections;
|
auto completions = w->completions()->allCompletions();
|
||||||
w->descendantsOfType( completionCollections );
|
allCompletions.insert( allCompletions.end(), completions.begin(), completions.end() );
|
||||||
for ( auto collection : completionCollections )
|
|
||||||
{
|
|
||||||
std::vector<const RimWellPathComponentInterface*> completions = collection->allCompletions();
|
|
||||||
allCompletions.insert( allCompletions.end(), completions.begin(), completions.end() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return allCompletions;
|
return allCompletions;
|
||||||
@ -1124,6 +1117,8 @@ const RimWellPath* RimWellPath::topLevelWellPath() const
|
|||||||
{
|
{
|
||||||
if ( m_wellPathTieIn() && m_wellPathTieIn->parentWell() )
|
if ( m_wellPathTieIn() && m_wellPathTieIn->parentWell() )
|
||||||
{
|
{
|
||||||
|
if ( m_wellPathTieIn->parentWell() == this ) return this;
|
||||||
|
|
||||||
return m_wellPathTieIn()->parentWell()->topLevelWellPath();
|
return m_wellPathTieIn()->parentWell()->topLevelWellPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1133,32 +1128,38 @@ const RimWellPath* RimWellPath::topLevelWellPath() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellPath::updateAfterAddingToWellPathGroup()
|
void RimWellPath::wellPathLateralsRecursively( std::vector<RimWellPath*>& wellPathLaterals ) const
|
||||||
{
|
{
|
||||||
|
wellPathLaterals.push_back( const_cast<RimWellPath*>( this ) );
|
||||||
|
|
||||||
|
std::vector<caf::PdmObjectHandle*> referringObjects;
|
||||||
|
this->objectsWithReferringPtrFields( referringObjects );
|
||||||
|
for ( auto obj : referringObjects )
|
||||||
|
{
|
||||||
|
if ( auto tieIn = dynamic_cast<RimWellPathTieIn*>( obj ) )
|
||||||
|
{
|
||||||
|
auto tieInWellPath = tieIn->childWell();
|
||||||
|
if ( tieInWellPath )
|
||||||
|
{
|
||||||
|
if ( std::find( wellPathLaterals.begin(), wellPathLaterals.end(), tieInWellPath ) == wellPathLaterals.end() )
|
||||||
|
{
|
||||||
|
tieInWellPath->wellPathLateralsRecursively( wellPathLaterals );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimWellPath*> RimWellPath::wellPathLateralsRecursively() const
|
std::vector<RimWellPath*> RimWellPath::allWellPathLaterals() const
|
||||||
{
|
{
|
||||||
std::vector<RimWellPath*> tieInWells;
|
std::vector<RimWellPath*> laterals;
|
||||||
|
|
||||||
auto wellPathColl = RimTools::wellPathCollection();
|
this->wellPathLateralsRecursively( laterals );
|
||||||
if ( wellPathColl )
|
|
||||||
{
|
|
||||||
wellPathColl->allWellPaths();
|
|
||||||
|
|
||||||
for ( auto w : wellPathColl->allWellPaths() )
|
return laterals;
|
||||||
{
|
|
||||||
if ( w->topLevelWellPath() == this )
|
|
||||||
{
|
|
||||||
tieInWells.push_back( w );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tieInWells;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -161,8 +161,7 @@ public:
|
|||||||
bool isMultiLateralWellPath() const;
|
bool isMultiLateralWellPath() const;
|
||||||
RimWellPath* topLevelWellPath();
|
RimWellPath* topLevelWellPath();
|
||||||
const RimWellPath* topLevelWellPath() const;
|
const RimWellPath* topLevelWellPath() const;
|
||||||
void updateAfterAddingToWellPathGroup();
|
std::vector<RimWellPath*> allWellPathLaterals() const;
|
||||||
std::vector<RimWellPath*> wellPathLateralsRecursively() const;
|
|
||||||
|
|
||||||
RimWellPathTieIn* wellPathTieIn() const;
|
RimWellPathTieIn* wellPathTieIn() const;
|
||||||
void connectWellPaths( RimWellPath* childWell, double tieInMeasuredDepth );
|
void connectWellPaths( RimWellPath* childWell, double tieInMeasuredDepth );
|
||||||
@ -214,6 +213,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static size_t simulationWellBranchCount( const QString& simWellName );
|
static size_t simulationWellBranchCount( const QString& simWellName );
|
||||||
|
void wellPathLateralsRecursively( std::vector<RimWellPath*>& wellPathLaterals ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Geometry and data
|
// Geometry and data
|
||||||
|
Loading…
Reference in New Issue
Block a user