#1623 Schedule invalidation of completion type results instead of immediate calculation

This commit is contained in:
Bjørnar Grip Fjær
2017-06-20 16:15:47 +02:00
parent 5a02cf1498
commit 78c948ea89
6 changed files with 37 additions and 18 deletions

View File

@@ -213,11 +213,12 @@ RiaApplication::RiaApplication(int& argc, char** argv)
// instead of using the application font
m_standardFont = new caf::FixedAtlasFont(caf::FixedAtlasFont::POINT_SIZE_8);
m_resViewUpdateTimer = NULL;
m_resViewUpdateTimer = nullptr;
m_recalculateCompletionTypeTimer = nullptr;
m_runningRegressionTests = false;
m_mainPlotWindow = NULL;
m_mainPlotWindow = nullptr;
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
}
@@ -2744,6 +2745,21 @@ void RiaApplication::scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdat
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::scheduleRecalculateCompletionTypeAndRedraw()
{
if (!m_recalculateCompletionTypeTimer)
{
m_recalculateCompletionTypeTimer = new QTimer(this);
m_recalculateCompletionTypeTimer->setSingleShot(true);
connect(m_recalculateCompletionTypeTimer, SIGNAL(timeout()), this, SLOT(slotRecaulculateCompletionType()));
}
m_recalculateCompletionTypeTimer->start(500);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2784,6 +2800,17 @@ void RiaApplication::slotUpdateScheduledDisplayModels()
m_resViewsToUpdate.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::slotRecaulculateCompletionType()
{
for (RimEclipseCase* eclipseCase : project()->activeOilField()->analysisModels->cases())
{
eclipseCase->recalculateCompletionTypeAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -99,6 +99,7 @@ public:
RimViewWindow* activePlotWindow() const;
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
void scheduleRecalculateCompletionTypeAndRedraw();
RimProject* project();
@@ -224,6 +225,7 @@ private:
private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void slotUpdateScheduledDisplayModels();
void slotRecaulculateCompletionType();
// Friend classes required to have access to slotUpdateScheduledDisplayModels
// As snapshots are produced fast in sequence, the feature must have access to force redraw
@@ -238,6 +240,7 @@ private:
std::vector<caf::PdmPointer<RimView> > m_resViewsToUpdate;
QTimer* m_resViewUpdateTimer;
QTimer* m_recalculateCompletionTypeTimer;
RiaSocketServer* m_socketServer;

View File

@@ -249,9 +249,9 @@ RimEclipseView* RimEclipseCase::createCopyAndAddView(const RimEclipseView* sourc
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::removeEclipseResultAndScheduleRedrawAllViews(RiaDefines::ResultCatType type, const QString& resultName)
void RimEclipseCase::recalculateCompletionTypeAndRedrawAllViews()
{
m_matrixModelResults->clearScalarResult(type, resultName);
m_matrixModelResults->clearScalarResult(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName());
for (RimView* view : views())
{

View File

@@ -78,7 +78,7 @@ public:
RimEclipseView* createAndAddReservoirView();
RimEclipseView* createCopyAndAddView(const RimEclipseView* sourceView);
void removeEclipseResultAndScheduleRedrawAllViews(RiaDefines::ResultCatType type, const QString& resultName);
void recalculateCompletionTypeAndRedrawAllViews();
virtual QString locationOnDisc() const { return QString(); }
virtual QString gridFileName() const { return QString(); }

View File

@@ -769,18 +769,8 @@ bool RimProject::showPlotWindow() const
//--------------------------------------------------------------------------------------------------
void RimProject::reloadCompletionTypeResultsInAllViews()
{
removeEclipseResultAndRedrawAllViews(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::removeEclipseResultAndRedrawAllViews(RiaDefines::ResultCatType type, const QString & resultName)
{
for (RimEclipseCase* eclipseCase : activeOilField()->analysisModels->cases)
{
eclipseCase->removeEclipseResultAndScheduleRedrawAllViews(type, resultName);
}
createDisplayModelAndRedrawAllViews();
RiaApplication::instance()->scheduleRecalculateCompletionTypeAndRedraw();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -123,7 +123,6 @@ protected:
private:
void appendScriptItems(QMenu* menu, RimScriptCollection* scriptCollection);
void removeEclipseResultAndRedrawAllViews(RiaDefines::ResultCatType type, const QString& resultName);
private:
caf::PdmField<QString> m_projectFileVersionString;