mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Guard against missing well results
When project file has settings for wells but there are no well results p4#: 20416
This commit is contained in:
@@ -261,6 +261,27 @@ void RimReservoirView::updateViewerWidgetWindowTitle()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::clampCurrentTimestep()
|
||||
{
|
||||
// Clamp the current timestep to actual possibilities
|
||||
if (this->gridCellResults())
|
||||
{
|
||||
if (m_currentTimeStep() > this->gridCellResults()->maxTimeStepCount())
|
||||
{
|
||||
m_currentTimeStep = this->gridCellResults()->maxTimeStepCount() -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_currentTimeStep < 0 ) m_currentTimeStep = 0;
|
||||
|
||||
if (!this->cellResult()->hasResult() || cellResult->hasStaticResult())
|
||||
{
|
||||
m_currentTimeStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -271,11 +292,11 @@ void RimReservoirView::createDisplayModelAndRedraw()
|
||||
{
|
||||
m_viewer->animationControl()->slotStop();
|
||||
|
||||
this->clampCurrentTimestep();
|
||||
|
||||
createDisplayModel();
|
||||
updateDisplayModelVisibility();
|
||||
|
||||
if (m_currentTimeStep < 0 ) m_currentTimeStep = 0;
|
||||
|
||||
if (m_viewer->frameCount() > 0)
|
||||
{
|
||||
m_viewer->animationControl()->setCurrentFrame(m_currentTimeStep);
|
||||
@@ -708,6 +729,7 @@ void RimReservoirView::loadDataAndUpdate()
|
||||
m_geometry->clearGeometryCache();
|
||||
|
||||
syncronizeWellsWithResults();
|
||||
this->clampCurrentTimestep();
|
||||
|
||||
createDisplayModel();
|
||||
updateDisplayModelVisibility();
|
||||
|
||||
Reference in New Issue
Block a user