mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Moved computation of geometry bounding box from main grid to reservoir
p4#: 20490
This commit is contained in:
parent
f04b4b0258
commit
e99c1cbfb1
@ -200,6 +200,22 @@ void RigActiveCellInfo::gridActiveCellCounts(size_t gridIndex, size_t& matrixAct
|
||||
fractureActiveCellCount = m_perGridActiveCellInfo[gridIndex].fractureModelActiveCellCount();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RigActiveCellInfo::matrixActiveCellsGeometryBoundingBox() const
|
||||
{
|
||||
return m_matrixActiveCellsBoundingBox;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellInfo::setMatrixActiveCellsGeometryBoundingBox(cvf::BoundingBox bb)
|
||||
{
|
||||
m_matrixActiveCellsBoundingBox = bb;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
void setFractureModelActiveCellsBoundingBox(const cvf::Vec3st& min, const cvf::Vec3st& max);
|
||||
void fractureModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
|
||||
|
||||
cvf::BoundingBox matrixActiveCellsGeometryBoundingBox() const;
|
||||
void setMatrixActiveCellsGeometryBoundingBox(cvf::BoundingBox bb);
|
||||
|
||||
|
||||
private:
|
||||
@ -93,6 +95,5 @@ private:
|
||||
// NOT USED
|
||||
// cvf::Vec3st m_validCellPositionMin;
|
||||
// cvf::Vec3st m_validCellPositionMax;
|
||||
// cvf::BoundingBox m_activeCellsBoundingBox;
|
||||
|
||||
cvf::BoundingBox m_matrixActiveCellsBoundingBox;
|
||||
};
|
||||
|
@ -28,10 +28,11 @@ RigMainGrid::RigMainGrid(void)
|
||||
{
|
||||
m_matrixModelResults = new RigReservoirCellResults(this);
|
||||
m_fractureModelResults = new RigReservoirCellResults(this);
|
||||
|
||||
m_activeCellsBoundingBox.add(cvf::Vec3d::ZERO);
|
||||
|
||||
m_displayModelOffset = cvf::Vec3d::ZERO;
|
||||
|
||||
m_gridIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RigMainGrid::~RigMainGrid(void)
|
||||
@ -74,87 +75,22 @@ void RigMainGrid::initAllSubCellsMainGridCellIndex()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RigMainGrid::matrixModelActiveCellsBoundingBox() const
|
||||
{
|
||||
return m_activeCellsBoundingBox;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// 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;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigMainGrid::displayModelOffset() const
|
||||
{
|
||||
return m_activeCellsBoundingBox.min();
|
||||
return m_displayModelOffset;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigMainGrid::computeBoundingBox()
|
||||
void RigMainGrid::setDisplayModelOffset(cvf::Vec3d offset)
|
||||
{
|
||||
m_activeCellsBoundingBox.reset();
|
||||
|
||||
if (m_nodes.size() == 0)
|
||||
{
|
||||
m_activeCellsBoundingBox.add(cvf::Vec3d::ZERO);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < cellCount(); i++)
|
||||
{
|
||||
const RigCell& c = cell(i);
|
||||
if (c.isActiveInMatrixModel())
|
||||
{
|
||||
const caf::SizeTArray8& indices = c.cornerIndices();
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 8; idx++)
|
||||
{
|
||||
m_activeCellsBoundingBox.add(m_nodes[indices[idx]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_displayModelOffset = offset;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Initialize pointers from grid to parent grid
|
||||
/// Compute cell ranges for active and valid cells
|
||||
@ -164,7 +100,6 @@ void RigMainGrid::computeCachedData()
|
||||
{
|
||||
initAllSubGridsParentGridPointer();
|
||||
initAllSubCellsMainGridCellIndex();
|
||||
computeBoundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -56,12 +56,12 @@ public:
|
||||
|
||||
// Overrides
|
||||
virtual cvf::Vec3d displayModelOffset() const;
|
||||
void setDisplayModelOffset(cvf::Vec3d offset);
|
||||
|
||||
private:
|
||||
void initAllSubGridsParentGridPointer();
|
||||
void initAllSubCellsMainGridCellIndex();
|
||||
void computeActiveAndValidCellRanges();
|
||||
void computeBoundingBox();
|
||||
|
||||
private:
|
||||
std::vector<cvf::Vec3d> m_nodes; ///< Global vertex table
|
||||
@ -71,6 +71,6 @@ private:
|
||||
cvf::ref<RigReservoirCellResults> m_matrixModelResults;
|
||||
cvf::ref<RigReservoirCellResults> m_fractureModelResults;
|
||||
|
||||
cvf::BoundingBox m_activeCellsBoundingBox;
|
||||
cvf::Vec3d m_displayModelOffset;
|
||||
};
|
||||
|
||||
|
@ -293,14 +293,7 @@ void RigReservoir::computeCachedData()
|
||||
{
|
||||
computeFaults();
|
||||
computeActiveCellData();
|
||||
|
||||
//TODO Set display model offset
|
||||
/*
|
||||
if (m_mainGrid.notNull())
|
||||
{
|
||||
m_mainGrid->setDisplayModelOffset(m_activeCellInfo.m_activeCellPositionMin);
|
||||
}
|
||||
*/
|
||||
computeActiveCellsGeometryBoundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -318,3 +311,43 @@ const RigActiveCellInfo* RigReservoir::activeCellInfo() const
|
||||
{
|
||||
return &m_activeCellInfo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoir::computeActiveCellsGeometryBoundingBox()
|
||||
{
|
||||
if (m_mainGrid.isNull())
|
||||
{
|
||||
cvf::BoundingBox bb;
|
||||
m_activeCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb);
|
||||
return;
|
||||
}
|
||||
|
||||
cvf::BoundingBox bb;
|
||||
if (m_mainGrid->nodes().size() == 0)
|
||||
{
|
||||
bb.add(cvf::Vec3d::ZERO);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < m_mainGrid->cells().size(); i++)
|
||||
{
|
||||
if (m_activeCellInfo.activeIndexInMatrixModel(i))
|
||||
{
|
||||
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);
|
||||
|
||||
m_mainGrid->setDisplayModelOffset(bb.min());
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ private:
|
||||
void computeFaults();
|
||||
void computeActiveCellData();
|
||||
void computeWellCellsPrGrid();
|
||||
void computeActiveCellsGeometryBoundingBox();
|
||||
|
||||
|
||||
private:
|
||||
RigActiveCellInfo m_activeCellInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user