mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix crashes when reading an odb file fails due to corruption
This commit is contained in:
parent
51fb8a6935
commit
54c7932806
@ -184,8 +184,13 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr(RivGeoMechPartMgrCache:
|
|||||||
}
|
}
|
||||||
|
|
||||||
RivGeoMechPartMgr* partMgrToUpdate = m_partMgrCache->partMgr(pMgrKey);
|
RivGeoMechPartMgr* partMgrToUpdate = m_partMgrCache->partMgr(pMgrKey);
|
||||||
RigGeoMechCaseData* caseData = m_geomechView->geoMechCase()->geoMechData();
|
int partCount = 0;
|
||||||
int partCount = caseData->femParts()->partCount();
|
RigGeoMechCaseData* caseData = nullptr;
|
||||||
|
if ( m_geomechView->geoMechCase() )
|
||||||
|
{
|
||||||
|
caseData = m_geomechView->geoMechCase()->geoMechData();
|
||||||
|
partCount = caseData->femParts()->partCount();
|
||||||
|
}
|
||||||
|
|
||||||
if (partMgrToUpdate->initializedFemPartCount() != partCount)
|
if (partMgrToUpdate->initializedFemPartCount() != partCount)
|
||||||
{
|
{
|
||||||
@ -254,6 +259,8 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr(RivGeoMechPartMgrCache:
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStepIndex)
|
void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStepIndex)
|
||||||
{
|
{
|
||||||
|
if (!m_geomechView->geoMechCase()) return;
|
||||||
|
|
||||||
size_t gridCount = m_geomechView->geoMechCase()->geoMechData()->femParts()->partCount();
|
size_t gridCount = m_geomechView->geoMechCase()->geoMechData()->femParts()->partCount();
|
||||||
|
|
||||||
if (gridCount == 0) return;
|
if (gridCount == 0) return;
|
||||||
|
@ -914,7 +914,9 @@ QString Rim3dOverlayInfoConfig::timeStepText(RimEclipseView* eclipseView)
|
|||||||
QString Rim3dOverlayInfoConfig::timeStepText(RimGeoMechView* geoMechView)
|
QString Rim3dOverlayInfoConfig::timeStepText(RimGeoMechView* geoMechView)
|
||||||
{
|
{
|
||||||
int currTimeStepIndex = geoMechView->currentTimeStep();
|
int currTimeStepIndex = geoMechView->currentTimeStep();
|
||||||
QStringList timeSteps = geoMechView->geoMechCase()->timeStepStrings();
|
|
||||||
|
QStringList timeSteps;
|
||||||
|
if (geoMechView->geoMechCase()) timeSteps = geoMechView->geoMechCase()->timeStepStrings();
|
||||||
|
|
||||||
QString dateTimeString;
|
QString dateTimeString;
|
||||||
if (currTimeStepIndex >= 0 && currTimeStepIndex < timeSteps.size())
|
if (currTimeStepIndex >= 0 && currTimeStepIndex < timeSteps.size())
|
||||||
|
@ -147,6 +147,8 @@ void RimCellRangeFilter::setDefaultValues()
|
|||||||
|
|
||||||
const cvf::StructGridInterface* grid = selectedGrid();
|
const cvf::StructGridInterface* grid = selectedGrid();
|
||||||
|
|
||||||
|
if (!grid) return;
|
||||||
|
|
||||||
Rim3dView* rimView = nullptr;
|
Rim3dView* rimView = nullptr;
|
||||||
this->firstAncestorOrThisOfTypeAsserted(rimView);
|
this->firstAncestorOrThisOfTypeAsserted(rimView);
|
||||||
RigActiveCellInfo* actCellInfo = RigReservoirGridTools::activeCellInfo(rimView);
|
RigActiveCellInfo* actCellInfo = RigReservoirGridTools::activeCellInfo(rimView);
|
||||||
@ -208,6 +210,8 @@ void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cvf::StructGridInterface* grid = selectedGrid();
|
const cvf::StructGridInterface* grid = selectedGrid();
|
||||||
|
|
||||||
|
if (!grid) return;
|
||||||
|
|
||||||
if (field == &startIndexI || field == &cellCountI)
|
if (field == &startIndexI || field == &cellCountI)
|
||||||
{
|
{
|
||||||
|
@ -139,7 +139,10 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
|
|||||||
|
|
||||||
if (m_compactionRefLayerUiField == (int)RigFemResultAddress::NO_COMPACTION)
|
if (m_compactionRefLayerUiField == (int)RigFemResultAddress::NO_COMPACTION)
|
||||||
{
|
{
|
||||||
m_compactionRefLayerUiField = (int)m_geomCase->geoMechData()->femParts()->part(0)->structGrid()->reservoirIJKBoundingBox().first.z();
|
if (m_geomCase && m_geomCase->geoMechData() )
|
||||||
|
{
|
||||||
|
m_compactionRefLayerUiField = (int)m_geomCase->geoMechData()->femParts()->part(0)->structGrid()->reservoirIJKBoundingBox().first.z();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,10 +202,13 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(
|
|||||||
}
|
}
|
||||||
else if (&m_compactionRefLayerUiField == fieldNeedingOptions)
|
else if (&m_compactionRefLayerUiField == fieldNeedingOptions)
|
||||||
{
|
{
|
||||||
size_t kCount = m_geomCase->geoMechData()->femParts()->part(0)->structGrid()->gridPointCountK() - 1;
|
if (m_geomCase->geoMechData())
|
||||||
for (size_t layerIdx = 0; layerIdx < kCount; ++layerIdx)
|
|
||||||
{
|
{
|
||||||
options.push_back(caf::PdmOptionItemInfo(QString::number(layerIdx + 1), (int)layerIdx));
|
size_t kCount = m_geomCase->geoMechData()->femParts()->part(0)->structGrid()->gridPointCountK() - 1;
|
||||||
|
for ( size_t layerIdx = 0; layerIdx < kCount; ++layerIdx )
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(QString::number(layerIdx + 1), (int)layerIdx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,7 +294,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
m_compactionRefLayer = m_compactionRefLayerUiField();
|
m_compactionRefLayer = m_compactionRefLayerUiField();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
|
if (m_geomCase->geoMechData() && m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
|
||||||
{
|
{
|
||||||
if (view) view->hasUserRequestedAnimation = true;
|
if (view) view->hasUserRequestedAnimation = true;
|
||||||
}
|
}
|
||||||
@ -416,7 +422,7 @@ void RimGeoMechResultDefinition::initAfterRead()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGeoMechResultDefinition::loadResult()
|
void RimGeoMechResultDefinition::loadResult()
|
||||||
{
|
{
|
||||||
if (m_geomCase)
|
if (m_geomCase && m_geomCase->geoMechData())
|
||||||
{
|
{
|
||||||
m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress());
|
m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress());
|
||||||
}
|
}
|
||||||
|
@ -215,12 +215,15 @@ QString RiuFemResultTextBuilder::formationDetails()
|
|||||||
|
|
||||||
size_t k = cvf::UNDEFINED_SIZE_T;
|
size_t k = cvf::UNDEFINED_SIZE_T;
|
||||||
{
|
{
|
||||||
RigGeoMechCaseData* geomData = m_reservoirView->geoMechCase()->geoMechData();
|
if ( m_reservoirView->geoMechCase() )
|
||||||
if(geomData)
|
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
RigGeoMechCaseData* geomData = m_reservoirView->geoMechCase()->geoMechData();
|
||||||
size_t j = 0;
|
if ( geomData )
|
||||||
geomData->femParts()->part(m_gridIndex)->structGrid()->ijkFromCellIndex(m_cellIndex, &i, &j, &k);
|
{
|
||||||
|
size_t i = 0;
|
||||||
|
size_t j = 0;
|
||||||
|
geomData->femParts()->part(m_gridIndex)->structGrid()->ijkFromCellIndex(m_cellIndex, &i, &j, &k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user