mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
One shared active cell info for all statistical cases
Invalidate existing statisticsCases when adding/removing source cases Moved computation of active cell union from RigStatistics to RimIdenticalGridCaseGroup Recompute active cell union when opening project file p4#: 21023
This commit is contained in:
@@ -52,90 +52,6 @@ void RigStatistics::addNamedResult(RigReservoirCellResults* destinationCellResul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
// See also RifReaderEclipseOutput::readActiveCellInfo()
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RigStatistics::computeActiveCellUnion()
|
|
||||||
{
|
|
||||||
if (m_sourceCases.size() == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CVF_ASSERT(m_destinationCase);
|
|
||||||
|
|
||||||
RigMainGrid* mainGrid = m_sourceCases[0]->reservoirData()->mainGrid();
|
|
||||||
CVF_ASSERT(mainGrid);
|
|
||||||
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGlobalCellCount(mainGrid->cells().size());
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setGlobalCellCount(mainGrid->cells().size());
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGridCount(mainGrid->gridCount());
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setGridCount(mainGrid->gridCount());
|
|
||||||
|
|
||||||
size_t globalActiveMatrixIndex = 0;
|
|
||||||
size_t globalActiveFractureIndex = 0;
|
|
||||||
|
|
||||||
for (size_t gridIdx = 0; gridIdx < mainGrid->gridCount(); gridIdx++)
|
|
||||||
{
|
|
||||||
RigGridBase* grid = mainGrid->gridByIndex(gridIdx);
|
|
||||||
|
|
||||||
std::vector<char> activeM(grid->cellCount(), 0);
|
|
||||||
std::vector<char> activeF(grid->cellCount(), 0);
|
|
||||||
|
|
||||||
for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++)
|
|
||||||
{
|
|
||||||
for (size_t caseIdx = 0; caseIdx < m_sourceCases.size(); caseIdx++)
|
|
||||||
{
|
|
||||||
size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx);
|
|
||||||
|
|
||||||
if (activeM[localGridCellIdx] == 0)
|
|
||||||
{
|
|
||||||
if (m_sourceCases[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActiveInMatrixModel(globalCellIdx))
|
|
||||||
{
|
|
||||||
activeM[localGridCellIdx] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeF[localGridCellIdx] == 0)
|
|
||||||
{
|
|
||||||
if (m_sourceCases[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActiveInMatrixModel(globalCellIdx))
|
|
||||||
{
|
|
||||||
activeF[localGridCellIdx] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t activeMatrixIndex = 0;
|
|
||||||
size_t activeFractureIndex = 0;
|
|
||||||
|
|
||||||
for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++)
|
|
||||||
{
|
|
||||||
size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx);
|
|
||||||
|
|
||||||
if (activeM[localGridCellIdx] != 0)
|
|
||||||
{
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setActiveIndexInMatrixModel(globalCellIdx, globalActiveMatrixIndex++);
|
|
||||||
activeMatrixIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeF[localGridCellIdx] != 0)
|
|
||||||
{
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setActiveIndexInMatrixModel(globalCellIdx, globalActiveFractureIndex++);
|
|
||||||
activeFractureIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGridActiveCellCounts(gridIdx, activeMatrixIndex);
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setGridActiveCellCounts(gridIdx, activeFractureIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData();
|
|
||||||
m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData();
|
|
||||||
|
|
||||||
m_destinationCase->computeCachedData();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString createResultNameMin(const QString& resultName) { return resultName + "_MIN"; }
|
QString createResultNameMin(const QString& resultName) { return resultName + "_MIN"; }
|
||||||
QString createResultNameMax(const QString& resultName) { return resultName + "_MAX"; }
|
QString createResultNameMax(const QString& resultName) { return resultName + "_MAX"; }
|
||||||
@@ -176,8 +92,6 @@ void RigStatistics::evaluateStatistics(const QList<QPair<RimDefines::ResultCatTy
|
|||||||
{
|
{
|
||||||
CVF_ASSERT(m_destinationCase);
|
CVF_ASSERT(m_destinationCase);
|
||||||
|
|
||||||
computeActiveCellUnion();
|
|
||||||
|
|
||||||
size_t activeMatrixCellCount = m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->globalMatrixModelActiveCellCount();
|
size_t activeMatrixCellCount = m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->globalMatrixModelActiveCellCount();
|
||||||
RigReservoirCellResults* matrixResults = m_destinationCase->results(RifReaderInterface::MATRIX_RESULTS);
|
RigReservoirCellResults* matrixResults = m_destinationCase->results(RifReaderInterface::MATRIX_RESULTS);
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ public:
|
|||||||
void debugOutput(RimDefines::ResultCatType resultType, const QString& resultName, size_t timeStepIdx);
|
void debugOutput(RimDefines::ResultCatType resultType, const QString& resultName, size_t timeStepIdx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void computeActiveCellUnion();
|
|
||||||
void addNamedResult(RigReservoirCellResults* cellResults, RimDefines::ResultCatType resultType, const QString& resultName, size_t activeCellCount);
|
void addNamedResult(RigReservoirCellResults* cellResults, RimDefines::ResultCatType resultType, const QString& resultName, size_t activeCellCount);
|
||||||
void buildSourceMetaData(RimDefines::ResultCatType resultType, const QString& resultName);
|
void buildSourceMetaData(RimDefines::ResultCatType resultType, const QString& resultName);
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,13 @@
|
|||||||
#include "RimReservoir.h"
|
#include "RimReservoir.h"
|
||||||
#include "RimReservoirView.h"
|
#include "RimReservoirView.h"
|
||||||
#include "RigEclipseCase.h"
|
#include "RigEclipseCase.h"
|
||||||
|
#include "RigReservoirCellResults.h"
|
||||||
|
|
||||||
#include "RimStatisticalCalculation.h"
|
#include "RimStatisticalCalculation.h"
|
||||||
#include "RimStatisticalCollection.h"
|
#include "RimStatisticalCollection.h"
|
||||||
#include "RimResultReservoir.h"
|
#include "RimResultReservoir.h"
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
|
#include "RigActiveCellInfo.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimIdenticalGridCaseGroup, "RimIdenticalGridCaseGroup");
|
CAF_PDM_SOURCE_INIT(RimIdenticalGridCaseGroup, "RimIdenticalGridCaseGroup");
|
||||||
@@ -48,6 +50,8 @@ RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup()
|
|||||||
statisticalReservoirCollection = new RimStatisticalCollection;
|
statisticalReservoirCollection = new RimStatisticalCollection;
|
||||||
|
|
||||||
m_mainGrid = NULL;
|
m_mainGrid = NULL;
|
||||||
|
|
||||||
|
clearActiveCellUnions();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -86,8 +90,12 @@ void RimIdenticalGridCaseGroup::addCase(RimReservoir* reservoir)
|
|||||||
|
|
||||||
if (statisticalReservoirCollection->reservoirs().size() == 0)
|
if (statisticalReservoirCollection->reservoirs().size() == 0)
|
||||||
{
|
{
|
||||||
statisticalReservoirCollection->createAndAppendStatisticalCalculation();
|
createAndAppendStatisticalCalculation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearActiveCellUnions();
|
||||||
|
clearStatisticsResults();
|
||||||
|
updateMainGridAndActiveCellsForStatisticsCases();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -101,6 +109,10 @@ void RimIdenticalGridCaseGroup::removeCase(RimReservoir* reservoir)
|
|||||||
{
|
{
|
||||||
m_mainGrid = NULL;
|
m_mainGrid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearActiveCellUnions();
|
||||||
|
clearStatisticsResults();
|
||||||
|
updateMainGridAndActiveCellsForStatisticsCases();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -161,15 +173,172 @@ void RimIdenticalGridCaseGroup::initAfterRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set main grid for statistical calculations
|
bool foundResultsInCache = false;
|
||||||
for (size_t i = 0; i < statisticalReservoirCollection()->reservoirs().size(); i++)
|
for (size_t i = 0; i < statisticalReservoirCollection()->reservoirs().size(); i++)
|
||||||
{
|
{
|
||||||
RimStatisticalCalculation* rimReservoir = dynamic_cast<RimStatisticalCalculation*>(statisticalReservoirCollection()->reservoirs()[i]);
|
RimStatisticalCalculation* rimReservoir = statisticalReservoirCollection()->reservoirs()[i];
|
||||||
CVF_ASSERT(rimReservoir);
|
|
||||||
|
|
||||||
rimReservoir->setMainGrid(mainEclipseCase->mainGrid());
|
// Check if any results are stored in cache
|
||||||
|
if (rimReservoir->results(RifReaderInterface::MATRIX_RESULTS)->m_resultCacheMetaData.size() > 0 ||
|
||||||
|
rimReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->m_resultCacheMetaData.size() > 0)
|
||||||
|
{
|
||||||
|
foundResultsInCache = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundResultsInCache)
|
||||||
|
{
|
||||||
|
computeUnionOfActiveCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainGrid = mainEclipseCase->mainGrid();
|
m_mainGrid = mainEclipseCase->mainGrid();
|
||||||
|
|
||||||
|
updateMainGridAndActiveCellsForStatisticsCases();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
|
||||||
|
{
|
||||||
|
if (m_unionOfMatrixActiveCells->globalMatrixModelActiveCellCount() > 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (caseCollection->reservoirs.size() == 0 || !m_mainGrid)
|
||||||
|
{
|
||||||
|
m_unionOfMatrixActiveCells = new RigActiveCellInfo;
|
||||||
|
m_unionOfFractureActiveCells = new RigActiveCellInfo;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
m_unionOfMatrixActiveCells->setGlobalCellCount(m_mainGrid->cells().size());
|
||||||
|
m_unionOfFractureActiveCells->setGlobalCellCount(m_mainGrid->cells().size());
|
||||||
|
m_unionOfMatrixActiveCells->setGridCount(m_mainGrid->gridCount());
|
||||||
|
m_unionOfFractureActiveCells->setGridCount(m_mainGrid->gridCount());
|
||||||
|
|
||||||
|
size_t globalActiveMatrixIndex = 0;
|
||||||
|
size_t globalActiveFractureIndex = 0;
|
||||||
|
|
||||||
|
for (size_t gridIdx = 0; gridIdx < m_mainGrid->gridCount(); gridIdx++)
|
||||||
|
{
|
||||||
|
RigGridBase* grid = m_mainGrid->gridByIndex(gridIdx);
|
||||||
|
|
||||||
|
std::vector<char> activeM(grid->cellCount(), 0);
|
||||||
|
std::vector<char> activeF(grid->cellCount(), 0);
|
||||||
|
|
||||||
|
for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++)
|
||||||
|
{
|
||||||
|
for (size_t caseIdx = 0; caseIdx < caseCollection->reservoirs.size(); caseIdx++)
|
||||||
|
{
|
||||||
|
size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx);
|
||||||
|
|
||||||
|
if (activeM[localGridCellIdx] == 0)
|
||||||
|
{
|
||||||
|
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActiveInMatrixModel(globalCellIdx))
|
||||||
|
{
|
||||||
|
activeM[localGridCellIdx] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeF[localGridCellIdx] == 0)
|
||||||
|
{
|
||||||
|
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActiveInMatrixModel(globalCellIdx))
|
||||||
|
{
|
||||||
|
activeF[localGridCellIdx] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t activeMatrixIndex = 0;
|
||||||
|
size_t activeFractureIndex = 0;
|
||||||
|
|
||||||
|
for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++)
|
||||||
|
{
|
||||||
|
size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx);
|
||||||
|
|
||||||
|
if (activeM[localGridCellIdx] != 0)
|
||||||
|
{
|
||||||
|
m_unionOfMatrixActiveCells->setActiveIndexInMatrixModel(globalCellIdx, globalActiveMatrixIndex++);
|
||||||
|
activeMatrixIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeF[localGridCellIdx] != 0)
|
||||||
|
{
|
||||||
|
m_unionOfFractureActiveCells->setActiveIndexInMatrixModel(globalCellIdx, globalActiveFractureIndex++);
|
||||||
|
activeFractureIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_unionOfMatrixActiveCells->setGridActiveCellCounts(gridIdx, activeMatrixIndex);
|
||||||
|
m_unionOfFractureActiveCells->setGridActiveCellCounts(gridIdx, activeFractureIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_unionOfMatrixActiveCells->computeDerivedData();
|
||||||
|
m_unionOfFractureActiveCells->computeDerivedData();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimStatisticalCalculation* RimIdenticalGridCaseGroup::createAndAppendStatisticalCalculation()
|
||||||
|
{
|
||||||
|
RimStatisticalCalculation* newObject = new RimStatisticalCalculation;
|
||||||
|
|
||||||
|
newObject->caseName = QString("Statistics ") + QString::number(statisticalReservoirCollection()->reservoirs.size()+1);
|
||||||
|
newObject->setMainGrid(this->mainGrid());
|
||||||
|
newObject->reservoirData()->setActiveCellInfo(RifReaderInterface::MATRIX_RESULTS, m_unionOfMatrixActiveCells.p());
|
||||||
|
newObject->reservoirData()->setActiveCellInfo(RifReaderInterface::FRACTURE_RESULTS, m_unionOfFractureActiveCells.p());
|
||||||
|
|
||||||
|
statisticalReservoirCollection()->reservoirs.push_back(newObject);
|
||||||
|
|
||||||
|
return newObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < statisticalReservoirCollection->reservoirs().size(); i++)
|
||||||
|
{
|
||||||
|
RimStatisticalCalculation* rimStaticsCase = statisticalReservoirCollection->reservoirs[i];
|
||||||
|
|
||||||
|
rimStaticsCase->setMainGrid(this->mainGrid());
|
||||||
|
rimStaticsCase->reservoirData()->setActiveCellInfo(RifReaderInterface::MATRIX_RESULTS, m_unionOfMatrixActiveCells.p());
|
||||||
|
rimStaticsCase->reservoirData()->setActiveCellInfo(RifReaderInterface::FRACTURE_RESULTS, m_unionOfFractureActiveCells.p());
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
rimStaticsCase->reservoirData()->computeCachedData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimIdenticalGridCaseGroup::clearStatisticsResults()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < statisticalReservoirCollection->reservoirs().size(); i++)
|
||||||
|
{
|
||||||
|
RimStatisticalCalculation* rimStaticsCase = statisticalReservoirCollection->reservoirs[i];
|
||||||
|
rimStaticsCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->clearAllResults();
|
||||||
|
rimStaticsCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->clearAllResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimIdenticalGridCaseGroup::clearActiveCellUnions()
|
||||||
|
{
|
||||||
|
m_unionOfMatrixActiveCells = new RigActiveCellInfo;
|
||||||
|
m_unionOfFractureActiveCells = new RigActiveCellInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
class RimReservoir;
|
class RimReservoir;
|
||||||
class RigMainGrid;
|
class RigMainGrid;
|
||||||
|
class RigActiveCellInfo;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
@@ -47,15 +48,29 @@ public:
|
|||||||
void addCase(RimReservoir* reservoir);
|
void addCase(RimReservoir* reservoir);
|
||||||
void removeCase(RimReservoir* reservoir);
|
void removeCase(RimReservoir* reservoir);
|
||||||
|
|
||||||
|
RimStatisticalCalculation* createAndAppendStatisticalCalculation();
|
||||||
|
|
||||||
caf::PdmField<RimCaseCollection*> caseCollection;
|
caf::PdmField<RimCaseCollection*> caseCollection;
|
||||||
caf::PdmField<RimStatisticalCollection*> statisticalReservoirCollection;
|
caf::PdmField<RimStatisticalCollection*> statisticalReservoirCollection;
|
||||||
|
|
||||||
RigMainGrid* mainGrid();
|
RigMainGrid* mainGrid();
|
||||||
|
|
||||||
|
void computeUnionOfActiveCells();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||||
|
|
||||||
virtual void initAfterRead();
|
virtual void initAfterRead();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateMainGridAndActiveCellsForStatisticsCases();
|
||||||
|
void clearStatisticsResults();
|
||||||
|
void clearActiveCellUnions();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RigMainGrid* m_mainGrid;
|
RigMainGrid* m_mainGrid;
|
||||||
|
|
||||||
|
cvf::ref<RigActiveCellInfo> m_unionOfMatrixActiveCells;
|
||||||
|
cvf::ref<RigActiveCellInfo> m_unionOfFractureActiveCells;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ void RimStatisticalCalculation::computeStatistics()
|
|||||||
openEclipseGridFile();
|
openEclipseGridFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimIdenticalGridCaseGroup* gridCaseGroup = caseGroup();
|
||||||
|
CVF_ASSERT(gridCaseGroup);
|
||||||
|
gridCaseGroup->computeUnionOfActiveCells();
|
||||||
|
|
||||||
std::vector<RimReservoir*> sourceCases;
|
std::vector<RimReservoir*> sourceCases;
|
||||||
|
|
||||||
getSourceCases(sourceCases);
|
getSourceCases(sourceCases);
|
||||||
|
|||||||
@@ -45,26 +45,6 @@ RimStatisticalCollection::~RimStatisticalCollection()
|
|||||||
reservoirs.deleteAllChildObjects();
|
reservoirs.deleteAllChildObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimStatisticalCalculation* RimStatisticalCollection::createAndAppendStatisticalCalculation()
|
|
||||||
{
|
|
||||||
RimStatisticalCalculation* newObject = new RimStatisticalCalculation;
|
|
||||||
RimIdenticalGridCaseGroup* gridCaseGroup = parentCaseGroup();
|
|
||||||
|
|
||||||
CVF_ASSERT(gridCaseGroup);
|
|
||||||
CVF_ASSERT(gridCaseGroup->mainGrid());
|
|
||||||
|
|
||||||
newObject->setMainGrid(gridCaseGroup->mainGrid());
|
|
||||||
|
|
||||||
newObject->caseName = QString("Statistics ") + QString::number(reservoirs.size()+1);
|
|
||||||
|
|
||||||
reservoirs.push_back(newObject);
|
|
||||||
|
|
||||||
return newObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public:
|
|||||||
|
|
||||||
caf::PdmPointersField<RimStatisticalCalculation*> reservoirs;
|
caf::PdmPointersField<RimStatisticalCalculation*> reservoirs;
|
||||||
|
|
||||||
RimStatisticalCalculation* createAndAppendStatisticalCalculation();
|
|
||||||
|
|
||||||
RimIdenticalGridCaseGroup* parentCaseGroup();
|
RimIdenticalGridCaseGroup* parentCaseGroup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -480,21 +480,22 @@ RimStatisticalCalculation* RimUiTreeModelPdm::addStatisticalCalculation(const QM
|
|||||||
caf::PdmUiTreeItem* currentItem = getTreeItemFromIndex(itemIndex);
|
caf::PdmUiTreeItem* currentItem = getTreeItemFromIndex(itemIndex);
|
||||||
|
|
||||||
QModelIndex collectionIndex;
|
QModelIndex collectionIndex;
|
||||||
RimStatisticalCollection* caseGroup = NULL;
|
RimIdenticalGridCaseGroup* caseGroup = NULL;
|
||||||
caf::PdmUiTreeItem* parentCollectionItem = NULL;
|
caf::PdmUiTreeItem* parentCollectionItem = NULL;
|
||||||
int position = 0;
|
int position = 0;
|
||||||
|
|
||||||
if (dynamic_cast<RimStatisticalCalculation*>(currentItem->dataObject().p()))
|
if (dynamic_cast<RimStatisticalCalculation*>(currentItem->dataObject().p()))
|
||||||
{
|
{
|
||||||
RimStatisticalCalculation* currentObject = dynamic_cast<RimStatisticalCalculation*>(currentItem->dataObject().p());
|
RimStatisticalCalculation* currentObject = dynamic_cast<RimStatisticalCalculation*>(currentItem->dataObject().p());
|
||||||
caseGroup = currentObject->parentStatisticalCollection();
|
caseGroup = currentObject->parentStatisticalCollection()->parentCaseGroup();
|
||||||
parentCollectionItem = currentItem->parent();
|
parentCollectionItem = currentItem->parent();
|
||||||
position = itemIndex.row();
|
position = itemIndex.row();
|
||||||
collectionIndex = itemIndex.parent();
|
collectionIndex = itemIndex.parent();
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<RimStatisticalCollection*>(currentItem->dataObject().p()))
|
else if (dynamic_cast<RimStatisticalCollection*>(currentItem->dataObject().p()))
|
||||||
{
|
{
|
||||||
caseGroup = dynamic_cast<RimStatisticalCollection*>(currentItem->dataObject().p());
|
RimStatisticalCollection* statColl = dynamic_cast<RimStatisticalCollection*>(currentItem->dataObject().p());
|
||||||
|
caseGroup = statColl->parentCaseGroup();
|
||||||
parentCollectionItem = currentItem;
|
parentCollectionItem = currentItem;
|
||||||
position = parentCollectionItem->childCount();
|
position = parentCollectionItem->childCount();
|
||||||
collectionIndex = itemIndex;
|
collectionIndex = itemIndex;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ bool RigActiveCellInfo::isActiveInMatrixModel(size_t globalCellIndex) const
|
|||||||
{
|
{
|
||||||
if (m_activeInMatrixModel.size() == 0)
|
if (m_activeInMatrixModel.size() == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVF_TIGHT_ASSERT(globalCellIndex < m_activeInMatrixModel.size());
|
CVF_TIGHT_ASSERT(globalCellIndex < m_activeInMatrixModel.size());
|
||||||
@@ -60,7 +60,7 @@ size_t RigActiveCellInfo::activeIndexInMatrixModel(size_t globalCellIndex) const
|
|||||||
{
|
{
|
||||||
if (m_activeInMatrixModel.size() == 0)
|
if (m_activeInMatrixModel.size() == 0)
|
||||||
{
|
{
|
||||||
return cvf::UNDEFINED_SIZE_T;
|
return globalCellIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVF_TIGHT_ASSERT(globalCellIndex < m_activeInMatrixModel.size());
|
CVF_TIGHT_ASSERT(globalCellIndex < m_activeInMatrixModel.size());
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RigActiveCellInfo
|
class RigActiveCellInfo : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RigActiveCellInfo();
|
RigActiveCellInfo();
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ RigEclipseCase::RigEclipseCase()
|
|||||||
|
|
||||||
m_matrixModelResults = new RigReservoirCellResults(m_mainGrid.p());
|
m_matrixModelResults = new RigReservoirCellResults(m_mainGrid.p());
|
||||||
m_fractureModelResults = new RigReservoirCellResults(m_mainGrid.p());
|
m_fractureModelResults = new RigReservoirCellResults(m_mainGrid.p());
|
||||||
|
|
||||||
|
m_activeCellInfo = new RigActiveCellInfo;
|
||||||
|
m_fractureActiveCellInfo = new RigActiveCellInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -285,19 +288,19 @@ void RigEclipseCase::computeActiveCellData()
|
|||||||
size_t i, j, k;
|
size_t i, j, k;
|
||||||
m_mainGrid->ijkFromCellIndex(idx, &i, &j, &k);
|
m_mainGrid->ijkFromCellIndex(idx, &i, &j, &k);
|
||||||
|
|
||||||
if (m_activeCellInfo.isActiveInMatrixModel(idx))
|
if (m_activeCellInfo->isActiveInMatrixModel(idx))
|
||||||
{
|
{
|
||||||
matrixModelActiveBB.add(i, j, k);
|
matrixModelActiveBB.add(i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_fractureActiveCellInfo.isActiveInMatrixModel(idx))
|
if (m_fractureActiveCellInfo->isActiveInMatrixModel(idx))
|
||||||
{
|
{
|
||||||
fractureModelActiveBB.add(i, j, k);
|
fractureModelActiveBB.add(i, j, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activeCellInfo.setMatrixModelActiveCellsBoundingBox(matrixModelActiveBB.m_min, matrixModelActiveBB.m_max);
|
m_activeCellInfo->setMatrixModelActiveCellsBoundingBox(matrixModelActiveBB.m_min, matrixModelActiveBB.m_max);
|
||||||
m_fractureActiveCellInfo.setMatrixModelActiveCellsBoundingBox(fractureModelActiveBB.m_min, fractureModelActiveBB.m_max);
|
m_fractureActiveCellInfo->setMatrixModelActiveCellsBoundingBox(fractureModelActiveBB.m_min, fractureModelActiveBB.m_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -316,10 +319,10 @@ RigActiveCellInfo* RigEclipseCase::activeCellInfo(RifReaderInterface::PorosityMo
|
|||||||
{
|
{
|
||||||
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||||
{
|
{
|
||||||
return &m_activeCellInfo;
|
return m_activeCellInfo.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
return &m_fractureActiveCellInfo;
|
return m_fractureActiveCellInfo.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -329,12 +332,28 @@ const RigActiveCellInfo* RigEclipseCase::activeCellInfo(RifReaderInterface::Poro
|
|||||||
{
|
{
|
||||||
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||||
{
|
{
|
||||||
return &m_activeCellInfo;
|
return m_activeCellInfo.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
return &m_fractureActiveCellInfo;
|
return m_fractureActiveCellInfo.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigEclipseCase::setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo)
|
||||||
|
{
|
||||||
|
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||||
|
{
|
||||||
|
m_activeCellInfo = activeCellInfo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_fractureActiveCellInfo = activeCellInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -343,14 +362,14 @@ void RigEclipseCase::computeActiveCellsGeometryBoundingBox()
|
|||||||
if (m_mainGrid.isNull())
|
if (m_mainGrid.isNull())
|
||||||
{
|
{
|
||||||
cvf::BoundingBox bb;
|
cvf::BoundingBox bb;
|
||||||
m_activeCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb);
|
m_activeCellInfo->setMatrixActiveCellsGeometryBoundingBox(bb);
|
||||||
m_fractureActiveCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb);
|
m_fractureActiveCellInfo->setMatrixActiveCellsGeometryBoundingBox(bb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RigActiveCellInfo* activeInfos[2];
|
RigActiveCellInfo* activeInfos[2];
|
||||||
activeInfos[0] = &m_fractureActiveCellInfo;
|
activeInfos[0] = m_fractureActiveCellInfo.p();
|
||||||
activeInfos[1] = &m_activeCellInfo; // Last, to make this bb.min become display offset
|
activeInfos[1] = m_activeCellInfo.p(); // Last, to make this bb.min become display offset
|
||||||
|
|
||||||
cvf::BoundingBox bb;
|
cvf::BoundingBox bb;
|
||||||
for (int acIdx = 0; acIdx < 2; ++acIdx)
|
for (int acIdx = 0; acIdx < 2; ++acIdx)
|
||||||
@@ -428,6 +447,8 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigEclipseCase::dataAccessObject(const
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel);
|
RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||||
const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
||||||
|
void setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo);
|
||||||
|
|
||||||
|
|
||||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject(const RigGridBase* grid,
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject(const RigGridBase* grid,
|
||||||
@@ -78,8 +79,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
cvf::ref<RigMainGrid> m_mainGrid;
|
cvf::ref<RigMainGrid> m_mainGrid;
|
||||||
|
|
||||||
RigActiveCellInfo m_activeCellInfo;
|
cvf::ref<RigActiveCellInfo> m_activeCellInfo;
|
||||||
RigActiveCellInfo m_fractureActiveCellInfo;
|
cvf::ref<RigActiveCellInfo> m_fractureActiveCellInfo;
|
||||||
|
|
||||||
cvf::ref<RigReservoirCellResults> m_matrixModelResults;
|
cvf::ref<RigReservoirCellResults> m_matrixModelResults;
|
||||||
cvf::ref<RigReservoirCellResults> m_fractureModelResults;
|
cvf::ref<RigReservoirCellResults> m_fractureModelResults;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "RigReservoirBuilderMock.h"
|
#include "RigReservoirBuilderMock.h"
|
||||||
#include "RigEclipseCase.h"
|
#include "RigEclipseCase.h"
|
||||||
|
#include "RigActiveCellInfo.h"
|
||||||
|
|
||||||
|
|
||||||
/* rand example: guess the number */
|
/* rand example: guess the number */
|
||||||
|
|||||||
@@ -505,10 +505,13 @@ void RigReservoirCellResults::removeResult(const QString& resultName)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigReservoirCellResults::clearAllResults()
|
void RigReservoirCellResults::clearAllResults()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_cellScalarResults.size(); i++)
|
m_cellScalarResults.clear();
|
||||||
{
|
m_maxMinValues.clear();
|
||||||
m_cellScalarResults[i].clear();
|
m_histograms.clear();
|
||||||
}
|
m_p10p90.clear();
|
||||||
|
m_meanValues.clear();
|
||||||
|
m_maxMinValuesPrTs.clear();
|
||||||
|
m_resultInfos.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user