diff --git a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp index b3eb047bd2..39901db10c 100644 --- a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp @@ -232,7 +232,7 @@ void RivFaultPartMgr::generatePartGeometry() part->setDrawable(geo.p()); // Set mapping from triangle face index to cell index - cvf::ref si = new RivSourceInfo(m_grid->gridIndex()); + cvf::ref si = new RivSourceInfo(const_cast(m_rimFault), m_grid->gridIndex()); si->m_cellFaceFromTriangleMapper = m_nativeFaultGenerator->triangleToCellFaceMapper(); part->setSourceInfo(si.p()); @@ -284,7 +284,7 @@ void RivFaultPartMgr::generatePartGeometry() part->setDrawable(geo.p()); // Set mapping from triangle face index to cell index - cvf::ref si = new RivSourceInfo(m_grid->gridIndex()); + cvf::ref si = new RivSourceInfo(const_cast(m_rimFault), m_grid->gridIndex()); si->m_cellFaceFromTriangleMapper = m_oppositeFaultGenerator->triangleToCellFaceMapper(); part->setSourceInfo(si.p()); @@ -334,7 +334,7 @@ void RivFaultPartMgr::generatePartGeometry() part->setDrawable(geo.p()); // Set mapping from triangle face index to cell index - cvf::ref si = new RivSourceInfo(m_grid->gridIndex());; + cvf::ref si = new RivSourceInfo(const_cast(m_rimFault), m_grid->gridIndex()); si->m_NNCIndices = m_NNCGenerator->triangleToNNCIndex().p(); part->setSourceInfo(si.p()); diff --git a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp index 27b47eff65..11b4f7e932 100644 --- a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp @@ -69,13 +69,14 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RivGridPartMgr::RivGridPartMgr(const RigGridBase* grid, size_t gridIdx) +RivGridPartMgr::RivGridPartMgr(RimEclipseCase* eclipseCase, const RigGridBase* grid, size_t gridIdx) : m_surfaceGenerator(grid) , m_gridIdx(gridIdx) , m_grid(grid) , m_surfaceFaceFilter(grid) , m_opacityLevel(1.0f) , m_defaultColor(cvf::Color3::WHITE) + , m_eclipseCase(eclipseCase) { CVF_ASSERT(grid); m_cellVisibility = new cvf::UByteArray; @@ -131,7 +132,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB part->setTransform(m_scaleTransform.p()); // Set mapping from triangle face index to cell index - cvf::ref si = new RivSourceInfo(m_gridIdx); + cvf::ref si = new RivSourceInfo(m_eclipseCase, m_gridIdx); si->m_cellFaceFromTriangleMapper = geoBuilder.triangleToCellFaceMapper(); part->setSourceInfo(si.p()); diff --git a/ApplicationCode/ModelVisualization/RivGridPartMgr.h b/ApplicationCode/ModelVisualization/RivGridPartMgr.h index 13a5a40fbd..aa71743d6e 100644 --- a/ApplicationCode/ModelVisualization/RivGridPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivGridPartMgr.h @@ -22,6 +22,8 @@ #include "RigGridBase.h" +#include "cafPdmPointer.h" + #include "cvfBase.h" #include "cvfObject.h" @@ -38,6 +40,7 @@ namespace cvf class RimEclipseCellColors; class RimCellEdgeColors; +class RimEclipseCase; @@ -52,7 +55,7 @@ class RimCellEdgeColors; class RivGridPartMgr: public cvf::Object { public: - RivGridPartMgr(const RigGridBase* grid, size_t gridIdx); + RivGridPartMgr(RimEclipseCase* eclipseCase, const RigGridBase* grid, size_t gridIdx); ~RivGridPartMgr(); void setTransform(cvf::Transform* scaleTransform); void setCellVisibility(cvf::UByteArray* cellVisibilities ); @@ -87,4 +90,6 @@ private: cvf::ref m_surfaceGridLines; cvf::ref m_cellVisibility; + + caf::PdmPointer m_eclipseCase; }; diff --git a/ApplicationCode/ModelVisualization/RivObjectSourceInfo.cpp b/ApplicationCode/ModelVisualization/RivObjectSourceInfo.cpp index d42b13fcd3..964eb13601 100644 --- a/ApplicationCode/ModelVisualization/RivObjectSourceInfo.cpp +++ b/ApplicationCode/ModelVisualization/RivObjectSourceInfo.cpp @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 - Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -21,16 +21,15 @@ #include "cafPdmObject.h" //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RivObjectSourceInfo::RivObjectSourceInfo(caf::PdmObject* object) : m_object(object) { - } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- caf::PdmObject* RivObjectSourceInfo::object() const { diff --git a/ApplicationCode/ModelVisualization/RivObjectSourceInfo.h b/ApplicationCode/ModelVisualization/RivObjectSourceInfo.h index 837a417e24..b3133fd796 100644 --- a/ApplicationCode/ModelVisualization/RivObjectSourceInfo.h +++ b/ApplicationCode/ModelVisualization/RivObjectSourceInfo.h @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 - Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -23,21 +23,22 @@ #include "cvfBase.h" #include "cvfObject.h" -namespace caf { - class PdmObject; +namespace caf +{ +class PdmObject; } //================================================================================================== -/// -/// +/// +/// //================================================================================================== class RivObjectSourceInfo : public cvf::Object { public: RivObjectSourceInfo(caf::PdmObject* object); - + caf::PdmObject* object() const; -private: +private: caf::PdmPointer m_object; }; diff --git a/ApplicationCode/ModelVisualization/RivReservoirPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirPartMgr.cpp index 4cfe9b7d80..0f235c009c 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirPartMgr.cpp @@ -22,6 +22,8 @@ #include "RigEclipseCaseData.h" +#include "RimEclipseCase.h" + #include "RivGridPartMgr.h" #include "RivReservoirFaultsPartMgr.h" @@ -30,17 +32,20 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivReservoirPartMgr::clearAndSetReservoir(const RigEclipseCaseData* eclipseCase, RimEclipseView* reservoirView) +void RivReservoirPartMgr::clearAndSetReservoir(RimEclipseCase* eclipseCase, RimEclipseView* reservoirView) { m_allGrids.clear(); - if (eclipseCase) + + if (eclipseCase && eclipseCase->eclipseCaseData()) { + RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); + std::vector grids; - eclipseCase->allGrids(&grids); + eclipseCaseData->allGrids(&grids); for (size_t i = 0; i < grids.size() ; ++i) { - m_allGrids.push_back(new RivGridPartMgr(grids[i], i)); + m_allGrids.push_back(new RivGridPartMgr(eclipseCase, grids[i], i)); } if (eclipseCase->mainGrid()) diff --git a/ApplicationCode/ModelVisualization/RivReservoirPartMgr.h b/ApplicationCode/ModelVisualization/RivReservoirPartMgr.h index a99b5e150b..433dfb6dee 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivReservoirPartMgr.h @@ -32,6 +32,7 @@ namespace cvf class RimEclipseCellColors; class RimCellEdgeColors; +class RimEclipseCase; class RigEclipseCaseData; class RimEclipseView; class RivReservoirFaultsPartMgr; @@ -47,7 +48,7 @@ class RivGridPartMgr; class RivReservoirPartMgr: public cvf::Object { public: - void clearAndSetReservoir(const RigEclipseCaseData* eclipseCase, RimEclipseView* reservoirView); + void clearAndSetReservoir(RimEclipseCase* eclipseCase, RimEclipseView* reservoirView); void setTransform(cvf::Transform* scaleTransform); void setCellVisibility(size_t gridIndex, cvf::UByteArray* cellVisibilities ); diff --git a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp index 969b34fcf4..83de6f4d70 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp @@ -151,6 +151,13 @@ void RivReservoirViewPartMgr::scheduleGeometryRegen(RivCellSetEnum geometryType) void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType) { RigEclipseCaseData* eclipseCase = nullptr; + RimEclipseCase* rimEclipseCase = nullptr; + + if (m_reservoirView) + { + m_reservoirView->firstAncestorOrThisOfType(rimEclipseCase); + } + if (m_reservoirView != nullptr && m_reservoirView->eclipseCase()) { eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData(); @@ -163,7 +170,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType) m_propFilteredGeometryFramesNeedsRegen[i] = true; if (m_propFilteredGeometryFrames[i].notNull()) { - m_propFilteredGeometryFrames[i]->clearAndSetReservoir(eclipseCase, m_reservoirView); + m_propFilteredGeometryFrames[i]->clearAndSetReservoir(rimEclipseCase, m_reservoirView); m_propFilteredGeometryFrames[i]->setTransform(m_scaleTransform.p()); } } @@ -175,7 +182,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType) m_propFilteredWellGeometryFramesNeedsRegen[i] = true; if (m_propFilteredWellGeometryFrames[i].notNull()) { - m_propFilteredWellGeometryFrames[i]->clearAndSetReservoir(eclipseCase, m_reservoirView); + m_propFilteredWellGeometryFrames[i]->clearAndSetReservoir(rimEclipseCase, m_reservoirView); m_propFilteredWellGeometryFrames[i]->setTransform(m_scaleTransform.p()); } } @@ -183,7 +190,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType) else { m_geometriesNeedsRegen[geomType] = true; - m_geometries[geomType].clearAndSetReservoir(eclipseCase, m_reservoirView); + m_geometries[geomType].clearAndSetReservoir(rimEclipseCase, m_reservoirView); m_geometries[geomType].setTransform(m_scaleTransform.p()); } } @@ -275,7 +282,8 @@ void RivReservoirViewPartMgr::ensureDynamicGeometryPartsCreated(RivCellSetEnum g void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType) { RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData(); - m_geometries[geometryType].clearAndSetReservoir(res, m_reservoirView); + + m_geometries[geometryType].clearAndSetReservoir(m_reservoirView->eclipseCase(), m_reservoirView); m_geometries[geometryType].setTransform(m_scaleTransform.p()); std::vector grids; @@ -434,7 +442,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t if ( m_propFilteredGeometryFrames[frameIndex].isNull()) m_propFilteredGeometryFrames[frameIndex] = new RivReservoirPartMgr; - m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(res, m_reservoirView); + m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(m_reservoirView->eclipseCase(), m_reservoirView); m_propFilteredGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p()); std::vector grids; @@ -510,7 +518,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd if ( m_propFilteredWellGeometryFrames[frameIndex].isNull()) m_propFilteredWellGeometryFrames[frameIndex] = new RivReservoirPartMgr; - m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(res, m_reservoirView); + m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(m_reservoirView->eclipseCase(), m_reservoirView); m_propFilteredWellGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p()); std::vector grids; diff --git a/ApplicationCode/ModelVisualization/RivSourceInfo.cpp b/ApplicationCode/ModelVisualization/RivSourceInfo.cpp index 4025bd1f9a..6c5d117fbc 100644 --- a/ApplicationCode/ModelVisualization/RivSourceInfo.cpp +++ b/ApplicationCode/ModelVisualization/RivSourceInfo.cpp @@ -2,27 +2,44 @@ // // Copyright (C) Statoil ASA // Copyright (C) Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RivSourceInfo.h" + #include "cvfStructGridGeometryGenerator.h" +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RivSourceInfo::RivSourceInfo(caf::PdmObject* pdmObject, size_t gridIndex) + : RivObjectSourceInfo(pdmObject) + , m_gridIndex(gridIndex) +{ +} //-------------------------------------------------------------------------------------------------- -/// +/// +//-------------------------------------------------------------------------------------------------- +size_t RivSourceInfo::gridIndex() const +{ + return m_gridIndex; +} + +//-------------------------------------------------------------------------------------------------- +/// //-------------------------------------------------------------------------------------------------- bool RivSourceInfo::hasCellFaceMapping() const { @@ -30,7 +47,7 @@ bool RivSourceInfo::hasCellFaceMapping() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RivSourceInfo::hasNNCIndices() const { diff --git a/ApplicationCode/ModelVisualization/RivSourceInfo.h b/ApplicationCode/ModelVisualization/RivSourceInfo.h index 5a70203839..03a961a902 100644 --- a/ApplicationCode/ModelVisualization/RivSourceInfo.h +++ b/ApplicationCode/ModelVisualization/RivSourceInfo.h @@ -2,40 +2,48 @@ // // Copyright (C) Statoil ASA // Copyright (C) Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RivObjectSourceInfo.h" + +#include "cvfArray.h" #include "cvfBase.h" #include "cvfObject.h" -#include "cvfArray.h" + #include "cvfStructGridGeometryGenerator.h" -class RivSourceInfo : public cvf::Object +//================================================================================================== +/// +/// +//================================================================================================== +class RivSourceInfo : public RivObjectSourceInfo { public: - explicit RivSourceInfo(size_t gridIndex) : m_gridIndex(gridIndex) {} + explicit RivSourceInfo(caf::PdmObject* pdmObject, size_t gridIndex); - size_t gridIndex() const { return m_gridIndex; } - bool hasCellFaceMapping() const; - bool hasNNCIndices() const; + size_t gridIndex() const; + bool hasCellFaceMapping() const; + bool hasNNCIndices() const; public: cvf::cref m_cellFaceFromTriangleMapper; - cvf::ref > m_NNCIndices; -private: + cvf::ref> m_NNCIndices; + +private: size_t m_gridIndex; };