mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1004 Add reload function to eclipse cases to reload all data from file
This commit is contained in:
parent
029809bf90
commit
201ff5699d
@ -45,6 +45,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -83,6 +85,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
69
ApplicationCode/Commands/RicReloadCaseFeature.cpp
Normal file
69
ApplicationCode/Commands/RicReloadCaseFeature.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicReloadCaseFeature.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicReloadCaseFeature, "RicReloadCaseFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicReloadCaseFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedFormationNamesCollObjs);
|
||||
for (caf::PdmObject* pdmObject : selectedFormationNamesCollObjs) {
|
||||
if (dynamic_cast<RimEclipseCase*>(pdmObject))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadCaseFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseCase*> selectedEclipseCases;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedEclipseCases);
|
||||
|
||||
for (RimEclipseCase* selectedCase : selectedEclipseCases)
|
||||
{
|
||||
selectedCase->releaseResultData();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadCaseFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Reload");
|
||||
actionToSetup->setIcon(QIcon(":/Refresh-32.png"));
|
||||
}
|
32
ApplicationCode/Commands/RicReloadCaseFeature.h
Normal file
32
ApplicationCode/Commands/RicReloadCaseFeature.h
Normal file
@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RicReloadCaseFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered(bool isChecked);
|
||||
virtual void setupActionLook(QAction* actionToSetup);
|
||||
};
|
@ -407,6 +407,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicReloadCaseFeature";
|
||||
commandIds << "RicExecuteScriptForCasesFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||
|
@ -297,40 +297,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
{
|
||||
if (changedField == &releaseResultMemory)
|
||||
{
|
||||
if (this->eclipseCaseData())
|
||||
{
|
||||
for (size_t i = 0; i < reservoirViews().size(); i++)
|
||||
{
|
||||
RimEclipseView* reservoirView = reservoirViews()[i];
|
||||
CVF_ASSERT(reservoirView);
|
||||
|
||||
RimEclipseCellColors* result = reservoirView->cellResult;
|
||||
CVF_ASSERT(result);
|
||||
|
||||
result->setResultVariable(RimDefines::undefinedResultName());
|
||||
result->loadResult();
|
||||
|
||||
RimCellEdgeColors* cellEdgeResult = reservoirView->cellEdgeResult;
|
||||
CVF_ASSERT(cellEdgeResult);
|
||||
|
||||
cellEdgeResult->setResultVariable(RimDefines::undefinedResultName());
|
||||
cellEdgeResult->loadResult();
|
||||
|
||||
reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
if (matrixModelResults)
|
||||
{
|
||||
matrixModelResults->clearAllResults();
|
||||
}
|
||||
|
||||
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
if (fractureModelResults)
|
||||
{
|
||||
fractureModelResults->clearAllResults();
|
||||
}
|
||||
}
|
||||
releaseResultData();
|
||||
|
||||
releaseResultMemory = oldValue.toBool();
|
||||
}
|
||||
@ -664,6 +631,37 @@ QString RimEclipseCase::timeStepName(int frameIdx)
|
||||
return date.toString(m_timeStepFormatString);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCase::releaseResultData()
|
||||
{
|
||||
if (this->eclipseCaseData())
|
||||
{
|
||||
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
if (matrixModelResults)
|
||||
{
|
||||
matrixModelResults->clearAllResults();
|
||||
}
|
||||
|
||||
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
if (fractureModelResults)
|
||||
{
|
||||
fractureModelResults->clearAllResults();
|
||||
|
||||
}
|
||||
|
||||
reloadEclipseGridFile();
|
||||
|
||||
for (size_t i = 0; i < reservoirViews().size(); i++)
|
||||
{
|
||||
RimEclipseView* reservoirView = reservoirViews()[i];
|
||||
CVF_ASSERT(reservoirView);
|
||||
reservoirView->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -95,6 +95,9 @@ public:
|
||||
virtual cvf::BoundingBox allCellsBoundingBox() const;
|
||||
virtual cvf::Vec3d displayModelOffset() const;
|
||||
|
||||
void releaseResultData();
|
||||
virtual void reloadEclipseGridFile() = 0;
|
||||
|
||||
// Overridden methods from PdmObject
|
||||
public:
|
||||
|
||||
|
@ -228,6 +228,15 @@ bool RimEclipseInputCase::openEclipseGridFile()
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseInputCase::reloadEclipseGridFile()
|
||||
{
|
||||
setReservoirData(nullptr);
|
||||
openEclipseGridFile();
|
||||
}
|
||||
|
||||
#define for_all(stdVector, indexName) for (size_t indexName = 0; indexName < stdVector.size(); ++indexName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Loads input property data from the gridFile and additional files
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
|
||||
// RimCase overrides
|
||||
virtual bool openEclipseGridFile(); // Find grid file among file set. Read, Find read and validate property date. Syncronize child property sets.
|
||||
virtual void reloadEclipseGridFile();
|
||||
|
||||
// Overrides from RimCase
|
||||
virtual QString locationOnDisc() const;
|
||||
|
@ -148,6 +148,16 @@ bool RimEclipseResultCase::openEclipseGridFile()
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::reloadEclipseGridFile()
|
||||
{
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
openEclipseGridFile();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
void setCaseInfo(const QString& userDescription, const QString& caseFileName);
|
||||
|
||||
virtual bool openEclipseGridFile();
|
||||
virtual void reloadEclipseGridFile();
|
||||
bool openAndReadActiveCellData(RigEclipseCaseData* mainEclipseCase);
|
||||
void readGridDimensions(std::vector< std::vector<int> >& gridDimensions);
|
||||
|
||||
|
@ -174,6 +174,15 @@ bool RimEclipseStatisticsCase::openEclipseGridFile()
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseStatisticsCase::reloadEclipseGridFile()
|
||||
{
|
||||
setReservoirData(nullptr);
|
||||
openEclipseGridFile();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
void updateConnectedEditorsAndReservoirViews();
|
||||
|
||||
virtual bool openEclipseGridFile();
|
||||
virtual void reloadEclipseGridFile();
|
||||
|
||||
RimCaseCollection* parentStatisticsCaseCollection();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user