Refactored RigActiveCellinfo to only have one set of information.

Fracture and Matrix separated information thus needs two such obejcts.
There still needs to remove some out-commented code
p4#: 20877
This commit is contained in:
Jacob Støren
2013-03-13 11:50:31 +01:00
parent 4358d87c09
commit 8a604aca24
23 changed files with 301 additions and 277 deletions

View File

@@ -86,9 +86,9 @@ static const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
// Static functions // Static functions
//************************************************************************************************** //**************************************************************************************************
bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellInfo, RigGridBase* localGrid, const ecl_grid_type* localEclGrid, size_t matrixActiveStartIndex, size_t fractureActiveStartIndex) bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellInfo, RigActiveCellInfo* fractureActiveCellInfo, RigGridBase* localGrid, const ecl_grid_type* localEclGrid, size_t matrixActiveStartIndex, size_t fractureActiveStartIndex)
{ {
CVF_ASSERT(activeCellInfo); CVF_ASSERT(activeCellInfo && fractureActiveCellInfo);
int cellCount = ecl_grid_get_global_size(localEclGrid); int cellCount = ecl_grid_get_global_size(localEclGrid);
size_t cellStartIndex = mainGrid->cells().size(); size_t cellStartIndex = mainGrid->cells().size();
@@ -126,7 +126,7 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn
int fractureActiveIndex = ecl_grid_get_active_fracture_index1(localEclGrid, localCellIdx); int fractureActiveIndex = ecl_grid_get_active_fracture_index1(localEclGrid, localCellIdx);
if (fractureActiveIndex != -1) if (fractureActiveIndex != -1)
{ {
activeCellInfo->setActiveIndexInFractureModel(cellStartIndex + localCellIdx, fractureActiveStartIndex + fractureActiveIndex); fractureActiveCellInfo->setActiveIndexInMatrixModel(cellStartIndex + localCellIdx, fractureActiveStartIndex + fractureActiveIndex);
} }
// Parent cell index // Parent cell index
@@ -241,8 +241,10 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
return false; return false;
} }
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(); RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
CVF_ASSERT(activeCellInfo); RigActiveCellInfo* fractureActiveCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS);
CVF_ASSERT(activeCellInfo && fractureActiveCellInfo);
RigMainGrid* mainGrid = eclipseCase->mainGrid(); RigMainGrid* mainGrid = eclipseCase->mainGrid();
{ {
@@ -280,6 +282,7 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
} }
activeCellInfo->setGlobalCellCount(totalCellCount); activeCellInfo->setGlobalCellCount(totalCellCount);
fractureActiveCellInfo->setGlobalCellCount(totalCellCount);
// Reserve room for the cells and nodes and fill them with data // Reserve room for the cells and nodes and fill them with data
@@ -290,7 +293,7 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
progInfo.setProgressDescription("Main Grid"); progInfo.setProgressDescription("Main Grid");
progInfo.setNextProgressIncrement(3); progInfo.setNextProgressIncrement(3);
transferGridCellData(mainGrid, activeCellInfo, mainGrid, mainEclGrid, 0, 0); transferGridCellData(mainGrid, activeCellInfo, fractureActiveCellInfo, mainGrid, mainEclGrid, 0, 0);
progInfo.setProgress(3); progInfo.setProgress(3);
@@ -298,10 +301,12 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid); size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid);
activeCellInfo->setGridCount(1 + numLGRs); activeCellInfo->setGridCount(1 + numLGRs);
activeCellInfo->setGridActiveCellCounts(0, globalMatrixActiveSize, globalFractureActiveSize); fractureActiveCellInfo->setGridCount(1 + numLGRs);
mainGrid->setMatrixModelActiveCellCount(globalMatrixActiveSize); activeCellInfo->setGridActiveCellCounts(0, globalMatrixActiveSize);
mainGrid->setFractureModelActiveCellCount(globalFractureActiveSize); fractureActiveCellInfo->setGridActiveCellCounts(0, globalFractureActiveSize);
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx) for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
{ {
@@ -310,22 +315,21 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx); ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1)); RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1));
transferGridCellData(mainGrid, activeCellInfo, localGrid, localEclGrid, globalMatrixActiveSize, globalFractureActiveSize); transferGridCellData(mainGrid, activeCellInfo, fractureActiveCellInfo, localGrid, localEclGrid, globalMatrixActiveSize, globalFractureActiveSize);
int matrixActiveCellCount = ecl_grid_get_nactive(localEclGrid); int matrixActiveCellCount = ecl_grid_get_nactive(localEclGrid);
localGrid->setMatrixModelActiveCellCount(matrixActiveCellCount);
globalMatrixActiveSize += matrixActiveCellCount; globalMatrixActiveSize += matrixActiveCellCount;
int fractureActiveCellCount = ecl_grid_get_nactive_fracture(localEclGrid); int fractureActiveCellCount = ecl_grid_get_nactive_fracture(localEclGrid);
localGrid->setFractureModelActiveCellCount(fractureActiveCellCount);
globalFractureActiveSize += fractureActiveCellCount; globalFractureActiveSize += fractureActiveCellCount;
activeCellInfo->setGridActiveCellCounts(lgrIdx + 1, matrixActiveCellCount, fractureActiveCellCount); activeCellInfo->setGridActiveCellCounts(lgrIdx + 1, matrixActiveCellCount);
fractureActiveCellInfo->setGridActiveCellCounts(lgrIdx + 1, fractureActiveCellCount);
progInfo.setProgress(3 + lgrIdx); progInfo.setProgress(3 + lgrIdx);
} }
activeCellInfo->computeDerivedData(); activeCellInfo->computeDerivedData();
fractureActiveCellInfo->computeDerivedData();
return true; return true;
} }
@@ -470,10 +474,13 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
return false; return false;
} }
RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(); RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
RigActiveCellInfo* fractureActiveCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS);
activeCellInfo->setGlobalCellCount(globalCellCount); activeCellInfo->setGlobalCellCount(globalCellCount);
fractureActiveCellInfo->setGlobalCellCount(globalCellCount);
activeCellInfo->setGridCount(actnumKeywordCount); activeCellInfo->setGridCount(actnumKeywordCount);
fractureActiveCellInfo->setGridCount(actnumKeywordCount);
size_t cellIdx = 0; size_t cellIdx = 0;
size_t globalActiveMatrixIndex = 0; size_t globalActiveMatrixIndex = 0;
@@ -495,17 +502,19 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
if (actnumValues[i] == 2 || actnumValues[i] == 3) if (actnumValues[i] == 2 || actnumValues[i] == 3)
{ {
activeCellInfo->setActiveIndexInFractureModel(cellIdx, globalActiveFractureIndex++); fractureActiveCellInfo->setActiveIndexInMatrixModel(cellIdx, globalActiveFractureIndex++);
activeFractureIndex++; activeFractureIndex++;
} }
cellIdx++; cellIdx++;
} }
activeCellInfo->setGridActiveCellCounts(gridIdx, activeMatrixIndex, activeFractureIndex); activeCellInfo->setGridActiveCellCounts(gridIdx, activeMatrixIndex);
fractureActiveCellInfo->setGridActiveCellCounts(gridIdx, activeFractureIndex);
} }
activeCellInfo->computeDerivedData(); activeCellInfo->computeDerivedData();
fractureActiveCellInfo->computeDerivedData();
} }
ecl_file_close(ecl_file); ecl_file_close(ecl_file);
@@ -554,7 +563,10 @@ bool RifReaderEclipseOutput::buildMetaData()
m_dynamicResultsAccess->resultNames(&resultNames, &resultNamesDataItemCounts); m_dynamicResultsAccess->resultNames(&resultNames, &resultNamesDataItemCounts);
{ {
QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, m_eclipseCase->activeCellInfo(), RifReaderInterface::MATRIX_RESULTS, m_dynamicResultsAccess->timeStepCount()); QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
RifReaderInterface::MATRIX_RESULTS, m_dynamicResultsAccess->timeStepCount());
for (int i = 0; i < matrixResultNames.size(); ++i) for (int i = 0; i < matrixResultNames.size(); ++i)
{ {
@@ -564,7 +576,10 @@ bool RifReaderEclipseOutput::buildMetaData()
} }
{ {
QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, m_eclipseCase->activeCellInfo(), RifReaderInterface::FRACTURE_RESULTS, m_dynamicResultsAccess->timeStepCount()); QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
RifReaderInterface::FRACTURE_RESULTS, m_dynamicResultsAccess->timeStepCount());
for (int i = 0; i < fractureResultNames.size(); ++i) for (int i = 0; i < fractureResultNames.size(); ++i)
{ {
@@ -588,7 +603,10 @@ bool RifReaderEclipseOutput::buildMetaData()
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_init_file, &resultNames, &resultNamesDataItemCounts); RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_init_file, &resultNames, &resultNamesDataItemCounts);
{ {
QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, m_eclipseCase->activeCellInfo(), RifReaderInterface::MATRIX_RESULTS, 1); QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
RifReaderInterface::MATRIX_RESULTS, 1);
QList<QDateTime> staticDate; QList<QDateTime> staticDate;
if (m_timeSteps.size() > 0) if (m_timeSteps.size() > 0)
@@ -604,7 +622,10 @@ bool RifReaderEclipseOutput::buildMetaData()
} }
{ {
QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, m_eclipseCase->activeCellInfo(), RifReaderInterface::FRACTURE_RESULTS, 1); QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
RifReaderInterface::FRACTURE_RESULTS, 1);
QList<QDateTime> staticDate; QList<QDateTime> staticDate;
if (m_timeSteps.size() > 0) if (m_timeSteps.size() > 0)
@@ -891,7 +912,9 @@ void RifReaderEclipseOutput::readWellCells()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts, const RigActiveCellInfo* activeCellInfo, PorosityModelResultType matrixOrFracture, size_t timeStepCount) const QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts,
const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo,
PorosityModelResultType matrixOrFracture, size_t timeStepCount) const
{ {
CVF_ASSERT(activeCellInfo); CVF_ASSERT(activeCellInfo);
@@ -902,7 +925,7 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
if (matrixOrFracture == RifReaderInterface::FRACTURE_RESULTS) if (matrixOrFracture == RifReaderInterface::FRACTURE_RESULTS)
{ {
if (activeCellInfo->globalFractureModelActiveCellCount() == 0) if (fractureActiveCellInfo->globalMatrixModelActiveCellCount() == 0)
{ {
return QStringList(); return QStringList();
} }
@@ -920,8 +943,8 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
size_t timeStepsMatrix = keywordDataItemCounts[i] / activeCellInfo->globalMatrixModelActiveCellCount(); size_t timeStepsMatrix = keywordDataItemCounts[i] / activeCellInfo->globalMatrixModelActiveCellCount();
size_t timeStepsMatrixRest = keywordDataItemCounts[i] % activeCellInfo->globalMatrixModelActiveCellCount(); size_t timeStepsMatrixRest = keywordDataItemCounts[i] % activeCellInfo->globalMatrixModelActiveCellCount();
size_t timeStepsMatrixAndFracture = keywordDataItemCounts[i] / (activeCellInfo->globalMatrixModelActiveCellCount() + activeCellInfo->globalFractureModelActiveCellCount()); size_t timeStepsMatrixAndFracture = keywordDataItemCounts[i] / (activeCellInfo->globalMatrixModelActiveCellCount() + fractureActiveCellInfo->globalMatrixModelActiveCellCount());
size_t timeStepsMatrixAndFractureRest = keywordDataItemCounts[i] % (activeCellInfo->globalMatrixModelActiveCellCount() + activeCellInfo->globalFractureModelActiveCellCount()); size_t timeStepsMatrixAndFractureRest = keywordDataItemCounts[i] % (activeCellInfo->globalMatrixModelActiveCellCount() + fractureActiveCellInfo->globalMatrixModelActiveCellCount());
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS) if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS)
{ {
@@ -956,33 +979,17 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector<double>* destinationResultValues, const std::vector<double>& sourceResultValues) void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector<double>* destinationResultValues, const std::vector<double>& sourceResultValues)
{ {
RigActiveCellInfo* actCellInfo = m_eclipseCase->activeCellInfo(); RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS);
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS)
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS && fracActCellInfo->globalMatrixModelActiveCellCount() == 0)
{ {
if (actCellInfo->globalFractureModelActiveCellCount() == 0) destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin(), sourceResultValues.end());
{
destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin(), sourceResultValues.end());
}
else
{
size_t dataItemCount = 0;
size_t sourceStartPosition = 0;
for (size_t i = 0; i < m_eclipseCase->mainGrid()->gridCount(); i++)
{
size_t matrixActiveCellCount = 0;
size_t fractureActiveCellCount = 0;
actCellInfo->gridActiveCellCounts(i, matrixActiveCellCount, fractureActiveCellCount);
destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin() + sourceStartPosition, sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount);
sourceStartPosition += (matrixActiveCellCount + fractureActiveCellCount);
}
}
} }
else else
{ {
RigActiveCellInfo* actCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
size_t dataItemCount = 0; size_t dataItemCount = 0;
size_t sourceStartPosition = 0; size_t sourceStartPosition = 0;
@@ -990,9 +997,22 @@ void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityMod
{ {
size_t matrixActiveCellCount = 0; size_t matrixActiveCellCount = 0;
size_t fractureActiveCellCount = 0; size_t fractureActiveCellCount = 0;
actCellInfo->gridActiveCellCounts(i, matrixActiveCellCount, fractureActiveCellCount);
actCellInfo->gridActiveCellCounts(i, matrixActiveCellCount);
fracActCellInfo->gridActiveCellCounts(i, fractureActiveCellCount);
destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount, sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount + fractureActiveCellCount); if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS)
{
destinationResultValues->insert(destinationResultValues->end(),
sourceResultValues.begin() + sourceStartPosition,
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount);
}
else
{
destinationResultValues->insert(destinationResultValues->end(),
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount,
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount + fractureActiveCellCount);
}
sourceStartPosition += (matrixActiveCellCount + fractureActiveCellCount); sourceStartPosition += (matrixActiveCellCount + fractureActiveCellCount);
} }

