mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#415) Used AABB tree to search for elements
to find close elements to the wellpath for Geom Well Log extraction
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "RigFemPartGrid.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfBoundingBoxTree.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -338,3 +339,38 @@ cvf::BoundingBox RigFemPart::boundingBox()
|
||||
return m_boundingBox;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPart::findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* elementIndices) const
|
||||
{
|
||||
if (m_elementSearchTree.isNull())
|
||||
{
|
||||
// build tree
|
||||
|
||||
size_t elmCount = elementCount();
|
||||
|
||||
std::vector<cvf::BoundingBox> cellBoundingBoxes;
|
||||
cellBoundingBoxes.resize(elmCount);
|
||||
|
||||
for (size_t elmIdx = 0; elmIdx < elmCount; ++elmIdx)
|
||||
{
|
||||
const int* cellIndices = connectivities(elmIdx);
|
||||
cvf::BoundingBox& cellBB = cellBoundingBoxes[elmIdx];
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[0]]);
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[1]]);
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[2]]);
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[3]]);
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[4]]);
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[5]]);
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[6]]);
|
||||
cellBB.add(m_nodes.coordinates[cellIndices[7]]);
|
||||
}
|
||||
|
||||
m_elementSearchTree = new cvf::BoundingBoxTree;
|
||||
m_elementSearchTree->buildTreeFromBoundingBoxes(cellBoundingBoxes, NULL);
|
||||
}
|
||||
|
||||
m_elementSearchTree->findIntersections(inputBB, elementIndices);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user