#3300 Fix crash when loading formation indices as part of a project file.

* Rename structGrid() to getOrCreateStructGrid() to make it obvious that it allocates internally.
This commit is contained in:
Gaute Lindkvist
2018-08-31 10:35:33 +02:00
parent 116c61eaf8
commit 4fd9cdfda3
12 changed files with 23 additions and 20 deletions

View File

@@ -108,9 +108,9 @@ void RigCaseToCaseRangeFilterMapper::convertRangeFilter(const RimCellRangeFilter
}
else
{
maxIIndex = femPart->structGrid()->cellCountI()- 1;
maxJIndex = femPart->structGrid()->cellCountJ()- 1;
maxKIndex = femPart->structGrid()->cellCountK()- 1;
maxIIndex = femPart->getOrCreateStructGrid()->cellCountI()- 1;
maxJIndex = femPart->getOrCreateStructGrid()->cellCountJ()- 1;
maxKIndex = femPart->getOrCreateStructGrid()->cellCountK()- 1;
}
src.EndI = CVF_MIN(src.EndI, maxIIndex);
@@ -398,7 +398,7 @@ RigCaseToCaseRangeFilterMapper::findBestFemCellFromEclCell(const RigMainGrid* ma
if (elmIdxToBestMatch != -1)
{
bool validIndex = dependentFemPart->structGrid()->ijkFromCellIndex(elmIdxToBestMatch, fi, fj, fk);
bool validIndex = dependentFemPart->getOrCreateStructGrid()->ijkFromCellIndex(elmIdxToBestMatch, fi, fj, fk);
CVF_ASSERT(validIndex);
}
else
@@ -429,7 +429,7 @@ RigCaseToCaseRangeFilterMapper::findBestEclCellFromFemCell(const RigFemPart* dep
bool isEclFaceNormalsOutwards = masterEclGrid->isFaceNormalsOutwards();
int elementIdx = static_cast<int>(dependentFemPart->structGrid()->cellIndexFromIJK(fi, fj, fk));
int elementIdx = static_cast<int>(dependentFemPart->getOrCreateStructGrid()->cellIndexFromIJK(fi, fj, fk));
cvf::Vec3d elmCorners[8];
RigCaseToCaseCellMapperTools::elementCorners(dependentFemPart, elementIdx, elmCorners);

View File

@@ -74,7 +74,7 @@ const cvf::StructGridInterface* RigReservoirGridTools::gridByIndex(RimCase* rimC
}
else if (geoMechPartCollection)
{
return geoMechPartCollection->part(gridIndex)->structGrid();
return geoMechPartCollection->part(gridIndex)->getOrCreateStructGrid();
}
return nullptr;