diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp index b99c223d6b..8b1deff830 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp @@ -26,6 +26,8 @@ #include "RimWellPathCollection.h" #include "RimFishbonesMultipleSubs.h" #include "RimFishbonesCollection.h" +#include "RimFishboneWellPath.h" +#include "RimFishboneWellPathCollection.h" #include "RimPerforationInterval.h" #include "RimPerforationCollection.h" #include "RimExportCompletionDataSettings.h" @@ -163,6 +165,8 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector { std::vector fishbonesCompletionData = generateFishbonesCompdatValues(wellPath, exportSettings); appendCompletionData(&completionData, fishbonesCompletionData); + std::vector fishbonesWellPathCompletionData = generateFishbonesWellPathCompdatValues(wellPath, exportSettings); + appendCompletionData(&completionData, fishbonesWellPathCompletionData); } // Merge map into a vector of values @@ -323,24 +327,8 @@ std::vector RicWellPathExportCompletionDataFeature::generateF RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex)); double diameter = location.fishbonesSubs->holeRadius() / 1000 * 2; - switch (intersection.direction) - { - case POS_I: - case NEG_I: - completion.setFromFishbone(diameter, CellDirection::DIR_I); - break; - case POS_J: - case NEG_J: - completion.setFromFishbone(diameter, CellDirection::DIR_J); - break; - case POS_K: - case NEG_K: - completion.setFromFishbone(diameter, CellDirection::DIR_K); - break; - default: - completion.setFromFishbone(diameter, CellDirection::DIR_UNDEF); - break; - } + CellDirection direction = wellPathCellDirectionToCellDirection(completion.direction); + completion.setFromFishbone(diameter, direction); completionData.push_back(completion); } } @@ -349,6 +337,32 @@ std::vector RicWellPathExportCompletionDataFeature::generateF return completionData; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicWellPathExportCompletionDataFeature::generateFishbonesWellPathCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings & settings) +{ + std::vector completionData; + + double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeRadius() / 1000 * 2; + for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths()) + { + std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates()); + for (auto& cell : intersectedCells) + { + size_t i, j, k; + settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k); + RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); + completion.addMetadata(fishbonesPath->name(), ""); + CellDirection direction = wellPathCellDirectionToCellDirection(cell.direction); + completion.setFromFishbone(diameter, direction); + completionData.push_back(completion); + } + } + + return completionData; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -367,25 +381,8 @@ std::vector RicWellPathExportCompletionDataFeature::generateP RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD())); double diameter = interval->radius() * 2; - switch (cell.direction) - { - case POS_I: - case NEG_I: - completion.setFromPerforation(diameter, CellDirection::DIR_I); - break; - case POS_J: - case NEG_J: - completion.setFromPerforation(diameter, CellDirection::DIR_J); - break; - case POS_K: - case NEG_K: - completion.setFromPerforation(diameter, CellDirection::DIR_K); - break; - default: - completion.setFromPerforation(diameter, CellDirection::DIR_UNDEF); - break; - } - + CellDirection direction = wellPathCellDirectionToCellDirection(cell.direction); + completion.setFromPerforation(diameter, direction); completionData.push_back(completion); } } @@ -604,3 +601,28 @@ void RicWellPathExportCompletionDataFeature::appendCompletionData(std::map& completionData); static std::vector generateFishbonesCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings); + static std::vector generateFishbonesWellPathCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings); static std::vector generatePerforationsCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings); static std::map computeLateralsPerCell(const std::vector& segmentLocations, bool removeMainBoreCells); @@ -146,4 +147,5 @@ private: static void appendCompletionData(std::map* completionData, const std::vector& data); + static CellDirection wellPathCellDirectionToCellDirection(WellPathCellDirection direction); }; diff --git a/ApplicationCode/ProjectDataModel/RimFishboneWellPath.h b/ApplicationCode/ProjectDataModel/RimFishboneWellPath.h index 768755d024..876723d5ff 100644 --- a/ApplicationCode/ProjectDataModel/RimFishboneWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimFishboneWellPath.h @@ -55,8 +55,8 @@ public: void setCoordinates(std::vector< cvf::Vec3d > coordinates); void setMeasuredDepths(std::vector< double > measuredDepths); - std::vector< cvf::Vec3d > coordinates() { return m_coordinates(); } - std::vector< double > measuredDepths() { return m_measuredDepths(); } + std::vector< cvf::Vec3d > coordinates() const { return m_coordinates(); } + std::vector< double > measuredDepths() const { return m_measuredDepths(); } private: QString displayCoordinates() const; diff --git a/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.cpp index 2bb6cd68c7..739df5e921 100644 --- a/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.cpp @@ -63,6 +63,21 @@ void RimFishboneWellPathCollection::fieldChangedByUi(const caf::PdmFieldHandle* proj->createDisplayModelAndRedrawAllViews(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimFishboneWellPathCollection::wellPaths() const +{ + std::vector paths; + + for (const RimFishboneWellPath* path : m_wellPaths) + { + paths.push_back(path); + } + + return paths; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.h b/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.h index f9f29e9090..81e03eccde 100644 --- a/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.h +++ b/ApplicationCode/ProjectDataModel/RimFishboneWellPathCollection.h @@ -44,6 +44,9 @@ public: void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); + std::vector wellPaths() const; + double holeRadius() const { return m_pipeProperties->holeRadius(); } + protected: virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;