mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Added support for selected well data in a statistics case
Now possible to show well data from selected source case for a statistics case Added state to RimResultCase to monitor data actually read from disk p4#: 21258
This commit is contained in:
parent
aea13e1810
commit
9b0378f8e0
@ -95,14 +95,6 @@ const RigCaseData* RimCase::reservoirData() const
|
||||
return m_rigEclipseCase.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCase::removeReservoirData()
|
||||
{
|
||||
this->setReservoirData(NULL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -56,7 +56,6 @@ public:
|
||||
|
||||
RigCaseData* reservoirData();
|
||||
const RigCaseData* reservoirData() const;
|
||||
void removeReservoirData();
|
||||
|
||||
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
|
||||
|
@ -59,3 +59,19 @@ RimIdenticalGridCaseGroup* RimCaseCollection::parentCaseGroup()
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RimCaseCollection::findByDescription(const QString& caseDescription) const
|
||||
{
|
||||
for (size_t i = 0; i < reservoirs.size(); i++)
|
||||
{
|
||||
if (caseDescription == reservoirs[i]->caseUserDescription())
|
||||
{
|
||||
return reservoirs[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ class RimCaseCollection : public caf::PdmObject
|
||||
public:
|
||||
RimCaseCollection();
|
||||
virtual ~RimCaseCollection();
|
||||
|
||||
caf::PdmPointersField<RimCase*> reservoirs;
|
||||
|
||||
RimIdenticalGridCaseGroup* parentCaseGroup();
|
||||
RimIdenticalGridCaseGroup* parentCaseGroup();
|
||||
RimCase* findByDescription(const QString& caseDescription) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1284,3 +1284,24 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::updateDisplayModelForWellResults()
|
||||
{
|
||||
m_geometry->clearGeometryCache();
|
||||
m_pipesPartManager->clearGeometryCache();
|
||||
|
||||
syncronizeWellsWithResults();
|
||||
|
||||
createDisplayModel();
|
||||
updateDisplayModelVisibility();
|
||||
|
||||
overlayInfoConfig()->update3DInfo();
|
||||
|
||||
if (animationMode && m_viewer)
|
||||
{
|
||||
m_viewer->slotSetCurrentFrame(m_currentTimeStep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,11 +117,11 @@ public:
|
||||
caf::PdmField<bool> animationMode;
|
||||
|
||||
// Access internal objects
|
||||
RimReservoirCellResultsStorage* currentGridCellResults();
|
||||
RimReservoirCellResultsStorage* currentGridCellResults();
|
||||
RigActiveCellInfo* currentActiveCellInfo();
|
||||
|
||||
void setEclipseCase(RimCase* reservoir);
|
||||
RimCase* eclipseCase();
|
||||
RimCase* eclipseCase();
|
||||
|
||||
// Animation
|
||||
int currentTimeStep() { return m_currentTimeStep;}
|
||||
@ -148,6 +148,8 @@ public:
|
||||
void createDisplayModelAndRedraw();
|
||||
void scheduleGeometryRegen(unsigned short geometryType);
|
||||
void schedulePipeGeometryRegen();
|
||||
void updateDisplayModelForWellResults();
|
||||
|
||||
|
||||
// Display model generation
|
||||
private:
|
||||
@ -178,9 +180,7 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_currentTimeStep;
|
||||
QPointer<RiuViewer> m_viewer;
|
||||
caf::PdmPointer<RimCase> m_reservoir;
|
||||
|
||||
|
||||
QPointer<RiuViewer> m_viewer;
|
||||
caf::PdmPointer<RimCase> m_reservoir;
|
||||
};
|
||||
|
||||
|
@ -47,10 +47,10 @@ RimResultCase::RimResultCase()
|
||||
caseDirectory.setIOWritable(false);
|
||||
caseDirectory.setUiHidden(true);
|
||||
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -60,15 +60,15 @@ bool RimResultCase::openEclipseGridFile()
|
||||
|
||||
progInfo.setProgressDescription("Open Grid File");
|
||||
progInfo.setNextProgressIncrement(48);
|
||||
// Early exit if reservoir data is created
|
||||
if (this->reservoirData()) return true;
|
||||
|
||||
// Early exit if data is already read
|
||||
if (m_gridAndWellDataIsReadFromFile) return true;
|
||||
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
|
||||
if (caseFileName().contains("Result Mock Debug Model"))
|
||||
{
|
||||
readerInterface = this->createMockModel(this->caseFileName());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -98,6 +98,9 @@ bool RimResultCase::openEclipseGridFile()
|
||||
progInfo.setProgressDescription("Computing Case Cache");
|
||||
computeCachedData();
|
||||
|
||||
m_gridAndWellDataIsReadFromFile = true;
|
||||
m_activeCellInfoIsReadFromFile = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -106,8 +109,10 @@ bool RimResultCase::openEclipseGridFile()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimResultCase::openAndReadActiveCellData(RigCaseData* mainEclipseCase)
|
||||
{
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
// Early exit if data is already read
|
||||
if (m_activeCellInfoIsReadFromFile) return true;
|
||||
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
if (caseFileName().contains("Result Mock Debug Model"))
|
||||
{
|
||||
readerInterface = this->createMockModel(this->caseFileName());
|
||||
@ -154,11 +159,11 @@ bool RimResultCase::openAndReadActiveCellData(RigCaseData* mainEclipseCase)
|
||||
|
||||
reservoirData()->computeActiveCellBoundingBoxes();
|
||||
|
||||
m_activeCellInfoIsReadFromFile = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -236,7 +241,6 @@ cvf::ref<RifReaderInterface> RimResultCase::createMockModel(QString modelName)
|
||||
return mockFileInterface.p();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,4 +62,6 @@ private:
|
||||
// Obsolete field
|
||||
caf::PdmField<QString> caseDirectory;
|
||||
|
||||
bool m_gridAndWellDataIsReadFromFile;
|
||||
bool m_activeCellInfoIsReadFromFile;
|
||||
};
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RimUiTreeModelPdm.h"
|
||||
|
||||
namespace caf {
|
||||
template<>
|
||||
@ -97,6 +99,8 @@ RimStatisticsCase::RimStatisticsCase()
|
||||
CAF_PDM_InitField(&m_lowPercentile, "LowPercentile", 10.0, "Low", "", "", "");
|
||||
CAF_PDM_InitField(&m_midPercentile, "MidPercentile", 50.0, "Mid", "", "", "");
|
||||
CAF_PDM_InitField(&m_highPercentile, "HighPercentile", 90.0, "High", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_wellDataSourceCase, "WellDataSourceCase", RimDefines::undefinedResultName(), "Well Data Source Case", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -405,6 +409,20 @@ QList<caf::PdmOptionItemInfo> RimStatisticsCase::calculateValueOptions(const caf
|
||||
return toOptionList(varList);
|
||||
}
|
||||
|
||||
else if (&m_wellDataSourceCase == fieldNeedingOptions)
|
||||
{
|
||||
QStringList sourceCaseNames;
|
||||
sourceCaseNames += RimDefines::undefinedResultName();
|
||||
|
||||
for (size_t i = 0; i < caseGroup()->caseCollection()->reservoirs().size(); i++)
|
||||
{
|
||||
sourceCaseNames += caseGroup()->caseCollection()->reservoirs()[i]->caseUserDescription();
|
||||
}
|
||||
|
||||
return toOptionList(sourceCaseNames);
|
||||
}
|
||||
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@ -430,9 +448,56 @@ void RimStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
m_calculateEditCommand = false;
|
||||
}
|
||||
|
||||
//updateSelectionSummaryLabel();
|
||||
if (&m_wellDataSourceCase == changedField)
|
||||
{
|
||||
RimUiTreeModelPdm* treeModel = RiuMainWindow::instance()->uiPdmModel();
|
||||
|
||||
// Find or load well data for given case
|
||||
RimCase* sourceResultCase = caseGroup()->caseCollection()->findByDescription(m_wellDataSourceCase);
|
||||
if (sourceResultCase)
|
||||
{
|
||||
sourceResultCase->openEclipseGridFile();
|
||||
|
||||
// Propagate well info to statistics case
|
||||
if (sourceResultCase->reservoirData())
|
||||
{
|
||||
const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults = sourceResultCase->reservoirData()->wellResults();
|
||||
setWellResultsAndUpdateViews(sourceCaseWellResults);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Collection<RigSingleWellResultsData> sourceCaseWellResults;
|
||||
setWellResultsAndUpdateViews(sourceCaseWellResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStatisticsCase::setWellResultsAndUpdateViews(const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults)
|
||||
{
|
||||
RimUiTreeModelPdm* treeModel = RiuMainWindow::instance()->uiPdmModel();
|
||||
|
||||
this->reservoirData()->setWellResults(sourceCaseWellResults);
|
||||
|
||||
// Update views
|
||||
for (size_t i = 0; i < reservoirViews().size(); i++)
|
||||
{
|
||||
RimReservoirView* reservoirView = reservoirViews()[i];
|
||||
CVF_ASSERT(reservoirView);
|
||||
|
||||
reservoirView->wellCollection()->wells.deleteAllChildObjects();
|
||||
reservoirView->updateDisplayModelForWellResults();
|
||||
|
||||
treeModel->rebuildUiSubTree(reservoirView->wellCollection());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void addPropertySetToHtmlText(QString& html, const QString& heading, const std::vector<QString>& varNames)
|
||||
{
|
||||
if (varNames.size())
|
||||
@ -608,3 +673,4 @@ void RimStatisticsCase::populateWithDefaultsIfNeeded()
|
||||
if (varList.contains("PORO")) m_selectedFractureStaticProperties.v().push_back("PORO");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ class RimIdenticalGridCaseGroup;
|
||||
class RimResultDefinition;
|
||||
class RimStatisticsCaseCollection;
|
||||
class RigMainGrid;
|
||||
class RigSingleWellResultsData;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@ -72,6 +73,8 @@ private:
|
||||
void updateSelectionSummaryLabel();
|
||||
void updatePercentileUiVisibility();
|
||||
|
||||
void setWellResultsAndUpdateViews(const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults);
|
||||
|
||||
// Pdm system overrides
|
||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) ;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly );
|
||||
@ -104,4 +107,5 @@ private:
|
||||
caf::PdmField<double > m_midPercentile;
|
||||
caf::PdmField<double > m_highPercentile;
|
||||
|
||||
caf::PdmField<QString> m_wellDataSourceCase;
|
||||
};
|
||||
|
@ -385,22 +385,7 @@ RimReservoirView* RimUiTreeModelPdm::addReservoirView(const QModelIndex& itemInd
|
||||
if (collectionItem)
|
||||
{
|
||||
RimCase* rimReservoir = dynamic_cast<RimCase*>(collectionItem->dataObject().p());
|
||||
|
||||
// If the case is one of the source cases in a CaseGroup, but not the main case, we need to
|
||||
// trigger a complete load of the case, if the new view is the first on the case.
|
||||
|
||||
if (rimReservoir && rimReservoir->parentGridCaseGroup()
|
||||
&& rimReservoir->parentGridCaseGroup()->contains(rimReservoir)
|
||||
&& !(rimReservoir == rimReservoir->parentGridCaseGroup()->mainCase())
|
||||
&& rimReservoir->reservoirViews().size() == 0)
|
||||
{
|
||||
if (rimReservoir->reservoirData())
|
||||
{
|
||||
CVF_ASSERT(rimReservoir->reservoirData()->refCount() == 1);
|
||||
}
|
||||
|
||||
rimReservoir->removeReservoirData();
|
||||
}
|
||||
rimReservoir->openEclipseGridFile();
|
||||
|
||||
RimReservoirView* insertedView = rimReservoir->createAndAddReservoirView();
|
||||
|
||||
|
@ -46,8 +46,8 @@ public:
|
||||
RigGridBase* grid(size_t index);
|
||||
size_t gridCount() const;
|
||||
|
||||
RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
const RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
||||
RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
const RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
||||
|
||||
RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
||||
@ -80,9 +80,9 @@ private:
|
||||
cvf::ref<RigActiveCellInfo> m_activeCellInfo;
|
||||
cvf::ref<RigActiveCellInfo> m_fractureActiveCellInfo;
|
||||
|
||||
cvf::ref<RigCaseCellResultsData> m_matrixModelResults;
|
||||
cvf::ref<RigCaseCellResultsData> m_fractureModelResults;
|
||||
cvf::ref<RigCaseCellResultsData> m_matrixModelResults;
|
||||
cvf::ref<RigCaseCellResultsData> m_fractureModelResults;
|
||||
|
||||
cvf::Collection<RigSingleWellResultsData> m_wellResults; //< A WellResults object for each well in the reservoir
|
||||
cvf::Collection<RigSingleWellResultsData> m_wellResults; //< A WellResults object for each well in the reservoir
|
||||
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid; //< A bool array pr grid with one bool pr cell telling wether the cell is a well cell or not
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user