#1858 Align and remove near struct duplicates of WellPathCellIntersectionInfo

This commit is contained in:
Jacob Støren
2017-12-12 14:49:10 +01:00
parent b15664cfc5
commit 6c3f569499
10 changed files with 66 additions and 87 deletions

View File

@@ -134,53 +134,6 @@ void RigEclipseWellLogExtractor::curveData(const RigResultAccessor* resultAccess
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<EclipseWellPathCellIntersectionInfo> RigEclipseWellLogExtractor::cellIntersectionInfo()
{
//std::vector<CellIntersectionInfo> intersectionInfos = this->intersectionInfo();
//
//for (const auto& cellIntersectInfo: intersectionInfos)
//{
// cvf::Vec3d internalCellLengths;
// internalCellLengths = RigWellPathIntersectionTools::calculateLengthInCell(m_caseData->mainGrid(),
// cellIntersectInfo.globCellIndex,
// cellIntersectInfo.startPoint,
// cellIntersectInfo.endPoint);
//
//}
std::vector<EclipseWellPathCellIntersectionInfo> cellIntersectionInfos;
if (m_intersections.size() > 1)
{
cellIntersectionInfos.reserve(m_intersections.size()-1);
for (size_t cpIdx = 0; cpIdx < m_intersections.size()-1; ++cpIdx)
{
size_t cellIdx1 = m_intersectedCellsGlobIdx[cpIdx];
size_t cellIdx2 = m_intersectedCellsGlobIdx[cpIdx+1];
if (cellIdx1 == cellIdx2)
{
cvf::Vec3d internalCellLengths;
internalCellLengths = RigWellPathIntersectionTools::calculateLengthInCell(m_caseData->mainGrid(),
cellIdx1,
m_intersections[cpIdx],
m_intersections[cpIdx+1]);
cellIntersectionInfos.push_back(EclipseWellPathCellIntersectionInfo(cellIdx1,
m_intersections[cpIdx],
m_intersections[cpIdx+1],
internalCellLengths));
}
}
}
return cellIntersectionInfos;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -199,4 +152,14 @@ std::vector<size_t> RigEclipseWellLogExtractor::findCloseCells(const cvf::Boundi
return closeCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigEclipseWellLogExtractor::calculateLengthInCell(size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint) const
{
std::array<cvf::Vec3d, 8> hexCorners;
m_caseData->mainGrid()->cellCornerVertices(cellIndex, hexCorners.data());
return RigWellPathIntersectionTools::calculateLengthInCell(hexCorners, startPoint, endPoint);
}

View File

@@ -25,8 +25,6 @@ class RigEclipseCaseData;
class RigWellPath;
class RigResultAccessor;
struct EclipseWellPathCellIntersectionInfo;
namespace cvf {
class BoundingBox;
}
@@ -42,12 +40,14 @@ public:
void curveData(const RigResultAccessor* resultAccessor, std::vector<double>* values );
const RigEclipseCaseData* caseData() { return m_caseData.p();}
std::vector<EclipseWellPathCellIntersectionInfo> cellIntersectionInfo();
const std::vector<size_t>& intersectedCellsGlobIdx();
protected:
void calculateIntersection();
std::vector<size_t> findCloseCells(const cvf::BoundingBox& bb);
virtual cvf::Vec3d calculateLengthInCell(size_t cellIndex,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint) const override;
cvf::cref<RigEclipseCaseData> m_caseData;
};

View File

@@ -29,6 +29,7 @@
#include "RigWellLogExtractionTools.h"
#include "RigWellPath.h"
#include "cvfGeometryTools.h"
#include "RigWellPathIntersectionTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -190,4 +191,26 @@ std::vector<size_t> RigGeoMechWellLogExtractor::findCloseCells(const cvf::Boundi
return closeCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigGeoMechWellLogExtractor::calculateLengthInCell(size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint) const
{
std::array<cvf::Vec3d, 8> hexCorners;
const RigFemPart* femPart = m_caseData->femParts()->part(0);
const std::vector<cvf::Vec3f>& nodeCoords = femPart->nodes().coordinates;
const int* cornerIndices = femPart->connectivities(cellIndex);
hexCorners[0] = cvf::Vec3d(nodeCoords[cornerIndices[0]]);
hexCorners[1] = cvf::Vec3d(nodeCoords[cornerIndices[1]]);
hexCorners[2] = cvf::Vec3d(nodeCoords[cornerIndices[2]]);
hexCorners[3] = cvf::Vec3d(nodeCoords[cornerIndices[3]]);
hexCorners[4] = cvf::Vec3d(nodeCoords[cornerIndices[4]]);
hexCorners[5] = cvf::Vec3d(nodeCoords[cornerIndices[5]]);
hexCorners[6] = cvf::Vec3d(nodeCoords[cornerIndices[6]]);
hexCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]);
return RigWellPathIntersectionTools::calculateLengthInCell(hexCorners, startPoint, endPoint);
}

