#1531 Display message in logger if perforation interval is outside eclipse grid

This commit is contained in:
Bjørnar Grip Fjær
2017-05-30 12:10:05 +02:00
parent 5cafccdc80
commit 99da23d4a7
2 changed files with 18 additions and 8 deletions

View File

@@ -18,6 +18,8 @@
#include "RigWellPathIntersectionTools.h" #include "RigWellPathIntersectionTools.h"
#include "RiaLogging.h"
#include "RigWellPath.h" #include "RigWellPath.h"
#include "RigMainGrid.h" #include "RigMainGrid.h"
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
@@ -50,12 +52,20 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
if (includeStartCell) if (includeStartCell)
{ {
bool foundCell;
startPoint = coords[0]; startPoint = coords[0];
cellIndex = findCellFromCoords(grid, startPoint, &foundCell);
if (foundCell)
{
endPoint = intersection->m_intersectionPoint; endPoint = intersection->m_intersectionPoint;
cellIndex = findCellFromCoords(grid, startPoint);
direction = calculateDirectionInCell(grid, cellIndex, startPoint, endPoint); direction = calculateDirectionInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, direction, startPoint, endPoint)); intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, direction, startPoint, endPoint));
} }
else
{
RiaLogging::debug("Path starts outside valid cell");
}
}
startPoint = intersection->m_intersectionPoint; startPoint = intersection->m_intersectionPoint;
cellIndex = intersection->m_hexIndex; cellIndex = intersection->m_hexIndex;
@@ -228,7 +238,7 @@ std::vector<size_t> RigWellPathIntersectionTools::findCloseCells(const RigMainGr
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid, const cvf::Vec3d& coords) size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid, const cvf::Vec3d& coords, bool* foundCell)
{ {
const std::vector<cvf::Vec3d>& nodeCoords = grid->nodes(); const std::vector<cvf::Vec3d>& nodeCoords = grid->nodes();
@@ -246,12 +256,12 @@ size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid,
if (RigHexIntersector::isPointInCell(coords, hexCorners)) if (RigHexIntersector::isPointInCell(coords, hexCorners))
{ {
*foundCell = true;
return closeCell; return closeCell;
} }
} }
// Coordinate is outside any cells? *foundCell = false;
CVF_ASSERT(false);
return 0; return 0;
} }

View File

@@ -76,7 +76,7 @@ public:
static WellPathCellDirection calculateDirectionInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint); static WellPathCellDirection calculateDirectionInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
static std::vector<size_t> findCloseCells(const RigMainGrid* grid, const cvf::BoundingBox& bb); static std::vector<size_t> findCloseCells(const RigMainGrid* grid, const cvf::BoundingBox& bb);
static size_t findCellFromCoords(const RigMainGrid* caseData, const cvf::Vec3d& coords); static size_t findCellFromCoords(const RigMainGrid* caseData, const cvf::Vec3d& coords, bool* foundCell);
static std::array<cvf::Vec3d, 8> getCellHexCorners(const RigMainGrid* grid, size_t cellIndex); static std::array<cvf::Vec3d, 8> getCellHexCorners(const RigMainGrid* grid, size_t cellIndex);
static void setHexCorners(const RigCell& cell, const std::vector<cvf::Vec3d>& nodeCoords, cvf::Vec3d* hexCorners); static void setHexCorners(const RigCell& cell, const std::vector<cvf::Vec3d>& nodeCoords, cvf::Vec3d* hexCorners);