mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Compute active and fracture cell count for all grids
Renamed numActiveCells on maingrid to globalMatrixActiveCellCount p4#: 20295
This commit is contained in:
parent
76721130eb
commit
4275e67a82
@ -114,6 +114,6 @@ TEST(RigReservoirTest, ElipseInputGridFile)
|
||||
bool result = inputReader.open("TEST10K_FLT_LGR_NNC.grdecl", &res);
|
||||
EXPECT_TRUE(result);
|
||||
EXPECT_EQ(size_t(1), res.mainGrid()->cells().size());
|
||||
EXPECT_EQ(size_t(1), res.mainGrid()->numActiveCells());
|
||||
EXPECT_EQ(size_t(1), res.mainGrid()->globalMatrixActiveCellCount());
|
||||
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
|
||||
caf::ProgressInfo progInfo(2,"");
|
||||
|
||||
// Get the number of active cells in the grid
|
||||
size_t numActiveCells = reservoir->mainGrid()->numActiveCells();
|
||||
size_t numActiveCells = reservoir->mainGrid()->globalMatrixActiveCellCount();
|
||||
size_t numGrids = reservoir->mainGrid()->gridCount();
|
||||
|
||||
// Create access object for dynamic results
|
||||
|
@ -89,7 +89,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
{
|
||||
caseName = m_reservoirView->eclipseCase()->caseName();
|
||||
totCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cells().size());
|
||||
activeCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->numActiveCells());
|
||||
activeCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->globalMatrixActiveCellCount());
|
||||
iSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountI());
|
||||
jSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountJ());
|
||||
kSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountK());
|
||||
|
@ -28,7 +28,9 @@
|
||||
RigGridBase::RigGridBase(RigMainGrid* mainGrid):
|
||||
m_gridPointDimensions(0,0,0),
|
||||
m_mainGrid(mainGrid),
|
||||
m_indexToStartOfCells(0)
|
||||
m_indexToStartOfCells(0),
|
||||
m_matrixActiveCellCount(cvf::UNDEFINED_SIZE_T),
|
||||
m_fractureActiveCellCount(cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
if (mainGrid == NULL)
|
||||
{
|
||||
@ -524,6 +526,59 @@ double RigGridBase::characteristicCellSize()
|
||||
return characteristicCellSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigGridBase::activeMatrixCellCount()
|
||||
{
|
||||
if (m_matrixActiveCellCount == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
computeMatrixAndFractureActiveCellCount();
|
||||
}
|
||||
|
||||
CVF_ASSERT(m_matrixActiveCellCount != cvf::UNDEFINED_SIZE_T);
|
||||
|
||||
return m_matrixActiveCellCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigGridBase::activeFractureCellCount()
|
||||
{
|
||||
if (m_fractureActiveCellCount == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
computeMatrixAndFractureActiveCellCount();
|
||||
}
|
||||
|
||||
CVF_ASSERT(m_fractureActiveCellCount != cvf::UNDEFINED_SIZE_T);
|
||||
|
||||
return m_fractureActiveCellCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigGridBase::computeMatrixAndFractureActiveCellCount()
|
||||
{
|
||||
m_matrixActiveCellCount = 0;
|
||||
m_fractureActiveCellCount = 0;
|
||||
|
||||
for (size_t i = 0; i < cellCount(); i++)
|
||||
{
|
||||
const RigCell& c = cell(i);
|
||||
if (c.matrixActive())
|
||||
{
|
||||
m_matrixActiveCellCount++;
|
||||
}
|
||||
|
||||
if (c.fractureActive())
|
||||
{
|
||||
m_fractureActiveCellCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -58,6 +58,10 @@ public:
|
||||
bool isMainGrid() const;
|
||||
RigMainGrid* mainGrid() const { return m_mainGrid; }
|
||||
|
||||
size_t activeMatrixCellCount();
|
||||
size_t activeFractureCellCount();
|
||||
void computeMatrixAndFractureActiveCellCount();
|
||||
|
||||
protected:
|
||||
friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
|
||||
void initSubGridParentPointer();
|
||||
@ -97,12 +101,16 @@ public:
|
||||
virtual bool isCellActive( size_t i, size_t j, size_t k ) const;
|
||||
virtual bool isCellValid( size_t i, size_t j, size_t k ) const;
|
||||
virtual bool cellIJKNeighbor(size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const;
|
||||
|
||||
private:
|
||||
std::string m_gridName;
|
||||
cvf::Vec3st m_gridPointDimensions;
|
||||
size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts.
|
||||
size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0.
|
||||
RigMainGrid* m_mainGrid;
|
||||
|
||||
size_t m_matrixActiveCellCount;
|
||||
size_t m_fractureActiveCellCount;
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ RigMainGrid::RigMainGrid(void)
|
||||
m_activeCellPositionMax(cvf::Vec3st::UNDEFINED),
|
||||
m_validCellPositionMin(cvf::Vec3st::UNDEFINED),
|
||||
m_validCellPositionMax(cvf::Vec3st::UNDEFINED),
|
||||
m_activeCellCount(cvf::UNDEFINED_SIZE_T)
|
||||
m_globalMatrixActiveCellCount(cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
m_results = new RigReservoirCellResults(this);
|
||||
|
||||
@ -82,9 +82,9 @@ void RigMainGrid::initAllSubCellsMainGridCellIndex()
|
||||
/// Calculates the number of active cells in the complete reservoir.
|
||||
/// Caches the result, so subsequent calls are fast
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigMainGrid::numActiveCells()
|
||||
size_t RigMainGrid::globalMatrixActiveCellCount()
|
||||
{
|
||||
if (m_activeCellCount != cvf::UNDEFINED_SIZE_T) return m_activeCellCount;
|
||||
if (m_globalMatrixActiveCellCount != cvf::UNDEFINED_SIZE_T) return m_globalMatrixActiveCellCount;
|
||||
|
||||
if (m_cells.size() == 0) return 0;
|
||||
|
||||
@ -96,8 +96,8 @@ size_t RigMainGrid::numActiveCells()
|
||||
if (m_cells[i].matrixActive()) numActiveCells++;
|
||||
}
|
||||
|
||||
m_activeCellCount = numActiveCells;
|
||||
return m_activeCellCount;
|
||||
m_globalMatrixActiveCellCount = numActiveCells;
|
||||
return m_globalMatrixActiveCellCount;
|
||||
}
|
||||
|
||||
|
||||
@ -248,6 +248,7 @@ void RigMainGrid::computeCachedData()
|
||||
initAllSubCellsMainGridCellIndex();
|
||||
computeActiveAndValidCellRanges();
|
||||
computeBoundingBox();
|
||||
computeActiveCellCountForAllGrids();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -264,7 +265,7 @@ void RigMainGrid::calculateActiveCellInfo(std::vector<qint32> &gridNumber,
|
||||
std::vector<qint32> &hostCellJ,
|
||||
std::vector<qint32> &hostCellK)
|
||||
{
|
||||
size_t numActiveCells = this->numActiveCells();
|
||||
size_t numActiveCells = this->globalMatrixActiveCellCount();
|
||||
|
||||
gridNumber.clear();
|
||||
cellI.clear();
|
||||
@ -344,3 +345,17 @@ const RigGridBase* RigMainGrid::gridByIndex(size_t localGridIndex) const
|
||||
CVF_ASSERT(localGridIndex - 1 < m_localGrids.size()) ;
|
||||
return m_localGrids[localGridIndex-1].p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigMainGrid::computeActiveCellCountForAllGrids()
|
||||
{
|
||||
computeMatrixAndFractureActiveCellCount();
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < m_localGrids.size(); ++i)
|
||||
{
|
||||
m_localGrids[i]->computeMatrixAndFractureActiveCellCount();
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
RigReservoirCellResults* results() {return m_results.p();}
|
||||
const RigReservoirCellResults* results() const {return m_results.p();}
|
||||
|
||||
size_t numActiveCells();
|
||||
size_t globalMatrixActiveCellCount();
|
||||
void activeCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
|
||||
void validCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
|
||||
|
||||
@ -72,12 +72,14 @@ private:
|
||||
void initAllSubCellsMainGridCellIndex();
|
||||
void computeActiveAndValidCellRanges();
|
||||
void computeBoundingBox();
|
||||
void computeActiveCellCountForAllGrids();
|
||||
|
||||
private:
|
||||
std::vector<cvf::Vec3d> m_nodes; ///< Global vertex table
|
||||
std::vector<RigCell> m_cells; ///< Global array of all cells in the reservoir (including the ones in LGR's)
|
||||
cvf::Collection<RigLocalGrid> m_localGrids; ///< List of all the LGR's in this reservoir
|
||||
cvf::ref<RigReservoirCellResults> m_results;
|
||||
size_t m_activeCellCount;
|
||||
size_t m_globalMatrixActiveCellCount;
|
||||
|
||||
cvf::Vec3st m_activeCellPositionMin;
|
||||
cvf::Vec3st m_activeCellPositionMax;
|
||||
|
@ -512,7 +512,7 @@ void RigReservoirCellResults::computeDepthRelatedResults()
|
||||
std::vector< std::vector<double> >& tops = cellScalarResults(topsResultGridIndex);
|
||||
std::vector< std::vector<double> >& bottom = cellScalarResults(bottomResultGridIndex);
|
||||
|
||||
bool computeValuesForActiveCellsOnly = m_ownerMainGrid->numActiveCells() > 0;
|
||||
bool computeValuesForActiveCellsOnly = m_ownerMainGrid->globalMatrixActiveCellCount() > 0;
|
||||
|
||||
size_t cellIdx = 0;
|
||||
for (cellIdx = 0; cellIdx < m_ownerMainGrid->cells().size(); cellIdx++)
|
||||
@ -651,7 +651,7 @@ bool RigReservoirCellResults::isUsingGlobalActiveIndex(size_t scalarResultIndex)
|
||||
CVF_TIGHT_ASSERT(scalarResultIndex < m_cellScalarResults.size());
|
||||
|
||||
if (!m_cellScalarResults[scalarResultIndex].size()) return true;
|
||||
if (m_cellScalarResults[scalarResultIndex][0].size() == m_ownerMainGrid->numActiveCells()) return true;
|
||||
if (m_cellScalarResults[scalarResultIndex][0].size() == m_ownerMainGrid->globalMatrixActiveCellCount()) return true;
|
||||
if (m_cellScalarResults[scalarResultIndex][0].size() == m_ownerMainGrid->cellCount()) return false;
|
||||
|
||||
CVF_TIGHT_ASSERT(false); // Wrong number of results
|
||||
|
@ -441,7 +441,7 @@ void RiaSocketServer::readPropertyDataFromOctave()
|
||||
|
||||
size_t cellCountFromOctave = m_bytesPerTimeStepToRead / sizeof(double);
|
||||
|
||||
size_t gridActiveCellCount = m_currentReservoir->reservoirData()->mainGrid()->numActiveCells();
|
||||
size_t gridActiveCellCount = m_currentReservoir->reservoirData()->mainGrid()->globalMatrixActiveCellCount();
|
||||
size_t gridTotalCellCount = m_currentReservoir->reservoirData()->mainGrid()->cellCount();
|
||||
|
||||
if (cellCountFromOctave != gridActiveCellCount && cellCountFromOctave != gridTotalCellCount)
|
||||
|
Loading…
Reference in New Issue
Block a user