#1858 General refactoring as preparations. Renaming Whitespace change. Remove obsolete code.

This commit is contained in:
Jacob Støren 2017-12-12 16:32:57 +01:00
parent 68f5253644
commit 7e820cd251
10 changed files with 54 additions and 68 deletions

View File

@ -176,19 +176,19 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
const RicExportCompletionDataSettingsUi& settings)
{
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(settings.caseToApply()->eclipseCaseData(),
wellPath->wellPathGeometry()->m_wellPathPoints);
std::set<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectedCells(settings.caseToApply()->eclipseCaseData(),
wellPath->wellPathGeometry()->m_wellPathPoints);
bool isMainBore = false;
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter(unitSystem);
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(settings.caseToApply->eclipseCaseData(),
fishbonesPath->coordinates(),
fishbonesPath->measuredDepths());
for (auto& cell : intersectedCells)
{
if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.globCellIndex) != wellPathCells.end()) continue;
if (wellPathCells.count(cell.globCellIndex) ) continue;
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
QString completionMetaData = fishbonesPath->name();
@ -220,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<WellPathCellIntersectionInfo> intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
std::vector<WellPathCellIntersectionInfo> intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(settings.caseToApply->eclipseCaseData(),
fishbonePerfWellPathCoords.first,
fishbonePerfWellPathCoords.second);

View File

@ -719,9 +719,9 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
using namespace std;
pair<vector<cvf::Vec3d>, vector<double> > perforationPointsAndMD = wellPath->wellPathGeometry()->clippedPointSubset(interval->startMD(), interval->endMD());
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(),
perforationPointsAndMD.first,
perforationPointsAndMD.second);
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(settings.caseToApply->eclipseCaseData(),
perforationPointsAndMD.first,
perforationPointsAndMD.second);
for (auto& cell : intersectedCells)
{
bool cellIsActive = activeCellInfo->isActive(cell.globCellIndex);
@ -757,22 +757,17 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RicWellPathExportCompletionDataFeature::findIntersectingCells(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& coords)
std::set<size_t> RicWellPathExportCompletionDataFeature::findIntersectedCells(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& coords)
{
std::set<size_t> cells;
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::getIntersectedCells(caseData->mainGrid(), coords);
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::findRawHexCellIntersections(caseData->mainGrid(), coords);
for (auto intersection : intersections)
{
cells.insert(intersection.m_hexIndex);
}
// Ensure only unique cells are included
std::vector<size_t> cellsVector;
cellsVector.assign(cells.begin(), cells.end());
// Sort cells
std::sort(cellsVector.begin(), cellsVector.end());
return cellsVector;
return cells;
}
//--------------------------------------------------------------------------------------------------
@ -881,7 +876,7 @@ void RicWellPathExportCompletionDataFeature::assignLateralIntersections(const Ri
lateralMDs.push_back(coordMD.second);
}
std::vector<WellPathCellIntersectionInfo> intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(),
std::vector<WellPathCellIntersectionInfo> intersections = RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(caseToApply->eclipseCaseData(),
lateralCoords,
lateralMDs);

View File

@ -144,7 +144,7 @@ public:
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs);
//functions also used by RicFishbonesTransmissibilityCalculationFeatureImp
static std::vector<size_t> findIntersectingCells(const RigEclipseCaseData* grid, const std::vector<cvf::Vec3d>& coords);
static std::set<size_t> findIntersectedCells(const RigEclipseCaseData* grid, const std::vector<cvf::Vec3d>& coords);
static void markWellPathCells(const std::vector<size_t>& wellPathCells, std::vector<WellSegmentLocation>* locations);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell);

View File

