mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5405 Faults : Use cell index as ID for bounding box in AABB tree
This commit is contained in:
parent
6f54d176cc
commit
8ecf5bc7eb
@ -712,8 +712,11 @@ void RigMainGrid::buildCellSearchTree()
|
||||
|
||||
size_t cellCount = m_cells.size();
|
||||
|
||||
std::vector<size_t> cellIndicesForBoundingBoxes;
|
||||
cellIndicesForBoundingBoxes.reserve( cellCount );
|
||||
|
||||
std::vector<cvf::BoundingBox> cellBoundingBoxes;
|
||||
cellBoundingBoxes.resize( cellCount );
|
||||
cellBoundingBoxes.reserve( cellCount );
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < cellCount; ++cIdx )
|
||||
{
|
||||
@ -721,7 +724,7 @@ void RigMainGrid::buildCellSearchTree()
|
||||
|
||||
const std::array<size_t, 8>& cellIndices = m_cells[cIdx].cornerIndices();
|
||||
|
||||
cvf::BoundingBox& cellBB = cellBoundingBoxes[cIdx];
|
||||
cvf::BoundingBox cellBB;
|
||||
cellBB.add( m_nodes[cellIndices[0]] );
|
||||
cellBB.add( m_nodes[cellIndices[1]] );
|
||||
cellBB.add( m_nodes[cellIndices[2]] );
|
||||
@ -730,10 +733,19 @@ void RigMainGrid::buildCellSearchTree()
|
||||
cellBB.add( m_nodes[cellIndices[5]] );
|
||||
cellBB.add( m_nodes[cellIndices[6]] );
|
||||
cellBB.add( m_nodes[cellIndices[7]] );
|
||||
|
||||
if ( cellBB.isValid() )
|
||||
{
|
||||
cellIndicesForBoundingBoxes.emplace_back( cIdx );
|
||||
cellBoundingBoxes.emplace_back( cellBB );
|
||||
}
|
||||
}
|
||||
|
||||
cellIndicesForBoundingBoxes.shrink_to_fit();
|
||||
cellBoundingBoxes.shrink_to_fit();
|
||||
|
||||
m_cellSearchTree = new cvf::BoundingBoxTree;
|
||||
m_cellSearchTree->buildTreeFromBoundingBoxes( cellBoundingBoxes, nullptr );
|
||||
m_cellSearchTree->buildTreeFromBoundingBoxes( cellBoundingBoxes, &cellIndicesForBoundingBoxes );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user