Fix crashes when exporting completions from input grid

This commit is contained in:
Gaute Lindkvist 2020-10-09 14:46:34 +02:00
parent c291f22d4d
commit 647bf0cf46
2 changed files with 11 additions and 4 deletions

View File

@ -1164,12 +1164,16 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::gener
const RigActiveCellInfo* activeCellInfo =
settings.caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
auto timeSteps = settings.caseToApply->timeStepDates();
if ( wellPath->perforationIntervalCollection()->isChecked() )
{
for ( const RimPerforationInterval* interval : intervals )
{
if ( !interval->isChecked() ) continue;
if ( !interval->isActiveOnDate( settings.caseToApply->timeStepDates()[settings.timeStep] ) ) continue;
if ( (size_t)settings.timeStep < timeSteps.size() &&
!interval->isActiveOnDate( settings.caseToApply->timeStepDates()[settings.timeStep] ) )
continue;
using namespace std;
pair<vector<cvf::Vec3d>, vector<double>> perforationPointsAndMD =

View File

@ -807,7 +807,8 @@ double RicWellPathExportMswCompletionsImpl::calculateLengthThroughActiveCells(
double totalOverlap = 0.0;
for ( const WellPathCellIntersectionInfo& intersection : wellPathIntersections )
{
if ( activeCellInfo->isActive( intersection.globCellIndex ) )
if ( intersection.globCellIndex < activeCellInfo->reservoirCellCount() &&
activeCellInfo->isActive( intersection.globCellIndex ) )
{
double overlapStart = std::max( startMD, intersection.startMD );
double overlapEnd = std::min( endMD, intersection.endMD );
@ -1993,8 +1994,10 @@ std::vector<RigCompletionData>
const RigActiveCellInfo* activeCellInfo =
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
if ( wellPath->perforationIntervalCollection()->isChecked() && perforationInterval->isChecked() &&
perforationInterval->isActiveOnDate( eclipseCase->timeStepDates()[timeStep] ) )
bool hasDate = (size_t)timeStep < eclipseCase->timeStepDates().size();
bool isActive = !hasDate || perforationInterval->isActiveOnDate( eclipseCase->timeStepDates()[timeStep] );
if ( wellPath->perforationIntervalCollection()->isChecked() && perforationInterval->isChecked() && isActive )
{
std::pair<std::vector<cvf::Vec3d>, std::vector<double>> perforationPointsAndMD =
wellPath->wellPathGeometry()->clippedPointSubset( perforationInterval->startMD(),