(#700) Build bounding box search tree when grid is loaded

This commit is contained in:
Magne Sjaastad 2015-12-09 15:36:37 +01:00
parent 47bb20368a
commit 4713014d26
2 changed files with 16 additions and 4 deletions

View File

@ -116,6 +116,8 @@ void RigMainGrid::computeCachedData()
{
initAllSubGridsParentGridPointer();
initAllSubCellsMainGridCellIndex();
buildCellSearchTree();
}
//--------------------------------------------------------------------------------------------------
@ -449,6 +451,16 @@ const RigFault* RigMainGrid::findFaultFromCellIndexAndCellFace(size_t reservoirC
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices) const
{
CVF_ASSERT(m_cellSearchTree.notNull());
m_cellSearchTree->findIntersections(inputBB, cellIndices);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::buildCellSearchTree()
{
if (m_cellSearchTree.isNull())
{
@ -476,8 +488,6 @@ void RigMainGrid::findIntersectingCells(const cvf::BoundingBox& inputBB, std::ve
m_cellSearchTree = new cvf::BoundingBoxTree;
m_cellSearchTree->buildTreeFromBoundingBoxes(cellBoundingBoxes, NULL);
}
m_cellSearchTree->findIntersections(inputBB, cellIndices);
}
//--------------------------------------------------------------------------------------------------

View File

@ -69,11 +69,13 @@ public:
void setFlipAxis(bool flipXAxis, bool flipYAxis);
void findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices) const;
cvf::BoundingBox boundingBox() const;
cvf::BoundingBox boundingBox() const;
private:
void initAllSubGridsParentGridPointer();
void initAllSubCellsMainGridCellIndex();
void computeActiveAndValidCellRanges();
void buildCellSearchTree();
private:
std::vector<cvf::Vec3d> m_nodes; ///< Global vertex table
@ -87,7 +89,7 @@ private:
cvf::ref<RigFaultsPrCellAccumulator> m_faultsPrCellAcc;
cvf::Vec3d m_displayModelOffset;
mutable cvf::ref<cvf::BoundingBoxTree> m_cellSearchTree;
cvf::ref<cvf::BoundingBoxTree> m_cellSearchTree;
mutable cvf::BoundingBox m_boundingBox;
bool m_flipXAxis;