From 12bbaa898df4c37caf7e1f5c7a046d65d4033e90 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 14 Jun 2017 07:53:28 +0200 Subject: [PATCH 01/17] Added several missing copyright headers --- .../RicBoxManipulatorEventHandler.cpp | 18 ++++++++++++ .../RicBoxManipulatorEventHandler.h | 18 ++++++++++++ .../GeoMechDataModel/RigFemResultPosEnum.h | 19 +++++++++++++ .../RivFemPartGeometryGenerator.cpp | 18 ++++++++++++ .../RivFemPartGeometryGenerator.h | 23 +++++++++++++++ .../RivGeoMechPartMgrCache.cpp | 19 +++++++++++++ .../RivGeoMechPartMgrCache.h | 28 +++++++++++++++++-- .../RimTreeViewStateSerializer.cpp | 21 ++++++++++++-- .../RimTreeViewStateSerializer.h | 22 +++++++++++++-- ApplicationCode/ProjectDataModel/RimView.cpp | 19 +++++++++++++ .../RigFlowDiagInterfaceTools.h | 17 +++++++++++ .../RiuInterfaceToViewWindow.cpp | 18 ++++++++++++ .../RiuSimpleHistogramWidget.cpp | 22 +++++++++++++++ 13 files changed, 255 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp index 931701575f..5ab908158d 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.cpp @@ -1,3 +1,21 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2013- Statoil ASA +// Copyright (C) 2013- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// #include "RicBoxManipulatorEventHandler.h" diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h b/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h index e2ddb19a46..974b11a579 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h @@ -1,3 +1,21 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2013- Statoil ASA +// Copyright (C) 2013- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultPosEnum.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultPosEnum.h index 3e362842b8..5120601f82 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultPosEnum.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultPosEnum.h @@ -1,3 +1,22 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #pragma once enum RigFemResultPosEnum { diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp index 1262412066..63058ce4ae 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp @@ -1,3 +1,21 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// #include "RivFemPartGeometryGenerator.h" diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h index 5a3fa7a48a..2d6edab282 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h @@ -1,3 +1,21 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// #pragma once @@ -18,6 +36,11 @@ class ScalarMapper; class RigFemPartScalarDataAccess; +//================================================================================================== +// +// +// +//================================================================================================== class RivFemPartTriangleToElmMapper : public cvf::Object { public: diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.cpp index 8306b2cc19..e51ef54fc9 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.cpp @@ -1,3 +1,22 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #include "RivGeoMechPartMgrCache.h" #include "RivGeoMechPartMgr.h" diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h index 2089a38640..75bf430bd3 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h @@ -1,9 +1,31 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #pragma once -#include -#include "cvfObject.h" -#include + #include "RivCellSetEnum.h" +#include "cvfObject.h" + +#include +#include + class RivGeoMechPartMgr; class RivGeoMechPartMgrGeneratorInterface; diff --git a/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.cpp b/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.cpp index 04ac193bed..3f810d3a2e 100644 --- a/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.cpp +++ b/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.cpp @@ -1,4 +1,23 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #include "RimTreeViewStateSerializer.h" + #include //-------------------------------------------------------------------------------------------------- @@ -125,5 +144,3 @@ void RimTreeViewStateSerializer::encodeStringFromModelIndex(const QModelIndex mi } } - - diff --git a/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.h b/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.h index 7fe24ef03f..424fefd158 100644 --- a/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.h +++ b/ApplicationCode/ProjectDataModel/RimTreeViewStateSerializer.h @@ -1,3 +1,21 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #pragma once #include @@ -12,7 +30,7 @@ public: static void applyTreeViewStateFromString(QTreeView* treeView, const QString& treeViewState); static void storeTreeViewStateToString (const QTreeView* treeView, QString& treeViewState); - static QModelIndex getModelIndexFromString(QAbstractItemModel* model, const QString& currentIndexString); - static void encodeStringFromModelIndex(const QModelIndex mi, QString& currentIndexString); + static QModelIndex getModelIndexFromString(QAbstractItemModel* model, const QString& currentIndexString); + static void encodeStringFromModelIndex(const QModelIndex mi, QString& currentIndexString); }; diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index 66e6784fc2..3edaba8f8a 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -1,3 +1,22 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #include "RimView.h" #include "RiaApplication.h" diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h index d7856563fc..ce1edb8f84 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h @@ -1,3 +1,20 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// #pragma once diff --git a/ApplicationCode/UserInterface/RiuInterfaceToViewWindow.cpp b/ApplicationCode/UserInterface/RiuInterfaceToViewWindow.cpp index 4e44aa983b..e1580d6e73 100644 --- a/ApplicationCode/UserInterface/RiuInterfaceToViewWindow.cpp +++ b/ApplicationCode/UserInterface/RiuInterfaceToViewWindow.cpp @@ -1,3 +1,21 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #include "RiuInterfaceToViewWindow.h" #include diff --git a/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp b/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp index 3f0785e38f..00ce6690b7 100644 --- a/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp +++ b/ApplicationCode/UserInterface/RiuSimpleHistogramWidget.cpp @@ -1,5 +1,27 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2011- Statoil ASA +// Copyright (C) 2013- Ceetron Solutions AS +// Copyright (C) 2011-2012 Ceetron AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #include "RiuSimpleHistogramWidget.h" + #include + #include //-------------------------------------------------------------------------------------------------- From a1446a70189d3241acc87c1faf471dd7fd1d53a4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 14 Jun 2017 07:54:37 +0200 Subject: [PATCH 02/17] Added regexp used to detect missing copyright headers --- doc/identify-missing-copyright.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 doc/identify-missing-copyright.txt diff --git a/doc/identify-missing-copyright.txt b/doc/identify-missing-copyright.txt new file mode 100644 index 0000000000..0c1d7c2caf --- /dev/null +++ b/doc/identify-missing-copyright.txt @@ -0,0 +1,5 @@ +This regexp will identify all files not starting with the character '/' +Useful to detect files with missing copyright header + +^(?!/).*$ + From 3404ce90f8edb276cc21ac9107e475f2c39df1ed Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 14 Jun 2017 08:27:25 +0200 Subject: [PATCH 03/17] Fix missing include on Linux --- .../GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h index 75bf430bd3..e8c4c52d56 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechPartMgrCache.h @@ -21,6 +21,7 @@ #include "RivCellSetEnum.h" +#include "cvfBase.h" #include "cvfObject.h" #include From 03a95857c8ea460a907fbe473fc6d468d727e860 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Mon, 12 Jun 2017 13:40:49 +0200 Subject: [PATCH 04/17] Moving fishbones transmissibility calculation to a separate class --- .../CompletionCommands/CMakeLists_files.cmake | 2 + ...sTransmissibilityCalculationFeatureImp.cpp | 131 ++++++++++++++++++ ...nesTransmissibilityCalculationFeatureImp.h | 37 +++++ ...RicWellPathExportCompletionDataFeature.cpp | 103 +------------- .../RicWellPathExportCompletionDataFeature.h | 16 +-- 5 files changed, 181 insertions(+), 108 deletions(-) create mode 100644 ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp create mode 100644 ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h diff --git a/ApplicationCode/Commands/CompletionCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/CompletionCommands/CMakeLists_files.cmake index 1cd56d0bbe..28424d8825 100644 --- a/ApplicationCode/Commands/CompletionCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CompletionCommands/CMakeLists_files.cmake @@ -18,6 +18,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.h +${CEE_CURRENT_LIST_DIR}RicFishbonesTransmissibilityCalculationFeatureImp.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -34,6 +35,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.cpp +${CEE_CURRENT_LIST_DIR}RicFishbonesTransmissibilityCalculationFeatureImp.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp new file mode 100644 index 0000000000..8a17332c65 --- /dev/null +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -0,0 +1,131 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicFishbonesTransmissibilityCalculationFeatureImp.h" + +#include "RigEclipseCaseData.h" +#include "RicExportCompletionDataSettingsUi.h" +#include "RicWellPathExportCompletionDataFeature.h" +#include "RimWellPath.h" +#include "RigWellPath.h" +#include "RimFishboneWellPath.h" +#include "RimFishbonesCollection.h" +#include "RigMainGrid.h" +#include "RimFishbonesMultipleSubs.h" +#include "RimFishboneWellPathCollection.h" + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) +{ + // Generate data + const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData(); + std::vector locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath); + + // Filter out cells where main bore is present + if (settings.removeLateralsInMainBoreCells()) + { + std::vector wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints); + RicWellPathExportCompletionDataFeature::markWellPathCells(wellPathCells, &locations); + } + + RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid(); + + std::vector completionData; + + for (const WellSegmentLocation& location : locations) + { + for (const WellSegmentLateral& lateral : location.laterals) + { + for (const WellSegmentLateralIntersection& intersection : lateral.intersections) + { + if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue; + + size_t i, j, k; + grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k); + 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->holeDiameter() / 1000; + if (settings.computeTransmissibility()) + { + double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply, + wellPath, + intersection.lengthsInCell, + location.fishbonesSubs->skinFactor(), + diameter / 2, + intersection.cellIndex); + completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor()); + } + else { + CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell); + completion.setFromFishbone(diameter, direction); + } + completionData.push_back(completion); + } + } + } + + return completionData; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) +{ + std::vector completionData; + + std::vector wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints); + + double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000; + for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths()) + { + std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates()); + for (auto& cell : intersectedCells) + { + if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue; + + 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(), ""); + if (settings.computeTransmissibility()) + { + double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor(); + double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply(), + wellPath, + cell.internalCellLengths, + skinFactor, + diameter / 2, + cell.cellIndex); + completion.setFromFishbone(transmissibility, skinFactor); + } + else { + CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths); + completion.setFromFishbone(diameter, direction); + } + completionData.push_back(completion); + } + } + + return completionData; +} + + diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h new file mode 100644 index 0000000000..7571cf1319 --- /dev/null +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class RigCompletionData; +class RimWellPath; +class RicExportCompletionDataSettingsUi; + +class RicFishbonesTransmissibilityCalculationFeatureImp +{ +public: + static std::vector generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); + static std::vector generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); + +private: + + +}; + diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index 69381e19d6..b6fdd02332 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -52,6 +52,7 @@ #include #include #include +#include "RicFishbonesTransmissibilityCalculationFeatureImp.h" CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature"); @@ -190,9 +191,9 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector } if (exportSettings.includeFishbones) { - std::vector fishbonesCompletionData = generateFishboneLateralsCompdatValues(wellPath, exportSettings); + std::vector fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(wellPath, exportSettings); appendCompletionData(&completionData, fishbonesCompletionData); - std::vector fishbonesWellPathCompletionData = generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings); + std::vector fishbonesWellPathCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings); appendCompletionData(&completionData, fishbonesWellPathCompletionData); } } @@ -322,104 +323,6 @@ void RicWellPathExportCompletionDataFeature::generateWpimultTable(RifEclipseData formatter.tableCompleted(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RicWellPathExportCompletionDataFeature::generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) -{ - // Generate data - const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData(); - std::vector locations = findWellSegmentLocations(settings.caseToApply, wellPath); - - // Filter out cells where main bore is present - if (settings.removeLateralsInMainBoreCells()) - { - std::vector wellPathCells = findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints); - markWellPathCells(wellPathCells, &locations); - } - - RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid(); - - std::vector completionData; - - for (const WellSegmentLocation& location : locations) - { - for (const WellSegmentLateral& lateral : location.laterals) - { - for (const WellSegmentLateralIntersection& intersection : lateral.intersections) - { - if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue; - - size_t i, j, k; - grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k); - 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->holeDiameter() / 1000; - if (settings.computeTransmissibility()) - { - double transmissibility = calculateTransmissibility(settings.caseToApply, - wellPath, - intersection.lengthsInCell, - location.fishbonesSubs->skinFactor(), - diameter / 2, - intersection.cellIndex); - completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor()); - } - else { - CellDirection direction = calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell); - completion.setFromFishbone(diameter, direction); - } - completionData.push_back(completion); - } - } - } - - return completionData; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RicWellPathExportCompletionDataFeature::generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) -{ - std::vector completionData; - - std::vector wellPathCells = findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints); - - double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000; - for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths()) - { - std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates()); - for (auto& cell : intersectedCells) - { - if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue; - - 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(), ""); - if (settings.computeTransmissibility()) - { - double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor(); - double transmissibility = calculateTransmissibility(settings.caseToApply(), - wellPath, - cell.internalCellLengths, - skinFactor, - diameter / 2, - cell.cellIndex); - completion.setFromFishbone(transmissibility, skinFactor); - } - else { - CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths); - completion.setFromFishbone(diameter, direction); - } - completionData.push_back(completion); - } - } - - return completionData; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h index b0d09da693..a27e1377f9 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h @@ -131,19 +131,21 @@ public: static std::vector findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath); static std::vector findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector& fishbonesSubs); + //functions also used by RicFishbonesTransmissibilityCalculationFeatureImp + static std::vector findIntersectingCells(const RigEclipseCaseData* grid, const std::vector& coords); + static void markWellPathCells(const std::vector& wellPathCells, std::vector* locations); + static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell); + static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex); + + private: static void exportCompletions(const std::vector& wellPaths, const RicExportCompletionDataSettingsUi& exportSettings); static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector& completionData); static void generateWpimultTable(RifEclipseDataTableFormatter& formatter, const std::vector& completionData); - static std::vector generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); - static std::vector generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); - static std::vector generatePerforationsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); - static std::vector findIntersectingCells(const RigEclipseCaseData* grid, const std::vector& coords); - static void markWellPathCells(const std::vector& wellPathCells, std::vector* locations); static bool wellSegmentLocationOrdering(const WellSegmentLocation& first, const WellSegmentLocation& second); static bool isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle); static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum); @@ -151,7 +153,5 @@ private: static void appendCompletionData(std::map* completionData, const std::vector& data); - static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell); - - static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex); }; + From fa549829b5682dd8a9327d3bd30d8212ae41a9ea Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 13 Jun 2017 15:37:06 +0200 Subject: [PATCH 05/17] #1561 Separating finding wellBoreParts for fishbones and the calculation of transmissibilities. Transmissibilities are adjusted based on number of fishbones in each cell when they are calculated. --- ...sTransmissibilityCalculationFeatureImp.cpp | 189 +++++++++++++++++- ...nesTransmissibilityCalculationFeatureImp.h | 51 ++++- ...RicWellPathExportCompletionDataFeature.cpp | 26 ++- .../RicWellPathExportCompletionDataFeature.h | 5 +- 4 files changed, 251 insertions(+), 20 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index 8a17332c65..5cd24e304c 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -29,7 +29,6 @@ #include "RimFishbonesMultipleSubs.h" #include "RimFishboneWellPathCollection.h" - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -88,7 +87,128 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) +void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWellBoreParts(std::map >& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) +{ + // Generate data + const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData(); + std::vector locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath); + + // Filter out cells where main bore is present + if (settings.removeLateralsInMainBoreCells()) + { + std::vector wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints); + RicWellPathExportCompletionDataFeature::markWellPathCells(wellPathCells, &locations); + } + + RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid(); + + std::vector completionData; + + for (const WellSegmentLocation& location : locations) + { + for (const WellSegmentLateral& lateral : location.laterals) + { + for (const WellSegmentLateralIntersection& intersection : lateral.intersections) + { + if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue; + + double diameter = location.fishbonesSubs->holeDiameter() / 1000; + QString completionMetaData = (location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex)); + WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(intersection.lengthsInCell, + diameter / 2, + location.fishbonesSubs->skinFactor(), + completionMetaData); + + wellBorePartsInCells[intersection.cellIndex].push_back(wellBorePart); //TODO: Blir dette riktig måte å ta vare på disse på? + + //TODO: Add cell direction??? + +// size_t i, j, k; +// grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k); +// RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); +// completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex)); +// if (settings.computeTransmissibility()) +// { +// double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply, +// wellPath, +// intersection.lengthsInCell, +// location.fishbonesSubs->skinFactor(), +// diameter / 2, +// intersection.cellIndex); +// completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor()); +// } +// else { +// CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell); +// completion.setFromFishbone(diameter, direction); +// } + } + } + } + +} + + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings) +{ + std::map > wellBorePartsInCells; //wellBore = main bore or fishbone lateral + findFishboneLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings); + findFishboneImportedLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings); + findMainWellBoreParts(wellBorePartsInCells, wellPath, settings); + + std::vector completionData; + + RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid(); + + for (auto cellAndWellBoreParts : wellBorePartsInCells) + { + size_t cellIndex = cellAndWellBoreParts.first; + std::vector wellBoreParts = cellAndWellBoreParts.second; + size_t i, j, k; + grid->ijkFromCellIndex(cellIndex, &i, &j, &k); + + size_t NumberOfCellContributions = wellBoreParts.size(); + //Simplest implementation possible, this can be improved later + QString directionToSplitCellVolume = "DX"; + + for (WellBorePartForTransCalc wellBorePart : wellBoreParts) + { + RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); + completion.addMetadata(wellBorePart.metaData, ""); + if (settings.computeTransmissibility()) + { + double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply, + wellPath, + wellBorePart.lengthsInCell, + wellBorePart.skinFactor, + wellBorePart.wellRadius, + cellIndex, + NumberOfCellContributions, + directionToSplitCellVolume); + completion.setFromFishbone(transmissibility, wellBorePart.skinFactor); + } + else + { + CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cellIndex, wellBorePart.lengthsInCell); + completion.setFromFishbone(wellBorePart.wellRadius*2, direction); + } + completionData.push_back(completion); + } + } + + return completionData; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings) { std::vector completionData; @@ -101,7 +221,7 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp for (auto& cell : intersectedCells) { if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue; - + size_t i, j, k; settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k); RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); @@ -110,11 +230,11 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp { double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor(); double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply(), - wellPath, - cell.internalCellLengths, - skinFactor, - diameter / 2, - cell.cellIndex); + wellPath, + cell.internalCellLengths, + skinFactor, + diameter / 2, + cell.cellIndex); completion.setFromFishbone(transmissibility, skinFactor); } else { @@ -124,8 +244,59 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp completionData.push_back(completion); } } - + return completionData; } +void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLateralsWellBoreParts(std::map >& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) +{ + std::vector wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints); + + double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000; + for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths()) + { + std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates()); + for (auto& cell : intersectedCells) + { + if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue; + + double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor(); + QString completionMetaData = fishbonesPath->name(); + WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths, + diameter / 2, + skinFactor, + completionMetaData); + wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart); + +// 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(), ""); +// if (settings.computeTransmissibility()) +// { +// double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply(), +// wellPath, +// cell.internalCellLengths, +// skinFactor, +// diameter / 2, +// cell.cellIndex); +// completion.setFromFishbone(transmissibility, skinFactor); +// } +// else { +// CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths); +// completion.setFromFishbone(diameter, direction); +// } + } + + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(std::map> wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) +{ + //TODO: Add relevant parts of main bore to wellBorePartsInCells + +} diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h index 7571cf1319..73d5942061 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h @@ -18,20 +18,63 @@ #pragma once +#include "cvfBase.h" +#include "cvfVector3.h" + #include +#include +#include class RigCompletionData; class RimWellPath; class RicExportCompletionDataSettingsUi; + +//================================================================================================== +/// +//================================================================================================== +struct WellBorePartForTransCalc { + WellBorePartForTransCalc(cvf::Vec3d lengthsInCell, + double wellRadius, + double skinFactor, + QString metaData) + : lengthsInCell(lengthsInCell), + wellRadius(wellRadius), + skinFactor(skinFactor), + metaData(metaData) + {} + + cvf::Vec3d lengthsInCell; + double wellRadius; + double skinFactor; + QString metaData; +}; + +//================================================================================================== +/// +//================================================================================================== class RicFishbonesTransmissibilityCalculationFeatureImp { public: - static std::vector generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); - static std::vector generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); + static std::vector generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings); + static std::vector generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings); + + static std::vector generateFishboneLateralsCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings); + + private: - - + static void findFishboneLateralsWellBoreParts(std::map >& wellBorePartsInCells, + const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings); + static void findFishboneImportedLateralsWellBoreParts(std::map >& wellBorePartsInCells, + const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings); + static void findMainWellBoreParts(std::map> wellBorePartsInCells, + const RimWellPath* wellPath, + const RicExportCompletionDataSettingsUi& settings); }; diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index b6fdd02332..e8e6eabecf 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -191,10 +191,14 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector } if (exportSettings.includeFishbones) { - std::vector fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(wellPath, exportSettings); +// std::vector fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(wellPath, exportSettings); +// appendCompletionData(&completionData, fishbonesCompletionData); +// std::vector fishbonesWellPathCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings); +// appendCompletionData(&completionData, fishbonesWellPathCompletionData); + + std::vector fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValuesUsingAdjustedCellVolume(wellPath, exportSettings); appendCompletionData(&completionData, fishbonesCompletionData); - std::vector fishbonesWellPathCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings); - appendCompletionData(&completionData, fishbonesWellPathCompletionData); + } } @@ -571,7 +575,14 @@ CellDirection RicWellPathExportCompletionDataFeature::calculateDirectionInCell(R //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex) +double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEclipseCase* eclipseCase, + const RimWellPath* wellPath, + const cvf::Vec3d& internalCellLengths, + double skinFactor, + double wellRadius, + size_t cellIndex, + size_t volumeScaleConstant, + QString directionForVolumeScaling) { RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); @@ -598,6 +609,13 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEcli double darcy = RiaEclipseUnitTools::darcysConstant(wellPath->unitSystem()); + if (volumeScaleConstant != 1) + { + if (directionForVolumeScaling == "DX") dx = dx / volumeScaleConstant; + if (directionForVolumeScaling == "DY") dy = dy / volumeScaleConstant; + if (directionForVolumeScaling == "DZ") dz = dz / volumeScaleConstant; + } + double transx = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.x(), permy, permz, dy, dz, wellRadius, skinFactor, darcy); double transy = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.y(), permx, permz, dx, dz, wellRadius, skinFactor, darcy); double transz = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.z(), permy, permx, dy, dx, wellRadius, skinFactor, darcy); diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h index a27e1377f9..a1bc6acbc5 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.h @@ -135,9 +135,8 @@ public: static std::vector findIntersectingCells(const RigEclipseCaseData* grid, const std::vector& coords); static void markWellPathCells(const std::vector& wellPathCells, std::vector* locations); static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell); - static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex); - - + + static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex, size_t volumeScaleConstant = 1, QString directionForVolumeScaling = "DX"); private: static void exportCompletions(const std::vector& wellPaths, const RicExportCompletionDataSettingsUi& exportSettings); From 28460030e5786791403f09a0626a96c5c5f40830 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Wed, 14 Jun 2017 10:28:49 +0200 Subject: [PATCH 06/17] #1561 Adding TODO/pseudo-code for handling main bore transmissibility in fishbone-trans-calc --- ...shbonesTransmissibilityCalculationFeatureImp.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index 5cd24e304c..c4a9312d2b 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -297,6 +297,17 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate //-------------------------------------------------------------------------------------------------- void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(std::map> wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) { - //TODO: Add relevant parts of main bore to wellBorePartsInCells + double holeDiameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter(); + +// TODO: +// Use entire well path from StartMD on fishboneCollection +// findCellsIntersectedByPath to find WellPathCellIntersectionInfo +// std::vector RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& pathCoords) +// set-up and add WellBorePartForTransCalc + + + + + } From 4577ef973cf6a590def802aa04aef47be6e44f70 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Wed, 14 Jun 2017 10:31:29 +0200 Subject: [PATCH 07/17] Removing (never used) arguments with default in RigWellPathIntersectionTools::findCellsIntersectedByPath (and renaming inside function) --- .../RigWellPathIntersectionTools.cpp | 43 +++++++++---------- .../RigWellPathIntersectionTools.h | 4 +- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp index a691a20ec3..544c5f7bde 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp @@ -32,14 +32,14 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& coords, bool includeStartCell, bool includeEndCell) +std::vector RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& pathCoords) { std::vector intersectionInfo; const RigMainGrid* grid = caseData->mainGrid(); - if (coords.size() < 2) return intersectionInfo; + if (pathCoords.size() < 2) return intersectionInfo; - std::vector intersections = getIntersectedCells(grid, coords); + std::vector intersections = getIntersectedCells(grid, pathCoords); removeEnteringIntersections(&intersections); if (intersections.empty()) return intersectionInfo; @@ -51,23 +51,22 @@ std::vector RigWellPathIntersectionTools::findCell auto intersection = intersections.cbegin(); - if (includeStartCell) + //start cell + bool foundCell; + startPoint = pathCoords[0]; + cellIndex = findCellFromCoords(grid, startPoint, &foundCell); + if (foundCell) { - bool foundCell; - startPoint = coords[0]; - cellIndex = findCellFromCoords(grid, startPoint, &foundCell); - if (foundCell) - { - endPoint = intersection->m_intersectionPoint; - internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint); - intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths)); - } - else - { - RiaLogging::debug("Path starts outside valid cell"); - } + endPoint = intersection->m_intersectionPoint; + internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint); + intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths)); + } + else + { + RiaLogging::debug("Path starts outside valid cell"); } + //center cells startPoint = intersection->m_intersectionPoint; cellIndex = intersection->m_hexIndex; @@ -84,12 +83,10 @@ std::vector RigWellPathIntersectionTools::findCell ++intersection; } - if (includeEndCell) - { - endPoint = coords[coords.size() - 1]; - internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint); - intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths)); - } + //end cell + endPoint = pathCoords[pathCoords.size() - 1]; + internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint); + intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths)); return intersectionInfo; } diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h index 80536bb00a..6711d8fdc6 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h +++ b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h @@ -44,7 +44,7 @@ struct WellPathCellIntersectionInfo { size_t cellIndex; cvf::Vec3d startPoint; cvf::Vec3d endPoint; - cvf::Vec3d internalCellLengths; + cvf::Vec3d internalCellLengths; // intersectionLengthsInCellCS }; //================================================================================================== @@ -53,7 +53,7 @@ struct WellPathCellIntersectionInfo { class RigWellPathIntersectionTools { public: - static std::vector findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& coords, bool includeStartCell = true, bool includeEndCell = true); + static std::vector findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& pathCoords); static std::vector getIntersectedCells(const RigMainGrid* grid, const std::vector& coords); From 815c2131406f5f2985c91ea79c39cc839ed8da49 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Wed, 14 Jun 2017 10:32:24 +0200 Subject: [PATCH 08/17] Renaming arguments in functions used by fishbone trans calculations --- ...RicWellPathExportCompletionDataFeature.cpp | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index e8e6eabecf..d6857515ee 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -409,11 +409,11 @@ bool RicWellPathExportCompletionDataFeature::wellSegmentLocationOrdering(const W //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicWellPathExportCompletionDataFeature::isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle) +bool RicWellPathExportCompletionDataFeature::isPointBetween(const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint, const cvf::Vec3d& pointToCheck) { cvf::Plane plane; - plane.setFromPointAndNormal(needle, pointB - pointA); - return plane.side(pointA) != plane.side(pointB); + plane.setFromPointAndNormal(pointToCheck, endPoint - startPoint); + return plane.side(startPoint) != plane.side(endPoint); } //-------------------------------------------------------------------------------------------------- @@ -464,18 +464,18 @@ void RicWellPathExportCompletionDataFeature::calculateLateralIntersections(const for (WellSegmentLateral& lateral : location->laterals) { lateral.branchNumber = ++(*branchNum); - std::vector coords = location->fishbonesSubs->coordsForLateral(location->subIndex, lateral.lateralIndex); - std::vector intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(), coords); + std::vector lateralCoords = location->fishbonesSubs->coordsForLateral(location->subIndex, lateral.lateralIndex); + std::vector intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(), lateralCoords); auto intersection = intersections.cbegin(); double length = 0; double depth = 0; - cvf::Vec3d startPoint = coords[0]; + cvf::Vec3d startPoint = lateralCoords[0]; int attachedSegmentNumber = location->icdSegmentNumber; - for (size_t i = 1; i < coords.size() && intersection != intersections.cend(); ++i) + for (size_t i = 1; i < lateralCoords.size() && intersection != intersections.cend(); ++i) { - if (isPointBetween(startPoint, coords[i], intersection->endPoint)) + if (isPointBetween(startPoint, lateralCoords[i], intersection->endPoint)) { length += (intersection->endPoint - startPoint).length(); depth += intersection->endPoint.z() - startPoint.z(); @@ -492,9 +492,9 @@ void RicWellPathExportCompletionDataFeature::calculateLateralIntersections(const } else { - length += (coords[i] - startPoint).length(); - depth += coords[i].z() - startPoint.z(); - startPoint = coords[i]; + length += (lateralCoords[i] - startPoint).length(); + depth += lateralCoords[i].z() - startPoint.z(); + startPoint = lateralCoords[i]; } } } From 84597a992df68f8208a7a6abf6ca92602e36f238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 14 Jun 2017 11:15:59 +0200 Subject: [PATCH 09/17] Add condictivity conversion method From pre-proto branch, to delete it there. Unused for now --- .../Application/Tools/RiaEclipseUnitTools.cpp | 24 +++++++++++++++++++ .../Application/Tools/RiaEclipseUnitTools.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp b/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp index 09f5a239ca..328a68cc26 100644 --- a/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp +++ b/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp @@ -57,3 +57,27 @@ double RiaEclipseUnitTools::darcysConstant(UnitSystem unitSystem) return 0.0; } } + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaEclipseUnitTools::convertConductivtyValue(double Kw, UnitSystem fromUnit, UnitSystem toUnit) +{ + + if (fromUnit == toUnit) return Kw; + + else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD) + { + return meterToFeet(Kw); + } + else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD) + { + return feetToMeter(Kw); + } + + CVF_ASSERT(false); + + return HUGE_VAL; +} + diff --git a/ApplicationCode/Application/Tools/RiaEclipseUnitTools.h b/ApplicationCode/Application/Tools/RiaEclipseUnitTools.h index 29bf4387bb..63f3a2ab93 100644 --- a/ApplicationCode/Application/Tools/RiaEclipseUnitTools.h +++ b/ApplicationCode/Application/Tools/RiaEclipseUnitTools.h @@ -43,5 +43,8 @@ public: static double inchToMeter(double inch) { return (inch / 12)*meterPerFeet(); } static double darcysConstant(UnitSystem unitSystem); + + static double convertConductivtyValue(double Kw, UnitSystem fromUnit, UnitSystem toUnit); + }; From c4172d4c19b1b8347a03db3cb4ac66f611feeccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Wed, 14 Jun 2017 12:41:37 +0200 Subject: [PATCH 10/17] #1601 Completion Type : Show undefined as gray --- .../ModelVisualization/CMakeLists_files.cmake | 2 + .../RivCompletionTypeResultToTextureMapper.h | 63 +++++++++++++++++++ .../RivDefaultResultToTextureMapper.h | 59 +++++++++++++++++ .../ModelVisualization/RivGridPartMgr.cpp | 14 ++--- .../RivResultToTextureMapper.h | 24 +------ .../RivTextureCoordsCreator.cpp | 24 +++++-- .../RivTextureCoordsCreator.h | 6 +- 7 files changed, 159 insertions(+), 33 deletions(-) create mode 100644 ApplicationCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h create mode 100644 ApplicationCode/ModelVisualization/RivDefaultResultToTextureMapper.h diff --git a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake index 6213d8535b..03c8d21e92 100644 --- a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake +++ b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake @@ -23,6 +23,8 @@ ${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h ${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h ${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h +${CEE_CURRENT_LIST_DIR}RivCompletionTypeResultToTextureMapper.h +${CEE_CURRENT_LIST_DIR}RivDefaultResultToTextureMapper.h ${CEE_CURRENT_LIST_DIR}RivTernaryResultToTextureMapper.h ${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.h ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper.h diff --git a/ApplicationCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h b/ApplicationCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h new file mode 100644 index 0000000000..9dcf297a4e --- /dev/null +++ b/ApplicationCode/ModelVisualization/RivCompletionTypeResultToTextureMapper.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RivResultToTextureMapper.h" + +#include "RigPipeInCellEvaluator.h" + +#include "cvfVector2.h" +#include "cvfScalarMapper.h" +#include "cvfBase.h" +#include "cvfObject.h" +#include "cvfStructGrid.h" + +#include + +class RivCompletionTypeResultToTextureMapper : public RivResultToTextureMapper +{ +public: + using RivResultToTextureMapper::RivResultToTextureMapper; + + cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const + { + cvf::Vec2f texCoord(0, 0); + + if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's + { + if (m_pipeInCellEvaluator->isWellPipeInCell(cellIndex)) + { + texCoord[1] = 0.5f; + } + else + { + texCoord[1] = 1.0f; + } + return texCoord; + } + + texCoord = m_scalarMapper->mapToTextureCoord(resultValue); + texCoord[1] = 0.5f; + + return texCoord; + } +}; + + diff --git a/ApplicationCode/ModelVisualization/RivDefaultResultToTextureMapper.h b/ApplicationCode/ModelVisualization/RivDefaultResultToTextureMapper.h new file mode 100644 index 0000000000..3dfe032e03 --- /dev/null +++ b/ApplicationCode/ModelVisualization/RivDefaultResultToTextureMapper.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA +// Copyright (C) Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RigPipeInCellEvaluator.h" +#include "RivResultToTextureMapper.h" + +#include "cvfVector2.h" +#include "cvfScalarMapper.h" +#include "cvfBase.h" +#include "cvfObject.h" +#include "cvfStructGrid.h" + +#include + +class RivDefaultResultToTextureMapper : public RivResultToTextureMapper +{ +public: + using RivResultToTextureMapper::RivResultToTextureMapper; + + cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const + { + cvf::Vec2f texCoord(0,0); + + if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's + { + texCoord[1] = 1.0f; + return texCoord; + } + + texCoord = m_scalarMapper->mapToTextureCoord(resultValue); + + if (!m_pipeInCellEvaluator->isWellPipeInCell(cellIndex)) + { + texCoord[1] = 0; // Set the Y texture coordinate to the opaque line in the texture + } + + return texCoord; + } +}; + + diff --git a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp index dc57e4e516..e8f9c15b01 100644 --- a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp @@ -44,6 +44,7 @@ #include "RivTernaryScalarMapperEffectGenerator.h" #include "RivTernaryTextureCoordsCreator.h" #include "RivTextureCoordsCreator.h" +#include "RivCompletionTypeResultToTextureMapper.h" #include "cafEffectGenerator.h" #include "cafPdmFieldCvfColor.h" @@ -260,18 +261,17 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellC return; } - texturer.createTextureCoords(m_surfaceFacesTextureCoords.p()); - if (cellResultColors->isCompletionTypeSelected()) { - cvf::Vec2fArray& surfaceCoords = *m_surfaceFacesTextureCoords.p(); - for (cvf::Vec2f& vec : surfaceCoords) - { - vec[1] = 0.5; - } + cvf::ref pipeInCellEval = RivTextureCoordsCreator::createPipeInCellEvaluator(cellResultColors, timeStepIndex, m_grid->gridIndex()); + const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); + + texturer.setResultToTextureMapper(new RivCompletionTypeResultToTextureMapper(mapper, pipeInCellEval.p())); m_opacityLevel = 0.5; } + texturer.createTextureCoords(m_surfaceFacesTextureCoords.p()); + const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), diff --git a/ApplicationCode/ModelVisualization/RivResultToTextureMapper.h b/ApplicationCode/ModelVisualization/RivResultToTextureMapper.h index e70ac7d6f3..52ee510106 100644 --- a/ApplicationCode/ModelVisualization/RivResultToTextureMapper.h +++ b/ApplicationCode/ModelVisualization/RivResultToTextureMapper.h @@ -32,32 +32,14 @@ class RivResultToTextureMapper : public cvf::Object { public: - RivResultToTextureMapper(const cvf::ScalarMapper* scalarMapper, + explicit RivResultToTextureMapper(const cvf::ScalarMapper* scalarMapper, const RigPipeInCellEvaluator* pipeInCellEvaluator) : m_scalarMapper(scalarMapper), m_pipeInCellEvaluator(pipeInCellEvaluator) {} - - cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const - { - cvf::Vec2f texCoord(0,0); - if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's - { - texCoord[1] = 1.0f; - return texCoord; - } - - texCoord = m_scalarMapper->mapToTextureCoord(resultValue); + virtual cvf::Vec2f getTexCoord(double resultValue, size_t cellIndex) const = 0; - if (!m_pipeInCellEvaluator->isWellPipeInCell(cellIndex)) - { - texCoord[1] = 0; // Set the Y texture coordinate to the opaque line in the texture - } - - return texCoord; - } - -private: +protected: cvf::cref m_scalarMapper; cvf::cref m_pipeInCellEvaluator; }; diff --git a/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp b/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp index 5403cfa84a..855ada5898 100644 --- a/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp +++ b/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp @@ -31,6 +31,7 @@ #include "RimLegendConfig.h" #include "RivResultToTextureMapper.h" +#include "RivDefaultResultToTextureMapper.h" #include "cvfStructGridGeometryGenerator.h" @@ -47,13 +48,11 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul m_resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, cellResultColors); - cvf::ref pipeInCellEval = - new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStepIndex), - eclipseCase->gridCellToResultWellIndex(gridIndex)); + cvf::ref pipeInCellEval = createPipeInCellEvaluator(cellResultColors, timeStepIndex, gridIndex); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); - m_texMapper = new RivResultToTextureMapper(mapper, pipeInCellEval.p()); + m_texMapper = new RivDefaultResultToTextureMapper(mapper, pipeInCellEval.p()); CVF_ASSERT(m_texMapper.notNull()); } @@ -78,6 +77,23 @@ void RivTextureCoordsCreator::createTextureCoords(cvf::Vec2fArray* quadTextureCo createTextureCoords(quadTextureCoords, m_quadMapper.p(), m_resultAccessor.p(), m_texMapper.p()); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RivTextureCoordsCreator::setResultToTextureMapper(RivResultToTextureMapper* textureMapper) +{ + m_texMapper = textureMapper; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigPipeInCellEvaluator * RivTextureCoordsCreator::createPipeInCellEvaluator(RimEclipseCellColors* cellColors, size_t timeStep, size_t gridIndex) +{ + return new RigPipeInCellEvaluator(cellColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStep), + cellColors->reservoirView()->eclipseCase()->eclipseCaseData()->gridCellToResultWellIndex(gridIndex)); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.h b/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.h index 9394a8b551..898c4fdf41 100644 --- a/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.h +++ b/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.h @@ -26,6 +26,7 @@ class RimEclipseCellColors; class RigResultAccessor; class RivResultToTextureMapper; +class RigPipeInCellEvaluator; namespace cvf { @@ -44,6 +45,9 @@ public: bool isValid(); void createTextureCoords(cvf::Vec2fArray* quadTextureCoords); + void setResultToTextureMapper(RivResultToTextureMapper* textureMapper); + + static RigPipeInCellEvaluator* createPipeInCellEvaluator(RimEclipseCellColors* cellColors, size_t timeStep, size_t gridIndex); private: @@ -52,7 +56,7 @@ private: const RigResultAccessor* resultAccessor, const RivResultToTextureMapper* texMapper); cvf::cref m_quadMapper; - cvf::ref m_resultAccessor; + cvf::ref m_resultAccessor; cvf::ref m_texMapper; }; From 8fceb8c74f469ee8638a90f5c84117e438e1d9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Wed, 14 Jun 2017 13:13:48 +0200 Subject: [PATCH 11/17] #1605 Add Well Name for Completion Export field --- .../RicNewWellPathIntersectionFeature.cpp | 2 +- .../RicWellPathViewerEventHandler.cpp | 2 +- .../Completions/RimWellPathCompletions.cpp | 18 ++++++++++ .../Completions/RimWellPathCompletions.h | 5 +++ .../ProjectDataModel/RimWellLogFile.cpp | 2 +- .../ProjectDataModel/RimWellPath.cpp | 33 ++++++++++++++----- .../ProjectDataModel/RimWellPath.h | 4 ++- .../RimWellPathCollection.cpp | 6 ++-- 8 files changed, 57 insertions(+), 15 deletions(-) diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp index 277dd6f850..fcb0a3b455 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp @@ -112,7 +112,7 @@ void RicNewWellPathIntersectionFeatureCmd::redo() CVF_ASSERT(m_wellPath); RimIntersection* intersection = new RimIntersection(); - intersection->name = m_wellPath->name; + intersection->name = m_wellPath->name(); intersection->type = RimIntersection::CS_WELL_PATH; intersection->wellPath = m_wellPath; diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathViewerEventHandler.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathViewerEventHandler.cpp index 6777903eae..ed06a32aa8 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathViewerEventHandler.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathViewerEventHandler.cpp @@ -66,7 +66,7 @@ bool RicWellPathViewerEventHandler::handleEvent(cvf::Object* eventObject) cvf::Vec3d trueVerticalDepth = wellPathSourceInfo->trueVerticalDepth(uiEvent->firstPartTriangleIndex, domainCoord); QString wellPathText; - wellPathText += QString("Well path name : %1\n").arg(wellPathSourceInfo->wellPath()->name); + wellPathText += QString("Well path name : %1\n").arg(wellPathSourceInfo->wellPath()->name()); wellPathText += QString("Measured depth : %1\n").arg(measuredDepth); QString formattedText; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp index d72230fc07..9e25c9ee74 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp @@ -40,6 +40,8 @@ RimWellPathCompletions::RimWellPathCompletions() CAF_PDM_InitFieldNoDefault(&m_fishbonesCollection, "Fishbones", "Fishbones", "", "", ""); m_fishbonesCollection = new RimFishbonesCollection; m_fishbonesCollection.uiCapability()->setUiHidden(true); + + CAF_PDM_InitField(&m_wellNameForExport, "WellNameForExport", QString(), "Well Name for Completion Export", "", "", ""); } //-------------------------------------------------------------------------------------------------- @@ -62,3 +64,19 @@ RimPerforationCollection* RimWellPathCompletions::perforationCollection() const return m_perforationCollection; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathCompletions::setWellNameForExport(const QString& name) +{ + m_wellNameForExport = name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPathCompletions::wellNameForExport() const +{ + return m_wellNameForExport(); +} + diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h index 3a26299cd7..820b3ee4ad 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathCompletions.h @@ -19,6 +19,7 @@ #pragma once #include "cafPdmObject.h" +#include "cafPdmField.h" #include "cafPdmChildField.h" class RimFishbonesCollection; @@ -38,7 +39,11 @@ public: RimFishbonesCollection* fishbonesCollection() const; RimPerforationCollection* perforationCollection() const; + void setWellNameForExport(const QString& name); + QString wellNameForExport() const; + private: caf::PdmChildField m_fishbonesCollection; caf::PdmChildField m_perforationCollection; + caf::PdmField m_wellNameForExport; }; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp index 332e5f4fff..e8e8fcee37 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFile.cpp @@ -148,7 +148,7 @@ bool RimWellLogFile::readFile(QString* errorMessage) { if (wellPath->filepath().isEmpty()) { - wellPath->name = m_wellName; + wellPath->setName(m_wellName); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index 0f4b0960ed..5401cac275 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -55,11 +55,11 @@ RimWellPath::RimWellPath() { CAF_PDM_InitObject("WellPath", ":/Well.png", "", ""); - CAF_PDM_InitFieldNoDefault(&name, "WellPathName", "Name", "", "", ""); - name.uiCapability()->setUiReadOnly(true); - name.xmlCapability()->setIOWritable(false); - name.xmlCapability()->setIOReadable(false); - name.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault(&m_name, "WellPathName", "Name", "", "", ""); + m_name.uiCapability()->setUiReadOnly(true); + m_name.xmlCapability()->setIOWritable(false); + m_name.xmlCapability()->setIOReadable(false); + m_name.uiCapability()->setUiHidden(true); CAF_PDM_InitFieldNoDefault(&id, "WellPathId", "Id", "", "", ""); id.uiCapability()->setUiReadOnly(true); id.xmlCapability()->setIOWritable(false); @@ -149,7 +149,7 @@ RimWellPath::~RimWellPath() //-------------------------------------------------------------------------------------------------- caf::PdmFieldHandle* RimWellPath::userDescriptionField() { - return &name; + return &m_name; } //-------------------------------------------------------------------------------------------------- @@ -254,6 +254,23 @@ void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimWellPath::name() const +{ + return m_name(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPath::setName(const QString& name) +{ + m_name = name; + m_completions->setWellNameForExport(name); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -273,7 +290,7 @@ bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathImporter* w RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(filepath(), wellPathIndexInFile()); // General well info - name = wellData.m_name; + setName(wellData.m_name); id = wellMetaData.m_id; sourceSystem = wellMetaData.m_sourceSystem; utmZone = wellMetaData.m_utmZone; @@ -477,5 +494,5 @@ void RimWellPath::setLogFileInfo(RimWellLogFile* logFileInfo) m_wellLogFile = logFileInfo; m_wellLogFile->uiCapability()->setUiHidden(true); - this->name = m_wellLogFile->wellName(); + setName(m_wellLogFile->wellName()); } diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.h b/ApplicationCode/ProjectDataModel/RimWellPath.h index 80a78f8418..a88df6d32c 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimWellPath.h @@ -64,7 +64,8 @@ public: virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ); - caf::PdmField name; + QString name() const; + void setName(const QString& name); caf::PdmField filepath; caf::PdmField wellPathIndexInFile; // -1 means none. @@ -123,4 +124,5 @@ private: cvf::ref m_wellPath; cvf::ref m_wellPathPartMgr; + caf::PdmField m_name; }; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp index 88d221cd84..774502503e 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp @@ -158,7 +158,7 @@ void RimWellPathCollection::readWellPathFiles() } } - progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name)); + progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name())); progress.incrementProgress(); } @@ -247,10 +247,10 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector& wellP RimWellPath* wellPath = wellPathArray[wpIdx]; wellPath->readWellPathFile(NULL, m_wellPathImporter); - progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name)); + progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name())); // If a well path with this name exists already, make it read the well path file - RimWellPath* existingWellPath = wellPathByName(wellPath->name); + RimWellPath* existingWellPath = wellPathByName(wellPath->name()); if (existingWellPath) { existingWellPath->filepath = wellPath->filepath; From 27f4357988894cd40dc1e335f4b8bb1dd59338a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Wed, 14 Jun 2017 13:43:56 +0200 Subject: [PATCH 12/17] #1605 Use Well Name for Completion Export as well name when exporting completions --- .../RicFishbonesTransmissibilityCalculationFeatureImp.cpp | 7 ++++--- .../RicWellPathExportCompletionDataFeature.cpp | 3 ++- ApplicationCode/ProjectDataModel/RimWellPath.cpp | 8 ++++++++ ApplicationCode/ProjectDataModel/RimWellPath.h | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index c4a9312d2b..da6bd5896b 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -28,6 +28,7 @@ #include "RigMainGrid.h" #include "RimFishbonesMultipleSubs.h" #include "RimFishboneWellPathCollection.h" +#include "RimWellPathCompletions.h" //-------------------------------------------------------------------------------------------------- /// @@ -59,7 +60,7 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp size_t i, j, k; grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k); - RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); + RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k)); completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex)); double diameter = location.fishbonesSubs->holeDiameter() / 1000; if (settings.computeTransmissibility()) @@ -178,7 +179,7 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp for (WellBorePartForTransCalc wellBorePart : wellBoreParts) { - RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); + RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k)); completion.addMetadata(wellBorePart.metaData, ""); if (settings.computeTransmissibility()) { @@ -224,7 +225,7 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp size_t i, j, k; settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k); - RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); + RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k)); completion.addMetadata(fishbonesPath->name(), ""); if (settings.computeTransmissibility()) { diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index d6857515ee..25c65c17c1 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -31,6 +31,7 @@ #include "RimPerforationInterval.h" #include "RimPerforationCollection.h" #include "RimReservoirCellResultsStorage.h" +#include "RimWellPathCompletions.h" #include "RicExportCompletionDataSettingsUi.h" @@ -344,7 +345,7 @@ std::vector RicWellPathExportCompletionDataFeature::generateP { size_t i, j, k; settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k); - RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); + RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k)); completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD())); double diameter = interval->diameter(); CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths); diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index 5401cac275..e2099a6735 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -204,6 +204,14 @@ const RimPerforationCollection* RimWellPath::perforationIntervalCollection() con return m_completions->perforationCollection(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RimWellPathCompletions* RimWellPath::completions() const +{ + return m_completions(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.h b/ApplicationCode/ProjectDataModel/RimWellPath.h index a88df6d32c..b2af0067f3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimWellPath.h @@ -82,6 +82,7 @@ public: const RimFishbonesCollection* fishbonesCollection() const; RimPerforationCollection* perforationIntervalCollection(); const RimPerforationCollection* perforationIntervalCollection() const; + const RimWellPathCompletions* completions() const; RigWellPath* wellPathGeometry(); const RigWellPath* wellPathGeometry() const; From cb72a4bfa4ec2dc3b9c9b687c0df6ef9f06da290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 14 Jun 2017 13:43:02 +0200 Subject: [PATCH 13/17] Fix linux compile error --- ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp b/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp index 328a68cc26..a10ceec231 100644 --- a/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp +++ b/ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp @@ -21,6 +21,7 @@ #include "cafAppEnum.h" #include "cvfAssert.h" +#include namespace caf { From c0d493f6906266105094b49e96667af286c50299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 14 Jun 2017 14:15:29 +0200 Subject: [PATCH 14/17] #1558 Move Hexintersection methods to a separate file To make it easierr to see and use from other code. --- .../ReservoirDataModel/CMakeLists_files.cmake | 2 + .../RigEclipseWellLogExtractor.cpp | 2 +- .../RigGeoMechWellLogExtractor.cpp | 3 +- .../RigHexIntersectionTools.cpp | 91 ++++++++++++++++ .../RigHexIntersectionTools.h | 64 +++++++++++ .../RigWellLogExtractionTools.h | 103 ++---------------- .../RigWellLogExtractor.cpp | 2 +- .../ReservoirDataModel/RigWellLogExtractor.h | 1 + .../RigWellPathIntersectionTools.cpp | 4 +- .../RigWellPathIntersectionTools.h | 2 +- 10 files changed, 172 insertions(+), 102 deletions(-) create mode 100644 ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.cpp create mode 100644 ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.h diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 242927e1ac..926c871211 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -49,6 +49,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseNativeVisibleCellsStatCalc.h ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h ${CEE_CURRENT_LIST_DIR}RigWellLogExtractionTools.h +${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools.h ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h ${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h ${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h @@ -100,6 +101,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseNativeVisibleCellsStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp ${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp +${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools.cpp ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp ${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp ${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp index d3840eec23..edb8648b81 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp @@ -85,7 +85,7 @@ void RigEclipseWellLogExtractor::calculateIntersection() hexCorners[7] = nodeCoords[cornerIndices[7]]; //int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[cIdx], &intersections); - RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[cIdx], &intersections); + RigHexIntersectionTools::lineHexCellIntersection(p1, p2, hexCorners, closeCells[cIdx], &intersections); } if (!isCellFaceNormalsOut) diff --git a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp index b2814d2e0c..11c536b403 100644 --- a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp @@ -28,6 +28,7 @@ #include "RigWellLogExtractionTools.h" #include "RigWellPath.h" +#include "cvfGeometryTools.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -155,7 +156,7 @@ void RigGeoMechWellLogExtractor::calculateIntersection() hexCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]); //int intersectionCount = RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], &intersections); - RigHexIntersector::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], &intersections); + RigHexIntersectionTools::lineHexCellIntersection(p1, p2, hexCorners, closeCells[ccIdx], &intersections); } // Now, with all the intersections of this piece of line, we need to diff --git a/ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.cpp b/ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.cpp new file mode 100644 index 0000000000..f3ea5ba4cf --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.cpp @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#include "RigHexIntersectionTools.h" + +#include "cvfBoundingBox.h" +#include "cvfGeometryTools.h" +#include "cvfRay.h" + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RigHexIntersectionTools::lineHexCellIntersection(const cvf::Vec3d p1, const cvf::Vec3d p2, const cvf::Vec3d hexCorners[8], const size_t hexIndex, std::vector* intersections) +{ + CVF_ASSERT(intersections != NULL); + + int intersectionCount = 0; + + for ( int face = 0; face < 6 ; ++face ) + { + cvf::ubyte faceVertexIndices[4]; + cvf::StructGridInterface::cellFaceVertexIndices(static_cast(face), faceVertexIndices); + + cvf::Vec3d intersection; + bool isEntering = false; + cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]); + + for ( int i = 0; i < 4; ++i ) + { + int next = i < 3 ? i+1 : 0; + + int intsStatus = cvf::GeometryTools::intersectLineSegmentTriangle(p1, p2, + hexCorners[faceVertexIndices[i]], + hexCorners[faceVertexIndices[next]], + faceCenter, + &intersection, + &isEntering); + if ( intsStatus == 1 ) + { + intersectionCount++; + intersections->push_back(HexIntersectionInfo(intersection, + isEntering, + static_cast(face), hexIndex)); + } + } + } + + return intersectionCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigHexIntersectionTools::isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8]) +{ + cvf::Ray ray; + ray.setOrigin(point); + size_t intersections = 0; + + for ( int face = 0; face < 6; ++face ) + { + cvf::ubyte faceVertexIndices[4]; + cvf::StructGridInterface::cellFaceVertexIndices(static_cast(face), faceVertexIndices); + cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]); + + for ( int i = 0; i < 4; ++i ) + { + int next = i < 3 ? i + 1 : 0; + if ( ray.triangleIntersect(hexCorners[faceVertexIndices[i]], hexCorners[faceVertexIndices[next]], faceCenter) ) + { + ++intersections; + } + } + } + return intersections % 2 == 1; +} diff --git a/ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.h b/ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.h new file mode 100644 index 0000000000..eb240f25d8 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigHexIntersectionTools.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "cvfBase.h" +#include "cvfVector3.h" +#include "cvfStructGrid.h" + +//================================================================================================== +/// Internal class for intersection point info +//================================================================================================== + +struct HexIntersectionInfo +{ + +public: + HexIntersectionInfo( cvf::Vec3d intersectionPoint, + bool isIntersectionEntering, + cvf::StructGridInterface::FaceType face, + size_t hexIndex) + : m_intersectionPoint(intersectionPoint), + m_isIntersectionEntering(isIntersectionEntering), + m_face(face), + m_hexIndex(hexIndex) {} + + + cvf::Vec3d m_intersectionPoint; + bool m_isIntersectionEntering; + cvf::StructGridInterface::FaceType m_face; + size_t m_hexIndex; +}; + +//-------------------------------------------------------------------------------------------------- +/// Specialized Line - Hex intersection +//-------------------------------------------------------------------------------------------------- +struct RigHexIntersectionTools +{ + static int lineHexCellIntersection(const cvf::Vec3d p1, + const cvf::Vec3d p2, + const cvf::Vec3d hexCorners[8], + const size_t hexIndex, + std::vector* intersections); + + static bool isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8]); + + +}; + + diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h b/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h index 0cefe536eb..9c44c95ac7 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h @@ -18,105 +18,16 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "cvfBoundingBox.h" -#include "cvfGeometryTools.h" -#include "cvfStructGrid.h" -#include "cvfRay.h" //================================================================================================== -/// Internal class for intersection point info +/// +/// //================================================================================================== -struct HexIntersectionInfo +struct RigWellLogExtractionTools { - -public: - HexIntersectionInfo( cvf::Vec3d intersectionPoint, - bool isIntersectionEntering, - cvf::StructGridInterface::FaceType face, - size_t hexIndex) - : m_intersectionPoint(intersectionPoint), - m_isIntersectionEntering(isIntersectionEntering), - m_face(face), - m_hexIndex(hexIndex) {} - - - cvf::Vec3d m_intersectionPoint; - bool m_isIntersectionEntering; - cvf::StructGridInterface::FaceType m_face; - size_t m_hexIndex; -}; - -//-------------------------------------------------------------------------------------------------- -/// Specialized Line - Hex intersection -//-------------------------------------------------------------------------------------------------- -struct RigHexIntersector -{ - static int lineHexCellIntersection(const cvf::Vec3d p1, const cvf::Vec3d p2, const cvf::Vec3d hexCorners[8], const size_t hexIndex, - std::vector* intersections) + static bool isEqualDepth(double d1, double d2) { - CVF_ASSERT(intersections != NULL); - - int intersectionCount = 0; - - for (int face = 0; face < 6 ; ++face) - { - cvf::ubyte faceVertexIndices[4]; - cvf::StructGridInterface::cellFaceVertexIndices(static_cast(face), faceVertexIndices); - - cvf::Vec3d intersection; - bool isEntering = false; - cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]); - - for (int i = 0; i < 4; ++i) - { - int next = i < 3 ? i+1 : 0; - - int intsStatus = cvf::GeometryTools::intersectLineSegmentTriangle(p1, p2, - hexCorners[faceVertexIndices[i]], - hexCorners[faceVertexIndices[next]], - faceCenter, - &intersection, - &isEntering); - if (intsStatus == 1) - { - intersectionCount++; - intersections->push_back(HexIntersectionInfo(intersection, - isEntering, - static_cast(face), hexIndex)); - } - } - } - - return intersectionCount; - } - - static bool isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8]) - { - cvf::Ray ray; - ray.setOrigin(point); - size_t intersections = 0; - - for (int face = 0; face < 6; ++face) - { - cvf::ubyte faceVertexIndices[4]; - cvf::StructGridInterface::cellFaceVertexIndices(static_cast(face), faceVertexIndices); - cvf::Vec3d faceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]); - - for (int i = 0; i < 4; ++i) - { - int next = i < 3 ? i + 1 : 0; - if (ray.triangleIntersect(hexCorners[faceVertexIndices[i]], hexCorners[faceVertexIndices[next]], faceCenter)) - { - ++intersections; - } - } - } - return intersections % 2 == 1; - } - - static bool isEqualDepth(double d1, double d2) - { double depthDiff = d1 - d2; const double tolerance = 0.1;// Meters To handle inaccuracies across faults @@ -142,7 +53,7 @@ struct RigMDCellIdxEnterLeaveKey bool operator < (const RigMDCellIdxEnterLeaveKey& other) const { - if (RigHexIntersector::isEqualDepth(measuredDepth, other.measuredDepth)) + if (RigWellLogExtractionTools::isEqualDepth(measuredDepth, other.measuredDepth)) { if (hexIndex == other.hexIndex) { @@ -182,7 +93,7 @@ struct RigMDEnterLeaveCellIdxKey bool operator < (const RigMDEnterLeaveCellIdxKey& other) const { - if (RigHexIntersector::isEqualDepth(measuredDepth, other.measuredDepth)) + if (RigWellLogExtractionTools::isEqualDepth(measuredDepth, other.measuredDepth)) { if (isEnteringCell == other.isEnteringCell) { @@ -207,7 +118,7 @@ struct RigMDEnterLeaveCellIdxKey { return ( key1.hexIndex == key2.hexIndex && key1.isEnteringCell && key2.isLeavingCell() - && !RigHexIntersector::isEqualDepth(key1.measuredDepth, key2.measuredDepth)); + && !RigWellLogExtractionTools::isEqualDepth(key1.measuredDepth, key2.measuredDepth)); } }; diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp index 8475aefc88..74f13fc9ba 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp @@ -85,7 +85,7 @@ void RigWellLogExtractor::populateReturnArrays(std::mapfirst.measuredDepth, it2->first.measuredDepth)) + if (RigWellLogExtractionTools::isEqualDepth(it1->first.measuredDepth, it2->first.measuredDepth)) { if (it1->first.hexIndex == it2->first.hexIndex) { diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h index a06ca717d6..29275b127d 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h @@ -28,6 +28,7 @@ #include "cvfStructGrid.h" #include "RigWellLogExtractionTools.h" +#include "RigHexIntersectionTools.h" class RigWellPath; diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp index 544c5f7bde..781b2b6266 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp @@ -115,7 +115,7 @@ std::vector RigWellPathIntersectionTools::getIntersectedCel grid->cellCornerVertices(closeCell, hexCorners.data()); - RigHexIntersector::lineHexCellIntersection(coords[i], coords[i + 1], hexCorners.data(), closeCell, &intersections); + RigHexIntersectionTools::lineHexCellIntersection(coords[i], coords[i + 1], hexCorners.data(), closeCell, &intersections); } } @@ -181,7 +181,7 @@ size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid, grid->cellCornerVertices(closeCell, hexCorners.data()); - if (RigHexIntersector::isPointInCell(coords, hexCorners.data())) + if (RigHexIntersectionTools::isPointInCell(coords, hexCorners.data())) { *foundCell = true; return closeCell; diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h index 6711d8fdc6..705ca69654 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h +++ b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h @@ -20,7 +20,7 @@ #include "RigCell.h" -#include "RigWellLogExtractionTools.h" +#include "RigHexIntersectionTools.h" #include "cvfVector3.h" From 088b486a3e879e92480a43e040fb9caa951cdeca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 14 Jun 2017 14:34:52 +0200 Subject: [PATCH 15/17] Linux compile fix --- ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h b/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h index 9c44c95ac7..f20a8030da 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogExtractionTools.h @@ -18,6 +18,7 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include //================================================================================================== /// From 4e82dbfe7b7d9fb458d0b08400a187a71d7c5bcf Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Wed, 14 Jun 2017 14:58:39 +0200 Subject: [PATCH 16/17] #1561 Adding transmissibilities from main bore to fishbone transmissibilities. Not exporting any results for inactive cells. --- ...sTransmissibilityCalculationFeatureImp.cpp | 85 ++++++------------- ...nesTransmissibilityCalculationFeatureImp.h | 4 +- ...RicWellPathExportCompletionDataFeature.cpp | 2 +- 3 files changed, 31 insertions(+), 60 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index da6bd5896b..8983988946 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -25,6 +25,7 @@ #include "RigWellPath.h" #include "RimFishboneWellPath.h" #include "RimFishbonesCollection.h" +#include "RigActiveCellInfo.h" #include "RigMainGrid.h" #include "RimFishbonesMultipleSubs.h" #include "RimFishboneWellPathCollection.h" @@ -120,41 +121,18 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell location.fishbonesSubs->skinFactor(), completionMetaData); - wellBorePartsInCells[intersection.cellIndex].push_back(wellBorePart); //TODO: Blir dette riktig måte å ta vare på disse på? + wellBorePartsInCells[intersection.cellIndex].push_back(wellBorePart); - //TODO: Add cell direction??? - -// size_t i, j, k; -// grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k); -// RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k)); -// completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex)); -// if (settings.computeTransmissibility()) -// { -// double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply, -// wellPath, -// intersection.lengthsInCell, -// location.fishbonesSubs->skinFactor(), -// diameter / 2, -// intersection.cellIndex); -// completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor()); -// } -// else { -// CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell); -// completion.setFromFishbone(diameter, direction); -// } } } } } - - - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath, +std::vector RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) { std::map > wellBorePartsInCells; //wellBore = main bore or fishbone lateral @@ -165,6 +143,7 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp std::vector completionData; RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid(); + const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); for (auto cellAndWellBoreParts : wellBorePartsInCells) { @@ -173,6 +152,9 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp size_t i, j, k; grid->ijkFromCellIndex(cellIndex, &i, &j, &k); + bool cellIsActive = activeCellInfo->isActive(cellIndex); + if (!cellIsActive) continue; + size_t NumberOfCellContributions = wellBoreParts.size(); //Simplest implementation possible, this can be improved later QString directionToSplitCellVolume = "DX"; @@ -201,7 +183,6 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp completionData.push_back(completion); } } - return completionData; } @@ -221,8 +202,8 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates()); for (auto& cell : intersectedCells) { - if (std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue; - + if (settings.removeLateralsInMainBoreCells && std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue; + size_t i, j, k; settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k); RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k)); @@ -245,7 +226,6 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp completionData.push_back(completion); } } - return completionData; } @@ -269,46 +249,37 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate skinFactor, completionMetaData); wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart); - -// 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(), ""); -// if (settings.computeTransmissibility()) -// { -// double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply(), -// wellPath, -// cell.internalCellLengths, -// skinFactor, -// diameter / 2, -// cell.cellIndex); -// completion.setFromFishbone(transmissibility, skinFactor); -// } -// else { -// CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths); -// completion.setFromFishbone(diameter, direction); -// } } - } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(std::map> wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) +void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(std::map>& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings) { double holeDiameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter(); + double FishboneStartMD = wellPath->fishbonesCollection()->startMD(); -// TODO: -// Use entire well path from StartMD on fishboneCollection -// findCellsIntersectedByPath to find WellPathCellIntersectionInfo -// std::vector RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& pathCoords) -// set-up and add WellBorePartForTransCalc - - + std::vector wellPathMD = wellPath->wellPathGeometry()->m_measuredDepths; + double wellPathEndMD = 0.0; + if (wellPathMD.size() > 1) wellPathEndMD = wellPathMD.back(); + std::vector fishbonePerfWellPathCoords = wellPath->wellPathGeometry()->clippedPointSubset(wellPath->fishbonesCollection()->startMD(), + wellPathEndMD); + std::vector intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), + fishbonePerfWellPathCoords); + for (auto& cell : intersectedCellsIntersectionInfo) + { + double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor(); + QString completionMetaData = wellPath->name() + " main bore"; + WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths, + holeDiameter / 2, + skinFactor, + completionMetaData); + wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart); + } } diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h index 73d5942061..b24ca05329 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.h @@ -61,7 +61,7 @@ public: static std::vector generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); - static std::vector generateFishboneLateralsCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath, + static std::vector generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); @@ -73,7 +73,7 @@ private: static void findFishboneImportedLateralsWellBoreParts(std::map >& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); - static void findMainWellBoreParts(std::map> wellBorePartsInCells, + static void findMainWellBoreParts(std::map>& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings); }; diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index 25c65c17c1..d80282ef1f 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -197,7 +197,7 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector // std::vector fishbonesWellPathCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings); // appendCompletionData(&completionData, fishbonesWellPathCompletionData); - std::vector fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValuesUsingAdjustedCellVolume(wellPath, exportSettings); + std::vector fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume(wellPath, exportSettings); appendCompletionData(&completionData, fishbonesCompletionData); } From 81d44ca69bcb0f719cf9b4871ca425e0a4721611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 14 Jun 2017 15:27:28 +0200 Subject: [PATCH 17/17] Linux Compile fix --- ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h index 29275b127d..b52862cee7 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h @@ -25,6 +25,8 @@ #include "cvfVector3.h" #include +#include + #include "cvfStructGrid.h" #include "RigWellLogExtractionTools.h"