#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

@ -33,6 +33,7 @@
#include "RimFishbonesMultipleSubs.h"
#include "RimWellPath.h"
#include "RimWellPathCompletions.h"
#include "RigWellLogExtractor.h"
//--------------------------------------------------------------------------------------------------
///
@ -182,7 +183,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter(unitSystem);
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
std::vector<EclipseWellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
fishbonesPath->coordinates(),
fishbonesPath->measuredDepths());
for (auto& cell : intersectedCells)
@ -191,7 +192,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
QString completionMetaData = fishbonesPath->name();
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths,
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.intersectionLengthsInCellCS,
diameter / 2,
skinFactor,
isMainBore,
@ -219,7 +220,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st
std::pair< std::vector<cvf::Vec3d>, std::vector<double> > fishbonePerfWellPathCoords = wellPath->wellPathGeometry()->clippedPointSubset(wellPath->fishbonesCollection()->startMD(),
wellPathEndMD);
std::vector<EclipseWellPathCellIntersectionInfo> intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
std::vector<WellPathCellIntersectionInfo> intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
fishbonePerfWellPathCoords.first,
fishbonePerfWellPathCoords.second);
@ -227,7 +228,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st
{
double skinFactor = wellPath->fishbonesCollection()->mainBoreSkinFactor();
QString completionMetaData = wellPath->name() + " main bore";
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths,
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.intersectionLengthsInCellCS,
holeDiameter / 2,
skinFactor,
isMainBore,

View File

@ -62,6 +62,7 @@
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
#include "RigWellLogExtractor.h"
CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature");
@ -718,7 +719,7 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
using namespace std;
pair<vector<cvf::Vec3d>, vector<double> > perforationPointsAndMD = wellPath->wellPathGeometry()->clippedPointSubset(interval->startMD(), interval->endMD());
std::vector<EclipseWellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
perforationPointsAndMD.first,
perforationPointsAndMD.second);
for (auto& cell : intersectedCells)
@ -729,11 +730,11 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
size_t i, j, k;
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.globCellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.globCellIndex, cell.internalCellLengths);
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.globCellIndex, cell.intersectionLengthsInCellCS);
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
wellPath,
cell.internalCellLengths,
cell.intersectionLengthsInCellCS,
interval->skinFactor(),
interval->diameter(unitSystem) / 2,
cell.globCellIndex,
@ -880,7 +881,7 @@ void RicWellPathExportCompletionDataFeature::assignLateralIntersections(const Ri
lateralMDs.push_back(coordMD.second);
}
std::vector<EclipseWellPathCellIntersectionInfo> intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(),
std::vector<WellPathCellIntersectionInfo> intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(),
lateralCoords,
lateralMDs);
@ -903,7 +904,7 @@ void RicWellPathExportCompletionDataFeature::assignLateralIntersections(const Ri
intersection->globCellIndex,
mdFromPreviousIntersection,
tvdChangeFromPreviousIntersection,
intersection->internalCellLengths);
intersection->intersectionLengthsInCellCS);
lateral.intersections.push_back(lateralIntersection);

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);