From a0e4f71138a1c6e761439e4bd5a9d296146864ad Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 25 Apr 2018 08:14:48 +0200 Subject: [PATCH] #2715 Add direct access to RigFemPartCollection from a GeoMechView --- .../RivGeoMechVizLogic.cpp | 4 +-- .../RivIntersectionBoxPartMgr.cpp | 2 +- .../Intersections/RivIntersectionPartMgr.cpp | 2 +- .../RivTensorResultPartMgr.cpp | 2 +- .../ProjectDataModel/RimGeoMechView.cpp | 30 +++++++++++++++++-- .../ProjectDataModel/RimGeoMechView.h | 8 +++-- .../ProjectDataModel/RimViewController.cpp | 16 +++++----- .../SocketInterface/RiaCaseInfoCommands.cpp | 2 +- .../UserInterface/RiuMohrsCirclePlot.cpp | 2 +- .../UserInterface/RiuViewerCommands.cpp | 2 +- 10 files changed, 50 insertions(+), 20 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechVizLogic.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechVizLogic.cpp index 6e84adbc19..33c489f26c 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechVizLogic.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivGeoMechVizLogic.cpp @@ -261,11 +261,11 @@ void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility(cvf::UByteArray* to { if (!m_geomechView->geoMechCase()) return; - size_t gridCount = m_geomechView->geoMechCase()->geoMechData()->femParts()->partCount(); + size_t gridCount = m_geomechView->femParts()->partCount(); if (gridCount == 0) return; - RigFemPart* part = m_geomechView->geoMechCase()->geoMechData()->femParts()->part(0); + RigFemPart* part = m_geomechView->femParts()->part(0); int elmCount = part->elementCount(); totalVisibility->resize(elmCount); diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp index 7506558e71..000d5decf3 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp @@ -371,7 +371,7 @@ cvf::ref RivIntersectionBoxPartMgr::createHexGr m_rimIntersectionBox->firstAncestorOrThisOfType(geoView); if (geoView) { - RigFemPart* femPart = geoView->geoMechCase()->geoMechData()->femParts()->part(0); + RigFemPart* femPart = geoView->femParts()->part(0); return new RivFemIntersectionGrid(femPart); } diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp index 4464ec8e0d..b4501571c6 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp @@ -1021,7 +1021,7 @@ cvf::ref RivIntersectionPartMgr::createHexGridI m_rimCrossSection->firstAncestorOrThisOfType(geoView); if (geoView) { - RigFemPart* femPart = geoView->geoMechCase()->geoMechData()->femParts()->part(0); + RigFemPart* femPart = geoView->femParts()->part(0); return new RivFemIntersectionGrid(femPart); } diff --git a/ApplicationCode/ModelVisualization/RivTensorResultPartMgr.cpp b/ApplicationCode/ModelVisualization/RivTensorResultPartMgr.cpp index 18a4ced74e..3c70fa5515 100644 --- a/ApplicationCode/ModelVisualization/RivTensorResultPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivTensorResultPartMgr.cpp @@ -78,7 +78,7 @@ void RivTensorResultPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLi if (!m_rimReservoirView->tensorResults()->showTensors()) return; - RigFemPartCollection* femParts = m_rimReservoirView->geoMechCase()->geoMechData()->femParts(); + RigFemPartCollection* femParts = m_rimReservoirView->femParts(); if (!femParts) return; std::vector tensorVisualizations; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index e6517d6b0b..5d49cacebc 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -220,7 +220,7 @@ void RimGeoMechView::createDisplayModel() // Well path model - cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox(); + cvf::BoundingBox femBBox = femParts()->boundingBox(); m_wellPathPipeVizModel->removeAllParts(); addWellPathsToModel(m_wellPathPipeVizModel.p(), femBBox); @@ -285,7 +285,7 @@ void RimGeoMechView::updateCurrentTimeStep() cvf::ref wellPathModelBasicList = new cvf::ModelBasicList; wellPathModelBasicList->setName(name); - cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox(); + cvf::BoundingBox femBBox = femParts()->boundingBox(); addDynamicWellPathsToModel(wellPathModelBasicList.p(), femBBox); frameScene->addModel(wellPathModelBasicList.p()); @@ -530,6 +530,32 @@ std::vector RimGeoMechView::legendConfigs() const } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigFemPartCollection* RimGeoMechView::femParts() const +{ + if (m_geomechCase && m_geomechCase->geoMechData()) + { + return m_geomechCase->geoMechData()->femParts(); + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFemPartCollection* RimGeoMechView::femParts() +{ + if (m_geomechCase && m_geomechCase->geoMechData()) + { + return m_geomechCase->geoMechData()->femParts(); + } + + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.h b/ApplicationCode/ProjectDataModel/RimGeoMechView.h index 18954b1a41..2463ffdf51 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.h @@ -32,17 +32,18 @@ #include "cvfObject.h" class RigFemPart; +class RigFemPartCollection; class Rim3dOverlayInfoConfig; class RimCellRangeFilterCollection; class RimGeoMechCase; class RimGeoMechCellColors; -class RimGeoMechResultDefinition; class RimGeoMechPropertyFilterCollection; +class RimGeoMechResultDefinition; +class RimRegularLegendConfig; class RimTensorResults; class RiuViewer; class RivGeoMechPartMgr; class RivGeoMechVizLogic; -class RimRegularLegendConfig; class RivTensorResultPartMgr; namespace cvf { @@ -95,6 +96,9 @@ public: std::vector legendConfigs() const override; + const RigFemPartCollection* femParts() const; + RigFemPartCollection* femParts(); + protected: virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; virtual void onLoadDataAndUpdate() override; diff --git a/ApplicationCode/ProjectDataModel/RimViewController.cpp b/ApplicationCode/ProjectDataModel/RimViewController.cpp index 2cc1cbcbd6..9aed000ab7 100644 --- a/ApplicationCode/ProjectDataModel/RimViewController.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewController.cpp @@ -590,15 +590,15 @@ const RigCaseToCaseCellMapper* RimViewController::cellMapper() } if (masterGeomechView && masterGeomechView->geoMechCase()->geoMechData() - && masterGeomechView->geoMechCase()->geoMechData()->femParts()->partCount()) + && masterGeomechView->femParts()->partCount()) { - masterFemPart = masterGeomechView->geoMechCase()->geoMechData()->femParts()->part(0); + masterFemPart = masterGeomechView->femParts()->part(0); } if (dependGeomechView && dependGeomechView->geoMechCase()->geoMechData() - && dependGeomechView->geoMechCase()->geoMechData()->femParts()->partCount()) + && dependGeomechView->femParts()->partCount()) { - dependFemPart = dependGeomechView->geoMechCase()->geoMechData()->femParts()->part(0); + dependFemPart = dependGeomechView->femParts()->part(0); } // If we have the correct mapping already, return it. @@ -839,7 +839,7 @@ bool RimViewController::isRangeFilterControlPossible() const if (eclipseView->eclipseCase()->reservoirData() && geomView->geoMechCase()->geoMechData()) { RigMainGrid* eclGrid = eclipseView->eclipseCase()->reservoirData()->mainGrid(); - RigFemPart* femPart = geomView->geoMechCase()->geoMechData()->femParts()->part(0); + RigFemPart* femPart = geomView->femParts()->part(0); if (eclGrid && femPart) { @@ -871,7 +871,7 @@ bool RimViewController::isRangeFilterMappingApliccable() const if (eclipseView->eclipseCase()->eclipseCaseData() && geomView->geoMechCase() && geomView->geoMechCase()->geoMechData()) { RigMainGrid* eclGrid = eclipseView->mainGrid(); - RigFemPart* femPart = geomView->geoMechCase()->geoMechData()->femParts()->part(0); + RigFemPart* femPart = geomView->femParts()->part(0); if (eclGrid && femPart) { @@ -988,7 +988,7 @@ void RimViewController::updateRangeFilterOverrides(RimCellRangeFilter* changedRa if (eclipseMasterView->mainGrid()) { RigMainGrid* srcEclGrid = eclipseMasterView->mainGrid(); - RigFemPart* dstFemPart = depGeomView->geoMechCase()->geoMechData()->femParts()->part(0); + RigFemPart* dstFemPart = depGeomView->femParts()->part(0); for (size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx) { RimCellRangeFilter* srcRFilter = sourceFilterCollection->rangeFilters[rfIdx]; @@ -1002,7 +1002,7 @@ void RimViewController::updateRangeFilterOverrides(RimCellRangeFilter* changedRa { if (depEclView->mainGrid()) { - RigFemPart* srcFemPart = geoMasterView->geoMechCase()->geoMechData()->femParts()->part(0); + RigFemPart* srcFemPart = geoMasterView->femParts()->part(0); RigMainGrid* dstEclGrid = depEclView->mainGrid(); for (size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx) { diff --git a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp index f72589d343..851cc99adf 100644 --- a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp @@ -616,7 +616,7 @@ public: { const RiuGeoMechSelectionItem* geomechItem = static_cast(item); - geomechItem->m_view->geoMechCase()->geoMechData()->femParts()->part(geomechItem->m_gridIndex)->structGrid()->ijkFromCellIndex(geomechItem->m_cellIndex, &i, &j, &k); + geomechItem->m_view->femParts()->part(geomechItem->m_gridIndex)->structGrid()->ijkFromCellIndex(geomechItem->m_cellIndex, &i, &j, &k); gridIndex = geomechItem->m_gridIndex; caseId = geomechItem->m_view->geoMechCase()->caseId; } diff --git a/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp b/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp index bd501eb10a..d2908d7ef7 100644 --- a/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp +++ b/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp @@ -346,7 +346,7 @@ void RiuMohrsCirclePlot::queryData(RimGeoMechView* geoMechView, size_t gridIndex CVF_ASSERT(geoMechView); m_sourceGeoMechViewOfLastPlot = geoMechView; - RigFemPart* femPart = geoMechView->geoMechCase()->geoMechData()->femParts()->part(gridIndex); + RigFemPart* femPart = geoMechView->femParts()->part(gridIndex); if (femPart->elementType(elmIndex) != HEX8P) return; int frameIdx = geoMechView->currentTimeStep(); diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 3d93e42fa1..dd1cbf91a9 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -1045,7 +1045,7 @@ void RiuViewerCommands::ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size if (geomView && geomView->geoMechCase()) { - geomView->geoMechCase()->geoMechData()->femParts()->part(gridIdx)->structGrid()->ijkFromCellIndex(cellIndex, i, j, k); + geomView->femParts()->part(gridIdx)->structGrid()->ijkFromCellIndex(cellIndex, i, j, k); } }