From 36bc2f8f6923875a5ddc29c9761482e1d4a8ad1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 15 Sep 2015 10:13:43 +0200 Subject: [PATCH] (#401) WIP: Activated the visibility calculation code. Started on mapping calculation. --- .../RivFemElmVisibilityCalculator.cpp | 9 ++++----- .../ModelVisualization/RivReservoirViewPartMgr.cpp | 9 ++++----- .../ReservoirDataModel/RigCaseToCaseCellMapper.cpp | 13 +++++++++++-- .../ReservoirDataModel/RigCaseToCaseCellMapper.h | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp index 5e25f19b11..599d001dd9 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemElmVisibilityCalculator.cpp @@ -34,6 +34,7 @@ #include "RigFemPartResultsCollection.h" #include "RimViewLink.h" #include "RimViewLinker.h" +#include "RigCaseToCaseCellMapper.h" //-------------------------------------------------------------------------------------------------- /// @@ -175,7 +176,6 @@ void RivFemElmVisibilityCalculator::computeOverriddenCellVisibility(cvf::UByteAr const RigFemPart* femPart, RimViewLink* masterViewLink) { -#if 0 CVF_ASSERT(elmVisibilities != NULL); CVF_ASSERT(femPart != NULL); @@ -186,13 +186,13 @@ void RivFemElmVisibilityCalculator::computeOverriddenCellVisibility(cvf::UByteAr elmVisibilities->resize(elmCount); elmVisibilities->setAll(false); - RigCaseToCaseCellMapper* cellMapper = masterViewLink->cellMapper(); + const RigCaseToCaseCellMapper* cellMapper = masterViewLink->cellMapper(); - for (size_t elmIdx = 0; elmIdx < elmCount; ++elmIdx) + for (int elmIdx = 0; elmIdx < elmCount; ++elmIdx) { // We are assuming that there is only one part. int cellCount = 0; - const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndex(elmIdx, &cellCount); + const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndices(elmIdx, &cellCount); for (int mcIdx = 0; mcIdx < cellCount; ++mcIdx) { @@ -200,6 +200,5 @@ void RivFemElmVisibilityCalculator::computeOverriddenCellVisibility(cvf::UByteAr } } -#endif } diff --git a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp index 16362abf85..4904375b2d 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp @@ -42,6 +42,7 @@ #include "RivGridPartMgr.h" #include "RimViewLink.h" #include "RimViewLinker.h" +#include "RigCaseToCaseCellMapper.h" //-------------------------------------------------------------------------------------------------- /// @@ -602,7 +603,6 @@ void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* c RimView* masterView = masterViewLink->ownerViewLinker()->mainView(); -#if 0 // get cell visibility #if 1 cvf::ref totCellVisibility = masterView->currentTotalCellVisibility(); @@ -618,14 +618,14 @@ void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* c cellVisibility->resize(gridCellCount); cellVisibility->setAll(false); - RigCaseToCaseCellMapper* cellMapper = masterViewLink->cellMapper(); + const RigCaseToCaseCellMapper* cellMapper = masterViewLink->cellMapper(); for (size_t lcIdx = 0; lcIdx < gridCellCount; ++lcIdx) { #if 1 - size_t reservoirCellIdx = grid->reservoirCellIndex(lcIdx); + int reservoirCellIdx = static_cast(grid->reservoirCellIndex(lcIdx)); int cellCount = 0; - const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndex(reservoirCellIdx, &cellCount); + const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndices(reservoirCellIdx, &cellCount); for (int mcIdx = 0; mcIdx < cellCount; ++mcIdx) { @@ -646,7 +646,6 @@ void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* c } #endif } -#endif } diff --git a/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp b/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp index 6746ce3125..757b3d343c 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.cpp @@ -18,6 +18,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RigCaseToCaseCellMapper.h" +#include "RigFemPart.h" //-------------------------------------------------------------------------------------------------- @@ -29,7 +30,8 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigMainGrid* masterEclGrid, Rig m_masterFemPart(dependentFemPart), m_dependentFemPart(NULL) { - + m_masterCellOrIntervalIndex.resize(dependentFemPart->elementCount(), cvf::UNDEFINED_INT); + } //-------------------------------------------------------------------------------------------------- @@ -72,9 +74,16 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigFemPart* masterFemPart, RigF //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const int * RigCaseToCaseCellMapper::masterCaseCellIndices(int dependentCaseReservoirCellIndex, int* masterCaseCellIndexCount) +const int * RigCaseToCaseCellMapper::masterCaseCellIndices(int dependentCaseReservoirCellIndex, int* masterCaseCellIndexCount) const { int seriesIndex = m_masterCellOrIntervalIndex[dependentCaseReservoirCellIndex]; + + if (seriesIndex == cvf::UNDEFINED_INT) + { + (*masterCaseCellIndexCount) = 0; + return NULL; + } + if (seriesIndex < 0) { (*masterCaseCellIndexCount) = static_cast(m_masterCellIndexSeries[-seriesIndex].size()); diff --git a/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.h b/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.h index adaf6d2fca..6eef2821ec 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.h +++ b/ApplicationCode/ReservoirDataModel/RigCaseToCaseCellMapper.h @@ -41,7 +41,7 @@ public: RigCaseToCaseCellMapper(RigFemPart* masterFemPart, RigMainGrid* dependentEclGrid); RigCaseToCaseCellMapper(RigFemPart* masterFemPart, RigFemPart* dependentFemPart); - const int * masterCaseCellIndices(int dependentCaseReservoirCellIndex, int* masterCaseCellIndexCount); + const int * masterCaseCellIndices(int dependentCaseReservoirCellIndex, int* masterCaseCellIndexCount) const; const RigMainGrid* masterGrid() const { return m_masterGrid;} const RigMainGrid* dependentGrid() const { return m_dependentGrid;}