From 779ecd2aa13ed46463c6fa766911d8103efe2557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 15 Jun 2017 13:13:25 +0200 Subject: [PATCH 01/22] #1594 #1563 Use selected depth type and unit for well log plot when showing plot data --- ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 6409efa341..6db5e7711b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -426,7 +426,14 @@ QString RimWellLogPlot::asciiDataForPlotExport() const if (curveNames.size() == 1) { - curveDepths = curveData->measuredDepthPlotValues(RimDefines::UNIT_NONE); + if (depthType() == TRUE_VERTICAL_DEPTH) + { + curveDepths = curveData->trueDepthPlotValues(depthUnit()); + } + else + { + curveDepths = curveData->measuredDepthPlotValues(depthUnit()); + } } std::vector xPlotValues = curveData->xPlotValues(); From 0d85289e7d132b1dd0a904a73885615cfc846337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 15 Jun 2017 13:36:23 +0200 Subject: [PATCH 02/22] #1563 Show plot data in order from top to bottom --- ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 6db5e7711b..ab8c63680b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -442,9 +442,9 @@ QString RimWellLogPlot::asciiDataForPlotExport() const } - for (int i = static_cast(curveDepths.size()) - 1; i >= 0; i--) + for (size_t i = 0; i < curveDepths.size(); ++i) { - if (i == static_cast(curveDepths.size()) - 1) + if (i == 0) { if (depthType() == CONNECTION_NUMBER) out += "Connection"; else if (depthType() == MEASURED_DEPTH) out += "MD "; @@ -453,7 +453,7 @@ QString RimWellLogPlot::asciiDataForPlotExport() const for (QString name : curveNames) out += " \t" + name; out += "\n"; } - else if (curveDepths[i] == curveDepths[i+1]) + else if (curveDepths[i] == curveDepths[i-1]) { continue; } From 5739e7e09e5b69f80bac174ecb1a7bb3b1fafcc8 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 15 Jun 2017 14:06:38 +0200 Subject: [PATCH 03/22] Add well path manager to RimView --- ApplicationCode/ProjectDataModel/RimView.cpp | 48 +++++++++++++++----- ApplicationCode/ProjectDataModel/RimView.h | 7 +++ 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index 3edaba8f8a..c17b2f9f4b 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -423,6 +423,33 @@ void RimView::endAnimation() } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RivWellPathCollectionPartMgr* RimView::wellPathsPartManager() +{ + ensureWellPathManagerIsCreated(); + + CVF_ASSERT(m_wellPathsPartManager.notNull()); + + return m_wellPathsPartManager.p(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimView::ensureWellPathManagerIsCreated() +{ + if (m_wellPathsPartManager.isNull()) + { + RimProject* proj = nullptr; + this->firstAncestorOrThisOfTypeAsserted(proj); + CVF_ASSERT(proj && proj->activeOilField() && proj->activeOilField()->wellPathCollection()); + + m_wellPathsPartManager = new RivWellPathCollectionPartMgr(proj->activeOilField()->wellPathCollection()); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -601,6 +628,8 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL; RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL; if (wellPathCollection) wellPathCollection->wellPathCollectionPartMgr()->scheduleGeometryRegen(); + + wellPathsPartManager()->scheduleGeometryRegen(); crossSectionCollection->updateIntersectionBoxGeometry(); @@ -708,19 +737,14 @@ void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox, cvf::Transform* scaleTransform) { - RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL; - RimWellPathCollection* wellPathCollection = oilFields ? oilFields->wellPathCollection() : NULL; - RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = wellPathCollection ? wellPathCollection->wellPathCollectionPartMgr() : NULL; + cvf::ref transForm = displayCoordTransform(); - if (wellPathCollectionPartMgr) - { - wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList, - displayModelOffset, - scaleTransform, - characteristicCellSize, - wellPathClipBoundingBox, - this->displayCoordTransform().p()); - } + wellPathsPartManager()->appendStaticGeometryPartsToModel(wellPathModelBasicList, + displayModelOffset, + scaleTransform, + characteristicCellSize, + wellPathClipBoundingBox, + transForm.p()); wellPathModelBasicList->updateBoundingBoxesRecursive(); } diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index 098c4fdabc..bd9fb29c2c 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -50,6 +50,7 @@ class RimPropertyFilterCollection; class RimViewController; class RimViewLinker; class RiuViewer; +class RivWellPathCollectionPartMgr; namespace cvf { @@ -203,6 +204,8 @@ protected: virtual void resetLegendsInViewer() = 0; virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility) = 0; + RivWellPathCollectionPartMgr* wellPathsPartManager(); + QPointer m_viewer; caf::PdmField m_currentTimeStep; @@ -237,9 +240,13 @@ private: void setCurrentTimeStepAndUpdate(int frameIdx); void endAnimation(); + void ensureWellPathManagerIsCreated(); + private: bool m_previousGridModeMeshLinesWasFaults; caf::PdmField m_disableLighting; + + cvf::ref m_wellPathsPartManager; }; From e50f876cf0f59b447ac04189a124fd8ebc15c820 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 15 Jun 2017 14:07:04 +0200 Subject: [PATCH 04/22] Add infrastructure for dynamic parts to well path part managers --- .../RivWellPathCollectionPartMgr.cpp | 26 +++++++++++ .../RivWellPathCollectionPartMgr.h | 20 ++++++-- .../ModelVisualization/RivWellPathPartMgr.cpp | 13 ++++++ .../ModelVisualization/RivWellPathPartMgr.h | 4 ++ .../ProjectDataModel/RimEclipseView.cpp | 46 +++++++++++++++---- 5 files changed, 96 insertions(+), 13 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp index 039f306272..7d503e6305 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp @@ -23,6 +23,8 @@ #include "RimWellPath.h" #include "RimWellPathCollection.h" #include "RivWellPathPartMgr.h" +#include "RigMainGrid.h" +#include "RimView.h" //-------------------------------------------------------------------------------------------------- @@ -83,3 +85,27 @@ void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBa } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(size_t timeStep, + cvf::ModelBasicList* model, + cvf::Vec3d displayModelOffset, + cvf::Transform* scaleTransform, + double characteristicCellSize, + cvf::BoundingBox wellPathClipBoundingBox, + caf::DisplayCoordTransform* displayCoordTransform) +{ + setScaleTransform(scaleTransform); + + if (!m_wellPathCollection->isActive()) return; + if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; + + for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) + { + RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); + partMgr->setScaleTransform(scaleTransform); + partMgr->appendDynamicGeometryPartsToModel(timeStep, model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); + } +} + diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h index cf4fc4821d..d902d87e6e 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h @@ -32,6 +32,7 @@ class RimWellPathCollection; class RimProject; class RivWellPathPartMgr; +class RimView; namespace cvf { @@ -55,11 +56,20 @@ public: void setScaleTransform(cvf::Transform * scaleTransform); void appendStaticGeometryPartsToModel( - cvf::ModelBasicList* model, - cvf::Vec3d displayModelOffset, - cvf::Transform* scaleTransform, - double characteristicCellSize, - cvf::BoundingBox wellPathClipBoundingBox, + cvf::ModelBasicList* model, + cvf::Vec3d displayModelOffset, + cvf::Transform* scaleTransform, + double characteristicCellSize, + cvf::BoundingBox wellPathClipBoundingBox, + caf::DisplayCoordTransform* displayCoordTransform); + + void appendDynamicGeometryPartsToModel( + size_t timeStep, + cvf::ModelBasicList* model, + cvf::Vec3d displayModelOffset, + cvf::Transform* scaleTransform, + double characteristicCellSize, + cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform); private: diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index a94073fb73..790e3a06ad 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -391,6 +391,19 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m appendPerforationsToModel(model, displayCoordTransform, characteristicCellSize); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(size_t frameIndex, + cvf::ModelBasicList* model, + cvf::Vec3d displayModelOffset, + double characteristicCellSize, + cvf::BoundingBox wellPathClipBoundingBox, + caf::DisplayCoordTransform* displayCoordTransform) +{ + // TODO add perforation intervals +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index 25769008da..5840f8fbb1 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -58,6 +58,10 @@ public: double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform); + void appendDynamicGeometryPartsToModel(size_t frameIndex, cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, + double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, + caf::DisplayCoordTransform* displayCoordTransform); + size_t segmentIndexFromTriangleIndex(size_t triangleIndex); private: diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 044aa65fdf..78627e9803 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -69,6 +69,7 @@ #include "cafCadNavigation.h" #include "cafCeetronPlusNavigation.h" +#include "cafDisplayCoordTransform.h" #include "cafFrameAnimationControl.h" #include "cafPdmUiTreeOrdering.h" @@ -617,23 +618,52 @@ void RimEclipseView::updateCurrentTimeStep() crossSectionCollection->applySingleColorEffect(); } - // Simulation Wells if (m_viewer) { cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep); if (frameScene) { - cvf::ref simWellModelBasicList = new cvf::ModelBasicList; - simWellModelBasicList->setName("SimWellPipeMod"); + // Simulation Wells + { + cvf::String name = "SimWellPipeMod"; + this->removeModelByName(frameScene, name); - m_simWellsPartManager->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(), m_currentTimeStep); + cvf::ref simWellModelBasicList = new cvf::ModelBasicList; + simWellModelBasicList->setName(name); - simWellModelBasicList->updateBoundingBoxesRecursive(); + m_simWellsPartManager->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(), m_currentTimeStep); - this->removeModelByName(frameScene, simWellModelBasicList->name()); - frameScene->addModel(simWellModelBasicList.p()); + simWellModelBasicList->updateBoundingBoxesRecursive(); - m_simWellsPartManager->updatePipeResultColor(m_currentTimeStep); + frameScene->addModel(simWellModelBasicList.p()); + + m_simWellsPartManager->updatePipeResultColor(m_currentTimeStep); + } + + // Well Paths + { + cvf::String name = "WellPathMod"; + this->removeModelByName(frameScene, name); + + cvf::ref wellPathModelBasicList = new cvf::ModelBasicList; + wellPathModelBasicList->setName(name); + + RigMainGrid* mainGrid = this->mainGrid(); + if (mainGrid) + { + wellPathsPartManager()->appendDynamicGeometryPartsToModel(m_currentTimeStep, + wellPathModelBasicList.p(), + mainGrid->displayModelOffset(), + m_reservoirGridPartManager->scaleTransform(), + mainGrid->characteristicIJCellSize(), + currentActiveCellInfo()->geometryBoundingBox(), + this->displayCoordTransform().p()); + + wellPathModelBasicList->updateBoundingBoxesRecursive(); + + frameScene->addModel(wellPathModelBasicList.p()); + } + } } } From 35a61046c32f06455c9435b3a2deadf693b28ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Thu, 15 Jun 2017 14:11:58 +0200 Subject: [PATCH 05/22] #1595 Update grid box when reloading case --- ApplicationCode/ProjectDataModel/RimEclipseCase.cpp | 1 + ApplicationCode/ProjectDataModel/RimView.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index b800d32ea3..9422143e65 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -663,6 +663,7 @@ void RimEclipseCase::reloadDataAndUpdate() RimEclipseView* reservoirView = reservoirViews()[i]; CVF_ASSERT(reservoirView); reservoirView->loadDataAndUpdate(); + reservoirView->updateGridBoxData(); } RimProject* project = RiaApplication::instance()->project(); diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index 098c4fdabc..cfe0839c62 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -169,6 +169,7 @@ public: public: virtual void loadDataAndUpdate() = 0; + void updateGridBoxData(); virtual RimCase* ownerCase() = 0; virtual caf::PdmFieldHandle* userDescriptionField() { return &name; } @@ -187,7 +188,6 @@ protected: virtual void createDisplayModel() = 0; void createHighlightAndGridBoxDisplayModel(); - void updateGridBoxData(); virtual void createPartCollectionFromSelection(cvf::Collection* parts) = 0; From 6cd0f0ebd29c67ac07ef5cdb56aae2139448f337 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 16 Jun 2017 08:56:02 +0200 Subject: [PATCH 06/22] #1440 Use view as basis for appending dynamic parts --- .../RivWellPathCollectionPartMgr.cpp | 14 +--- .../RivWellPathCollectionPartMgr.h | 9 +-- .../ModelVisualization/RivWellPathPartMgr.cpp | 73 ++++++++++++++----- .../ModelVisualization/RivWellPathPartMgr.h | 10 ++- .../ProjectDataModel/RimEclipseView.cpp | 8 +- 5 files changed, 65 insertions(+), 49 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp index 7d503e6305..9ba3b9726a 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp @@ -88,24 +88,16 @@ void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(size_t timeStep, - cvf::ModelBasicList* model, - cvf::Vec3d displayModelOffset, - cvf::Transform* scaleTransform, - double characteristicCellSize, - cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform) +void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model) { - setScaleTransform(scaleTransform); - if (!m_wellPathCollection->isActive()) return; if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) { RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); - partMgr->setScaleTransform(scaleTransform); - partMgr->appendDynamicGeometryPartsToModel(timeStep, model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); + partMgr->appendDynamicGeometryPartsToModel(view, model); } + } diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h index d902d87e6e..4088a98f91 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h @@ -63,14 +63,7 @@ public: cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform); - void appendDynamicGeometryPartsToModel( - size_t timeStep, - cvf::ModelBasicList* model, - cvf::Vec3d displayModelOffset, - cvf::Transform* scaleTransform, - double characteristicCellSize, - cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform); + void appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model); private: caf::PdmPointer m_wellPathCollection; diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 790e3a06ad..48b3932c7f 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -23,26 +23,29 @@ #include "RiaApplication.h" +#include "RigMainGrid.h" #include "RigWellPath.h" +#include "RimEclipseCase.h" +#include "RimEclipseView.h" +#include "RimFishboneWellPath.h" +#include "RimFishboneWellPathCollection.h" +#include "RimFishbonesCollection.h" #include "RimFishbonesMultipleSubs.h" +#include "RimPerforationCollection.h" +#include "RimPerforationInterval.h" +#include "RimView.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" -#include "RimFishboneWellPath.h" -#include "RimFishbonesCollection.h" -#include "RimFishboneWellPathCollection.h" -#include "RimPerforationInterval.h" -#include "RimPerforationCollection.h" #include "RivFishbonesSubsPartMgr.h" +#include "RivObjectSourceInfo.h" #include "RivPartPriority.h" #include "RivPipeGeometryGenerator.h" #include "RivWellPathSourceInfo.h" -#include "RivObjectSourceInfo.h" -#include "cafEffectGenerator.h" #include "cafDisplayCoordTransform.h" - +#include "cafEffectGenerator.h" #include "cvfDrawableGeo.h" #include "cvfDrawableText.h" #include "cvfFont.h" @@ -58,7 +61,7 @@ //-------------------------------------------------------------------------------------------------- RivWellPathPartMgr::RivWellPathPartMgr(RimWellPath* wellPath) { - m_rimWellPath = wellPath; + m_rimWellPath = wellPath; m_needsTransformUpdate = true; @@ -146,13 +149,12 @@ void RivWellPathPartMgr::appendCompletionsToModel(cvf::ModelBasicList* model, ca model->addPart(part.p()); } } - } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) +void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) { if (!m_rimWellPath || !m_rimWellPath->perforationIntervalCollection()->isChecked()) return; @@ -176,6 +178,8 @@ void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model, c if (!perforation->isChecked()) continue; if (perforation->startMD() > perforation->endMD()) continue; + if (currentViewDate.isValid() && !perforation->isActiveOnDate(currentViewDate)) continue; + std::vector displayCoords; displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->interpolatedPointAlongWellPath(perforation->startMD()))); for (size_t i = 0; i < wellPathGeometry->m_measuredDepths.size(); ++i) @@ -388,20 +392,51 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m appendFishbonesPartsToModel(model, displayCoordTransform, characteristicCellSize); appendCompletionsToModel(model, displayCoordTransform, characteristicCellSize); - appendPerforationsToModel(model, displayCoordTransform, characteristicCellSize); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(size_t frameIndex, - cvf::ModelBasicList* model, - cvf::Vec3d displayModelOffset, - double characteristicCellSize, - cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform) +void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model) { - // TODO add perforation intervals + RimWellPathCollection* wellPathCollection = this->wellPathCollection(); + if (!wellPathCollection) return; + + if (m_rimWellPath.isNull()) return; + + if (wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) + return; + + if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false) + return; + + cvf::ref displayCoordTransform = view->displayCoordTransform(); + double characteristicCellSize = 10.0; + QDateTime currentDateTime; + + RimEclipseView* eclipseView = dynamic_cast(view); + if (eclipseView) + { + RigMainGrid* mainGrid = eclipseView->mainGrid(); + if (mainGrid) + { + characteristicCellSize = mainGrid->characteristicIJCellSize(); + } + + RimEclipseCase* eclipseCase = nullptr; + view->firstAncestorOrThisOfType(eclipseCase); + if (eclipseCase) + { + std::vector timeStepDates = eclipseCase->timeStepDates(); + + if (view->currentTimeStep() < timeStepDates.size()) + { + currentDateTime = timeStepDates[view->currentTimeStep()]; + } + } + } + + appendPerforationsToModel(currentDateTime, model, displayCoordTransform.p(), characteristicCellSize); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index 5840f8fbb1..3aa88a35c3 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -43,6 +43,9 @@ class RimProject; class RimWellPath; class RivFishbonesSubsPartMgr; class RimWellPathCollection; +class RimView; + +class QDateTime; class RivWellPathPartMgr : public cvf::Object { @@ -58,16 +61,15 @@ public: double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform); - void appendDynamicGeometryPartsToModel(size_t frameIndex, cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, - double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform); + void appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model); size_t segmentIndexFromTriangleIndex(size_t triangleIndex); private: void appendFishbonesPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); void appendCompletionsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); - void appendPerforationsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox); void clearAllBranchData(); inline RimWellPathCollection* wellPathCollection(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 78627e9803..20c36dd149 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -651,13 +651,7 @@ void RimEclipseView::updateCurrentTimeStep() RigMainGrid* mainGrid = this->mainGrid(); if (mainGrid) { - wellPathsPartManager()->appendDynamicGeometryPartsToModel(m_currentTimeStep, - wellPathModelBasicList.p(), - mainGrid->displayModelOffset(), - m_reservoirGridPartManager->scaleTransform(), - mainGrid->characteristicIJCellSize(), - currentActiveCellInfo()->geometryBoundingBox(), - this->displayCoordTransform().p()); + wellPathsPartManager()->appendDynamicGeometryPartsToModel(this, wellPathModelBasicList.p()); wellPathModelBasicList->updateBoundingBoxesRecursive(); From 07e1acac1533c9428133537142f15579db1e717b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 16 Jun 2017 16:29:16 +0200 Subject: [PATCH 07/22] #1440 Add const to date access functions --- .../GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp | 2 +- .../GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h | 2 +- ApplicationCode/GeoMech/OdbReader/RifGeoMechReaderInterface.h | 4 ++-- ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp | 4 ++-- ApplicationCode/GeoMech/OdbReader/RifOdbReader.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index a7a1060638..d3b32816af 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -1840,7 +1840,7 @@ std::vector< RigFemResultAddress> RigFemPartResultsCollection::getResAddrToCompo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigFemPartResultsCollection::stepNames() +std::vector RigFemPartResultsCollection::stepNames() const { CVF_ASSERT(m_readerInterface.notNull()); return m_readerInterface->stepNames(); diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h index 5659479e1b..cf6e82620e 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h @@ -51,7 +51,7 @@ public: double parameterFrictionAngleRad() const { return m_frictionAngleRad; } std::map > scalarFieldAndComponentNames(RigFemResultPosEnum resPos); - std::vector stepNames(); + std::vector stepNames() const; bool assertResultsLoaded(const RigFemResultAddress& resVarAddr); void deleteResult(const RigFemResultAddress& resVarAddr); diff --git a/ApplicationCode/GeoMech/OdbReader/RifGeoMechReaderInterface.h b/ApplicationCode/GeoMech/OdbReader/RifGeoMechReaderInterface.h index ac3b2fadf0..6ec6370e65 100644 --- a/ApplicationCode/GeoMech/OdbReader/RifGeoMechReaderInterface.h +++ b/ApplicationCode/GeoMech/OdbReader/RifGeoMechReaderInterface.h @@ -44,8 +44,8 @@ public: virtual bool openFile(const std::string& fileName, std::string* errorMessage) = 0; virtual bool readFemParts(RigFemPartCollection* geoMechCase) = 0; - virtual std::vector stepNames() = 0; - virtual std::vector frameTimes(int stepIndex) = 0; + virtual std::vector stepNames() const = 0; + virtual std::vector frameTimes(int stepIndex) const = 0; virtual std::vector elementSetNames(int partIndex) = 0; virtual std::vector elementSet(int partIndex, int setIndex) = 0; diff --git a/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp b/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp index 59a1339df4..f2844f7c2f 100644 --- a/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp +++ b/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp @@ -422,7 +422,7 @@ bool RifOdbReader::readFemParts(RigFemPartCollection* femParts) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RifOdbReader::stepNames() +std::vector RifOdbReader::stepNames() const { CVF_ASSERT(m_odb != NULL); @@ -442,7 +442,7 @@ std::vector RifOdbReader::stepNames() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RifOdbReader::frameTimes(int stepIndex) +std::vector RifOdbReader::frameTimes(int stepIndex) const { CVF_ASSERT(m_odb != NULL); diff --git a/ApplicationCode/GeoMech/OdbReader/RifOdbReader.h b/ApplicationCode/GeoMech/OdbReader/RifOdbReader.h index be1004c0c9..6e2df2008d 100644 --- a/ApplicationCode/GeoMech/OdbReader/RifOdbReader.h +++ b/ApplicationCode/GeoMech/OdbReader/RifOdbReader.h @@ -44,8 +44,8 @@ public: virtual bool openFile(const std::string& fileName, std::string* errorMessage); virtual bool readFemParts(RigFemPartCollection* geoMechCase); - virtual std::vector stepNames(); - virtual std::vector frameTimes(int stepIndex); + virtual std::vector stepNames() const override; + virtual std::vector frameTimes(int stepIndex) const override; virtual std::vector elementSetNames(int partIndex); virtual std::vector elementSet(int partIndex, int setIndex); From 15848a82dc9b3c67462dfb44f0bde1e8bd2fbb91 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 16 Jun 2017 16:40:35 +0200 Subject: [PATCH 08/22] #1440 Build time step format string on open --- .../ProjectDataModel/RimEclipseCase.cpp | 86 ++++++++++--------- .../ProjectDataModel/RimEclipseCase.h | 12 ++- 2 files changed, 52 insertions(+), 46 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 4ddf841d81..673d7b6238 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -422,6 +422,51 @@ void RimEclipseCase::setReservoirData(RigEclipseCaseData* eclipseCase) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseCase::createTimeStepFormatString() +{ + std::vector timeStepDates = this->timeStepDates(); + + bool hasHoursAndMinutesInTimesteps = false; + bool hasSecondsInTimesteps = false; + bool hasMillisecondsInTimesteps = false; + for (size_t i = 0; i < timeStepDates.size(); i++) + { + if (timeStepDates[i].time().msec() != 0.0) + { + hasMillisecondsInTimesteps = true; + hasSecondsInTimesteps = true; + hasHoursAndMinutesInTimesteps = true; + break; + } + else if (timeStepDates[i].time().second() != 0.0) + { + hasHoursAndMinutesInTimesteps = true; + hasSecondsInTimesteps = true; + } + else if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0) + { + hasHoursAndMinutesInTimesteps = true; + } + } + + m_timeStepFormatString = "dd.MMM yyyy"; + if (hasHoursAndMinutesInTimesteps) + { + m_timeStepFormatString += " - hh:mm"; + if (hasSecondsInTimesteps) + { + m_timeStepFormatString += ":ss"; + if (hasMillisecondsInTimesteps) + { + m_timeStepFormatString += ".zzz"; + } + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -516,6 +561,8 @@ bool RimEclipseCase::openReserviorCase() if (results->cellResults()) results->cellResults()->createPlaceholderResultEntries(); } + createTimeStepFormatString(); + return true; } @@ -556,45 +603,6 @@ QString RimEclipseCase::timeStepName(int frameIdx) std::vector timeStepDates = this->timeStepDates(); CVF_ASSERT(frameIdx < static_cast(timeStepDates.size())); - if (m_timeStepFormatString.isEmpty()) - { - bool hasHoursAndMinutesInTimesteps = false; - bool hasSecondsInTimesteps = false; - bool hasMillisecondsInTimesteps = false; - for (size_t i = 0; i < timeStepDates.size(); i++) - { - if (timeStepDates[i].time().msec() != 0.0) - { - hasMillisecondsInTimesteps = true; - hasSecondsInTimesteps = true; - hasHoursAndMinutesInTimesteps = true; - break; - } - else if (timeStepDates[i].time().second() != 0.0) { - hasHoursAndMinutesInTimesteps = true; - hasSecondsInTimesteps = true; - } - else if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0) - { - hasHoursAndMinutesInTimesteps = true; - } - } - - m_timeStepFormatString = "dd.MMM yyyy"; - if (hasHoursAndMinutesInTimesteps) - { - m_timeStepFormatString += " - hh:mm"; - if (hasSecondsInTimesteps) - { - m_timeStepFormatString += ":ss"; - if (hasMillisecondsInTimesteps) - { - m_timeStepFormatString += ".zzz"; - } - } - } - } - QDateTime date = timeStepDates.at(frameIdx); return date.toString(m_timeStepFormatString); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 339916a2f2..5cce6417c0 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -99,9 +99,6 @@ public: void reloadDataAndUpdate(); virtual void reloadEclipseGridFile() = 0; - // Overridden methods from PdmObject -public: - protected: virtual void initAfterRead(); virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ); @@ -114,14 +111,15 @@ protected: void setReservoirData(RigEclipseCaseData* eclipseCase); private: - cvf::ref m_rigEclipseCase; + void createTimeStepFormatString(); private: + cvf::ref m_rigEclipseCase; + QString m_timeStepFormatString; + std::map m_wellToColorMap; + caf::PdmChildField m_matrixModelResults; caf::PdmChildField m_fractureModelResults; - QString m_timeStepFormatString; - - std::map m_wellToColorMap; // Obsolete fields protected: From 759067367b6e1e41c117bd4f3284016fc95a3bec Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 16 Jun 2017 16:45:14 +0200 Subject: [PATCH 09/22] #1440 Add const to time string functions --- ApplicationCode/ProjectDataModel/RimCase.h | 4 ++-- .../ProjectDataModel/RimEclipseCase.cpp | 17 ++++++++++++++--- .../ProjectDataModel/RimEclipseCase.h | 7 ++++--- .../ProjectDataModel/RimGeoMechCase.cpp | 8 ++++---- .../ProjectDataModel/RimGeoMechCase.h | 4 ++-- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimCase.h b/ApplicationCode/ProjectDataModel/RimCase.h index 675c5649ac..e7785b6dff 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.h +++ b/ApplicationCode/ProjectDataModel/RimCase.h @@ -51,8 +51,8 @@ public: virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath) = 0; - virtual QStringList timeStepStrings() = 0; - virtual QString timeStepName(int frameIdx) = 0; + virtual QStringList timeStepStrings() const = 0; + virtual QString timeStepName(int frameIdx) const = 0; virtual cvf::BoundingBox activeCellsBoundingBox() const = 0; virtual cvf::BoundingBox allCellsBoundingBox() const = 0; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 673d7b6238..7f102c395d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -525,7 +525,18 @@ RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::Poro return m_fractureModelResults(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::PorosityModelResultType porosityModel) const +{ + if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + { + return m_matrixModelResults(); + } + return m_fractureModelResults(); +} //-------------------------------------------------------------------------------------------------- /// @@ -582,7 +593,7 @@ std::vector RimEclipseCase::views() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QStringList RimEclipseCase::timeStepStrings() +QStringList RimEclipseCase::timeStepStrings() const { QStringList stringList; @@ -598,7 +609,7 @@ QStringList RimEclipseCase::timeStepStrings() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimEclipseCase::timeStepName(int frameIdx) +QString RimEclipseCase::timeStepName(int frameIdx) const { std::vector timeStepDates = this->timeStepDates(); CVF_ASSERT(frameIdx < static_cast(timeStepDates.size())); @@ -671,7 +682,7 @@ void RimEclipseCase::reloadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimEclipseCase::timeStepDates() +std::vector RimEclipseCase::timeStepDates() const { return results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 5cce6417c0..b5ff497ad8 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -74,6 +74,7 @@ public: cvf::Color3f defaultWellColor(const QString& wellName); RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel); + const RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel) const; RimEclipseView* createAndAddReservoirView(); RimEclipseView* createCopyAndAddView(const RimEclipseView* sourceView); @@ -87,9 +88,9 @@ public: RimCaseCollection* parentCaseCollection(); virtual std::vector views(); - virtual QStringList timeStepStrings(); - virtual QString timeStepName(int frameIdx); - std::vector timeStepDates(); + virtual QStringList timeStepStrings() const override; + virtual QString timeStepName(int frameIdx) const override; + std::vector timeStepDates() const; virtual cvf::BoundingBox activeCellsBoundingBox() const; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 47759350be..b3c6da50f7 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -191,11 +191,11 @@ void RimGeoMechCase::initAfterRead() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QStringList RimGeoMechCase::timeStepStrings() +QStringList RimGeoMechCase::timeStepStrings() const { QStringList stringList; - RigGeoMechCaseData* rigCaseData = geoMechData(); + const RigGeoMechCaseData* rigCaseData = geoMechData(); if (rigCaseData && rigCaseData->femPartResults()) { std::vector stepNames = rigCaseData->femPartResults()->stepNames(); @@ -211,9 +211,9 @@ QStringList RimGeoMechCase::timeStepStrings() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimGeoMechCase::timeStepName(int frameIdx) +QString RimGeoMechCase::timeStepName(int frameIdx) const { - RigGeoMechCaseData* rigCaseData = geoMechData(); + const RigGeoMechCaseData* rigCaseData = geoMechData(); if (rigCaseData && rigCaseData->femPartResults()) { std::vector stepNames = rigCaseData->femPartResults()->stepNames(); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h index 08926ce81a..7fede2fc23 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h @@ -58,8 +58,8 @@ public: virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath); virtual std::vector views(); - virtual QStringList timeStepStrings(); - virtual QString timeStepName(int frameIdx); + virtual QStringList timeStepStrings() const override; + virtual QString timeStepName(int frameIdx) const override; virtual cvf::BoundingBox activeCellsBoundingBox() const; virtual cvf::BoundingBox allCellsBoundingBox() const; From bd3d060c96f1fcfa04bd8ff55f14d99a005efe45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 16 Jun 2017 17:03:25 +0200 Subject: [PATCH 10/22] #1567 Fix on patch branch --- ApplicationCode/Application/RiaApplication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 15e26fd1a6..6ddcca5b8c 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -1479,14 +1479,14 @@ bool RiaApplication::parseArguments() foreach (QString caseName, caseNames) { QString caseFileNameWithExt = caseName + ".EGRID"; - if (!caf::Utils::fileExists(caseFileNameWithExt)) + if (caf::Utils::fileExists(caseFileNameWithExt)) { openEclipseCaseFromFile(caseFileNameWithExt); } else { caseFileNameWithExt = caseName + ".GRID"; - if (!caf::Utils::fileExists(caseFileNameWithExt)) + if (caf::Utils::fileExists(caseFileNameWithExt)) { openEclipseCaseFromFile(caseFileNameWithExt); } From 36b4ad8860d4eb6bfbc14d789a1dc8545fa15a22 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 16 Jun 2017 17:20:08 +0200 Subject: [PATCH 11/22] #1440 Add timeStepDates() to RimCase --- ApplicationCode/ProjectDataModel/RimCase.h | 1 + .../ProjectDataModel/RimEclipseCase.h | 2 +- .../ProjectDataModel/RimGeoMechCase.cpp | 42 +++++++++++++++++++ .../ProjectDataModel/RimGeoMechCase.h | 15 +++---- .../RimGridTimeHistoryCurve.cpp | 6 +-- .../RiuSelectionChangedHandler.cpp | 3 +- 6 files changed, 53 insertions(+), 16 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimCase.h b/ApplicationCode/ProjectDataModel/RimCase.h index e7785b6dff..a5b1788172 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.h +++ b/ApplicationCode/ProjectDataModel/RimCase.h @@ -51,6 +51,7 @@ public: virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath) = 0; + virtual std::vector timeStepDates() const = 0; virtual QStringList timeStepStrings() const = 0; virtual QString timeStepName(int frameIdx) const = 0; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index b5ff497ad8..77672d95d8 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -90,7 +90,7 @@ public: virtual std::vector views(); virtual QStringList timeStepStrings() const override; virtual QString timeStepName(int frameIdx) const override; - std::vector timeStepDates() const; + virtual std::vector timeStepDates() const override; virtual cvf::BoundingBox activeCellsBoundingBox() const; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index b3c6da50f7..4b97888443 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -89,6 +89,38 @@ RimGeoMechCase::~RimGeoMechCase(void) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGeoMechCase::setFileName(const QString& fileName) +{ + m_caseFileName = fileName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimGeoMechCase::caseFileName() const +{ + return m_caseFileName(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigGeoMechCaseData* RimGeoMechCase::geoMechData() +{ + return m_geoMechCaseData.p(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigGeoMechCaseData* RimGeoMechCase::geoMechData() const +{ + return m_geoMechCaseData.p(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -172,6 +204,16 @@ std::vector RimGeoMechCase::views() return views; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimGeoMechCase::timeStepDates() const +{ + QStringList timeStrings = timeStepStrings(); + + return RimGeoMechCase::dateTimeVectorFromTimeStepStrings(timeStrings); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h index 7fede2fc23..1e2c70de54 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h @@ -46,18 +46,19 @@ public: RimGeoMechCase(void); virtual ~RimGeoMechCase(void); - void setFileName(const QString& fileName) {m_caseFileName = fileName;} - QString caseFileName() const {return m_caseFileName();} + void setFileName(const QString& fileName); + QString caseFileName() const; bool openGeoMechCase(std::string* errorMessage); - RigGeoMechCaseData* geoMechData() { return m_geoMechCaseData.p(); } - const RigGeoMechCaseData* geoMechData() const { return m_geoMechCaseData.p(); } + RigGeoMechCaseData* geoMechData(); + const RigGeoMechCaseData* geoMechData() const; RimGeoMechView* createAndAddReservoirView(); virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath); virtual std::vector views(); + virtual std::vector timeStepDates() const override; virtual QStringList timeStepStrings() const override; virtual QString timeStepName(int frameIdx) const override; @@ -67,11 +68,9 @@ public: // Fields: caf::PdmChildArrayField geoMechViews; +private: static std::vector dateTimeVectorFromTimeStepStrings(const QStringList& timeStepStrings); - - -private: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; @@ -85,6 +84,4 @@ private: caf::PdmField m_caseFileName; caf::PdmField m_cohesion; caf::PdmField m_frictionAngleDeg; -protected: - }; diff --git a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 6c93a71c3e..ccb3fa4afe 100644 --- a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -385,8 +385,7 @@ std::vector RimGridTimeHistoryCurve::timeStepValues() const { std::vector values = timeHistResultAccessor->timeHistoryValues(); - QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings(); - std::vector dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames); + std::vector dates = geoMechTopItem->geoMechCase()->timeStepDates(); if (dates.size() == values.size()) { for (QDateTime dt : dates) @@ -430,8 +429,7 @@ std::vector RimGridTimeHistoryCurve::daysSinceSimulationStart() const { std::vector values = timeHistResultAccessor->timeHistoryValues(); - QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings(); - std::vector dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames); + std::vector dates = geoMechTopItem->geoMechCase()->timeStepDates(); if (dates.size() == values.size()) { if (!dates.empty()) { diff --git a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp index 3a5ecd5fb0..11ad19921e 100644 --- a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -195,8 +195,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuGeoMechSelec std::vector timeHistoryValues = timeHistResultAccessor->timeHistoryValues(); - QStringList stepNames = geoMechView->geoMechCase()->timeStepStrings(); - std::vector dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames); + std::vector dates = geoMechView->geoMechCase()->timeStepDates(); if (dates.size() == timeHistoryValues.size()) { RiuMainWindow::instance()->resultPlot()->addCurve(curveName, geomSelectionItem->m_color, dates, timeHistoryValues); From 31bde3eb9acf7d097f1aa2dc3774ceb9713d3210 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 19 Jun 2017 10:48:47 +0200 Subject: [PATCH 12/22] #1599 Do not use file extention in getSaveFilename() as this causes issues on KDE desktop --- ApplicationCode/Commands/RicSnapshotViewToClipboardFeature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/Commands/RicSnapshotViewToClipboardFeature.cpp b/ApplicationCode/Commands/RicSnapshotViewToClipboardFeature.cpp index 05b198be5f..d884e8e9dd 100644 --- a/ApplicationCode/Commands/RicSnapshotViewToClipboardFeature.cpp +++ b/ApplicationCode/Commands/RicSnapshotViewToClipboardFeature.cpp @@ -146,7 +146,7 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked) startPath += "/image.png"; - QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath, tr("Image files (*.bmp *.png * *.jpg)")); + QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath); if (fileName.isEmpty()) { return; From b2a3116e8ff09dcb2f97470026aa950d5d29623d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Mon, 19 Jun 2017 10:54:05 +0200 Subject: [PATCH 13/22] #1622 Fix problem with space in fault include file names --- .../ProjectDataModel/RimEclipseCase.cpp | 45 +++++++++++++++++-- .../ProjectDataModel/RimEclipseCase.h | 9 +++- .../ProjectDataModel/RimEclipseResultCase.cpp | 7 +-- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 9422143e65..ce2c15ee2b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -76,14 +76,20 @@ RimEclipseCase::RimEclipseCase() CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", ""); CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", ""); - CAF_PDM_InitFieldNoDefault(&filesContainingFaults, "FilesContainingFaults", "", "", "", ""); - filesContainingFaults.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault(&m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", ""); + m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden(true); + + // Obsolete fields + CAF_PDM_InitFieldNoDefault(&m_filesContainingFaults_OBSOLETE, "FilesContainingFaults", "", "", "", ""); + m_filesContainingFaults_OBSOLETE.xmlCapability()->setIOWritable(false); + m_filesContainingFaults_OBSOLETE.uiCapability()->setUiHidden(true); - // Obsolete field CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,""); caseName.xmlCapability()->setIOWritable(false); caseName.uiCapability()->setUiHidden(true); + // Init + m_matrixModelResults = new RimReservoirCellResultsStorage; m_matrixModelResults.uiCapability()->setUiHidden(true); m_matrixModelResults.uiCapability()->setUiTreeChildrenHidden(true); @@ -519,6 +525,39 @@ RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::Poro +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimEclipseCase::filesContainingFaults() const +{ + QString separatedPaths = m_filesContainingFaultsSemColSeparated; + QStringList pathList = separatedPaths.split(";", QString::SkipEmptyParts); + std::vector stdPathList; + + for (auto& path: pathList) stdPathList.push_back(path); + + return stdPathList; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseCase::setFilesContainingFaults(const std::vector& val) +{ + QString separatedPaths; + + for (size_t i = 0; i < val.size(); ++i) + { + const auto& path = val[i]; + separatedPaths += path; + if (!(i+1 >= val.size()) ) + { + separatedPaths += ";"; + } + } + m_filesContainingFaultsSemColSeparated = separatedPaths; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 81cf3f1b46..cc43a21ded 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -62,8 +62,8 @@ public: caf::PdmField flipXAxis; caf::PdmField flipYAxis; - caf::PdmField > filesContainingFaults; - + std::vector filesContainingFaults() const; + void setFilesContainingFaults(const std::vector& val); bool openReserviorCase(); virtual bool openEclipseGridFile() = 0; @@ -121,8 +121,13 @@ private: QString m_timeStepFormatString; std::map m_wellToColorMap; + caf::PdmField m_filesContainingFaultsSemColSeparated; + // Obsolete fields protected: caf::PdmField caseName; +private: + caf::PdmField > m_filesContainingFaults_OBSOLETE; + }; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 35a552fa18..89864ef12c 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -117,7 +117,7 @@ bool RimEclipseResultCase::openEclipseGridFile() return false; } - this->filesContainingFaults = readerInterface->filenamesWithFaults(); + this->setFilesContainingFaults(readerInterface->filenamesWithFaults()); this->setReservoirData( eclipseCase.p() ); } @@ -359,13 +359,14 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths); std::vector relocatedFaultFiles; - for (auto faultFileName : filesContainingFaults()) + const std::vector& orgFilesContainingFaults = filesContainingFaults(); + for (auto faultFileName : orgFilesContainingFaults) { QString relocatedFaultFile = RimTools::relocateFile(faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths); relocatedFaultFiles.push_back(relocatedFaultFile); } - filesContainingFaults = relocatedFaultFiles; + setFilesContainingFaults(relocatedFaultFiles); #if 0 // Output the search path for debugging for (size_t i = 0; i < searchedPaths.size(); ++i) From b5b13789b46f53ea97dc3a93a3fa08cdff0ec26b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 19 Jun 2017 20:49:06 +0200 Subject: [PATCH 14/22] Add const to several geomech functions --- ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp | 2 +- ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h | 4 ++-- .../GeoMech/GeoMechDataModel/RigFemPartCollection.cpp | 2 +- .../GeoMech/GeoMechDataModel/RigFemPartCollection.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp index dc2c4bee97..e4a5ba220a 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp @@ -283,7 +283,7 @@ cvf::Vec3f RigFemPart::faceNormal(int elmIdx, int faceIdx) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -float RigFemPart::characteristicElementSize() +float RigFemPart::characteristicElementSize() const { if (m_characteristicElementSize != std::numeric_limits::infinity()) return m_characteristicElementSize; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h index 7c8230e35c..5c856f5e45 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h @@ -78,7 +78,7 @@ public: { return m_elmNeighbors[elementIndex].faceInNeighborElm[faceIndex]; } cvf::BoundingBox boundingBox() const; - float characteristicElementSize(); + float characteristicElementSize() const; const std::vector& possibleGridCornerElements() const { return m_possibleGridCornerElements; } void findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector* elementIndices) const; @@ -106,7 +106,7 @@ private: std::vector< Neighbors > m_elmNeighbors; std::vector m_possibleGridCornerElements; - float m_characteristicElementSize; + mutable float m_characteristicElementSize; mutable cvf::BoundingBox m_boundingBox; mutable cvf::ref m_elementSearchTree; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp index cd735dea19..f0f7429c34 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp @@ -88,7 +88,7 @@ size_t RigFemPartCollection::totalElementCount() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -float RigFemPartCollection::characteristicElementSize() +float RigFemPartCollection::characteristicElementSize() const { if (partCount()) { diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h index 5f172de9b7..3e78e1d04d 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h @@ -36,7 +36,7 @@ public: int partCount() const; size_t totalElementCount() const; - float characteristicElementSize(); + float characteristicElementSize() const; cvf::BoundingBox boundingBox() const; From 994198d388fcb7f97b1024d3c8659bc67e58bafb Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 19 Jun 2017 20:55:58 +0200 Subject: [PATCH 15/22] Add characteristicCellSize to RimView --- .../ModelVisualization/RivWellPathPartMgr.cpp | 31 ++++++++----------- ApplicationCode/ProjectDataModel/RimCase.h | 2 ++ .../ProjectDataModel/RimEclipseCase.cpp | 14 +++++++++ .../ProjectDataModel/RimEclipseCase.h | 3 ++ .../ProjectDataModel/RimGeoMechCase.cpp | 15 +++++++++ .../ProjectDataModel/RimGeoMechCase.h | 3 ++ 6 files changed, 50 insertions(+), 18 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 48b3932c7f..55cdb1cb13 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -399,6 +399,8 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m //-------------------------------------------------------------------------------------------------- void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model) { + CVF_ASSERT(view && model); + RimWellPathCollection* wellPathCollection = this->wellPathCollection(); if (!wellPathCollection) return; @@ -410,32 +412,25 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::M if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false) return; - cvf::ref displayCoordTransform = view->displayCoordTransform(); - double characteristicCellSize = 10.0; QDateTime currentDateTime; + double characteristicCellSize = 10.0; - RimEclipseView* eclipseView = dynamic_cast(view); - if (eclipseView) + RimCase* rimCase = nullptr; + view->firstAncestorOrThisOfType(rimCase); + if (rimCase) { - RigMainGrid* mainGrid = eclipseView->mainGrid(); - if (mainGrid) - { - characteristicCellSize = mainGrid->characteristicIJCellSize(); - } + std::vector timeStepDates = rimCase->timeStepDates(); - RimEclipseCase* eclipseCase = nullptr; - view->firstAncestorOrThisOfType(eclipseCase); - if (eclipseCase) + if (view->currentTimeStep() < timeStepDates.size()) { - std::vector timeStepDates = eclipseCase->timeStepDates(); - - if (view->currentTimeStep() < timeStepDates.size()) - { - currentDateTime = timeStepDates[view->currentTimeStep()]; - } + currentDateTime = timeStepDates[view->currentTimeStep()]; } + + characteristicCellSize = rimCase->characteristicCellSize(); } + cvf::ref displayCoordTransform = view->displayCoordTransform(); + appendPerforationsToModel(currentDateTime, model, displayCoordTransform.p(), characteristicCellSize); } diff --git a/ApplicationCode/ProjectDataModel/RimCase.h b/ApplicationCode/ProjectDataModel/RimCase.h index a5b1788172..cb274de8f0 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.h +++ b/ApplicationCode/ProjectDataModel/RimCase.h @@ -62,6 +62,8 @@ public: virtual void updateFormationNamesData() = 0; + virtual double characteristicCellSize() const = 0; + protected: virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; private: diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 7f102c395d..8b85a6d12d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -679,6 +679,20 @@ void RimEclipseCase::reloadDataAndUpdate() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimEclipseCase::characteristicCellSize() const +{ + const RigEclipseCaseData* rigEclipseCase = eclipseCaseData(); + if (rigEclipseCase) + { + return rigEclipseCase->mainGrid()->characteristicIJCellSize(); + } + + return 10.0; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 77672d95d8..8f04cdde9c 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -100,6 +100,9 @@ public: void reloadDataAndUpdate(); virtual void reloadEclipseGridFile() = 0; + + virtual double characteristicCellSize() const override; + protected: virtual void initAfterRead(); virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 4b97888443..a3d4b7c78c 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -289,6 +289,21 @@ cvf::BoundingBox RimGeoMechCase::allCellsBoundingBox() const } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimGeoMechCase::characteristicCellSize() const +{ + if (geoMechData() && geoMechData()->femParts()) + { + double cellSize = geoMechData()->femParts()->characteristicElementSize(); + + return cellSize; + } + + return 10.0; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h index 1e2c70de54..8af598bd1e 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h @@ -65,9 +65,12 @@ public: virtual cvf::BoundingBox activeCellsBoundingBox() const; virtual cvf::BoundingBox allCellsBoundingBox() const; + virtual double characteristicCellSize() const override; + // Fields: caf::PdmChildArrayField geoMechViews; + private: static std::vector dateTimeVectorFromTimeStepStrings(const QStringList& timeStepStrings); From 210bdab4c31189e82c1d08bfb0943a8c9fadacc1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 19 Jun 2017 22:15:28 +0200 Subject: [PATCH 16/22] Remove scale transform --- .../RivWellPathCollectionPartMgr.cpp | 22 +++--------- .../RivWellPathCollectionPartMgr.h | 4 --- .../ModelVisualization/RivWellPathPartMgr.cpp | 34 +++++-------------- .../ModelVisualization/RivWellPathPartMgr.h | 7 ++-- .../ProjectDataModel/RimEclipseView.cpp | 11 +----- .../ProjectDataModel/RimGeoMechView.cpp | 7 +--- ApplicationCode/ProjectDataModel/RimView.cpp | 11 +++--- ApplicationCode/ProjectDataModel/RimView.h | 5 +-- 8 files changed, 21 insertions(+), 80 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp index 9ba3b9726a..9a5f8b6f8b 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp @@ -57,31 +57,18 @@ void RivWellPathCollectionPartMgr::scheduleGeometryRegen() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathCollectionPartMgr::setScaleTransform(cvf::Transform * scaleTransform) -{ - for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) - { - m_wellPathCollection->wellPaths[wIdx]->partMgr()->setScaleTransform(scaleTransform); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, - cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, +void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + double characteristicCellSize, + cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform) { - setScaleTransform(scaleTransform); - if (!m_wellPathCollection->isActive()) return; if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) { RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); - partMgr->setScaleTransform(scaleTransform); - partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); + partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); } } @@ -98,6 +85,5 @@ void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(RimView* vi RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); partMgr->appendDynamicGeometryPartsToModel(view, model); } - } diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h index 4088a98f91..3c9602d71b 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h @@ -53,12 +53,8 @@ public: void scheduleGeometryRegen(); - void setScaleTransform(cvf::Transform * scaleTransform); - void appendStaticGeometryPartsToModel( cvf::ModelBasicList* model, - cvf::Vec3d displayModelOffset, - cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform); diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 55cdb1cb13..77426516bf 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -209,7 +209,7 @@ void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewD //-------------------------------------------------------------------------------------------------- /// The pipe geometry needs to be rebuilt on scale change to keep the pipes round //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, +void RivWellPathPartMgr::buildWellPathParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox) { RimWellPathCollection* wellPathCollection = this->wellPathCollection(); @@ -223,7 +223,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl clearAllBranchData(); double wellPathRadius = this->wellPathRadius(characteristicCellSize, wellPathCollection); - cvf::Vec3d textPosition = wellPathGeometry->m_wellPathPoints[0]; + cvf::Vec3d textPosition; // Generate the well path geometry as a line and pipe structure { @@ -263,7 +263,6 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl if (clippedPoints.size() < 2) return; - textPosition = clippedPoints[0]; cvfCoords->assign(clippedPoints); } else @@ -274,12 +273,11 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl // Scale the centerline coordinates using the Z-scale transform of the grid and correct for the display offset. for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx) { - cvf::Vec4d transfCoord = m_scaleTransform->worldTransform() * cvf::Vec4d((*cvfCoords)[cIdx] - displayModelOffset, 1); - (*cvfCoords)[cIdx][0] = transfCoord[0]; - (*cvfCoords)[cIdx][1] = transfCoord[1]; - (*cvfCoords)[cIdx][2] = transfCoord[2]; + (*cvfCoords)[cIdx] = displayCoordTransform->transformToDisplayCoord((*cvfCoords)[cIdx]); } + textPosition = cvfCoords->get(0); + pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p()); pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface(); pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine(); @@ -312,10 +310,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl // Generate label with well-path name - textPosition -= displayModelOffset; - textPosition.transformPoint(m_scaleTransform->worldTransform()); - textPosition.z() += characteristicCellSize; // * m_rimReservoirView->wellCollection()->wellHeadScaleFactor(); - textPosition.z() += 1.2 * characteristicCellSize; + textPosition.z() += 2.2 * characteristicCellSize; m_wellLabelPart = NULL; if (wellPathCollection->showWellPathLabel() && m_rimWellPath->showWellPathLabel() && !m_rimWellPath->name().isEmpty()) @@ -354,8 +349,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, - double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, +void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform) { RimWellPathCollection* wellPathCollection = this->wellPathCollection(); @@ -372,7 +366,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m if (m_needsTransformUpdate) { // The pipe geometry needs to be rebuilt on scale change to keep the pipes round - buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox); + buildWellPathParts(displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox); } if (m_pipeBranchData.m_surfacePart.notNull()) @@ -434,18 +428,6 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::M appendPerforationsToModel(currentDateTime, model, displayCoordTransform.p(), characteristicCellSize); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::setScaleTransform( cvf::Transform * scaleTransform ) -{ - if (m_scaleTransform.isNull() || m_scaleTransform.p() != scaleTransform) - { - m_scaleTransform = scaleTransform; - scheduleGeometryRegen(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index 3aa88a35c3..099dc19cbc 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -53,11 +53,9 @@ public: explicit RivWellPathPartMgr(RimWellPath* wellPath); ~RivWellPathPartMgr(); - void setScaleTransform(cvf::Transform * scaleTransform); - void scheduleGeometryRegen(); - void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, + void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, caf::DisplayCoordTransform* displayCoordTransform); @@ -70,7 +68,7 @@ private: void appendCompletionsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); void appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); - void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox); + void buildWellPathParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox); void clearAllBranchData(); inline RimWellPathCollection* wellPathCollection(); inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection); @@ -78,7 +76,6 @@ private: private: caf::PdmPointer m_rimWellPath; - cvf::ref m_scaleTransform; bool m_needsTransformUpdate; struct RivPipeBranchData diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 20c36dd149..e22babff5d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -424,18 +424,9 @@ void RimEclipseView::createDisplayModel() */ // Well path model - m_wellPathPipeVizModel->removeAllParts(); - RigMainGrid* mainGrid = this->mainGrid(); - if (mainGrid) - { - addWellPathsToModel(m_wellPathPipeVizModel.p(), - mainGrid->displayModelOffset(), - mainGrid->characteristicIJCellSize(), - currentActiveCellInfo()->geometryBoundingBox(), - m_reservoirGridPartManager->scaleTransform()); - } + addWellPathsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox()); m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p()); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 3b7240578a..2fb11b48ba 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -210,15 +210,10 @@ void RimGeoMechView::createDisplayModel() // Well path model - double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize(); cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox(); m_wellPathPipeVizModel->removeAllParts(); - addWellPathsToModel(m_wellPathPipeVizModel.p(), - cvf::Vec3d(0, 0, 0), - characteristicCellSize, - femBBox, - scaleTransform()); + addWellPathsToModel(m_wellPathPipeVizModel.p(), femBBox); m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p()); diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index c17b2f9f4b..e57a115e61 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -732,17 +732,14 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV /// //-------------------------------------------------------------------------------------------------- void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, - const cvf::Vec3d& displayModelOffset, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - cvf::Transform* scaleTransform) + const cvf::BoundingBox& wellPathClipBoundingBox) { + if (!this->ownerCase()) return; + cvf::ref transForm = displayCoordTransform(); wellPathsPartManager()->appendStaticGeometryPartsToModel(wellPathModelBasicList, - displayModelOffset, - scaleTransform, - characteristicCellSize, + this->ownerCase()->characteristicCellSize(), wellPathClipBoundingBox, transForm.p()); diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index bd9fb29c2c..103fdab189 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -178,10 +178,7 @@ protected: void setDefaultView(); void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, - const cvf::Vec3d& displayModelOffset, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - cvf::Transform* scaleTransform); + const cvf::BoundingBox& wellPathClipBoundingBox); static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName); From b9ee3d6d4a5052d931c9fa3bf102b8e0c148c68f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 19 Jun 2017 22:53:19 +0200 Subject: [PATCH 17/22] Add const and remove dependency to RimView --- .../RivFishbonesSubsPartMgr.cpp | 4 +- .../RivFishbonesSubsPartMgr.h | 4 +- .../RivWellPathCollectionPartMgr.cpp | 13 +++-- .../RivWellPathCollectionPartMgr.h | 19 +++++--- .../ModelVisualization/RivWellPathPartMgr.cpp | 47 +++++++------------ .../ModelVisualization/RivWellPathPartMgr.h | 20 ++++---- .../ProjectDataModel/RimEclipseView.cpp | 10 +--- .../ProjectDataModel/RimGeoMechView.cpp | 33 ++++++++++--- ApplicationCode/ProjectDataModel/RimView.cpp | 25 ++++++++++ ApplicationCode/ProjectDataModel/RimView.h | 3 ++ 10 files changed, 110 insertions(+), 68 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp b/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp index 414dd140a2..1efa5f1305 100644 --- a/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.cpp @@ -54,7 +54,7 @@ RivFishbonesSubsPartMgr::~RivFishbonesSubsPartMgr() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivFishbonesSubsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) +void RivFishbonesSubsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) { clearGeometryCache(); @@ -82,7 +82,7 @@ void RivFishbonesSubsPartMgr::clearGeometryCache() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivFishbonesSubsPartMgr::buildParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) +void RivFishbonesSubsPartMgr::buildParts(const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) { RimWellPath* wellPath = nullptr; m_rimFishbonesSubs->firstAncestorOrThisOfTypeAsserted(wellPath); diff --git a/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.h b/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.h index a5d16a53fc..162f01ab8f 100644 --- a/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivFishbonesSubsPartMgr.h @@ -53,11 +53,11 @@ public: RivFishbonesSubsPartMgr(RimFishbonesMultipleSubs* subs); ~RivFishbonesSubsPartMgr(); - void appendGeometryPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void appendGeometryPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); void clearGeometryCache(); private: - void buildParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void buildParts(const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); private: diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp index 9a5f8b6f8b..007ea0cede 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp @@ -59,8 +59,8 @@ void RivWellPathCollectionPartMgr::scheduleGeometryRegen() //-------------------------------------------------------------------------------------------------- void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize, - cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform) + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform) { if (!m_wellPathCollection->isActive()) return; if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; @@ -75,7 +75,12 @@ void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model) +void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform) + { if (!m_wellPathCollection->isActive()) return; if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; @@ -83,7 +88,7 @@ void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(RimView* vi for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) { RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); - partMgr->appendDynamicGeometryPartsToModel(view, model); + partMgr->appendDynamicGeometryPartsToModel(model, timeStamp, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); } } diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h index 3c9602d71b..7dfc6aaa11 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h @@ -34,6 +34,8 @@ class RimProject; class RivWellPathPartMgr; class RimView; +class QDateTime; + namespace cvf { class ModelBasicList; @@ -53,14 +55,17 @@ public: void scheduleGeometryRegen(); - void appendStaticGeometryPartsToModel( - cvf::ModelBasicList* model, - double characteristicCellSize, - cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform); + void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); - void appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model); + void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); private: - caf::PdmPointer m_wellPathCollection; + caf::PdmPointer m_wellPathCollection; }; diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 77426516bf..71ba04cc43 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -34,7 +34,6 @@ #include "RimFishbonesMultipleSubs.h" #include "RimPerforationCollection.h" #include "RimPerforationInterval.h" -#include "RimView.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" @@ -97,7 +96,7 @@ RivWellPathPartMgr::~RivWellPathPartMgr() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendFishbonesPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) +void RivWellPathPartMgr::appendFishbonesPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) { if (!m_rimWellPath || !m_rimWellPath->fishbonesCollection()->isChecked()) return; @@ -122,7 +121,7 @@ void RivWellPathPartMgr::appendFishbonesPartsToModel(cvf::ModelBasicList* model, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendCompletionsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) +void RivWellPathPartMgr::appendCompletionsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) { if (!m_rimWellPath || !m_rimWellPath->fishbonesCollection()->wellPathCollection()->isChecked()) return; @@ -154,7 +153,7 @@ void RivWellPathPartMgr::appendCompletionsToModel(cvf::ModelBasicList* model, ca //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) +void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) { if (!m_rimWellPath || !m_rimWellPath->perforationIntervalCollection()->isChecked()) return; @@ -209,8 +208,9 @@ void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewD //-------------------------------------------------------------------------------------------------- /// The pipe geometry needs to be rebuilt on scale change to keep the pipes round //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::buildWellPathParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize, - cvf::BoundingBox wellPathClipBoundingBox) +void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox) { RimWellPathCollection* wellPathCollection = this->wellPathCollection(); if (!wellPathCollection) return; @@ -349,8 +349,10 @@ void RivWellPathPartMgr::buildWellPathParts(caf::DisplayCoordTransform* displayC //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform) +void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform) { RimWellPathCollection* wellPathCollection = this->wellPathCollection(); if (!wellPathCollection) return; @@ -391,9 +393,13 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model) +void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform) { - CVF_ASSERT(view && model); + CVF_ASSERT(model); RimWellPathCollection* wellPathCollection = this->wellPathCollection(); if (!wellPathCollection) return; @@ -406,26 +412,7 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::M if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false) return; - QDateTime currentDateTime; - double characteristicCellSize = 10.0; - - RimCase* rimCase = nullptr; - view->firstAncestorOrThisOfType(rimCase); - if (rimCase) - { - std::vector timeStepDates = rimCase->timeStepDates(); - - if (view->currentTimeStep() < timeStepDates.size()) - { - currentDateTime = timeStepDates[view->currentTimeStep()]; - } - - characteristicCellSize = rimCase->characteristicCellSize(); - } - - cvf::ref displayCoordTransform = view->displayCoordTransform(); - - appendPerforationsToModel(currentDateTime, model, displayCoordTransform.p(), characteristicCellSize); + appendPerforationsToModel(timeStamp, model, displayCoordTransform, characteristicCellSize); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index 099dc19cbc..120e4fdaf3 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -43,7 +43,6 @@ class RimProject; class RimWellPath; class RivFishbonesSubsPartMgr; class RimWellPathCollection; -class RimView; class QDateTime; @@ -56,19 +55,24 @@ public: void scheduleGeometryRegen(); void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, - double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, - caf::DisplayCoordTransform* displayCoordTransform); + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); - void appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model); + void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); size_t segmentIndexFromTriangleIndex(size_t triangleIndex); private: - void appendFishbonesPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); - void appendCompletionsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); - void appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void appendFishbonesPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void appendCompletionsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); - void buildWellPathParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox); + void buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize, const cvf::BoundingBox& wellPathClipBoundingBox); void clearAllBranchData(); inline RimWellPathCollection* wellPathCollection(); inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index e22babff5d..2cb8ee7c55 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -639,15 +639,9 @@ void RimEclipseView::updateCurrentTimeStep() cvf::ref wellPathModelBasicList = new cvf::ModelBasicList; wellPathModelBasicList->setName(name); - RigMainGrid* mainGrid = this->mainGrid(); - if (mainGrid) - { - wellPathsPartManager()->appendDynamicGeometryPartsToModel(this, wellPathModelBasicList.p()); + addDynamicWellPathsToModel(wellPathModelBasicList.p(), currentActiveCellInfo()->geometryBoundingBox()); - wellPathModelBasicList->updateBoundingBoxesRecursive(); - - frameScene->addModel(wellPathModelBasicList.p()); - } + frameScene->addModel(wellPathModelBasicList.p()); } } } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 2fb11b48ba..c635a57ad0 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -254,14 +254,32 @@ void RimGeoMechView::updateCurrentTimeStep() cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep); if (frameScene) { - // Grid model - cvf::ref frameParts = new cvf::ModelBasicList; - frameParts->setName("GridModel"); - m_vizLogic->appendPartsToModel(m_currentTimeStep, frameParts.p()); - frameParts->updateBoundingBoxesRecursive(); + { + // Grid model + cvf::String name = "GridModel"; + this->removeModelByName(frameScene, name); - this->removeModelByName(frameScene, frameParts->name()); - frameScene->addModel(frameParts.p()); + cvf::ref frameParts = new cvf::ModelBasicList; + frameParts->setName(name); + m_vizLogic->appendPartsToModel(m_currentTimeStep, frameParts.p()); + frameParts->updateBoundingBoxesRecursive(); + + frameScene->addModel(frameParts.p()); + } + + // Well Paths + { + cvf::String name = "WellPathMod"; + this->removeModelByName(frameScene, name); + + cvf::ref wellPathModelBasicList = new cvf::ModelBasicList; + wellPathModelBasicList->setName(name); + + cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox(); + addDynamicWellPathsToModel(wellPathModelBasicList.p(), femBBox); + + frameScene->addModel(wellPathModelBasicList.p()); + } } } @@ -278,6 +296,7 @@ void RimGeoMechView::updateCurrentTimeStep() { crossSectionCollection->applySingleColorEffect(); } + } else { diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index e57a115e61..78a54a75c2 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -746,6 +746,31 @@ void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, wellPathModelBasicList->updateBoundingBoxesRecursive(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox) +{ + if (!this->ownerCase()) return; + + cvf::ref transForm = displayCoordTransform(); + + QDateTime currentTimeStamp; + std::vector timeStamps = ownerCase()->timeStepDates(); + if (currentTimeStep() < timeStamps.size()) + { + currentTimeStamp = timeStamps[currentTimeStep()]; + } + + wellPathsPartManager()->appendDynamicGeometryPartsToModel(wellPathModelBasicList, + currentTimeStamp, + this->ownerCase()->characteristicCellSize(), + wellPathClipBoundingBox, + transForm.p()); + + wellPathModelBasicList->updateBoundingBoxesRecursive(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index 103fdab189..c29103ad57 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -180,6 +180,9 @@ protected: void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox); + void addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, + const cvf::BoundingBox& wellPathClipBoundingBox); + static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName); virtual void createDisplayModel() = 0; From 690d86b87604d94b6d8205b3356dd2a763b7c1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 20 Jun 2017 09:07:57 +0200 Subject: [PATCH 18/22] #1624 Update opm-flowdiagnostics-applications to c78f50897cea10ed56c7eadd1a1b23aa5ffbc56e that handles none-unified restart files --- ResInsightVersion.cmake | 2 +- .../opm/utility/ECLResultData.cpp | 31 ++++++++++++++----- .../opm/utility/ECLResultData.hpp | 4 +++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 82a02e7903..503d8d1985 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -14,7 +14,7 @@ set(ERT_GITHUB_SHA "06a39878636af0bc52582430ad0431450e51139c") set(OPM_FLOWDIAGNOSTICS_SHA "b6e59ddcd2feba450c8612a7402c9239e442c0d4") # https://github.com/OPM/opm-flowdiagnostics-applications -set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "ccaaa4dd1b553e131a3051687fd615fe728b76ee") +set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "c78f50897cea10ed56c7eadd1a1b23aa5ffbc56e") # https://github.com/OPM/opm-parser/blob/master/opm/parser/eclipse/Units/Units.hpp # This file was moved from opm-core to opm-parser october 2016 diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.cpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.cpp index 8d2cff11bb..8520734519 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.cpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.cpp @@ -992,6 +992,10 @@ private: /// of main grid's section within a view. std::string firstKeyword_; + /// True if path (or pointer) to unified restart file was passed + /// as constructor argument. + bool isUnified_; + /// Map LGR names to integral grid IDs. std::unique_ptr gridIDCache_; @@ -1021,44 +1025,55 @@ Opm::ECLRestartData::Impl::Impl(Path prefix) : prefix_ (std::move(prefix)) , result_ (openResultSet(deriveRestartPath(prefix_))) , firstKeyword_(firstFileKeyword(result_.get())) + , isUnified_ (firstKeyword_ == "SEQNUM") {} Opm::ECLRestartData::Impl::Impl(std::shared_ptr rstrt) : prefix_ (ecl_file_get_src_file(rstrt.get())) , result_ (std::move(rstrt)) , firstKeyword_(firstFileKeyword(result_.get())) + , isUnified_ (firstKeyword_ == "SEQNUM") {} Opm::ECLRestartData::Impl::Impl(const Impl& rhs) : prefix_ (rhs.prefix_) , result_ (openResultSet(deriveRestartPath(prefix_))) , firstKeyword_(firstFileKeyword(result_.get())) + , isUnified_ (rhs.isUnified_) {} Opm::ECLRestartData::Impl::Impl(Impl&& rhs) : prefix_ (std::move(rhs.prefix_)) , result_ (std::move(rhs.result_)) , firstKeyword_(std::move(rhs.firstKeyword_)) + , isUnified_ (rhs.isUnified_) {} bool Opm::ECLRestartData::Impl::selectReportStep(const int step) { - if (! ecl_file_has_report_step(*this, step)) { + if (isUnified_ && ! ecl_file_has_report_step(*this, step)) { return false; } this->gridIDCache_.reset(); if (auto* globView = ecl_file_get_global_view(*this)) { - // Ignore sequence numbers, dates, and simulation time. - const auto seqnum = -1; - const auto dates = static_cast(-1); - const auto simdays = -1.0; + if (isUnified_) { + // Set active block view to particular report step. + // Ignore sequence numbers, dates, and simulation time. + const auto seqnum = -1; + const auto dates = static_cast(-1); + const auto simdays = -1.0; - this->activeBlock_ = - ecl_file_view_add_restart_view(globView, seqnum, - step, dates, simdays); + this->activeBlock_ = + ecl_file_view_add_restart_view(globView, seqnum, + step, dates, simdays); + } else { + // Set active block view to global. + this->activeBlock_ = globView; + } + // Update grid id cache from active view. if (this->activeBlock_ != nullptr) { this->gridIDCache_ .reset(new ECLImpl::GridIDCache(this->activeBlock_)); diff --git a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.hpp b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.hpp index c48b6a4645..aa101932e9 100644 --- a/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.hpp +++ b/ThirdParty/custom-opm-flowdiag-app/opm-flowdiagnostics-applications/opm/utility/ECLResultData.hpp @@ -109,6 +109,10 @@ namespace Opm { /// step. /// /// This is needed when working with dynamic restart data. + /// If constructed from a unified restart file, this function + /// will check that the requested step is available in the + /// file. If constructed from a non-unified restart file, no + /// such check is performed. /// /// \param[in] step Report step number. /// From 8e47d82038e0fda3bae8fbccedcd6649b72af3b7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 20 Jun 2017 14:48:30 +0200 Subject: [PATCH 19/22] Improve layout in header file --- .../ModelVisualization/RivWellPathPartMgr.h | 48 ++++++++++++------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index 120e4fdaf3..5c401255a0 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -52,30 +52,42 @@ public: explicit RivWellPathPartMgr(RimWellPath* wellPath); ~RivWellPathPartMgr(); - void scheduleGeometryRegen(); + void scheduleGeometryRegen(); - void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform); + void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); - void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, - const QDateTime& timeStamp, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform); + void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); - size_t segmentIndexFromTriangleIndex(size_t triangleIndex); + size_t segmentIndexFromTriangleIndex(size_t triangleIndex); private: - void appendFishbonesPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); - void appendCompletionsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); - void appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); + void appendFishbonesPartsToModel(cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + double characteristicCellSize); - void buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize, const cvf::BoundingBox& wellPathClipBoundingBox); - void clearAllBranchData(); - inline RimWellPathCollection* wellPathCollection(); - inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection); + void appendCompletionsToModel(cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + double characteristicCellSize); + + void appendPerforationsToModel(const QDateTime& currentViewDate, + cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + double characteristicCellSize); + + void buildWellPathParts(const caf::DisplayCoordTransform* displayCoordTransform, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox); + + void clearAllBranchData(); + inline RimWellPathCollection* wellPathCollection(); + inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection); private: caf::PdmPointer m_rimWellPath; From 9f76f851b81e116d0eb03b10805ffc51c72add90 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 21 Jun 2017 13:48:08 +0200 Subject: [PATCH 20/22] Set version number to 2017.05.2 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 503d8d1985..6305eb054d 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,7 +1,7 @@ set(RESINSIGHT_MAJOR_VERSION 2017) set(RESINSIGHT_MINOR_VERSION 05) -set(RESINSIGHT_INCREMENT_VERSION "1") +set(RESINSIGHT_INCREMENT_VERSION "2") # https://github.com/CRAVA/crava/tree/master/libs/nrlib From 3193127e32981f241dac8bb27603dbc4d3ed5b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 21 Jun 2017 15:39:59 +0200 Subject: [PATCH 21/22] #1440 Remove RivWellPathCollectionPartMgr as it did not manage any parts This is a step to make it easier to make the interface from the views to get the well path related geometry parts more "static". --- .../ModelVisualization/CMakeLists_files.cmake | 2 - .../RivWellPathCollectionPartMgr.cpp | 94 ------------------- .../RivWellPathCollectionPartMgr.h | 71 -------------- .../ProjectDataModel/RimEclipseView.cpp | 1 - ApplicationCode/ProjectDataModel/RimView.cpp | 29 ++---- ApplicationCode/ProjectDataModel/RimView.h | 8 +- .../RimWellPathCollection.cpp | 56 ++++++++++- .../ProjectDataModel/RimWellPathCollection.h | 27 ++++-- doc/well_path_part_manager.plantuml | 57 ++++++++--- 9 files changed, 122 insertions(+), 223 deletions(-) delete mode 100644 ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp delete mode 100644 ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h diff --git a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake index 03c8d21e92..6f3dffcf80 100644 --- a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake +++ b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake @@ -19,7 +19,6 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.h ${CEE_CURRENT_LIST_DIR}RivSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h -${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h ${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h ${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h @@ -59,7 +58,6 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp -${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.cpp diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp deleted file mode 100644 index 007ea0cede..0000000000 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.cpp +++ /dev/null @@ -1,94 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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 "RivWellPathCollectionPartMgr.h" - -#include "RimWellPath.h" -#include "RimWellPathCollection.h" -#include "RivWellPathPartMgr.h" -#include "RigMainGrid.h" -#include "RimView.h" - - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RivWellPathCollectionPartMgr::RivWellPathCollectionPartMgr(RimWellPathCollection* wellPathCollection) -{ - m_wellPathCollection = wellPathCollection; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RivWellPathCollectionPartMgr::~RivWellPathCollectionPartMgr() -{ - -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivWellPathCollectionPartMgr::scheduleGeometryRegen() -{ - for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) - { - m_wellPathCollection->wellPaths[wIdx]->partMgr()->scheduleGeometryRegen(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform) -{ - if (!m_wellPathCollection->isActive()) return; - if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; - - for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) - { - RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); - partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, - const QDateTime& timeStamp, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform) - -{ - if (!m_wellPathCollection->isActive()) return; - if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; - - for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) - { - RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); - partMgr->appendDynamicGeometryPartsToModel(model, timeStamp, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); - } -} - diff --git a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h deleted file mode 100644 index 7dfc6aaa11..0000000000 --- a/ApplicationCode/ModelVisualization/RivWellPathCollectionPartMgr.h +++ /dev/null @@ -1,71 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cvfBase.h" -#include "cvfCollection.h" -#include "cafPdmPointer.h" -#include "cvfVector3.h" -#include "cvfBoundingBox.h" -#include "cvfTransform.h" - -#include "cafPdmPointer.h" - -class RimWellPathCollection; -class RimProject; -class RivWellPathPartMgr; -class RimView; - -class QDateTime; - -namespace cvf -{ - class ModelBasicList; -} - -namespace caf -{ - class DisplayCoordTransform; -} - - -class RivWellPathCollectionPartMgr : public cvf::Object -{ -public: - explicit RivWellPathCollectionPartMgr(RimWellPathCollection* wellPathCollection); - ~RivWellPathCollectionPartMgr(); - - void scheduleGeometryRegen(); - - void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform); - - void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, - const QDateTime& timeStamp, - double characteristicCellSize, - const cvf::BoundingBox& wellPathClipBoundingBox, - const caf::DisplayCoordTransform* displayCoordTransform); - -private: - caf::PdmPointer m_wellPathCollection; -}; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 2cb8ee7c55..84e0ef44cd 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -65,7 +65,6 @@ #include "RivReservoirViewPartMgr.h" #include "RivSingleCellPartGenerator.h" #include "RivTernarySaturationOverlayItem.h" -#include "RivWellPathCollectionPartMgr.h" #include "cafCadNavigation.h" #include "cafCeetronPlusNavigation.h" diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index 78a54a75c2..d9865d140a 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -40,8 +40,6 @@ #include "RiuMainWindow.h" #include "RiuViewer.h" -#include "RivWellPathCollectionPartMgr.h" - #include "cafDisplayCoordTransform.h" #include "cafFrameAnimationControl.h" #include "cafPdmObjectFactory.h" @@ -54,6 +52,7 @@ #include "cvfViewport.h" #include +#include "cvfTransform.h" namespace caf { @@ -426,28 +425,13 @@ void RimView::endAnimation() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RivWellPathCollectionPartMgr* RimView::wellPathsPartManager() +RimWellPathCollection* RimView::wellPathsPartManager() { - ensureWellPathManagerIsCreated(); + RimProject* proj = nullptr; + this->firstAncestorOrThisOfTypeAsserted(proj); + CVF_ASSERT(proj && proj->activeOilField() && proj->activeOilField()->wellPathCollection()); - CVF_ASSERT(m_wellPathsPartManager.notNull()); - - return m_wellPathsPartManager.p(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimView::ensureWellPathManagerIsCreated() -{ - if (m_wellPathsPartManager.isNull()) - { - RimProject* proj = nullptr; - this->firstAncestorOrThisOfTypeAsserted(proj); - CVF_ASSERT(proj && proj->activeOilField() && proj->activeOilField()->wellPathCollection()); - - m_wellPathsPartManager = new RivWellPathCollectionPartMgr(proj->activeOilField()->wellPathCollection()); - } + return proj->activeOilField()->wellPathCollection(); } //-------------------------------------------------------------------------------------------------- @@ -627,7 +611,6 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV // Regenerate well paths RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL; RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL; - if (wellPathCollection) wellPathCollection->wellPathCollectionPartMgr()->scheduleGeometryRegen(); wellPathsPartManager()->scheduleGeometryRegen(); diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index c29103ad57..045547dab5 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -50,7 +50,7 @@ class RimPropertyFilterCollection; class RimViewController; class RimViewLinker; class RiuViewer; -class RivWellPathCollectionPartMgr; +class RimWellPathCollection; namespace cvf { @@ -204,7 +204,7 @@ protected: virtual void resetLegendsInViewer() = 0; virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility) = 0; - RivWellPathCollectionPartMgr* wellPathsPartManager(); + RimWellPathCollection* wellPathsPartManager(); QPointer m_viewer; @@ -240,13 +240,9 @@ private: void setCurrentTimeStepAndUpdate(int frameIdx); void endAnimation(); - void ensureWellPathManagerIsCreated(); - private: bool m_previousGridModeMeshLinesWasFaults; caf::PdmField m_disableLighting; - - cvf::ref m_wellPathsPartManager; }; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp index 1e0b23881b..1bad2a8f52 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp @@ -37,8 +37,6 @@ #include "RiuMainWindow.h" -#include "RivWellPathCollectionPartMgr.h" - #include "RifWellPathImporter.h" #include "cafPdmUiEditorHandle.h" @@ -50,6 +48,7 @@ #include #include +#include "RivWellPathPartMgr.h" namespace caf { @@ -93,8 +92,6 @@ RimWellPathCollection::RimWellPathCollection() CAF_PDM_InitFieldNoDefault(&wellPaths, "WellPaths", "Well Paths", "", "", ""); wellPaths.uiCapability()->setUiHidden(true); - m_wellPathCollectionPartManager = new RivWellPathCollectionPartMgr(this); - m_wellPathImporter = new RifWellPathImporter; } @@ -328,12 +325,61 @@ caf::PdmFieldHandle* RimWellPathCollection::objectToggleField() //-------------------------------------------------------------------------------------------------- void RimWellPathCollection::scheduleGeometryRegenAndRedrawViews() { - m_wellPathCollectionPartManager->scheduleGeometryRegen(); + this->scheduleGeometryRegen(); RimProject* proj; this->firstAncestorOrThisOfType(proj); if (proj) proj->createDisplayModelAndRedrawAllViews(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathCollection::scheduleGeometryRegen() +{ + for (size_t wIdx = 0; wIdx < this->wellPaths.size(); wIdx++) + { + this->wellPaths[wIdx]->partMgr()->scheduleGeometryRegen(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathCollection::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform) +{ + if (!this->isActive()) return; + if (this->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; + + for (size_t wIdx = 0; wIdx < this->wellPaths.size(); wIdx++) + { + RivWellPathPartMgr* partMgr = this->wellPaths[wIdx]->partMgr(); + partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathCollection::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform) + +{ + if (!this->isActive()) return; + if (this->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; + + for (size_t wIdx = 0; wIdx < this->wellPaths.size(); wIdx++) + { + RivWellPathPartMgr* partMgr = this->wellPaths[wIdx]->partMgr(); + partMgr->appendDynamicGeometryPartsToModel(model, timeStamp, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h index 7f309c7442..68a013a924 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h @@ -35,12 +35,19 @@ #include -class RivWellPathCollectionPartMgr; class RifWellPathImporter; class RimWellPath; class RimProject; class RigWellPath; +namespace cvf { +class ModelBasicList; +class BoundingBox; +} + +namespace caf { +class DisplayCoordTransform; +} //================================================================================================== /// @@ -76,10 +83,7 @@ public: caf::PdmField wellPathClipZDistance; caf::PdmChildArrayField wellPaths; - - RivWellPathCollectionPartMgr* wellPathCollectionPartMgr() { return m_wellPathCollectionPartManager.p(); } - void readWellPathFiles(); void addWellPaths(QStringList filePaths); @@ -89,8 +93,19 @@ public: RimWellPath* wellPathByName(const QString& wellPathName) const; void addWellLogs(const QStringList& filePaths); - void scheduleGeometryRegenAndRedrawViews(); + void scheduleGeometryRegen(); + + void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); + + void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + const QDateTime& timeStamp, + double characteristicCellSize, + const cvf::BoundingBox& wellPathClipBoundingBox, + const caf::DisplayCoordTransform* displayCoordTransform); void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath); protected: virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ); @@ -104,7 +119,5 @@ private: RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath(const RimWellPath* wellPath); - cvf::ref m_wellPathCollectionPartManager; - RifWellPathImporter* m_wellPathImporter; }; diff --git a/doc/well_path_part_manager.plantuml b/doc/well_path_part_manager.plantuml index 7c5e7509b3..983cd2d6c7 100644 --- a/doc/well_path_part_manager.plantuml +++ b/doc/well_path_part_manager.plantuml @@ -1,23 +1,52 @@ @startuml +/' +package Viz{ +class RivWellPathPartMgr +class RivFishbonesSubsPartMgr +class RivWellFracturePartMgr +} +'/ - - -RimView --> RivWellPathCollectionPartMgr - -RivWellPathCollectionPartMgr -* "N" RivWellPathPartMgr - -class RivWellPathPartMgr { -RimWellPath* m_wellPath +package Pdm{ +class RimView +class RimOilField +class RimEclipseCaseCollection +class RimCase +class RimWellPath +class RimWellPathCollection +class RimFishbonesMultipleSubs +class RimWellPathCompletions +class RimFishboneWellPathCollection +class RimPerforationCollection +class RimWellPathFractureCollection +class RimFishbonesCollection +class RimFracture } -class RimWellPath { -RimWellPathFractureCollection m_fractureCollection; -} +RivWellPathPartMgr ..> RimWellPath +RimWellPath *--> RivWellPathPartMgr -class RimWellPathFractureCollection { -caf::PdmChildArrayField fractures; -} +RivWellPathPartMgr *--> "n" RivFishbonesSubsPartMgr +RivFishbonesSubsPartMgr ..> RimFishbonesMultipleSubs +RivWellFracturePartMgr ...> RimFracture + +RimOilField *--> RimWellPathCollection +RimOilField *--> RimEclipseCaseCollection +RimEclipseCaseCollection *--> "n" RimCase + +RimCase *--> "n" RimView +RimWellPathCollection *--> "n" RimWellPath +RimWellPath *--> RimWellPathCompletions +RimFishbonesCollection *--> RimFishbonesMultipleSubs +RimFishbonesCollection *--> RimFishboneWellPathCollection +RimWellPathCompletions *--> RimFishbonesCollection +RimWellPathCompletions *--> RimPerforationCollection +RimWellPathCompletions *--> RimWellPathFractureCollection + +RimWellPathFractureCollection *--> "n" RimFracture + +RimFracture *--> RivWellFracturePartMgr @enduml From b2a1f5690b31cd878b10cfc54450a0d42d54e044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 21 Jun 2017 17:13:19 +0200 Subject: [PATCH 22/22] #1440 Remove all real caching in the well path geometry system Had no effect anyway. Rename method to scheduleRedrawAffectedViews() --- .../RicNewFishbonesSubsFeature.cpp | 3 +- ...forationIntervalAtMeasuredDepthFeature.cpp | 2 +- .../RicNewPerforationIntervalFeature.cpp | 2 +- .../Commands/RicDeleteItemExec.cpp | 2 +- .../Commands/RicDeleteSubItemsFeature.cpp | 2 +- .../RicWellPathDeleteFeature.cpp | 2 +- .../ModelVisualization/RivWellPathPartMgr.cpp | 39 +++---------------- .../ModelVisualization/RivWellPathPartMgr.h | 5 --- ApplicationCode/ProjectDataModel/RimView.cpp | 2 - .../ProjectDataModel/RimWellPath.cpp | 2 - .../RimWellPathCollection.cpp | 16 +------- .../ProjectDataModel/RimWellPathCollection.h | 3 +- 12 files changed, 15 insertions(+), 65 deletions(-) diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp index 8caec03595..18b7fb5078 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp @@ -171,8 +171,7 @@ void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(RimFishbonesCollectio if (autoAdjustSettings) { activeView->setScaleZAndUpdate(1.0); - - wellPathColl->scheduleGeometryRegenAndRedrawViews(); + activeView->scheduleCreateDisplayModelAndRedraw(); RiuMainWindow::instance()->updateScaleValue(); } diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp index ad5f91a9c2..95a85c979f 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp @@ -60,7 +60,7 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isC wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection); wellPathCollection->uiCapability()->updateConnectedEditors(); - wellPathCollection->scheduleGeometryRegenAndRedrawViews(); + wellPathCollection->scheduleRedrawAffectedViews(); RiuMainWindow::instance()->selectAsCurrentItem(perforationInterval); } diff --git a/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.cpp index 5be1e9c01b..cc55aaea97 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.cpp @@ -64,7 +64,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered(bool isChecked) if (!wellPathCollection) return; wellPathCollection->uiCapability()->updateConnectedEditors(); - wellPathCollection->scheduleGeometryRegenAndRedrawViews(); + wellPathCollection->scheduleRedrawAffectedViews(); RiuMainWindow::instance()->selectAsCurrentItem(perforationInterval); } diff --git a/ApplicationCode/Commands/RicDeleteItemExec.cpp b/ApplicationCode/Commands/RicDeleteItemExec.cpp index c6a31d6a50..8a4204b4f3 100644 --- a/ApplicationCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationCode/Commands/RicDeleteItemExec.cpp @@ -125,7 +125,7 @@ void RicDeleteItemExec::redo() if (wellPathColl) { - wellPathColl->scheduleGeometryRegenAndRedrawViews(); + wellPathColl->scheduleRedrawAffectedViews(); wellPathColl->uiCapability()->updateConnectedEditors(); } diff --git a/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp b/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp index e7d81966a6..8c0d668543 100644 --- a/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp +++ b/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp @@ -77,7 +77,7 @@ void RicDeleteSubItemsFeature::onActionTriggered(bool isChecked) wellPathColl->deleteAllWellPaths(); wellPathColl->updateConnectedEditors(); - wellPathColl->scheduleGeometryRegenAndRedrawViews(); + wellPathColl->scheduleRedrawAffectedViews(); } } } diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathDeleteFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathDeleteFeature.cpp index d419766521..c44d12bf29 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathDeleteFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathDeleteFeature.cpp @@ -67,7 +67,7 @@ void RicWellPathDeleteFeature::onActionTriggered(bool isChecked) } wellPathCollection->uiCapability()->updateConnectedEditors(); - wellPathCollection->scheduleGeometryRegenAndRedrawViews(); + wellPathCollection->scheduleRedrawAffectedViews(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 71ba04cc43..5ddbf86777 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -62,8 +62,6 @@ RivWellPathPartMgr::RivWellPathPartMgr(RimWellPath* wellPath) { m_rimWellPath = wellPath; - m_needsTransformUpdate = true; - // Setup a scalar mapper cvf::ref scalarMapper = new cvf::ScalarMapperDiscreteLinear; cvf::Color3ubArray legendColors; @@ -98,23 +96,12 @@ RivWellPathPartMgr::~RivWellPathPartMgr() //-------------------------------------------------------------------------------------------------- void RivWellPathPartMgr::appendFishbonesPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize) { - if (!m_rimWellPath || !m_rimWellPath->fishbonesCollection()->isChecked()) return; + if ( !m_rimWellPath || !m_rimWellPath->fishbonesCollection()->isChecked() ) return; - // This concept is taken from RivReservoirSimWellsPartMgr, and is required to be able to have - // separate part managers for each view - if (m_fishbonesPartMgrs.size() != m_rimWellPath->fishbonesCollection()->fishbonesSubs.size()) + for ( auto rimFishboneSubs : m_rimWellPath->fishbonesCollection()->fishbonesSubs() ) { - m_fishbonesPartMgrs.clear(); - - for (auto rimFishboneSubs : m_rimWellPath->fishbonesCollection()->fishbonesSubs()) - { - m_fishbonesPartMgrs.push_back(new RivFishbonesSubsPartMgr(rimFishboneSubs)); - } - } - - for (auto rivFishbonesPartManager : m_fishbonesPartMgrs) - { - rivFishbonesPartManager->appendGeometryPartsToModel(model, displayCoordTransform, characteristicCellSize); + cvf::ref fishbSubPartMgr = new RivFishbonesSubsPartMgr(rimFishboneSubs); + fishbSubPartMgr->appendGeometryPartsToModel(model, displayCoordTransform, characteristicCellSize); } } @@ -342,7 +329,6 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di m_wellLabelPart = part; } - m_needsTransformUpdate = false; } @@ -365,11 +351,8 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false ) return; - if (m_needsTransformUpdate) - { - // The pipe geometry needs to be rebuilt on scale change to keep the pipes round - buildWellPathParts(displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox); - } + // The pipe geometry needs to be rebuilt on scale change to keep the pipes round + buildWellPathParts(displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox); if (m_pipeBranchData.m_surfacePart.notNull()) { @@ -415,16 +398,6 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* appendPerforationsToModel(timeStamp, model, displayCoordTransform, characteristicCellSize); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RivWellPathPartMgr::scheduleGeometryRegen() -{ - m_needsTransformUpdate = true; - - m_fishbonesPartMgrs.clear(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index 5c401255a0..5af7e431cc 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -52,8 +52,6 @@ public: explicit RivWellPathPartMgr(RimWellPath* wellPath); ~RivWellPathPartMgr(); - void scheduleGeometryRegen(); - void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize, const cvf::BoundingBox& wellPathClipBoundingBox, @@ -92,8 +90,6 @@ private: private: caf::PdmPointer m_rimWellPath; - bool m_needsTransformUpdate; - struct RivPipeBranchData { cvf::ref m_pipeGeomGenerator; @@ -110,5 +106,4 @@ private: cvf::ref m_scalarMapperSurfaceEffect; cvf::ref m_scalarMapperMeshEffect; - cvf::Collection m_fishbonesPartMgrs; }; diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index d9865d140a..dcc035e3ed 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -612,8 +612,6 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL; RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL; - wellPathsPartManager()->scheduleGeometryRegen(); - crossSectionCollection->updateIntersectionBoxGeometry(); if (m_viewer) diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index bb41f7cd1a..58b979f099 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -248,8 +248,6 @@ RivWellPathPartMgr* RimWellPath::partMgr() //-------------------------------------------------------------------------------------------------- void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - partMgr()->scheduleGeometryRegen(); - RimProject* proj; this->firstAncestorOrThisOfTypeAsserted(proj); if (changedField == &showWellPath) diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp index 1bad2a8f52..81dd755533 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp @@ -111,7 +111,7 @@ RimWellPathCollection::~RimWellPathCollection() //-------------------------------------------------------------------------------------------------- void RimWellPathCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - scheduleGeometryRegenAndRedrawViews(); + scheduleRedrawAffectedViews(); } @@ -323,25 +323,13 @@ caf::PdmFieldHandle* RimWellPathCollection::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathCollection::scheduleGeometryRegenAndRedrawViews() +void RimWellPathCollection::scheduleRedrawAffectedViews() { - this->scheduleGeometryRegen(); RimProject* proj; this->firstAncestorOrThisOfType(proj); if (proj) proj->createDisplayModelAndRedrawAllViews(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimWellPathCollection::scheduleGeometryRegen() -{ - for (size_t wIdx = 0; wIdx < this->wellPaths.size(); wIdx++) - { - this->wellPaths[wIdx]->partMgr()->scheduleGeometryRegen(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h index 68a013a924..feb625ed9f 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h @@ -93,8 +93,7 @@ public: RimWellPath* wellPathByName(const QString& wellPathName) const; void addWellLogs(const QStringList& filePaths); - void scheduleGeometryRegenAndRedrawViews(); - void scheduleGeometryRegen(); + void scheduleRedrawAffectedViews(); void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize,