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:
@@ -200,6 +200,22 @@ void RigActiveCellInfo::gridActiveCellCounts(size_t gridIndex, size_t& matrixAct
|
|||||||
fractureActiveCellCount = m_perGridActiveCellInfo[gridIndex].fractureModelActiveCellCount();
|
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 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;
|
||||||
|
void setMatrixActiveCellsGeometryBoundingBox(cvf::BoundingBox bb);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -93,6 +95,5 @@ private:
|
|||||||
// NOT USED
|
// NOT USED
|
||||||
// cvf::Vec3st m_validCellPositionMin;
|
// cvf::Vec3st m_validCellPositionMin;
|
||||||
// cvf::Vec3st m_validCellPositionMax;
|
// cvf::Vec3st m_validCellPositionMax;
|
||||||
// cvf::BoundingBox m_activeCellsBoundingBox;
|
cvf::BoundingBox m_matrixActiveCellsBoundingBox;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ RigMainGrid::RigMainGrid(void)
|
|||||||
m_matrixModelResults = new RigReservoirCellResults(this);
|
m_matrixModelResults = new RigReservoirCellResults(this);
|
||||||
m_fractureModelResults = new RigReservoirCellResults(this);
|
m_fractureModelResults = new RigReservoirCellResults(this);
|
||||||
|
|
||||||
m_activeCellsBoundingBox.add(cvf::Vec3d::ZERO);
|
m_displayModelOffset = cvf::Vec3d::ZERO;
|
||||||
|
|
||||||
m_gridIndex = 0;
|
m_gridIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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
|
cvf::Vec3d RigMainGrid::displayModelOffset() const
|
||||||
{
|
{
|
||||||
return m_activeCellsBoundingBox.min();
|
return m_displayModelOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigMainGrid::computeBoundingBox()
|
void RigMainGrid::setDisplayModelOffset(cvf::Vec3d offset)
|
||||||
{
|
{
|
||||||
m_activeCellsBoundingBox.reset();
|
m_displayModelOffset = offset;
|
||||||
|
|
||||||
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]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Initialize pointers from grid to parent grid
|
/// Initialize pointers from grid to parent grid
|
||||||
/// Compute cell ranges for active and valid cells
|
/// Compute cell ranges for active and valid cells
|
||||||
@@ -164,7 +100,6 @@ void RigMainGrid::computeCachedData()
|
|||||||
{
|
{
|
||||||
initAllSubGridsParentGridPointer();
|
initAllSubGridsParentGridPointer();
|
||||||
initAllSubCellsMainGridCellIndex();
|
initAllSubCellsMainGridCellIndex();
|
||||||
computeBoundingBox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ public:
|
|||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual cvf::Vec3d displayModelOffset() const;
|
virtual cvf::Vec3d displayModelOffset() const;
|
||||||
|
void setDisplayModelOffset(cvf::Vec3d offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSubGridsParentGridPointer();
|
void initAllSubGridsParentGridPointer();
|
||||||
void initAllSubCellsMainGridCellIndex();
|
void initAllSubCellsMainGridCellIndex();
|
||||||
void computeActiveAndValidCellRanges();
|
void computeActiveAndValidCellRanges();
|
||||||
void computeBoundingBox();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<cvf::Vec3d> m_nodes; ///< Global vertex table
|
std::vector<cvf::Vec3d> m_nodes; ///< Global vertex table
|
||||||
@@ -71,6 +71,6 @@ private:
|
|||||||
cvf::ref<RigReservoirCellResults> m_matrixModelResults;
|
cvf::ref<RigReservoirCellResults> m_matrixModelResults;
|
||||||
cvf::ref<RigReservoirCellResults> m_fractureModelResults;
|
cvf::ref<RigReservoirCellResults> m_fractureModelResults;
|
||||||
|
|
||||||
cvf::BoundingBox m_activeCellsBoundingBox;
|
cvf::Vec3d m_displayModelOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -293,14 +293,7 @@ void RigReservoir::computeCachedData()
|
|||||||
{
|
{
|
||||||
computeFaults();
|
computeFaults();
|
||||||
computeActiveCellData();
|
computeActiveCellData();
|
||||||
|
computeActiveCellsGeometryBoundingBox();
|
||||||
//TODO Set display model offset
|
|
||||||
/*
|
|
||||||
if (m_mainGrid.notNull())
|
|
||||||
{
|
|
||||||
m_mainGrid->setDisplayModelOffset(m_activeCellInfo.m_activeCellPositionMin);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -318,3 +311,43 @@ const RigActiveCellInfo* RigReservoir::activeCellInfo() const
|
|||||||
{
|
{
|
||||||
return &m_activeCellInfo;
|
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 computeFaults();
|
||||||
void computeActiveCellData();
|
void computeActiveCellData();
|
||||||
void computeWellCellsPrGrid();
|
void computeWellCellsPrGrid();
|
||||||
|
void computeActiveCellsGeometryBoundingBox();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RigActiveCellInfo m_activeCellInfo;
|
RigActiveCellInfo m_activeCellInfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user