(#557, #560, #561) WLP: Aligned intresection map insertion code Geom/Eclipse

This commit is contained in:
Jacob Støren 2015-10-14 10:10:07 +02:00
parent 8d2fee9bf4
commit 9fa2395fdc
4 changed files with 54 additions and 52 deletions

View File

@ -46,25 +46,26 @@ void RigEclipseWellLogExtractor::calculateIntersection()
{
std::map<RigMDCellIdxEnterLeaveIntersectionSorterKey, HexIntersectionInfo > uniqueIntersections;
{
const std::vector<cvf::Vec3d>& nodeCoords = m_caseData->mainGrid()->nodes();
bool isCellFaceNormalsOut = m_caseData->mainGrid()->isFaceNormalsOutwards();
if (!m_wellPath->m_wellPathPoints.size()) return ;
for (size_t wpp = 0; wpp < m_wellPath->m_wellPathPoints.size() - 1; ++wpp)
{
cvf::BoundingBox bb;
std::vector<HexIntersectionInfo> intersections;
cvf::Vec3d p1 = m_wellPath->m_wellPathPoints[wpp];
cvf::Vec3d p2 = m_wellPath->m_wellPathPoints[wpp+1];
cvf::BoundingBox bb;
bb.add(p1);
bb.add(p2);
std::vector<size_t> closeCells = findCloseCells(bb);
std::vector<HexIntersectionInfo> intersections;
cvf::Vec3d hexCorners[8];
for (size_t cIdx = 0; cIdx < closeCells.size(); ++cIdx)
@ -91,7 +92,7 @@ void RigEclipseWellLogExtractor::calculateIntersection()
intersections[intIdx].m_isIntersectionEntering = !intersections[intIdx].m_isIntersectionEntering ;
}
}
// Now, with all the intersections of this piece of line, we need to
// sort them in order, and set the measured depth and corresponding cell index
@ -101,30 +102,12 @@ void RigEclipseWellLogExtractor::calculateIntersection()
double md1 = m_wellPath->m_measuredDepths[wpp];
double md2 = m_wellPath->m_measuredDepths[wpp+1];
for (size_t intIdx = 0; intIdx < intersections.size(); ++intIdx)
{
double lenghtAlongLineSegment1 = (intersections[intIdx].m_intersectionPoint - p1).length();
double lenghtAlongLineSegment2 = (p2 - intersections[intIdx].m_intersectionPoint).length();
double measuredDepthDiff = md2 - md1;
double lineLength = lenghtAlongLineSegment1 + lenghtAlongLineSegment2;
double measuredDepthOfPoint = 0.0;
insertIntersectionsInMap(intersections,
p1, md1, p2, md2,
&uniqueIntersections);
if (lineLength > 0.00001)
{
measuredDepthOfPoint = md1 + measuredDepthDiff*lenghtAlongLineSegment1/(lineLength);
}
else
{
measuredDepthOfPoint = md1;
}
uniqueIntersections.insert(std::make_pair(RigMDCellIdxEnterLeaveIntersectionSorterKey(measuredDepthOfPoint,
intersections[intIdx].m_hexIndex,
intersections[intIdx].m_isIntersectionEntering),
intersections[intIdx]));
}
}
}
this->populateReturnArrays(uniqueIntersections);
@ -157,3 +140,4 @@ std::vector<size_t> RigEclipseWellLogExtractor::findCloseCells(const cvf::Boundi
return closeCells;
}

View File

@ -123,15 +123,16 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
for (size_t wpp = 0; wpp < m_wellPath->m_wellPathPoints.size() - 1; ++wpp)
{
cvf::BoundingBox bb;
std::vector<HexIntersectionInfo> intersections;
cvf::Vec3d p1 = m_wellPath->m_wellPathPoints[wpp];
cvf::Vec3d p2 = m_wellPath->m_wellPathPoints[wpp+1];
cvf::BoundingBox bb;
bb.add(p1);
bb.add(p2);
std::vector<size_t> closeCells = findCloseCells(bb);
std::vector<HexIntersectionInfo> intersections;
cvf::Vec3d hexCorners[8];
for (size_t ccIdx = 0; ccIdx < closeCells.size(); ++ccIdx)
@ -156,31 +157,15 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
// Now, with all the intersections of this piece of line, we need to
// sort them in order, and set the measured depth and corresponding cell index
// Inserting the intersections in this map will remove identical intersections
// and sort them according to MD, CellIdx, Leave/enter
double md1 = m_wellPath->m_measuredDepths[wpp];
double md2 = m_wellPath->m_measuredDepths[wpp+1];
for (size_t intIdx = 0; intIdx < intersections.size(); ++intIdx)
{
double lenghtAlongLineSegment1 = (intersections[intIdx].m_intersectionPoint - p1).length();
double lenghtAlongLineSegment2 = (p2 - intersections[intIdx].m_intersectionPoint).length();
double measuredDepthDiff = md2 - md1;
double lineLength = lenghtAlongLineSegment1 + lenghtAlongLineSegment2;
double measuredDepthOfPoint = 0.0;
if (lineLength > 0.00001)
{
measuredDepthOfPoint = md1 + measuredDepthDiff*lenghtAlongLineSegment1/(lineLength);
}
else
{
measuredDepthOfPoint = md1;
}
uniqueIntersections.insert(std::make_pair(RigMDCellIdxEnterLeaveIntersectionSorterKey(measuredDepthOfPoint,
intersections[intIdx].m_hexIndex,
intersections[intIdx].m_isIntersectionEntering),
intersections[intIdx]));
}
insertIntersectionsInMap(intersections,
p1, md1, p2, md2,
&uniqueIntersections);
}
}

View File

@ -36,6 +36,35 @@ RigWellLogExtractor::~RigWellLogExtractor()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogExtractor::insertIntersectionsInMap(const std::vector<HexIntersectionInfo> &intersections, cvf::Vec3d p1, double md1, cvf::Vec3d p2, double md2,
std::map<RigMDCellIdxEnterLeaveIntersectionSorterKey, HexIntersectionInfo > *uniqueIntersections)
{
for (size_t intIdx = 0; intIdx < intersections.size(); ++intIdx)
{
double lenghtAlongLineSegment1 = (intersections[intIdx].m_intersectionPoint - p1).length();
double lenghtAlongLineSegment2 = (p2 - intersections[intIdx].m_intersectionPoint).length();
double measuredDepthDiff = md2 - md1;
double lineLength = lenghtAlongLineSegment1 + lenghtAlongLineSegment2;
double measuredDepthOfPoint = 0.0;
if (lineLength > 0.00001)
{
measuredDepthOfPoint = md1 + measuredDepthDiff*lenghtAlongLineSegment1/(lineLength);
}
else
{
measuredDepthOfPoint = md1;
}
uniqueIntersections->insert(std::make_pair(RigMDCellIdxEnterLeaveIntersectionSorterKey(measuredDepthOfPoint,
intersections[intIdx].m_hexIndex,
intersections[intIdx].m_isIntersectionEntering),
intersections[intIdx]));
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -46,6 +46,10 @@ public:
const RigWellPath* wellPathData() { return m_wellPath.p();}
protected:
void insertIntersectionsInMap(const std::vector<HexIntersectionInfo> &intersections,
cvf::Vec3d p1, double md1, cvf::Vec3d p2, double md2,
std::map<RigMDCellIdxEnterLeaveIntersectionSorterKey, HexIntersectionInfo > *uniqueIntersections);
void populateReturnArrays(std::map<RigMDCellIdxEnterLeaveIntersectionSorterKey, HexIntersectionInfo > &uniqueIntersections);
std::vector<double> m_measuredDepth;