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::set<RimWellPath*> laterals;
|
||||
std::set<RimWellPath*> lateralSet;
|
||||
|
||||
for ( auto t : topLevelWells )
|
||||
{
|
||||
auto laterals = t->wellPathLateralsRecursively();
|
||||
auto laterals = t->allWellPathLaterals();
|
||||
for ( auto l : laterals )
|
||||
{
|
||||
allLaterals.push_back( l );
|
||||
lateralSet.insert( l );
|
||||
}
|
||||
}
|
||||
|
||||
allLaterals.assign( lateralSet.begin(), lateralSet.end() );
|
||||
}
|
||||
|
||||
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 RicExportCompletionDataSettingsUi& exportSettings )
|
||||
{
|
||||
@ -142,21 +142,21 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
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;
|
||||
if ( topLevelWellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType() )
|
||||
if ( wellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType() )
|
||||
{
|
||||
allWellPathLaterals = topLevelWellPath->wellPathLateralsRecursively();
|
||||
allWellPathLaterals = wellPath->allWellPathLaterals();
|
||||
}
|
||||
else
|
||||
{
|
||||
int caseId = exportSettings.caseToApply->caseId();
|
||||
QString format = QString(
|
||||
"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 );
|
||||
}
|
||||
|
||||
@ -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>> completionsPerEclipseCellPerforations;
|
||||
|
||||
for ( auto wellPath : allWellPathLaterals )
|
||||
for ( auto wellPathLateral : allWellPathLaterals )
|
||||
{
|
||||
// Generate completion data
|
||||
|
||||
if ( exportSettings.includePerforations )
|
||||
{
|
||||
std::vector<RigCompletionData> perforationCompletionData =
|
||||
generatePerforationsCompdatValues( wellPath,
|
||||
wellPath->perforationIntervalCollection()->perforations(),
|
||||
generatePerforationsCompdatValues( wellPathLateral,
|
||||
wellPathLateral->perforationIntervalCollection()->perforations(),
|
||||
exportSettings );
|
||||
|
||||
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, perforationCompletionData );
|
||||
@ -184,7 +184,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
{
|
||||
std::vector<RigCompletionData> fishbonesCompletionData =
|
||||
RicFishbonesTransmissibilityCalculationFeatureImp::
|
||||
generateFishboneCompdatValuesUsingAdjustedCellVolume( wellPath, exportSettings );
|
||||
generateFishboneCompdatValuesUsingAdjustedCellVolume( wellPathLateral, exportSettings );
|
||||
|
||||
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, fishbonesCompletionData );
|
||||
appendCompletionData( &completionsPerEclipseCellFishbones, fishbonesCompletionData );
|
||||
@ -196,7 +196,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
std::vector<RicWellPathFractureReportItem>* reportItems = &fractureDataReportItems;
|
||||
|
||||
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::
|
||||
generateCompdatValuesForWellPath( wellPath,
|
||||
generateCompdatValuesForWellPath( wellPathLateral,
|
||||
exportSettings.caseToApply(),
|
||||
reportItems,
|
||||
fractureTransmissibilityExportInformationStream.get(),
|
||||
@ -281,7 +281,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
}
|
||||
else if ( exportSettings.fileSplit == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL )
|
||||
{
|
||||
for ( auto wellPath : topLevelWellPaths )
|
||||
for ( auto wellPath : wellPaths )
|
||||
{
|
||||
std::vector<RigCompletionData> completionsForWell;
|
||||
for ( const auto& completion : completions )
|
||||
@ -324,7 +324,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
|
||||
for ( const auto& completionType : completionTypes )
|
||||
{
|
||||
for ( auto wellPath : topLevelWellPaths )
|
||||
for ( auto wellPath : wellPaths )
|
||||
{
|
||||
std::vector<RigCompletionData> completionsForWell;
|
||||
for ( const auto& completion : completions )
|
||||
@ -408,7 +408,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
|
||||
|
||||
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;
|
||||
|
||||
auto tieInWells = wellPathLateralsRecursively();
|
||||
tieInWells.push_back( const_cast<RimWellPath*>( this ) );
|
||||
|
||||
for ( auto w : tieInWells )
|
||||
auto laterals = allWellPathLaterals();
|
||||
for ( auto w : laterals )
|
||||
{
|
||||
std::vector<const RimWellPathCompletions*> completionCollections;
|
||||
w->descendantsOfType( completionCollections );
|
||||
for ( auto collection : completionCollections )
|
||||
{
|
||||
std::vector<const RimWellPathComponentInterface*> completions = collection->allCompletions();
|
||||
allCompletions.insert( allCompletions.end(), completions.begin(), completions.end() );
|
||||
}
|
||||
auto completions = w->completions()->allCompletions();
|
||||
allCompletions.insert( allCompletions.end(), completions.begin(), completions.end() );
|
||||
}
|
||||
|
||||
return allCompletions;
|
||||
@ -1124,6 +1117,8 @@ const RimWellPath* RimWellPath::topLevelWellPath() const
|
||||
{
|
||||
if ( m_wellPathTieIn() && m_wellPathTieIn->parentWell() )
|
||||
{
|
||||
if ( m_wellPathTieIn->parentWell() == this ) return this;
|
||||
|
||||
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();
|
||||
if ( wellPathColl )
|
||||
{
|
||||
wellPathColl->allWellPaths();
|
||||
this->wellPathLateralsRecursively( laterals );
|
||||
|
||||
for ( auto w : wellPathColl->allWellPaths() )
|
||||
{
|
||||
if ( w->topLevelWellPath() == this )
|
||||
{
|
||||
tieInWells.push_back( w );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tieInWells;
|
||||
return laterals;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -161,8 +161,7 @@ public:
|
||||
bool isMultiLateralWellPath() const;
|
||||
RimWellPath* topLevelWellPath();
|
||||
const RimWellPath* topLevelWellPath() const;
|
||||
void updateAfterAddingToWellPathGroup();
|
||||
std::vector<RimWellPath*> wellPathLateralsRecursively() const;
|
||||
std::vector<RimWellPath*> allWellPathLaterals() const;
|
||||
|
||||
RimWellPathTieIn* wellPathTieIn() const;
|
||||
void connectWellPaths( RimWellPath* childWell, double tieInMeasuredDepth );
|
||||
@ -214,6 +213,7 @@ private:
|
||||
|
||||
private:
|
||||
static size_t simulationWellBranchCount( const QString& simWellName );
|
||||
void wellPathLateralsRecursively( std::vector<RimWellPath*>& wellPathLaterals ) const;
|
||||
|
||||
private:
|
||||
// Geometry and data
|
||||
|
Loading…
Reference in New Issue
Block a user