From 87977824db1ab97c23213274ac83f382cc6fd42c Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 14 Mar 2018 15:52:10 +0100 Subject: [PATCH] Guard for missing well path --- ...sTransmissibilityCalculationFeatureImp.cpp | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index d372d0bc0b..f1947ed92c 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -65,6 +65,8 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) { + if (!wellPath) return; + // Generate data const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData(); std::vector locations = RicWellPathExportCompletionDataFeatureImpl::findWellSegmentLocations(settings.caseToApply, wellPath); @@ -101,8 +103,15 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell /// //-------------------------------------------------------------------------------------------------- std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath, - const RicExportCompletionDataSettingsUi& settings) + const RicExportCompletionDataSettingsUi& settings) { + std::vector completionData; + + if (!wellPath || !wellPath->completions()) + { + return completionData; + } + std::map > wellBorePartsInCells; //wellBore = main bore or fishbone lateral findFishboneLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings); findFishboneImportedLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings); @@ -111,8 +120,6 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp findMainWellBoreParts(wellBorePartsInCells, wellPath, settings); } - std::vector completionData; - const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); for (const auto& cellAndWellBoreParts : wellBorePartsInCells) @@ -200,6 +207,10 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate const RicExportCompletionDataSettingsUi& settings) { RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType(); + + if (!wellPath) return; + if (!wellPath->wellPathGeometry()) return; + std::set wellPathCells = RicFishbonesTransmissibilityCalculationFeatureImp::findIntersectedCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints); bool isMainBore = false; @@ -235,6 +246,9 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) { + if (!wellPath) return; + if (!wellPath->wellPathGeometry()) return; + RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType(); bool isMainBore = true; double holeDiameter = wellPath->fishbonesCollection()->mainBoreDiameter(unitSystem); @@ -250,6 +264,8 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st fishbonePerfWellPathCoords.first, fishbonePerfWellPathCoords.second); + if (!wellPath->fishbonesCollection()) return; + for (auto& cell : intersectedCellsIntersectionInfo) { double skinFactor = wellPath->fishbonesCollection()->mainBoreSkinFactor(); @@ -273,6 +289,11 @@ std::set RicFishbonesTransmissibilityCalculationFeatureImp::findIntersec { std::set cells; + if (!caseData) + { + return cells; + } + std::vector intersections = RigWellPathIntersectionTools::findRawHexCellIntersections(caseData->mainGrid(), coords); for (auto intersection : intersections) {