@ -51,6 +51,7 @@
#include <QDateTime>
#include "RigHexIntersectionTools.h"
//--------------------------------------------------------------------------------------------------
///
@ -91,8 +92,8 @@ void RimCompletionCellIntersectionCalc::calculateWellPathIntersections(const Rim
std::vector<double>& values,
const QDateTime& fromDate)
{
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::getIntersectedCells(grid,
wellPath->wellPathGeometry()->m_wellPathPoints);
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::findRawHexCellIntersections(grid,
wellPath->wellPathGeometry()->m_wellPathPoints);
for (auto& intersection : intersections)
{
@ -144,7 +145,8 @@ void RimCompletionCellIntersectionCalc::calculateFishbonesIntersections(const Ri
{
for (size_t lateralIndex : sub.lateralIndices)
{
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::getIntersectedCells(grid, fishbonesSubs->coordsForLateral(sub.subIndex, lateralIndex));
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::findRawHexCellIntersections(grid,
fishbonesSubs->coordsForLateral(sub.subIndex, lateralIndex));
for (auto& intersection : intersections)
{
values[intersection.m_hexIndex] = RiaDefines::FISHBONES;
@ -165,8 +167,8 @@ void RimCompletionCellIntersectionCalc::calculatePerforationIntersections(const
pair<vector<cvf::Vec3d>, vector<double> > clippedWellPathData = wellPath->wellPathGeometry()->clippedPointSubset(perforationInterval->startMD(),
perforationInterval->endMD());
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::getIntersectedCells(grid,
clippedWellPathData.first);
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::findRawHexCellIntersections(grid,
clippedWellPathData.first);
for (auto& intersection : intersections)
{
values[intersection.m_hexIndex] = RiaDefines::PERFORATION_INTERVAL;

View File

@ -360,7 +360,7 @@ public:
RigEclipseWellLogExtractor* eclExtractor = findWellLogExtractor(wellPathName, eclCase);
if (!eclExtractor) return;
std::vector<WellPathCellIntersectionInfo> intersections = eclExtractor->intersectionInfo();
std::vector<WellPathCellIntersectionInfo> intersections = eclExtractor->cellIntersectionInfosAlongWellPath();
for (size_t wpExIdx = 0; wpExIdx < intersections.size(); wpExIdx++)
{
@ -452,7 +452,7 @@ public:
if (!eclExtractor) return;
std::vector<WellPathCellIntersectionInfo> intersections = eclExtractor->intersectionInfo();
std::vector<WellPathCellIntersectionInfo> intersections = eclExtractor->cellIntersectionInfosAlongWellPath();
for (size_t wpExIdx = 0; wpExIdx < intersections.size(); wpExIdx++)
{

View File

@ -556,7 +556,7 @@ bool RimWellLogRftCurve::createWellPathIdxToRftFileIdxMapping()
if (!eclExtractor) return false;
std::vector<WellPathCellIntersectionInfo> intersections = eclExtractor->intersectionInfo();
std::vector<WellPathCellIntersectionInfo> intersections = eclExtractor->cellIntersectionInfosAlongWellPath();
if (intersections.empty()) return false;
std::map<size_t, size_t> globCellIndicesToIndexInWell;

View File

@ -43,7 +43,7 @@ RigWellLogExtractor::~RigWellLogExtractor()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo> RigWellLogExtractor::intersectionInfo() const
std::vector<WellPathCellIntersectionInfo> RigWellLogExtractor::cellIntersectionInfosAlongWellPath() const
{
std::vector<WellPathCellIntersectionInfo> infoVector;
if (m_intersectedCellsGlobIdx.empty()) return infoVector;

View File

@ -65,7 +65,7 @@ public:
const RigWellPath* wellPathData() { return m_wellPath.p();}
std::vector<WellPathCellIntersectionInfo> intersectionInfo() const;
std::vector<WellPathCellIntersectionInfo> cellIntersectionInfosAlongWellPath() const;
protected:
static void insertIntersectionsInMap(const std::vector<HexIntersectionInfo> &intersections,

View File

@ -34,9 +34,9 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData,
const std::vector<cvf::Vec3d>& pathCoords,
const std::vector<double>& pathMds)
std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(const RigEclipseCaseData* caseData,
const std::vector<cvf::Vec3d>& pathCoords,
const std::vector<double>& pathMds)
{
std::vector<WellPathCellIntersectionInfo> intersectionInfos;
const RigMainGrid* grid = caseData->mainGrid();
@ -51,13 +51,14 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
dummyWellPath.p(),
caseData->ownerCase()->caseUserDescription().toStdString());
return extractor->intersectionInfo();
return extractor->cellIntersectionInfosAlongWellPath();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<HexIntersectionInfo> RigWellPathIntersectionTools::getIntersectedCells(const RigMainGrid* grid, const std::vector<cvf::Vec3d>& coords)
std::vector<HexIntersectionInfo> RigWellPathIntersectionTools::findRawHexCellIntersections(const RigMainGrid* grid,
const std::vector<cvf::Vec3d>& coords)
{
std::vector<HexIntersectionInfo> intersections;
for (size_t i = 0; i < coords.size() - 1; ++i)
@ -87,7 +88,9 @@ std::vector<HexIntersectionInfo> RigWellPathIntersectionTools::getIntersectedCel
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell(const std::array<cvf::Vec3d, 8>& hexCorners, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint)
cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell(const std::array<cvf::Vec3d, 8>& hexCorners,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint)
{
cvf::Vec3d vec = endPoint - startPoint;
cvf::Vec3d iAxisDirection;
@ -106,7 +109,10 @@ cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell(const std::array<
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint)
cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell(const RigMainGrid* grid,
size_t cellIndex,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint)
{
std::array<cvf::Vec3d, 8> hexCorners;
grid->cellCornerVertices(cellIndex, hexCorners.data());
@ -151,22 +157,3 @@ size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid,
*foundCell = false;
return 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPathIntersectionTools::removeEnteringIntersections(std::vector<HexIntersectionInfo>* intersections)
{
for (auto it = intersections->begin(); it != intersections->end();)
{
if (it->m_isIntersectionEntering)
{
it = intersections->erase(it);
}
else
{
++it;
}
}
}

View File

@ -18,17 +18,16 @@
#pragma once
#include "RigCell.h"
#include "RigHexIntersectionTools.h"
#include "cvfBase.h"
#include "cvfVector3.h"
#include "cvfBoundingBox.h"
#include <array>
class RigWellPath;
class RigMainGrid;
class RigEclipseCaseData;
struct HexIntersectionInfo;
struct WellPathCellIntersectionInfo;
//==================================================================================================
@ -37,18 +36,21 @@ struct WellPathCellIntersectionInfo;
class RigWellPathIntersectionTools
{
public:
static std::vector<WellPathCellIntersectionInfo> findCellsIntersectedByPath(const RigEclipseCaseData* caseData,
const std::vector<cvf::Vec3d>& pathCoords,
const std::vector<double>& pathMds);
static std::vector<WellPathCellIntersectionInfo> findCellIntersectionInfosAlongPath(const RigEclipseCaseData* caseData,
const std::vector<cvf::Vec3d>& pathCoords,
const std::vector<double>& pathMds);
static std::vector<HexIntersectionInfo> getIntersectedCells(const RigMainGrid* grid, const std::vector<cvf::Vec3d>& coords);
static std::vector<HexIntersectionInfo> findRawHexCellIntersections(const RigMainGrid* grid, const std::vector<cvf::Vec3d>& coords);
static cvf::Vec3d calculateLengthInCell(const std::array<cvf::Vec3d, 8>& hexCorners, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
static cvf::Vec3d calculateLengthInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
static cvf::Vec3d calculateLengthInCell(const std::array<cvf::Vec3d, 8>& hexCorners,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint);
static cvf::Vec3d calculateLengthInCell(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 size_t findCellFromCoords(const RigMainGrid* caseData, const cvf::Vec3d& coords, bool* foundCell);
static std::vector<size_t> findCloseCells(const RigMainGrid* grid, const cvf::BoundingBox& bb);
static size_t findCellFromCoords(const RigMainGrid* caseData, const cvf::Vec3d& coords, bool* foundCell);
private:
static void removeEnteringIntersections(std::vector<HexIntersectionInfo>* intersections);
};