View File

@@ -64,7 +64,7 @@ private:
static RifEclipseRestartDataAccess* createDynamicResultsAccess(const QStringList& fileSet); static RifEclipseRestartDataAccess* createDynamicResultsAccess(const QStringList& fileSet);
QStringList validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts, const RigActiveCellInfo* activeCellInfo, PorosityModelResultType matrixOrFracture, size_t timeStepCount) const; QStringList validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts, const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo, PorosityModelResultType matrixOrFracture, size_t timeStepCount) const;
virtual QList<QDateTime> timeSteps(); virtual QList<QDateTime> timeSteps();
private: private:

View File

@@ -247,7 +247,7 @@ void RivReservoirViewPartMgr::createGeometry(ReservoirGeometryCacheType geometry
void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, ReservoirGeometryCacheType geometryType, RigGridBase* grid, size_t gridIdx) void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, ReservoirGeometryCacheType geometryType, RigGridBase* grid, size_t gridIdx)
{ {
RigEclipseCase* eclipseCase = m_reservoirView->eclipseCase()->reservoirData(); RigEclipseCase* eclipseCase = m_reservoirView->eclipseCase()->reservoirData();
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(); RigActiveCellInfo* activeCellInfo = m_reservoirView->currentActiveCellInfo();
switch (geometryType) switch (geometryType)
{ {

View File

@@ -80,7 +80,8 @@ void Rim3dOverlayInfoConfig::update3DInfo()
{ {
QString caseName; QString caseName;
QString totCellCount; QString totCellCount;
QString activeCellCount; QString activeCellCountText;
QString fractureActiveCellCount;
QString iSize, jSize, kSize; QString iSize, jSize, kSize;
QString propName; QString propName;
QString cellEdgeName; QString cellEdgeName;
@@ -89,7 +90,12 @@ void Rim3dOverlayInfoConfig::update3DInfo()
{ {
caseName = m_reservoirView->eclipseCase()->caseName(); caseName = m_reservoirView->eclipseCase()->caseName();
totCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cells().size()); totCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cells().size());
activeCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo()->globalMatrixModelActiveCellCount()); size_t mxActCellCount = m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->globalMatrixModelActiveCellCount();
size_t frActCellCount = m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->globalMatrixModelActiveCellCount();
if (frActCellCount > 0) activeCellCountText += "Matrix : ";
activeCellCountText += QString::number(mxActCellCount);
if (frActCellCount > 0) activeCellCountText += " Fracture : " + QString::number(frActCellCount);
iSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountI()); iSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountI());
jSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountJ()); jSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountJ());
kSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountK()); kSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountK());
@@ -100,7 +106,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
QString infoText = QString( QString infoText = QString(
"<p><b><center>-- %1 --</center></b><p> " "<p><b><center>-- %1 --</center></b><p> "
"<b>Cell count. Total:</b> %2 <b>Active:</b> %3 <br>" "<b>Cell count. Total:</b> %2 <b>Active:</b> %3 <br>"
"<b>Main Grid I,J,K:</b> %4, %5, %6 <br>").arg(caseName, totCellCount, activeCellCount, iSize, jSize, kSize); "<b>Main Grid I,J,K:</b> %4, %5, %6 <br>").arg(caseName, totCellCount, activeCellCountText, iSize, jSize, kSize);
if (m_reservoirView->animationMode() && m_reservoirView->cellResult()->hasResult()) if (m_reservoirView->animationMode() && m_reservoirView->cellResult()->hasResult())
{ {
@@ -110,9 +116,9 @@ void Rim3dOverlayInfoConfig::update3DInfo()
double p10, p90; double p10, p90;
double mean; double mean;
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex(); size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max); m_reservoirView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); m_reservoirView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
m_reservoirView->gridCellResults()->meanCellScalarValues(scalarIndex, mean); m_reservoirView->currentGridCellResults()->meanCellScalarValues(scalarIndex, mean);
//infoText += QString("<blockquote><b>Min:</b> %1 <b>P10:</b> %2 <b>Mean:</b> %3 <b>P90:</b> %4 <b>Max:</b> %5 </blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max); //infoText += QString("<blockquote><b>Min:</b> %1 <b>P10:</b> %2 <b>Mean:</b> %3 <b>P90:</b> %4 <b>Max:</b> %5 </blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
//infoText += QString("<blockquote><pre>Min: %1 P10: %2 Mean: %3 \n P90: %4 Max: %5 </pre></blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max); //infoText += QString("<blockquote><pre>Min: %1 P10: %2 Mean: %3 \n P90: %4 Max: %5 </pre></blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
@@ -134,7 +140,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|| m_reservoirView->wellCollection()->hasVisibleWellPipes()) || m_reservoirView->wellCollection()->hasVisibleWellPipes())
{ {
int currentTimeStep = m_reservoirView->currentTimeStep(); int currentTimeStep = m_reservoirView->currentTimeStep();
QDateTime date = m_reservoirView->gridCellResults()->timeStepDate(0, currentTimeStep); QDateTime date = m_reservoirView->currentGridCellResults()->timeStepDate(0, currentTimeStep);
infoText += QString("<b>Time Step:</b> %1 <b>Time:</b> %2").arg(currentTimeStep).arg(date.toString("dd.MMM yyyy")); infoText += QString("<b>Time Step:</b> %1 <b>Time:</b> %2").arg(currentTimeStep).arg(date.toString("dd.MMM yyyy"));
} }
@@ -150,12 +156,12 @@ void Rim3dOverlayInfoConfig::update3DInfo()
double mean; double mean;
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex(); size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max); m_reservoirView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90); m_reservoirView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
m_reservoirView->gridCellResults()->meanCellScalarValues(scalarIndex, mean); m_reservoirView->currentGridCellResults()->meanCellScalarValues(scalarIndex, mean);
m_reservoirView->viewer()->showHistogram(true); m_reservoirView->viewer()->showHistogram(true);
m_reservoirView->viewer()->setHistogram(min, max, m_reservoirView->gridCellResults()->cellScalarValuesHistogram(scalarIndex)); m_reservoirView->viewer()->setHistogram(min, max, m_reservoirView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex));
m_reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean); m_reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean);
} }
} }