View File

@@ -51,6 +51,9 @@ public:
private:
void calculateIntersection();
std::vector<size_t> findCloseCells(const cvf::BoundingBox& bb);
virtual cvf::Vec3d calculateLengthInCell(size_t cellIndex,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint) const override;
cvf::ref<RigGeoMechCaseData> m_caseData;
};

View File

@@ -63,6 +63,8 @@ std::vector<WellPathCellIntersectionInfo> RigWellLogExtractor::intersectionInfo(
cellInfo.intersectedCellFaceIn = m_intersectedCellFaces[i];
cellInfo.intersectedCellFaceOut = m_intersectedCellFaces[i+1];
cellInfo.intersectionLengthsInCellCS = this->calculateLengthInCell(cellInfo.globCellIndex, cellInfo.startPoint, cellInfo.endPoint);
infoVector.push_back(cellInfo);
}

View File

@@ -42,6 +42,7 @@ struct WellPathCellIntersectionInfo
cvf::Vec3d endPoint;
double startMD;
double endMD;
cvf::Vec3d intersectionLengthsInCellCS;
cvf::StructGridInterface::FaceType intersectedCellFaceIn;
cvf::StructGridInterface::FaceType intersectedCellFaceOut;
@@ -76,9 +77,10 @@ protected:
void populateReturnArrays(std::map<RigMDCellIdxEnterLeaveKey, HexIntersectionInfo > &uniqueIntersections);
void appendIntersectionToArrays(double measuredDepth, const HexIntersectionInfo& intersection);
std::vector<double> m_measuredDepth;
std::vector<double> m_trueVerticalDepth;
virtual cvf::Vec3d calculateLengthInCell(size_t cellIndex,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint) const = 0;
std::vector<cvf::Vec3d> m_intersections;
std::vector<size_t> m_intersectedCellsGlobIdx;
std::vector<cvf::StructGridInterface::FaceType>
@@ -86,6 +88,10 @@ protected:
cvf::cref<RigWellPath> m_wellPath;
private:
std::vector<double> m_measuredDepth;
std::vector<double> m_trueVerticalDepth;
std::string m_wellCaseErrorMsgName;
};

View File

@@ -34,11 +34,11 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<EclipseWellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData,
std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData,
const std::vector<cvf::Vec3d>& pathCoords,
const std::vector<double>& pathMds)
{
std::vector<EclipseWellPathCellIntersectionInfo> intersectionInfos;
std::vector<WellPathCellIntersectionInfo> intersectionInfos;
const RigMainGrid* grid = caseData->mainGrid();
if (pathCoords.size() < 2) return intersectionInfos;
@@ -51,7 +51,7 @@ std::vector<EclipseWellPathCellIntersectionInfo> RigWellPathIntersectionTools::f
dummyWellPath.p(),
caseData->ownerCase()->caseUserDescription().toStdString());
return extractor->cellIntersectionInfo();
return extractor->intersectionInfo();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -29,27 +29,7 @@
class RigWellPath;
class RigMainGrid;
class RigEclipseCaseData;
//==================================================================================================
///
//==================================================================================================
struct EclipseWellPathCellIntersectionInfo
{
EclipseWellPathCellIntersectionInfo(size_t globReservoirCellIndex,
cvf::Vec3d startPoint,
cvf::Vec3d endPoint,
cvf::Vec3d internalCellLengths)
: globCellIndex(globReservoirCellIndex),
startPoint(startPoint),
endPoint(endPoint),
internalCellLengths(internalCellLengths)
{}
size_t globCellIndex;
cvf::Vec3d startPoint;
cvf::Vec3d endPoint;
cvf::Vec3d internalCellLengths; // intersectionLengthsInCellCS
};
struct WellPathCellIntersectionInfo;
//==================================================================================================
///
@@ -57,7 +37,7 @@ struct EclipseWellPathCellIntersectionInfo
class RigWellPathIntersectionTools
{
public:
static std::vector<EclipseWellPathCellIntersectionInfo> findCellsIntersectedByPath(const RigEclipseCaseData* caseData,
static std::vector<WellPathCellIntersectionInfo> findCellsIntersectedByPath(const RigEclipseCaseData* caseData,
const std::vector<cvf::Vec3d>& pathCoords,
const std::vector<double>& pathMds);