mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use active cell info structure
p4#: 20455
This commit is contained in:
@@ -37,6 +37,7 @@ RigActiveCellInfo::RigActiveCellInfo()
|
||||
void RigActiveCellInfo::setGlobalCellCount(size_t globalCellCount)
|
||||
{
|
||||
m_activeInMatrixModel.resize(globalCellCount, cvf::UNDEFINED_SIZE_T);
|
||||
m_activeInFractureModel.resize(globalCellCount, cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -191,6 +192,15 @@ void RigActiveCellInfo::fractureModelActiveCellsBoundingBox(cvf::Vec3st& min, cv
|
||||
max = m_fractureModelActiveCellPositionMax;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellInfo::gridActiveCellCounts(size_t gridIndex, size_t& matrixActiveCellCount, size_t& fractureActiveCellCount)
|
||||
{
|
||||
matrixActiveCellCount = m_perGridActiveCellInfo[gridIndex].matrixModelActiveCellCount();
|
||||
fractureActiveCellCount = m_perGridActiveCellInfo[gridIndex].fractureModelActiveCellCount();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
// From RigBase
|
||||
void setGridCount(size_t gridCount);
|
||||
void setGridActiveCellCounts(size_t gridIndex, size_t matrixActiveCellCount, size_t fractureActiveCellCount);
|
||||
void gridActiveCellCounts(size_t gridIndex, size_t& matrixActiveCellCount, size_t& fractureActiveCellCount);
|
||||
void computeDerivedData();
|
||||
|
||||
|
||||
|
||||
@@ -499,6 +499,13 @@ void RigGridBase::setMatrixModelActiveCellCount(size_t activeMatrixModelCellCoun
|
||||
m_matrixModelActiveCellCount = activeMatrixModelCellCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigGridBase::mainGridCellIndex(size_t localGridCellIndex) const
|
||||
{
|
||||
return m_indexToStartOfCells + localGridCellIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -48,7 +48,9 @@ public:
|
||||
RigCell& cell(size_t gridCellIndex);
|
||||
const RigCell& cell(size_t gridCellIndex) const;
|
||||
|
||||
size_t mainGridCellIndex(size_t localGridCellIndex) const;
|
||||
void setIndexToStartOfCells(size_t indexToStartOfCells) { m_indexToStartOfCells = indexToStartOfCells; }
|
||||
|
||||
void setGridIndex(size_t index) { m_gridIndex = index; }
|
||||
size_t gridIndex() { return m_gridIndex; }
|
||||
|
||||
|
||||
@@ -222,3 +222,91 @@ bool RigReservoir::findSharedSourceFace(cvf::StructGridInterface::FaceType& shar
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Helper class used to find min/max range for valid and active cells
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class CellRangeBB
|
||||
{
|
||||
public:
|
||||
CellRangeBB()
|
||||
: m_min(cvf::UNDEFINED_SIZE_T, cvf::UNDEFINED_SIZE_T, cvf::UNDEFINED_SIZE_T),
|
||||
m_max(cvf::Vec3st::ZERO)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void add(size_t i, size_t j, size_t k)
|
||||
{
|
||||
if (i < m_min.x()) m_min.x() = i;
|
||||
if (j < m_min.y()) m_min.y() = j;
|
||||
if (k < m_min.z()) m_min.z() = k;
|
||||
|
||||
if (i > m_max.x()) m_max.x() = i;
|
||||
if (j > m_max.y()) m_max.y() = j;
|
||||
if (k > m_max.z()) m_max.z() = k;
|
||||
}
|
||||
|
||||
public:
|
||||
cvf::Vec3st m_min;
|
||||
cvf::Vec3st m_max;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoir::computeActiveCellData()
|
||||
{
|
||||
CellRangeBB matrixModelActiveBB;
|
||||
CellRangeBB fractureModelActiveBB;
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < m_mainGrid->cellCount(); idx++)
|
||||
{
|
||||
const RigCell& c = m_mainGrid->cell(idx);
|
||||
|
||||
size_t i, j, k;
|
||||
m_mainGrid->ijkFromCellIndex(idx, &i, &j, &k);
|
||||
|
||||
if (c.isActiveInMatrixModel())
|
||||
{
|
||||
matrixModelActiveBB.add(i, j, k);
|
||||
}
|
||||
|
||||
if (c.isActiveInFractureModel())
|
||||
{
|
||||
fractureModelActiveBB.add(i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
m_activeCellInfo.setMatrixModelActiveCellsBoundingBox(matrixModelActiveBB.m_min, matrixModelActiveBB.m_max);
|
||||
m_activeCellInfo.setFractureModelActiveCellsBoundingBox(fractureModelActiveBB.m_min, fractureModelActiveBB.m_max);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoir::computeCachedData()
|
||||
{
|
||||
computeFaults();
|
||||
computeActiveCellData();
|
||||
|
||||
//TODO Set display model offset
|
||||
/*
|
||||
if (m_mainGrid.notNull())
|
||||
{
|
||||
m_mainGrid->setDisplayModelOffset(m_activeCellInfo.m_activeCellPositionMin);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigActiveCellInfo* RigReservoir::activeCellInfo()
|
||||
{
|
||||
return &m_activeCellInfo;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "cvfObject.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigWellResults.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
|
||||
|
||||
class RigReservoir: public cvf::Object
|
||||
@@ -40,17 +41,20 @@ public:
|
||||
void allGrids(std::vector<const RigGridBase*>* grids) const;
|
||||
const RigGridBase* grid(size_t index) const;
|
||||
|
||||
void computeCachedData();
|
||||
|
||||
void setWellResults(const cvf::Collection<RigWellResults>& data);
|
||||
const cvf::Collection<RigWellResults>& wellResults() { return m_wellResults; }
|
||||
|
||||
|
||||
cvf::UByteArray* wellCellsInGrid(size_t gridIndex);
|
||||
void computeFaults();
|
||||
|
||||
RigCell& cellFromWellResultCell(const RigWellResultCell& wellResultCell);
|
||||
bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultCell& sourceWellCellResult, const RigWellResultCell& otherWellCellResult) const;
|
||||
|
||||
RigActiveCellInfo* activeCellInfo();
|
||||
|
||||
/*
|
||||
// From RigMainGrid, can this function be moved to Octave socket server?
|
||||
void calculateMatrixModelActiveCellInfo(std::vector<qint32>& gridNumber,
|
||||
std::vector<qint32>& i,
|
||||
@@ -60,11 +64,15 @@ public:
|
||||
std::vector<qint32>& hostCellI,
|
||||
std::vector<qint32>& hostCellJ,
|
||||
std::vector<qint32>& hostCellK);
|
||||
|
||||
*/
|
||||
|
||||
private:
|
||||
void computeFaults();
|
||||
void computeActiveCellData();
|
||||
void computeWellCellsPrGrid();
|
||||
|
||||
private:
|
||||
RigActiveCellInfo m_activeCellInfo;
|
||||
cvf::ref<RigMainGrid> m_mainGrid;
|
||||
|
||||
cvf::Collection<RigWellResults> m_wellResults;
|
||||
|
||||
Reference in New Issue
Block a user