View File

@@ -71,7 +71,7 @@ void RimCellEdgeResultSlot::setReservoirView(RimReservoirView* ownerReservoirVie
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimCellEdgeResultSlot::loadResult() void RimCellEdgeResultSlot::loadResult()
{ {
CVF_ASSERT(m_reservoirView && m_reservoirView->gridCellResults()); CVF_ASSERT(m_reservoirView && m_reservoirView->currentGridCellResults());
resetResultIndices(); resetResultIndices();
QStringList vars = findResultVariableNames(); QStringList vars = findResultVariableNames();
@@ -80,7 +80,7 @@ void RimCellEdgeResultSlot::loadResult()
int i; int i;
for (i = 0; i < vars.size(); ++i) for (i = 0; i < vars.size(); ++i)
{ {
size_t resultindex = m_reservoirView->gridCellResults()->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, vars[i]); size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, vars[i]);
int cubeFaceIdx; int cubeFaceIdx;
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx) for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
{ {
@@ -130,10 +130,10 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeResultSlot::calculateValueOptions(const
{ {
if (fieldNeedingOptions == &resultVariable) if (fieldNeedingOptions == &resultVariable)
{ {
if (m_reservoirView && m_reservoirView->gridCellResults()) if (m_reservoirView && m_reservoirView->currentGridCellResults())
{ {
QStringList varList; QStringList varList;
varList = m_reservoirView->gridCellResults()->resultNames(RimDefines::STATIC_NATIVE); varList = m_reservoirView->currentGridCellResults()->resultNames(RimDefines::STATIC_NATIVE);
//TODO: Must also handle input properties //TODO: Must also handle input properties
//varList += m_reservoirView->gridCellResults()->resultNames(RimDefines::INPUT_PROPERTY); //varList += m_reservoirView->gridCellResults()->resultNames(RimDefines::INPUT_PROPERTY);
@@ -205,10 +205,10 @@ QStringList RimCellEdgeResultSlot::findResultVariableNames()
{ {
QStringList varNames; QStringList varNames;
if (m_reservoirView && m_reservoirView->gridCellResults() && !resultVariable().isEmpty()) if (m_reservoirView && m_reservoirView->currentGridCellResults() && !resultVariable().isEmpty())
{ {
QStringList varList; QStringList varList;
varList = m_reservoirView->gridCellResults()->resultNames(RimDefines::STATIC_NATIVE); varList = m_reservoirView->currentGridCellResults()->resultNames(RimDefines::STATIC_NATIVE);
//TODO: Must handle Input properties //TODO: Must handle Input properties
int i; int i;
@@ -313,7 +313,7 @@ void RimCellEdgeResultSlot::minMaxCellEdgeValues(double& min, double& max)
{ {
double cMin, cMax; double cMin, cMax;
m_reservoirView->gridCellResults()->minMaxCellScalarValues(resultIndices[idx], cMin, cMax); m_reservoirView->currentGridCellResults()->minMaxCellScalarValues(resultIndices[idx], cMin, cMax);
globalMin = CVF_MIN(globalMin, cMin); globalMin = CVF_MIN(globalMin, cMin);
globalMax = CVF_MAX(globalMax, cMax); globalMax = CVF_MAX(globalMax, cMax);

View File

@@ -143,7 +143,7 @@ void RimCellPropertyFilter::setDefaultValues()
size_t scalarIndex = resultDefinition->gridScalarIndex(); size_t scalarIndex = resultDefinition->gridScalarIndex();
if (scalarIndex != cvf::UNDEFINED_SIZE_T) if (scalarIndex != cvf::UNDEFINED_SIZE_T)
{ {
RigReservoirCellResults* results = m_parentContainer->reservoirView()->gridCellResults(); RigReservoirCellResults* results = m_parentContainer->reservoirView()->currentGridCellResults();
if (results) if (results)
{ {
results->minMaxCellScalarValues(scalarIndex, min, max); results->minMaxCellScalarValues(scalarIndex, min, max);

View File

@@ -136,13 +136,9 @@ RigMainGrid* RimCellRangeFilterCollection::mainGrid() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigActiveCellInfo* RimCellRangeFilterCollection::activeCellInfo() const RigActiveCellInfo* RimCellRangeFilterCollection::activeCellInfo() const
{ {
if (m_reservoirView && if (m_reservoirView )
m_reservoirView->eclipseCase() &&
m_reservoirView->eclipseCase()->reservoirData() &&
m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo())
{ {
return m_reservoirView->currentActiveCellInfo();
return m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo();
} }
return NULL; return NULL;

View File

@@ -75,7 +75,8 @@ void RimInputReservoir::openDataFileSet(const QStringList& filenames)
m_rigEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); m_rigEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
m_rigEclipseCase->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); m_rigEclipseCase->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
m_rigEclipseCase->activeCellInfo()->computeDerivedData(); m_rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData();
m_rigEclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData();
return; return;
} }

View File

@@ -272,11 +272,11 @@ void RimReservoirView::updateViewerWidgetWindowTitle()
void RimReservoirView::clampCurrentTimestep() void RimReservoirView::clampCurrentTimestep()
{ {
// Clamp the current timestep to actual possibilities // Clamp the current timestep to actual possibilities
if (this->gridCellResults()) if (this->currentGridCellResults())
{ {
if (m_currentTimeStep() >= static_cast<int>(this->gridCellResults()->maxTimeStepCount())) if (m_currentTimeStep() >= static_cast<int>(this->currentGridCellResults()->maxTimeStepCount()))
{ {
m_currentTimeStep = static_cast<int>(this->gridCellResults()->maxTimeStepCount()) -1; m_currentTimeStep = static_cast<int>(this->currentGridCellResults()->maxTimeStepCount()) -1;
} }
} }
@@ -460,10 +460,10 @@ void RimReservoirView::createDisplayModel()
|| this->propertyFilterCollection()->hasActiveDynamicFilters() || this->propertyFilterCollection()->hasActiveDynamicFilters()
|| this->wellCollection->hasVisibleWellPipes()) || this->wellCollection->hasVisibleWellPipes())
{ {
CVF_ASSERT(gridCellResults()); CVF_ASSERT(currentGridCellResults());
size_t i; size_t i;
for (i = 0; i < gridCellResults()->maxTimeStepCount(); i++) for (i = 0; i < currentGridCellResults()->maxTimeStepCount(); i++)
{ {
timeStepIndices.push_back(i); timeStepIndices.push_back(i);
} }
@@ -711,7 +711,7 @@ void RimReservoirView::loadDataAndUpdate()
RIApplication* app = RIApplication::instance(); RIApplication* app = RIApplication::instance();
if (app->preferences()->autocomputeSOIL) if (app->preferences()->autocomputeSOIL)
{ {
RigReservoirCellResults* results = gridCellResults(); RigReservoirCellResults* results = currentGridCellResults();
CVF_ASSERT(results); CVF_ASSERT(results);
results->loadOrComputeSOIL(); results->loadOrComputeSOIL();
} }
@@ -721,7 +721,7 @@ void RimReservoirView::loadDataAndUpdate()
CVF_ASSERT(this->cellResult() != NULL); CVF_ASSERT(this->cellResult() != NULL);
this->cellResult()->loadResult(); this->cellResult()->loadResult();
if (m_reservoir->reservoirData()->activeCellInfo()->globalFractureModelActiveCellCount() == 0) if (m_reservoir->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->globalMatrixModelActiveCellCount() == 0)
{ {
this->cellResult->porosityModel.setUiHidden(true); this->cellResult->porosityModel.setUiHidden(true);
} }
@@ -882,7 +882,6 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex,
{ {
RigEclipseCase* eclipseCase = m_reservoir->reservoirData(); RigEclipseCase* eclipseCase = m_reservoir->reservoirData();
RigGridBase* grid = eclipseCase->grid(gridIndex); RigGridBase* grid = eclipseCase->grid(gridIndex);
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo();
if (this->cellResult()->hasResult()) if (this->cellResult()->hasResult())
{ {
@@ -971,7 +970,7 @@ void RimReservoirView::setupBeforeSave()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Convenience for quick access to results /// Convenience for quick access to results
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigReservoirCellResults* RimReservoirView::gridCellResults() RigReservoirCellResults* RimReservoirView::currentGridCellResults()
{ {
if (m_reservoir && if (m_reservoir &&
m_reservoir->reservoirData() && m_reservoir->reservoirData() &&
@@ -986,6 +985,23 @@ RigReservoirCellResults* RimReservoirView::gridCellResults()
return NULL; return NULL;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo* RimReservoirView::currentActiveCellInfo()
{
if (m_reservoir &&
m_reservoir->reservoirData()
)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult->porosityModel());
return m_reservoir->reservoirData()->activeCellInfo(porosityModel);
}
return NULL;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -1185,11 +1201,8 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
// If all wells are forced off, return // If all wells are forced off, return
if (this->wellCollection()->wellCellVisibility() == RimWellCollection::FORCE_ALL_OFF) return; if (this->wellCollection()->wellCellVisibility() == RimWellCollection::FORCE_ALL_OFF) return;
RigActiveCellInfo* activeCellInfo = NULL; RigActiveCellInfo* activeCellInfo = this->currentActiveCellInfo();
if (eclipseCase() && eclipseCase()->reservoirData())
{
activeCellInfo = eclipseCase()->reservoirData()->activeCellInfo();
}
CVF_ASSERT(activeCellInfo); CVF_ASSERT(activeCellInfo);
// Loop over the wells and find their contribution // Loop over the wells and find their contribution

View File

@@ -118,7 +118,8 @@ public:
caf::PdmField<bool> animationMode; caf::PdmField<bool> animationMode;
// Access internal objects // Access internal objects
RigReservoirCellResults* gridCellResults(); RigReservoirCellResults* currentGridCellResults();
RigActiveCellInfo* currentActiveCellInfo();
void setEclipseCase(RimReservoir* reservoir); void setEclipseCase(RimReservoir* reservoir);
RimReservoir* eclipseCase(); RimReservoir* eclipseCase();

View File

@@ -63,9 +63,9 @@ void RimResultDefinition::setReservoirView(RimReservoirView* ownerReservoirView)
// TODO: This code is executed before reservoir is read, and then porosity model is never set to zero // TODO: This code is executed before reservoir is read, and then porosity model is never set to zero
if (m_reservoirView->eclipseCase() && if (m_reservoirView->eclipseCase() &&
m_reservoirView->eclipseCase()->reservoirData() && m_reservoirView->eclipseCase()->reservoirData() &&
m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo() ) m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS) )
{ {
if (m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo()->globalFractureModelActiveCellCount() == 0) if (m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->globalMatrixModelActiveCellCount() == 0)
{ {
porosityModel.setUiHidden(true); porosityModel.setUiHidden(true);
} }
@@ -92,9 +92,9 @@ QList<caf::PdmOptionItemInfo> RimResultDefinition::calculateValueOptions(const c
{ {
if (fieldNeedingOptions == &resultVariable) if (fieldNeedingOptions == &resultVariable)
{ {
if (m_reservoirView && m_reservoirView->gridCellResults()) if (m_reservoirView && m_reservoirView->currentGridCellResults())
{ {
QStringList varList = m_reservoirView->gridCellResults()->resultNames(resultType()); QStringList varList = m_reservoirView->currentGridCellResults()->resultNames(resultType());
QList<caf::PdmOptionItemInfo> optionList; QList<caf::PdmOptionItemInfo> optionList;
int i; int i;
for (i = 0; i < varList.size(); ++i) for (i = 0; i < varList.size(); ++i)
@@ -119,7 +119,7 @@ size_t RimResultDefinition::gridScalarIndex() const
{ {
if (m_gridScalarResultIndex == cvf::UNDEFINED_SIZE_T) if (m_gridScalarResultIndex == cvf::UNDEFINED_SIZE_T)
{ {
const RigReservoirCellResults* gridCellResults = m_reservoirView->gridCellResults(); const RigReservoirCellResults* gridCellResults = m_reservoirView->currentGridCellResults();
if (gridCellResults) m_gridScalarResultIndex = gridCellResults->findScalarResultIndex(resultType(), resultVariable()); if (gridCellResults) m_gridScalarResultIndex = gridCellResults->findScalarResultIndex(resultType(), resultVariable());
} }
return m_gridScalarResultIndex; return m_gridScalarResultIndex;
@@ -130,7 +130,7 @@ size_t RimResultDefinition::gridScalarIndex() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimResultDefinition::loadResult() void RimResultDefinition::loadResult()
{ {
RigReservoirCellResults* gridCellResults = m_reservoirView->gridCellResults(); RigReservoirCellResults* gridCellResults = m_reservoirView->currentGridCellResults();
if (gridCellResults) if (gridCellResults)
{ {
m_gridScalarResultIndex = gridCellResults->findOrLoadScalarResult(resultType(), resultVariable); m_gridScalarResultIndex = gridCellResults->findOrLoadScalarResult(resultType(), resultVariable);
@@ -148,7 +148,7 @@ void RimResultDefinition::loadResult()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimResultDefinition::hasStaticResult() const bool RimResultDefinition::hasStaticResult() const
{ {
const RigReservoirCellResults* gridCellResults = m_reservoirView->gridCellResults(); const RigReservoirCellResults* gridCellResults = m_reservoirView->currentGridCellResults();
if (hasResult() && gridCellResults->timeStepCount(m_gridScalarResultIndex) == 1 ) if (hasResult() && gridCellResults->timeStepCount(m_gridScalarResultIndex) == 1 )
{ {
return true; return true;
@@ -166,7 +166,7 @@ bool RimResultDefinition::hasResult() const
{ {
if (m_gridScalarResultIndex != cvf::UNDEFINED_SIZE_T) return true; if (m_gridScalarResultIndex != cvf::UNDEFINED_SIZE_T) return true;
const RigReservoirCellResults* gridCellResults = m_reservoirView->gridCellResults(); const RigReservoirCellResults* gridCellResults = m_reservoirView->currentGridCellResults();
if (gridCellResults) if (gridCellResults)
{ {
m_gridScalarResultIndex = gridCellResults->findScalarResultIndex(resultType(), resultVariable()); m_gridScalarResultIndex = gridCellResults->findScalarResultIndex(resultType(), resultVariable());
@@ -182,7 +182,7 @@ bool RimResultDefinition::hasResult() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimResultDefinition::hasDynamicResult() const bool RimResultDefinition::hasDynamicResult() const
{ {
const RigReservoirCellResults* gridCellResults = m_reservoirView->gridCellResults(); const RigReservoirCellResults* gridCellResults = m_reservoirView->currentGridCellResults();
if (hasResult() && gridCellResults->timeStepCount(m_gridScalarResultIndex) > 1 ) if (hasResult() && gridCellResults->timeStepCount(m_gridScalarResultIndex) > 1 )
return true; return true;
else else

View File

@@ -35,16 +35,10 @@ TEST(RigActiveCellInfo, BasicTest)
{ {
EXPECT_TRUE(rigActiveCellInfo.activeIndexInMatrixModel(i) == cvf::UNDEFINED_SIZE_T); EXPECT_TRUE(rigActiveCellInfo.activeIndexInMatrixModel(i) == cvf::UNDEFINED_SIZE_T);
EXPECT_FALSE(rigActiveCellInfo.isActiveInMatrixModel(i)); EXPECT_FALSE(rigActiveCellInfo.isActiveInMatrixModel(i));
EXPECT_TRUE(rigActiveCellInfo.activeIndexInFractureModel(i) == cvf::UNDEFINED_SIZE_T);
EXPECT_FALSE(rigActiveCellInfo.isActiveInFractureModel(i));
} }
rigActiveCellInfo.setActiveIndexInMatrixModel(3, 1); rigActiveCellInfo.setActiveIndexInMatrixModel(3, 1);
EXPECT_TRUE(rigActiveCellInfo.activeIndexInMatrixModel(3) == 1); EXPECT_TRUE(rigActiveCellInfo.activeIndexInMatrixModel(3) == 1);
rigActiveCellInfo.setActiveIndexInFractureModel(9, 3);
EXPECT_TRUE(rigActiveCellInfo.activeIndexInFractureModel(9) == 3);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -55,27 +49,23 @@ TEST(RigActiveCellInfo, GridCellCounts)
{ {
RigActiveCellInfo rigActiveCellInfo; RigActiveCellInfo rigActiveCellInfo;
rigActiveCellInfo.setGridCount(3); rigActiveCellInfo.setGridCount(3);
rigActiveCellInfo.setGridActiveCellCounts(0, 0, 0); rigActiveCellInfo.setGridActiveCellCounts(0, 0);
rigActiveCellInfo.setGridActiveCellCounts(1, 1, 0); rigActiveCellInfo.setGridActiveCellCounts(1, 1);
rigActiveCellInfo.setGridActiveCellCounts(2, 2, 0); rigActiveCellInfo.setGridActiveCellCounts(2, 2);
rigActiveCellInfo.computeDerivedData(); rigActiveCellInfo.computeDerivedData();
EXPECT_TRUE(rigActiveCellInfo.globalMatrixModelActiveCellCount() == 3); EXPECT_TRUE(rigActiveCellInfo.globalMatrixModelActiveCellCount() == 3);
EXPECT_TRUE(rigActiveCellInfo.globalFractureModelActiveCellCount() == 0);
} }
{ {
RigActiveCellInfo rigActiveCellInfo; RigActiveCellInfo rigActiveCellInfo;
rigActiveCellInfo.setGridCount(3); rigActiveCellInfo.setGridCount(3);
rigActiveCellInfo.setGridActiveCellCounts(0, 0, 3); rigActiveCellInfo.setGridActiveCellCounts(0, 3 );
rigActiveCellInfo.setGridActiveCellCounts(1, 1, 4); rigActiveCellInfo.setGridActiveCellCounts(1, 4 );
rigActiveCellInfo.setGridActiveCellCounts(2, 2, 5); rigActiveCellInfo.setGridActiveCellCounts(2, 5 );
rigActiveCellInfo.computeDerivedData(); rigActiveCellInfo.computeDerivedData();
EXPECT_TRUE(rigActiveCellInfo.globalMatrixModelActiveCellCount() == 3); EXPECT_TRUE(rigActiveCellInfo.globalMatrixModelActiveCellCount() == 12);
EXPECT_TRUE(rigActiveCellInfo.globalFractureModelActiveCellCount() == 12);
} }
} }

View File

@@ -24,7 +24,7 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigActiveCellInfo::RigActiveCellInfo() RigActiveCellInfo::RigActiveCellInfo()
: m_globalMatrixModelActiveCellCount(0), : m_globalMatrixModelActiveCellCount(0),
m_globalFractureModelActiveCellCount(0), // m_globalFractureModelActiveCellCount(0),
m_activeCellPositionMin(cvf::Vec3d::ZERO), m_activeCellPositionMin(cvf::Vec3d::ZERO),
m_activeCellPositionMax(cvf::Vec3d::ZERO) m_activeCellPositionMax(cvf::Vec3d::ZERO)
{ {
@@ -37,7 +37,7 @@ RigActiveCellInfo::RigActiveCellInfo()
void RigActiveCellInfo::setGlobalCellCount(size_t globalCellCount) void RigActiveCellInfo::setGlobalCellCount(size_t globalCellCount)
{ {
m_activeInMatrixModel.resize(globalCellCount, cvf::UNDEFINED_SIZE_T); m_activeInMatrixModel.resize(globalCellCount, cvf::UNDEFINED_SIZE_T);
m_activeInFractureModel.resize(globalCellCount, cvf::UNDEFINED_SIZE_T); // m_activeInFractureModel.resize(globalCellCount, cvf::UNDEFINED_SIZE_T);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -79,7 +79,7 @@ void RigActiveCellInfo::setActiveIndexInMatrixModel(size_t globalCellIndex, size
m_activeInMatrixModel[globalCellIndex] = globalActiveCellIndex; m_activeInMatrixModel[globalCellIndex] = globalActiveCellIndex;
} }
/*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -119,7 +119,7 @@ void RigActiveCellInfo::setActiveIndexInFractureModel(size_t globalCellIndex, si
m_activeInFractureModel[globalCellIndex] = globalActiveCellIndex; m_activeInFractureModel[globalCellIndex] = globalActiveCellIndex;
} }
*/
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -127,7 +127,7 @@ void RigActiveCellInfo::setGridCount(size_t gridCount)
{ {
m_perGridActiveCellInfo.resize(gridCount); m_perGridActiveCellInfo.resize(gridCount);
} }
/*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -136,7 +136,19 @@ void RigActiveCellInfo::setGridActiveCellCounts(size_t gridIndex, size_t matrixA
CVF_ASSERT(gridIndex < m_perGridActiveCellInfo.size()); CVF_ASSERT(gridIndex < m_perGridActiveCellInfo.size());
m_perGridActiveCellInfo[gridIndex].setMatrixModelActiveCellCount(matrixActiveCellCount); m_perGridActiveCellInfo[gridIndex].setMatrixModelActiveCellCount(matrixActiveCellCount);
m_perGridActiveCellInfo[gridIndex].setFractureModelActiveCellCount(fractureActiveCellCount); //m_perGridActiveCellInfo[gridIndex].setFractureModelActiveCellCount(fractureActiveCellCount);
}
*/
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::setGridActiveCellCounts(size_t gridIndex, size_t matrixActiveCellCount)
{
CVF_ASSERT(gridIndex < m_perGridActiveCellInfo.size());
m_perGridActiveCellInfo[gridIndex].setMatrixModelActiveCellCount(matrixActiveCellCount);
//m_perGridActiveCellInfo[gridIndex].setFractureModelActiveCellCount(fractureActiveCellCount);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -145,12 +157,12 @@ void RigActiveCellInfo::setGridActiveCellCounts(size_t gridIndex, size_t matrixA
void RigActiveCellInfo::computeDerivedData() void RigActiveCellInfo::computeDerivedData()
{ {
m_globalMatrixModelActiveCellCount = 0; m_globalMatrixModelActiveCellCount = 0;
m_globalFractureModelActiveCellCount = 0; //m_globalFractureModelActiveCellCount = 0;
for (size_t i = 0; i < m_perGridActiveCellInfo.size(); i++) for (size_t i = 0; i < m_perGridActiveCellInfo.size(); i++)
{ {
m_globalMatrixModelActiveCellCount += m_perGridActiveCellInfo[i].matrixModelActiveCellCount(); m_globalMatrixModelActiveCellCount += m_perGridActiveCellInfo[i].matrixModelActiveCellCount();
m_globalFractureModelActiveCellCount += m_perGridActiveCellInfo[i].fractureModelActiveCellCount(); // m_globalFractureModelActiveCellCount += m_perGridActiveCellInfo[i].fractureModelActiveCellCount();
} }
} }
@@ -161,7 +173,7 @@ size_t RigActiveCellInfo::globalMatrixModelActiveCellCount() const
{ {
return m_globalMatrixModelActiveCellCount; return m_globalMatrixModelActiveCellCount;
} }
/*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -169,7 +181,7 @@ size_t RigActiveCellInfo::globalFractureModelActiveCellCount() const
{ {
return m_globalFractureModelActiveCellCount; return m_globalFractureModelActiveCellCount;
} }
*/
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -187,7 +199,7 @@ void RigActiveCellInfo::matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf:
min = m_activeCellPositionMin; min = m_activeCellPositionMin;
max = m_activeCellPositionMax; max = m_activeCellPositionMax;
} }
/*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -214,7 +226,16 @@ void RigActiveCellInfo::gridActiveCellCounts(size_t gridIndex, size_t& matrixAct
matrixActiveCellCount = m_perGridActiveCellInfo[gridIndex].matrixModelActiveCellCount(); matrixActiveCellCount = m_perGridActiveCellInfo[gridIndex].matrixModelActiveCellCount();
fractureActiveCellCount = m_perGridActiveCellInfo[gridIndex].fractureModelActiveCellCount(); fractureActiveCellCount = m_perGridActiveCellInfo[gridIndex].fractureModelActiveCellCount();
} }
*/
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::gridActiveCellCounts(size_t gridIndex, size_t& matrixActiveCellCount)
{
matrixActiveCellCount = m_perGridActiveCellInfo[gridIndex].matrixModelActiveCellCount();
//fractureActiveCellCount = m_perGridActiveCellInfo[gridIndex].fractureModelActiveCellCount();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -246,7 +267,7 @@ void RigActiveCellInfo::GridActiveCellCounts::setMatrixModelActiveCellCount(size
{ {
m_matrixModelActiveCellCount = activeMatrixModelCellCount; m_matrixModelActiveCellCount = activeMatrixModelCellCount;
} }
/*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -262,3 +283,4 @@ void RigActiveCellInfo::GridActiveCellCounts::setFractureModelActiveCellCount(si
{ {
m_fractureModelActiveCellCount = activeFractureModelCellCount; m_fractureModelActiveCellCount = activeFractureModelCellCount;
} }
*/

View File

@@ -38,22 +38,24 @@ public:
size_t activeIndexInMatrixModel(size_t globalCellIndex) const; size_t activeIndexInMatrixModel(size_t globalCellIndex) const;
void setActiveIndexInMatrixModel(size_t globalCellIndex, size_t globalActiveCellIndex); void setActiveIndexInMatrixModel(size_t globalCellIndex, size_t globalActiveCellIndex);
bool isActiveInFractureModel(size_t globalCellIndex) const; //bool isActiveInFractureModel(size_t globalCellIndex) const;
size_t activeIndexInFractureModel(size_t globalCellIndex) const; //size_t activeIndexInFractureModel(size_t globalCellIndex) const;
void setActiveIndexInFractureModel(size_t globalCellIndex, size_t globalActiveCellIndex); //void setActiveIndexInFractureModel(size_t globalCellIndex, size_t globalActiveCellIndex);
void setGridCount(size_t gridCount); void setGridCount(size_t gridCount);
void setGridActiveCellCounts(size_t gridIndex, size_t matrixActiveCellCount, size_t fractureActiveCellCount); //void setGridActiveCellCounts(size_t gridIndex, size_t matrixActiveCellCount, size_t fractureActiveCellCount);
void gridActiveCellCounts(size_t gridIndex, size_t& matrixActiveCellCount, size_t& fractureActiveCellCount); void setGridActiveCellCounts(size_t gridIndex, size_t matrixActiveCellCount);
//void gridActiveCellCounts(size_t gridIndex, size_t& matrixActiveCellCount, size_t& fractureActiveCellCount);
void gridActiveCellCounts(size_t gridIndex, size_t& matrixActiveCellCount);
void computeDerivedData(); void computeDerivedData();
size_t globalMatrixModelActiveCellCount() const; size_t globalMatrixModelActiveCellCount() const;
size_t globalFractureModelActiveCellCount() const; //size_t globalFractureModelActiveCellCount() const;
void setMatrixModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max); void setMatrixModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max);
void matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const; void matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void setFractureModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max); //void setFractureModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max);
void fractureModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const; //void fractureModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
cvf::BoundingBox matrixActiveCellsGeometryBoundingBox() const; cvf::BoundingBox matrixActiveCellsGeometryBoundingBox() const;
void setMatrixActiveCellsGeometryBoundingBox(cvf::BoundingBox bb); void setMatrixActiveCellsGeometryBoundingBox(cvf::BoundingBox bb);
@@ -65,12 +67,12 @@ private:
public: public:
size_t matrixModelActiveCellCount() const; size_t matrixModelActiveCellCount() const;
void setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount); void setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount);
size_t fractureModelActiveCellCount() const; //size_t fractureModelActiveCellCount() const;
void setFractureModelActiveCellCount(size_t activeFractureModelCellCount); //void setFractureModelActiveCellCount(size_t activeFractureModelCellCount);
private: private:
size_t m_matrixModelActiveCellCount; size_t m_matrixModelActiveCellCount;
size_t m_fractureModelActiveCellCount; //size_t m_fractureModelActiveCellCount;
}; };
@@ -78,15 +80,15 @@ private:
std::vector<GridActiveCellCounts> m_perGridActiveCellInfo; std::vector<GridActiveCellCounts> m_perGridActiveCellInfo;
std::vector<size_t> m_activeInMatrixModel; std::vector<size_t> m_activeInMatrixModel;
std::vector<size_t> m_activeInFractureModel; //std::vector<size_t> m_activeInFractureModel;
size_t m_globalMatrixModelActiveCellCount; size_t m_globalMatrixModelActiveCellCount;
size_t m_globalFractureModelActiveCellCount; //size_t m_globalFractureModelActiveCellCount;
cvf::Vec3st m_activeCellPositionMin; cvf::Vec3st m_activeCellPositionMin;
cvf::Vec3st m_activeCellPositionMax; cvf::Vec3st m_activeCellPositionMax;
cvf::Vec3st m_fractureModelActiveCellPositionMin; //cvf::Vec3st m_fractureModelActiveCellPositionMin;
cvf::Vec3st m_fractureModelActiveCellPositionMax; //cvf::Vec3st m_fractureModelActiveCellPositionMax;
cvf::BoundingBox m_matrixActiveCellsBoundingBox; cvf::BoundingBox m_matrixActiveCellsBoundingBox;
}; };

View File

@@ -287,14 +287,14 @@ void RigEclipseCase::computeActiveCellData()
matrixModelActiveBB.add(i, j, k); matrixModelActiveBB.add(i, j, k);
} }
if (m_activeCellInfo.isActiveInFractureModel(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_activeCellInfo.setFractureModelActiveCellsBoundingBox(fractureModelActiveBB.m_min, fractureModelActiveBB.m_max); m_fractureActiveCellInfo.setMatrixModelActiveCellsBoundingBox(fractureModelActiveBB.m_min, fractureModelActiveBB.m_max);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -309,17 +309,27 @@ void RigEclipseCase::computeCachedData()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigActiveCellInfo* RigEclipseCase::activeCellInfo() RigActiveCellInfo* RigEclipseCase::activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel)
{ {
return &m_activeCellInfo; if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
{
return &m_activeCellInfo;
}
return &m_fractureActiveCellInfo;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const RigActiveCellInfo* RigEclipseCase::activeCellInfo() const const RigActiveCellInfo* RigEclipseCase::activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const
{ {
return &m_activeCellInfo; if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
{
return &m_activeCellInfo;
}
return &m_fractureActiveCellInfo;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -331,33 +341,42 @@ void RigEclipseCase::computeActiveCellsGeometryBoundingBox()
{ {
cvf::BoundingBox bb; cvf::BoundingBox bb;
m_activeCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb); m_activeCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb);
m_fractureActiveCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb);
return; return;
} }
cvf::BoundingBox bb; RigActiveCellInfo* activeInfos[2];
if (m_mainGrid->nodes().size() == 0) activeInfos[0] = &m_fractureActiveCellInfo;
{ activeInfos[1] = &m_activeCellInfo; // Last, to make this bb.min become display offset
bb.add(cvf::Vec3d::ZERO);
}
else
{
for (size_t i = 0; i < m_mainGrid->cellCount(); i++)
{
if (m_activeCellInfo.isActiveInMatrixModel(i))
{
const RigCell& c = m_mainGrid->cells()[i];
const caf::SizeTArray8& indices = c.cornerIndices();
size_t idx; cvf::BoundingBox bb;
for (idx = 0; idx < 8; idx++) for (int acIdx = 0; acIdx < 2; ++acIdx)
{
bb.reset();
if (m_mainGrid->nodes().size() == 0)
{
bb.add(cvf::Vec3d::ZERO);
}
else
{
for (size_t i = 0; i < m_mainGrid->cellCount(); i++)
{
if (activeInfos[acIdx]->isActiveInMatrixModel(i))
{ {
bb.add(m_mainGrid->nodes()[indices[idx]]); const RigCell& c = m_mainGrid->cells()[i];
const caf::SizeTArray8& indices = c.cornerIndices();
size_t idx;
for (idx = 0; idx < 8; idx++)
{
bb.add(m_mainGrid->nodes()[indices[idx]]);
}
} }
} }
} }
}
m_activeCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb); activeInfos[acIdx]->setMatrixActiveCellsGeometryBoundingBox(bb);
}
m_mainGrid->setDisplayModelOffset(bb.min()); m_mainGrid->setDisplayModelOffset(bb.min());
} }

View File

@@ -36,55 +36,54 @@ public:
RigEclipseCase(); RigEclipseCase();
~RigEclipseCase(); ~RigEclipseCase();
RigMainGrid* mainGrid() { return m_mainGrid.p(); } RigMainGrid* mainGrid() { return m_mainGrid.p(); }
const RigMainGrid* mainGrid() const { return m_mainGrid.p(); } const RigMainGrid* mainGrid() const { return m_mainGrid.p(); }
void setMainGrid(RigMainGrid* mainGrid); void setMainGrid(RigMainGrid* mainGrid);
void allGrids(std::vector<RigGridBase*>* grids); // To be removed void allGrids(std::vector<RigGridBase*>* grids); // To be removed
void allGrids(std::vector<const RigGridBase*>* grids) const;// To be removed void allGrids(std::vector<const RigGridBase*>* grids) const;// To be removed
const RigGridBase* grid(size_t index) const; const RigGridBase* grid(size_t index) const;
RigGridBase* grid(size_t index); RigGridBase* grid(size_t index);
size_t gridCount() const; size_t gridCount() const;
RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel); RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel);
const RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel) const; const RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel) const;
RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel);
const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const;
void closeReaderInterface();
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject(const RigGridBase* grid, cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject(const RigGridBase* grid,
RifReaderInterface::PorosityModelResultType porosityModel, RifReaderInterface::PorosityModelResultType porosityModel,
size_t timeStepIndex, size_t timeStepIndex,
size_t scalarSetIndex); size_t scalarSetIndex);
void computeCachedData(); void setWellResults(const cvf::Collection<RigWellResults>& data);
const cvf::Collection<RigWellResults>& wellResults() { return m_wellResults; }
void setWellResults(const cvf::Collection<RigWellResults>& data);
const cvf::Collection<RigWellResults>& wellResults() { return m_wellResults; }
cvf::UByteArray* wellCellsInGrid(size_t gridIndex); cvf::UByteArray* wellCellsInGrid(size_t gridIndex);
RigCell& cellFromWellResultCell(const RigWellResultCell& wellResultCell); RigCell& cellFromWellResultCell(const RigWellResultCell& wellResultCell);
bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultCell& sourceWellCellResult, const RigWellResultCell& otherWellCellResult) const; bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultCell& sourceWellCellResult, const RigWellResultCell& otherWellCellResult) const;
RigActiveCellInfo* activeCellInfo();
const RigActiveCellInfo* activeCellInfo() const;
void computeCachedData();
void closeReaderInterface();
private: private:
void computeActiveCellData(); void computeActiveCellData();
void computeWellCellsPrGrid(); void computeWellCellsPrGrid();
void computeActiveCellsGeometryBoundingBox(); void computeActiveCellsGeometryBoundingBox();
private: private:
RigActiveCellInfo m_activeCellInfo; cvf::ref<RigMainGrid> m_mainGrid;
cvf::ref<RigMainGrid> m_mainGrid; RigActiveCellInfo m_activeCellInfo;
RigActiveCellInfo m_fractureActiveCellInfo;
cvf::ref<RigReservoirCellResults> m_matrixModelResults; cvf::ref<RigReservoirCellResults> m_matrixModelResults;
cvf::ref<RigReservoirCellResults> m_fractureModelResults; cvf::ref<RigReservoirCellResults> m_fractureModelResults;
cvf::Collection<RigWellResults> m_wellResults;
cvf::Collection<RigWellResults> m_wellResults; 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
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid;
}; };

View File

@@ -28,9 +28,7 @@
RigGridBase::RigGridBase(RigMainGrid* mainGrid): RigGridBase::RigGridBase(RigMainGrid* mainGrid):
m_gridPointDimensions(0,0,0), m_gridPointDimensions(0,0,0),
m_mainGrid(mainGrid), m_mainGrid(mainGrid),
m_indexToStartOfCells(0), m_indexToStartOfCells(0)
m_matrixModelActiveCellCount(cvf::UNDEFINED_SIZE_T),
m_fractureModelActiveCellCount(cvf::UNDEFINED_SIZE_T)
{ {
if (mainGrid == NULL) if (mainGrid == NULL)
{ {
@@ -451,38 +449,6 @@ double RigGridBase::characteristicIJCellSize()
return characteristicCellSize; return characteristicCellSize;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigGridBase::matrixModelActiveCellCount() const
{
return m_matrixModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigGridBase::fractureModelActiveCellCount() const
{
return m_fractureModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGridBase::setFractureModelActiveCellCount(size_t activeFractureModelCellCount)
{
m_fractureModelActiveCellCount = activeFractureModelCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGridBase::setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount)
{
m_matrixModelActiveCellCount = activeMatrixModelCellCount;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -63,12 +63,7 @@ public:
void computeFaults(); void computeFaults();
bool isMainGrid() const; bool isMainGrid() const;
RigMainGrid* mainGrid() const { return m_mainGrid; } RigMainGrid* mainGrid() const { return m_mainGrid; }
size_t matrixModelActiveCellCount() const;
void setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount);
size_t fractureModelActiveCellCount() const ;
void setFractureModelActiveCellCount(size_t activeFractureModelCellCount);
protected: protected:
friend class RigMainGrid;//::initAllSubGridsParentGridPointer(); friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
void initSubGridParentPointer(); void initSubGridParentPointer();
@@ -106,9 +101,6 @@ private:
size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0. size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0.
RigMainGrid* m_mainGrid; RigMainGrid* m_mainGrid;
size_t m_matrixModelActiveCellCount;
size_t m_fractureModelActiveCellCount;
}; };

View File

@@ -130,7 +130,7 @@ private:
/*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -179,7 +179,7 @@ private:
*/
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -194,11 +194,11 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::create
CVF_ASSERT(gridIndex < eclipseCase->gridCount()); CVF_ASSERT(gridIndex < eclipseCase->gridCount());
CVF_ASSERT(eclipseCase); CVF_ASSERT(eclipseCase);
CVF_ASSERT(eclipseCase->results(porosityModel)); CVF_ASSERT(eclipseCase->results(porosityModel));
CVF_ASSERT(eclipseCase->activeCellInfo()); CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
RigGridBase *grid = eclipseCase->grid(gridIndex); RigGridBase *grid = eclipseCase->grid(gridIndex);
if ( !eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo()) if ( !eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
{ {
return NULL; return NULL;
} }
@@ -215,16 +215,8 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::create
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex); bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex);
if (useGlobalActiveIndex) if (useGlobalActiveIndex)
{ {
if (porosityModel == RifReaderInterface::MATRIX_RESULTS) cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridMatrixActiveCellsScalarDataAccess(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));
{ return object;
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridMatrixActiveCellsScalarDataAccess(grid, resultValues, eclipseCase->activeCellInfo());
return object;
}
else
{
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridFractureActiveCellsScalarDataAccess(grid, resultValues, eclipseCase->activeCellInfo());
return object;
}
} }
else else
{ {

View File

@@ -247,7 +247,7 @@ void RigReservoirBuilderMock::populateReservoir(RigEclipseCase* eclipseCase)
addWellData(eclipseCase, eclipseCase->mainGrid()); addWellData(eclipseCase, eclipseCase->mainGrid());
// Set all cells active // Set all cells active
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(); RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
activeCellInfo->setGlobalCellCount(eclipseCase->mainGrid()->cells().size()); activeCellInfo->setGlobalCellCount(eclipseCase->mainGrid()->cells().size());
for (size_t i = 0; i < eclipseCase->mainGrid()->cells().size(); i++) for (size_t i = 0; i < eclipseCase->mainGrid()->cells().size(); i++)
{ {

View File

@@ -59,8 +59,10 @@ void RigStatistics::computeActiveCellUnion()
RigMainGrid* mainGrid = m_sourceCases[0]->mainGrid(); RigMainGrid* mainGrid = m_sourceCases[0]->mainGrid();
CVF_ASSERT(mainGrid); CVF_ASSERT(mainGrid);
m_destinationCase->activeCellInfo()->setGlobalCellCount(mainGrid->cells().size()); m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGlobalCellCount(mainGrid->cells().size());
m_destinationCase->activeCellInfo()->setGridCount(mainGrid->gridCount()); 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 globalActiveMatrixIndex = 0;
size_t globalActiveFractureIndex = 0; size_t globalActiveFractureIndex = 0;
@@ -80,7 +82,7 @@ void RigStatistics::computeActiveCellUnion()
if (activeM[localGridCellIdx] == 0) if (activeM[localGridCellIdx] == 0)
{ {
if (m_sourceCases[caseIdx]->activeCellInfo()->isActiveInMatrixModel(globalCellIdx)) if (m_sourceCases[caseIdx]->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActiveInMatrixModel(globalCellIdx))
{ {
activeM[localGridCellIdx] = 1; activeM[localGridCellIdx] = 1;
} }
@@ -88,7 +90,7 @@ void RigStatistics::computeActiveCellUnion()
if (activeF[localGridCellIdx] == 0) if (activeF[localGridCellIdx] == 0)
{ {
if (m_sourceCases[caseIdx]->activeCellInfo()->isActiveInFractureModel(globalCellIdx)) if (m_sourceCases[caseIdx]->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActiveInMatrixModel(globalCellIdx))
{ {
activeF[localGridCellIdx] = 1; activeF[localGridCellIdx] = 1;
} }
@@ -105,21 +107,24 @@ void RigStatistics::computeActiveCellUnion()
if (activeM[localGridCellIdx] != 0) if (activeM[localGridCellIdx] != 0)
{ {
m_destinationCase->activeCellInfo()->setActiveIndexInMatrixModel(globalCellIdx, globalActiveMatrixIndex++); m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setActiveIndexInMatrixModel(globalCellIdx, globalActiveMatrixIndex++);
activeMatrixIndex++; activeMatrixIndex++;
} }
if (activeF[localGridCellIdx] != 0) if (activeF[localGridCellIdx] != 0)
{ {
m_destinationCase->activeCellInfo()->setActiveIndexInFractureModel(globalCellIdx, globalActiveFractureIndex++); m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setActiveIndexInMatrixModel(globalCellIdx, globalActiveFractureIndex++);
activeFractureIndex++; activeFractureIndex++;
} }
} }
m_destinationCase->activeCellInfo()->setGridActiveCellCounts(gridIdx, activeMatrixIndex, activeFractureIndex); m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGridActiveCellCounts(gridIdx, activeMatrixIndex);
m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setGridActiveCellCounts(gridIdx, activeFractureIndex);
} }
m_destinationCase->activeCellInfo()->computeDerivedData(); m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData();
m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData();
m_destinationCase->computeCachedData(); m_destinationCase->computeCachedData();
} }
@@ -164,7 +169,7 @@ void RigStatistics::evaluateStatistics(const QList<QPair<RimDefines::ResultCatTy
computeActiveCellUnion(); computeActiveCellUnion();
size_t activeMatrixCellCount = m_destinationCase->activeCellInfo()->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);
for (int i = 0; i < resultSpecification.size(); i++) for (int i = 0; i < resultSpecification.size(); i++)
@@ -190,9 +195,9 @@ void RigStatistics::evaluateStatistics(const QList<QPair<RimDefines::ResultCatTy
} }
else else
{ {
// Meta info is loaded from disk for first case only // Meta info is loaded from disk for first case only
// Build metadata for all other source cases // Build metadata for all other source cases
buildSourceMetaData(resultType, resultName); buildSourceMetaData(resultType, resultName);
} }
QString minResultName = createResultNameMin(resultName); QString minResultName = createResultNameMin(resultName);
@@ -297,7 +302,7 @@ void RigStatistics::evaluateStatistics(const QList<QPair<RimDefines::ResultCatTy
std::vector<double> values(dataAccesObjectList.size(), HUGE_VAL); std::vector<double> values(dataAccesObjectList.size(), HUGE_VAL);
size_t globalGridCellIdx = grid->globalGridCellIndex(cellIdx); size_t globalGridCellIdx = grid->globalGridCellIndex(cellIdx);
if (m_destinationCase->activeCellInfo()->isActiveInMatrixModel(globalGridCellIdx)) if (m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActiveInMatrixModel(globalGridCellIdx))
{ {
bool foundAnyValidValues = false; bool foundAnyValidValues = false;
for (size_t caseIdx = 0; caseIdx < dataAccesObjectList.size(); caseIdx++) for (size_t caseIdx = 0; caseIdx < dataAccesObjectList.size(); caseIdx++)

View File

@@ -446,7 +446,7 @@ void RiaSocketServer::readPropertyDataFromOctave()
size_t cellCountFromOctave = m_bytesPerTimeStepToRead / sizeof(double); size_t cellCountFromOctave = m_bytesPerTimeStepToRead / sizeof(double);
size_t gridActiveCellCount = m_currentReservoir->reservoirData()->activeCellInfo()->globalMatrixModelActiveCellCount(); size_t gridActiveCellCount = m_currentReservoir->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->globalMatrixModelActiveCellCount();
size_t gridTotalCellCount = m_currentReservoir->reservoirData()->mainGrid()->cellCount(); size_t gridTotalCellCount = m_currentReservoir->reservoirData()->mainGrid()->cellCount();
if (cellCountFromOctave != gridActiveCellCount && cellCountFromOctave != gridTotalCellCount) if (cellCountFromOctave != gridActiveCellCount && cellCountFromOctave != gridTotalCellCount)
@@ -634,7 +634,7 @@ void RiaSocketServer::calculateMatrixModelActiveCellInfo(std::vector<qint32>& gr
return; return;
} }
RigActiveCellInfo* actCellInfo = m_currentReservoir->reservoirData()->activeCellInfo(); RigActiveCellInfo* actCellInfo = m_currentReservoir->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
size_t numMatrixModelActiveCells = actCellInfo->globalMatrixModelActiveCellCount(); size_t numMatrixModelActiveCells = actCellInfo->globalMatrixModelActiveCellCount();
gridNumber.reserve(numMatrixModelActiveCells); gridNumber.reserve(numMatrixModelActiveCells);

View File

@@ -540,13 +540,13 @@ void RIMainWindow::refreshAnimationActions()
{ {
enableAnimControls = true; enableAnimControls = true;
if (app->activeReservoirView()->gridCellResults()) if (app->activeReservoirView()->currentGridCellResults())
{ {
if (app->activeReservoirView()->cellResult()->hasDynamicResult() if (app->activeReservoirView()->cellResult()->hasDynamicResult()
|| app->activeReservoirView()->propertyFilterCollection()->hasActiveDynamicFilters() || app->activeReservoirView()->propertyFilterCollection()->hasActiveDynamicFilters()
|| app->activeReservoirView()->wellCollection()->hasVisibleWellPipes()) || app->activeReservoirView()->wellCollection()->hasVisibleWellPipes())
{ {
QList<QDateTime> timeStepDates = app->activeReservoirView()->gridCellResults()->timeStepDates(0); QList<QDateTime> timeStepDates = app->activeReservoirView()->currentGridCellResults()->timeStepDates(0);
bool showHoursAndMinutes = false; bool showHoursAndMinutes = false;
for (int i = 0; i < timeStepDates.size(); i++) for (int i = 0; i < timeStepDates.size(); i++)
{ {