(#415) Use AABB tree for searching after cells

close to line segment for Eclipse cases
Fixed crash when well path geometry is empty
This commit is contained in:
Jacob Støren 2015-09-07 16:15:37 +02:00
parent 6440215d21
commit 3468160d8f
3 changed files with 11 additions and 5 deletions

View File

@ -26,6 +26,7 @@
#include "cvfGeometryTools.h" #include "cvfGeometryTools.h"
#include "RigWellLogExtractionTools.h" #include "RigWellLogExtractionTools.h"
#include "RigMainGrid.h"
//================================================================================================== //==================================================================================================
/// ///
@ -47,6 +48,8 @@ void RigEclipseWellLogExtractor::calculateIntersection()
double globalMeasuredDepth = 0; // Where do we start ? z - of first well path point ? double globalMeasuredDepth = 0; // Where do we start ? z - of first well path point ?
if (!m_wellPath->m_wellPathPoints.size()) return ;
for (size_t wpp = 0; wpp < m_wellPath->m_wellPathPoints.size() - 1; ++wpp) for (size_t wpp = 0; wpp < m_wellPath->m_wellPathPoints.size() - 1; ++wpp)
{ {
cvf::BoundingBox bb; cvf::BoundingBox bb;
@ -133,10 +136,13 @@ void RigEclipseWellLogExtractor::curveData(const RigResultAccessor* resultAccess
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<size_t> RigEclipseWellLogExtractor::findCloseCells(const cvf::BoundingBox& bb) std::vector<size_t> RigEclipseWellLogExtractor::findCloseCells(const cvf::BoundingBox& bb)
{ {
std::vector<size_t> closeCells;
m_caseData->mainGrid()->findIntersectingCells(bb, &closeCells);
#if 0
const std::vector<RigCell>& cells = m_caseData->mainGrid()->cells(); const std::vector<RigCell>& cells = m_caseData->mainGrid()->cells();
const std::vector<cvf::Vec3d>& nodeCoords = m_caseData->mainGrid()->nodes(); const std::vector<cvf::Vec3d>& nodeCoords = m_caseData->mainGrid()->nodes();
std::vector<size_t> closeCells;
size_t cellCount = cells.size(); size_t cellCount = cells.size();
for (size_t cIdx = 0; cIdx < cellCount; ++cIdx) for (size_t cIdx = 0; cIdx < cellCount; ++cIdx)
@ -157,7 +163,7 @@ std::vector<size_t> RigEclipseWellLogExtractor::findCloseCells(const cvf::Boundi
closeCells.push_back(cIdx); closeCells.push_back(cIdx);
} }
} }
#endif
return closeCells; return closeCells;
} }

View File

@ -446,7 +446,7 @@ const RigFault* RigMainGrid::findFaultFromCellIndexAndCellFace(size_t reservoirC
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigMainGrid::findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices) void RigMainGrid::findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices) const
{ {
if (m_cellSearchTree.isNull()) if (m_cellSearchTree.isNull())
{ {

View File

@ -68,7 +68,7 @@ public:
void setDisplayModelOffset(cvf::Vec3d offset); void setDisplayModelOffset(cvf::Vec3d offset);
void setFlipAxis(bool flipXAxis, bool flipYAxis); void setFlipAxis(bool flipXAxis, bool flipYAxis);
void findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices); void findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector<size_t>* cellIndices) const;
private: private:
void initAllSubGridsParentGridPointer(); void initAllSubGridsParentGridPointer();
@ -87,7 +87,7 @@ private:
cvf::ref<RigFaultsPrCellAccumulator> m_faultsPrCellAcc; cvf::ref<RigFaultsPrCellAccumulator> m_faultsPrCellAcc;
cvf::Vec3d m_displayModelOffset; cvf::Vec3d m_displayModelOffset;
cvf::ref<cvf::BoundingBoxTree> m_cellSearchTree; mutable cvf::ref<cvf::BoundingBoxTree> m_cellSearchTree;
bool m_flipXAxis; bool m_flipXAxis;
bool m_flipYAxis; bool m_flipYAxis;