From 3acd426ead2ef182c5a6c79684119ff6f42cf3e4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 18 Feb 2019 11:15:34 +0100 Subject: [PATCH] Whitespace --- .../RivReservoirViewPartMgr.cpp | 656 ++++++++++-------- .../RimEclipsePropertyFilterCollection.cpp | 57 +- .../ProjectDataModel/RimEclipseView.cpp | 496 ++++++------- 3 files changed, 629 insertions(+), 580 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp index 741dfa7a89..7ee05f2981 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp @@ -3,17 +3,17 @@ // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -22,9 +22,9 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" -#include "RigEclipseCaseData.h" #include "RigCaseToCaseCellMapper.h" #include "RigCell.h" +#include "RigEclipseCaseData.h" #include "RigGridBase.h" #include "RigResultAccessorFactory.h" @@ -49,16 +49,15 @@ #include //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RivReservoirViewPartMgr::RivReservoirViewPartMgr(RimEclipseView * resv) : -m_reservoirView(resv) +RivReservoirViewPartMgr::RivReservoirViewPartMgr(RimEclipseView* resv) + : m_reservoirView(resv) { m_scaleTransform = new cvf::Transform(); clearGeometryCache(); } - //-------------------------------------------------------------------------------------------------- /// Clears the geometry cache for the given, and the dependent geometryTypes (from a visibility standpoint) //-------------------------------------------------------------------------------------------------- @@ -66,87 +65,87 @@ void RivReservoirViewPartMgr::scheduleGeometryRegen(RivCellSetEnum geometryType) { switch (geometryType) { - case OVERRIDDEN_CELL_VISIBILITY: - clearGeometryCache(OVERRIDDEN_CELL_VISIBILITY); - case INACTIVE: - clearGeometryCache(INACTIVE); - clearGeometryCache(RANGE_FILTERED_INACTIVE); - break; - case RANGE_FILTERED_INACTIVE: - clearGeometryCache(RANGE_FILTERED_INACTIVE); - break; - case ACTIVE: - clearGeometryCache(ACTIVE); - clearGeometryCache(ALL_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); - clearGeometryCache(RANGE_FILTERED); - clearGeometryCache(RANGE_FILTERED_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case ALL_WELL_CELLS: - clearGeometryCache(ALL_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); - clearGeometryCache(RANGE_FILTERED); - clearGeometryCache(RANGE_FILTERED_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case VISIBLE_WELL_CELLS: - clearGeometryCache(VISIBLE_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); - clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case VISIBLE_WELL_FENCE_CELLS: - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case RANGE_FILTERED: - clearGeometryCache(RANGE_FILTERED); - clearGeometryCache(RANGE_FILTERED_INACTIVE); - clearGeometryCache(RANGE_FILTERED_WELL_CELLS); - clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case RANGE_FILTERED_WELL_CELLS: - clearGeometryCache(RANGE_FILTERED_WELL_CELLS); - clearGeometryCache(RANGE_FILTERED); - clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: - clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: - clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case PROPERTY_FILTERED: - clearGeometryCache(PROPERTY_FILTERED); - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; - case PROPERTY_FILTERED_WELL_CELLS: - clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); - break; + case OVERRIDDEN_CELL_VISIBILITY: + clearGeometryCache(OVERRIDDEN_CELL_VISIBILITY); + case INACTIVE: + clearGeometryCache(INACTIVE); + clearGeometryCache(RANGE_FILTERED_INACTIVE); + break; + case RANGE_FILTERED_INACTIVE: + clearGeometryCache(RANGE_FILTERED_INACTIVE); + break; + case ACTIVE: + clearGeometryCache(ACTIVE); + clearGeometryCache(ALL_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); + clearGeometryCache(RANGE_FILTERED); + clearGeometryCache(RANGE_FILTERED_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case ALL_WELL_CELLS: + clearGeometryCache(ALL_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); + clearGeometryCache(RANGE_FILTERED); + clearGeometryCache(RANGE_FILTERED_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case VISIBLE_WELL_CELLS: + clearGeometryCache(VISIBLE_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); + clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case VISIBLE_WELL_FENCE_CELLS: + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case RANGE_FILTERED: + clearGeometryCache(RANGE_FILTERED); + clearGeometryCache(RANGE_FILTERED_INACTIVE); + clearGeometryCache(RANGE_FILTERED_WELL_CELLS); + clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case RANGE_FILTERED_WELL_CELLS: + clearGeometryCache(RANGE_FILTERED_WELL_CELLS); + clearGeometryCache(RANGE_FILTERED); + clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: + clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: + clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case PROPERTY_FILTERED: + clearGeometryCache(PROPERTY_FILTERED); + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; + case PROPERTY_FILTERED_WELL_CELLS: + clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS); + break; } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType) { @@ -190,7 +189,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::clearGeometryCache() { @@ -210,10 +209,11 @@ void RivReservoirViewPartMgr::clearGeometryCache() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, - const std::vector& gridIndices) +void RivReservoirViewPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, + RivCellSetEnum geometryType, + const std::vector& gridIndices) { ensureStaticGeometryPartsCreated(geometryType); @@ -221,21 +221,23 @@ void RivReservoirViewPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicLi } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::ensureStaticGeometryPartsCreated(RivCellSetEnum geometryType) { if (geometryType < PROPERTY_FILTERED && m_geometriesNeedsRegen[geometryType]) { - createGeometry( geometryType); + createGeometry(geometryType); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, - size_t frameIndex, const std::vector& gridIndices) +void RivReservoirViewPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + RivCellSetEnum geometryType, + size_t frameIndex, + const std::vector& gridIndices) { ensureDynamicGeometryPartsCreated(geometryType, frameIndex); @@ -250,7 +252,7 @@ void RivReservoirViewPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicL } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::ensureDynamicGeometryPartsCreated(RivCellSetEnum geometryType, size_t frameIndex) { @@ -263,7 +265,8 @@ void RivReservoirViewPartMgr::ensureDynamicGeometryPartsCreated(RivCellSetEnum g } else if (geometryType == PROPERTY_FILTERED_WELL_CELLS) { - if (frameIndex >= m_propFilteredWellGeometryFramesNeedsRegen.size() || m_propFilteredWellGeometryFramesNeedsRegen[frameIndex]) + if (frameIndex >= m_propFilteredWellGeometryFramesNeedsRegen.size() || + m_propFilteredWellGeometryFramesNeedsRegen[frameIndex]) { createPropertyFilteredWellGeometry(frameIndex); } @@ -271,7 +274,7 @@ void RivReservoirViewPartMgr::ensureDynamicGeometryPartsCreated(RivCellSetEnum g } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType) { @@ -279,15 +282,15 @@ void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType) m_geometries[geometryType].clearAndSetReservoir(geometryType, m_reservoirView->eclipseCase(), m_reservoirView); m_geometries[geometryType].setTransform(m_scaleTransform.p()); - + std::vector grids; res->allGrids(&grids); for (size_t i = 0; i < grids.size(); ++i) { - cvf::ref cellVisibility = m_geometries[geometryType].cellVisibility(i); + cvf::ref cellVisibility = m_geometries[geometryType].cellVisibility(i); computeVisibility(cellVisibility.p(), geometryType, grids[i], i); - + m_geometries[geometryType].setCellVisibility(i, cellVisibility.p()); } @@ -295,25 +298,29 @@ void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, RivCellSetEnum geometryType, RigGridBase* grid, size_t gridIdx) +void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, + RivCellSetEnum geometryType, + RigGridBase* grid, + size_t gridIdx) { - RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData(); - auto activeCellInfo = m_reservoirView->currentActiveCellInfo(); + RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData(); + auto activeCellInfo = m_reservoirView->currentActiveCellInfo(); switch (geometryType) { - case OVERRIDDEN_CELL_VISIBILITY: - computeOverriddenCellVisibility(cellVisibility, grid); - break; - case ACTIVE: - computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), false, false, true); - break; - case ALL_WELL_CELLS: - copyByteArray(cellVisibility, eclipseCase->wellCellsInGrid(gridIdx)); - break; - case VISIBLE_WELL_CELLS: + case OVERRIDDEN_CELL_VISIBILITY: + computeOverriddenCellVisibility(cellVisibility, grid); + break; + case ACTIVE: + computeNativeVisibility( + cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), false, false, true); + break; + case ALL_WELL_CELLS: + copyByteArray(cellVisibility, eclipseCase->wellCellsInGrid(gridIdx)); + break; + case VISIBLE_WELL_CELLS: { cvf::ref allWellCellsVisibility; ensureStaticGeometryPartsCreated(ALL_WELL_CELLS); @@ -329,7 +336,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, } } break; - case VISIBLE_WELL_FENCE_CELLS: + case VISIBLE_WELL_FENCE_CELLS: { cvf::ref allWellCellsVisibility; ensureStaticGeometryPartsCreated(ALL_WELL_CELLS); @@ -345,37 +352,46 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, } } break; - case INACTIVE: - computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), m_reservoirView->showInvalidCells(), true, false); - break; - case RANGE_FILTERED: + case INACTIVE: + computeNativeVisibility(cellVisibility, + grid, + activeCellInfo, + eclipseCase->wellCellsInGrid(gridIdx), + m_reservoirView->showInvalidCells(), + true, + false); + break; + case RANGE_FILTERED: { cvf::ref nativeVisibility; ensureStaticGeometryPartsCreated(ACTIVE); nativeVisibility = m_geometries[ACTIVE].cellVisibility(gridIdx); - computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); + computeRangeVisibility( + geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); } break; - case RANGE_FILTERED_INACTIVE: + case RANGE_FILTERED_INACTIVE: { cvf::ref nativeVisibility; ensureStaticGeometryPartsCreated(INACTIVE); nativeVisibility = m_geometries[INACTIVE].cellVisibility(gridIdx); - computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); + computeRangeVisibility( + geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); } break; - case RANGE_FILTERED_WELL_CELLS: + case RANGE_FILTERED_WELL_CELLS: { cvf::ref nativeVisibility; ensureStaticGeometryPartsCreated(ALL_WELL_CELLS); nativeVisibility = m_geometries[ALL_WELL_CELLS].cellVisibility(gridIdx); - computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); + computeRangeVisibility( + geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); } break; - case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: + case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: { cvf::ref visibleWellCells; cvf::ref rangeFilteredWellCells; @@ -383,7 +399,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, ensureStaticGeometryPartsCreated(VISIBLE_WELL_CELLS); ensureStaticGeometryPartsCreated(RANGE_FILTERED_WELL_CELLS); - visibleWellCells = m_geometries[VISIBLE_WELL_CELLS].cellVisibility(gridIdx); + visibleWellCells = m_geometries[VISIBLE_WELL_CELLS].cellVisibility(gridIdx); rangeFilteredWellCells = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gridIdx); cellVisibility->resize(visibleWellCells->size()); @@ -395,7 +411,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, } } break; - case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: + case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: { cvf::ref visibleWellCells; cvf::ref rangeFilteredWellCells; @@ -403,7 +419,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, ensureStaticGeometryPartsCreated(VISIBLE_WELL_FENCE_CELLS); ensureStaticGeometryPartsCreated(RANGE_FILTERED); - visibleWellCells = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gridIdx); + visibleWellCells = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gridIdx); rangeFilteredWellCells = m_geometries[RANGE_FILTERED].cellVisibility(gridIdx); cellVisibility->resize(visibleWellCells->size()); @@ -415,41 +431,42 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, } } break; - default: - CVF_ASSERT(false); // Call special function for property filtered stuff - break; + default: + CVF_ASSERT(false); // Call special function for property filtered stuff + break; } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t frameIndex) { RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData(); - if ( frameIndex >= m_propFilteredGeometryFrames.size()) - { + if (frameIndex >= m_propFilteredGeometryFrames.size()) + { m_propFilteredGeometryFrames.resize(frameIndex + 1); m_propFilteredGeometryFramesNeedsRegen.resize(frameIndex + 1, true); } - if ( m_propFilteredGeometryFrames[frameIndex].isNull()) m_propFilteredGeometryFrames[frameIndex] = new RivReservoirPartMgr; + if (m_propFilteredGeometryFrames[frameIndex].isNull()) m_propFilteredGeometryFrames[frameIndex] = new RivReservoirPartMgr; - m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(PROPERTY_FILTERED, m_reservoirView->eclipseCase(), m_reservoirView); + m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir( + PROPERTY_FILTERED, m_reservoirView->eclipseCase(), m_reservoirView); m_propFilteredGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p()); std::vector grids; res->allGrids(&grids); bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters(); - bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells(); + bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells(); for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx) { - cvf::ref cellVisibility = m_propFilteredGeometryFrames[frameIndex]->cellVisibility(gIdx); - cvf::ref rangeVisibility; - cvf::ref fenceVisibility; + cvf::ref cellVisibility = m_propFilteredGeometryFrames[frameIndex]->cellVisibility(gIdx); + cvf::ref rangeVisibility; + cvf::ref fenceVisibility; if (hasActiveRangeFilters && hasVisibleWellCells) { @@ -489,44 +506,47 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t (*cellVisibility)[cellIdx] = (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx]; } - computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection()); + computePropertyVisibility( + cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection()); m_propFilteredGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p()); - } + } m_propFilteredGeometryFramesNeedsRegen[frameIndex] = false; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameIndex) { RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData(); - if ( frameIndex >= m_propFilteredWellGeometryFrames.size()) - { + if (frameIndex >= m_propFilteredWellGeometryFrames.size()) + { m_propFilteredWellGeometryFrames.resize(frameIndex + 1); m_propFilteredWellGeometryFramesNeedsRegen.resize(frameIndex + 1, true); } - if ( m_propFilteredWellGeometryFrames[frameIndex].isNull()) m_propFilteredWellGeometryFrames[frameIndex] = new RivReservoirPartMgr; + if (m_propFilteredWellGeometryFrames[frameIndex].isNull()) + m_propFilteredWellGeometryFrames[frameIndex] = new RivReservoirPartMgr; - m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(PROPERTY_FILTERED_WELL_CELLS, m_reservoirView->eclipseCase(), m_reservoirView); + m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir( + PROPERTY_FILTERED_WELL_CELLS, m_reservoirView->eclipseCase(), m_reservoirView); m_propFilteredWellGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p()); std::vector grids; res->allGrids(&grids); bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters(); - bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells(); + bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells(); for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx) { - cvf::ref cellVisibility = m_propFilteredWellGeometryFrames[frameIndex]->cellVisibility(gIdx); - cvf::ref rangeVisibility; - cvf::ref wellCellsOutsideRange; - cvf::ref wellFenceCells; + cvf::ref cellVisibility = m_propFilteredWellGeometryFrames[frameIndex]->cellVisibility(gIdx); + cvf::ref rangeVisibility; + cvf::ref wellCellsOutsideRange; + cvf::ref wellFenceCells; if (hasActiveRangeFilters && hasVisibleWellCells) { @@ -538,14 +558,13 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd ensureStaticGeometryPartsCreated(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); wellFenceCells = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx); - } else if (hasActiveRangeFilters && !hasVisibleWellCells) { ensureStaticGeometryPartsCreated(RANGE_FILTERED_WELL_CELLS); - rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx); + rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx); wellCellsOutsideRange = rangeVisibility; - wellFenceCells = rangeVisibility; + wellFenceCells = rangeVisibility; } else if (!hasActiveRangeFilters && hasVisibleWellCells) { @@ -560,9 +579,9 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd else if (!hasActiveRangeFilters && !hasVisibleWellCells) { ensureStaticGeometryPartsCreated(ALL_WELL_CELLS); - wellFenceCells = m_geometries[ALL_WELL_CELLS].cellVisibility(gIdx); + wellFenceCells = m_geometries[ALL_WELL_CELLS].cellVisibility(gIdx); wellCellsOutsideRange = wellFenceCells; - rangeVisibility = wellFenceCells; + rangeVisibility = wellFenceCells; } cellVisibility->resize(rangeVisibility->size()); @@ -570,10 +589,12 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd #pragma omp parallel for for (int cellIdx = 0; cellIdx < static_cast(cellVisibility->size()); ++cellIdx) { - (*cellVisibility)[cellIdx] = (*wellFenceCells)[cellIdx] || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideRange)[cellIdx]; + (*cellVisibility)[cellIdx] = + (*wellFenceCells)[cellIdx] || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideRange)[cellIdx]; } - computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection()); + computePropertyVisibility( + cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection()); m_propFilteredWellGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p()); } @@ -584,10 +605,13 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd //-------------------------------------------------------------------------------------------------- /// Evaluate visibility based on cell state //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses, - bool invalidCellsIsVisible, - bool inactiveCellsIsVisible, - bool activeCellsIsVisible) +void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisibility, + const RigGridBase* grid, + const RigActiveCellInfo* activeCellInfo, + const cvf::UByteArray* cellIsInWellStatuses, + bool invalidCellsIsVisible, + bool inactiveCellsIsVisible, + bool activeCellsIsVisible) { CVF_ASSERT(cellVisibility != nullptr); CVF_ASSERT(grid != nullptr); @@ -597,17 +621,15 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib cellVisibility->resize(grid->cellCount()); -#pragma omp parallel for +#pragma omp parallel for for (int cellIndex = 0; cellIndex < static_cast(grid->cellCount()); cellIndex++) { - const RigCell& cell = grid->cell(cellIndex); - size_t reservoirCellIndex = cell.mainGridCellIndex(); + const RigCell& cell = grid->cell(cellIndex); + size_t reservoirCellIndex = cell.mainGridCellIndex(); - if ( !invalidCellsIsVisible && cell.isInvalid() - || !inactiveCellsIsVisible && !activeCellInfo->isActive(reservoirCellIndex) - || !activeCellsIsVisible && activeCellInfo->isActive(reservoirCellIndex) - || (*cellIsInWellStatuses)[cellIndex] - ) + if (!invalidCellsIsVisible && cell.isInvalid() || + !inactiveCellsIsVisible && !activeCellInfo->isActive(reservoirCellIndex) || + !activeCellsIsVisible && activeCellInfo->isActive(reservoirCellIndex) || (*cellIsInWellStatuses)[cellIndex]) { (*cellVisibility)[cellIndex] = false; } @@ -619,25 +641,25 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid) { - RimViewController* masterViewLink = m_reservoirView->viewController(); - + CVF_ASSERT(masterViewLink); RimGridView* masterView = masterViewLink->ownerViewLinker()->masterView(); - // get cell visibility - #if 1 - cvf::ref totCellVisibility = masterView->currentTotalCellVisibility(); - #else - // Could get something more like - std::vector > gridsWithCellSetVisibility = masterView->getAllGridsCurrentCellSetsCellVisibility(); - #endif - +// get cell visibility +#if 1 + cvf::ref totCellVisibility = masterView->currentTotalCellVisibility(); +#else + // Could get something more like + std::vector> gridsWithCellSetVisibility = + masterView->getAllGridsCurrentCellSetsCellVisibility(); +#endif + CVF_ASSERT(cellVisibility != nullptr); CVF_ASSERT(grid != nullptr); @@ -649,40 +671,38 @@ void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* c for (size_t lcIdx = 0; lcIdx < gridCellCount; ++lcIdx) { - #if 1 - int reservoirCellIdx = static_cast(grid->reservoirCellIndex(lcIdx)); - int cellCount = 0; +#if 1 + int reservoirCellIdx = static_cast(grid->reservoirCellIndex(lcIdx)); + int cellCount = 0; const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndices(reservoirCellIdx, &cellCount); - + for (int mcIdx = 0; mcIdx < cellCount; ++mcIdx) { - (*cellVisibility)[lcIdx] |= (*totCellVisibility)[cellIndicesInMasterCase[mcIdx]]; // If any is visible, show + (*cellVisibility)[lcIdx] |= (*totCellVisibility)[cellIndicesInMasterCase[mcIdx]]; // If any is visible, show } - #else - +#else + const RigGridCells& masterCaseCells = cellMapper->masterCaseGridAndLocalCellIndex(grid->gridIndex, lcIdx); for (int mcIdx = 0; mcIdx < masterCaseCells.cellCount(); ++mcIdx) { - int cellSetCount = gridsWithCellSetVisibility[ masterCaseCells.gridIndex[mcIdx] ].size(); + int cellSetCount = gridsWithCellSetVisibility[masterCaseCells.gridIndex[mcIdx]].size(); for (int csIdx = 0; csIdx < cellSetCount; ++csIdx) { - (*cellVisibility)[lcIdx] |= gridsWithCellSetVisibility[masterCaseCells.gridIndex[mcIdx]][masterCaseCells.cellIndex[mcIdx]]; + (*cellVisibility)[lcIdx] |= + gridsWithCellSetVisibility[masterCaseCells.gridIndex[mcIdx]][masterCaseCells.cellIndex[mcIdx]]; } } - #endif +#endif } } - - - //-------------------------------------------------------------------------------------------------- /// Copy the data from source into destination. This is not trivial to do using cvf::Array ... -/// using parallelized operator [] and not memcopy. Do not know what is faster. +/// using parallelized operator [] and not memcopy. Do not know what is faster. //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const cvf::UByteArray* source ) +void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const cvf::UByteArray* source) { CVF_ASSERT(destination != nullptr); CVF_ASSERT(source != nullptr); @@ -692,22 +712,21 @@ void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const destination->resize(source->size()); } -#pragma omp parallel for +#pragma omp parallel for for (int cellIndex = 0; cellIndex < static_cast(source->size()); cellIndex++) { (*destination)[cellIndex] = (*source)[cellIndex]; } } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType, - cvf::UByteArray* cellVisibility, - const RigGridBase* grid, - const cvf::UByteArray* nativeVisibility, - const RimCellRangeFilterCollection* rangeFilterColl) +void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType, + cvf::UByteArray* cellVisibility, + const RigGridBase* grid, + const cvf::UByteArray* nativeVisibility, + const RimCellRangeFilterCollection* rangeFilterColl) { CVF_ASSERT(cellVisibility != nullptr); CVF_ASSERT(nativeVisibility != nullptr); @@ -725,7 +744,7 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType cvf::CellRangeFilter gridCellRangeFilter; rangeFilterColl->compoundCellRangeFilter(&gridCellRangeFilter, grid->gridIndex()); - const RigLocalGrid* lgr = nullptr; + const RigLocalGrid* lgr = nullptr; cvf::ref parentGridVisibilities; if (!grid->isMainGrid()) @@ -737,7 +756,8 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType if (geometryType == RANGE_FILTERED_WELL_CELLS) { - geometryType = RANGE_FILTERED; // Use the range filtering in the parent grid, not the well cells in the parent grid + geometryType = + RANGE_FILTERED; // Use the range filtering in the parent grid, not the well cells in the parent grid } RivReservoirPartMgr* reservoirGridPartMgr = &m_geometries[geometryType]; @@ -745,19 +765,20 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType parentGridVisibilities = reservoirGridPartMgr->cellVisibility(parentGridIndex); } - bool hasAdditiveRangeFilters = rangeFilterColl->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells(); + bool hasAdditiveRangeFilters = + rangeFilterColl->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells(); -#pragma omp parallel for +#pragma omp parallel for for (int cellIndex = 0; cellIndex < static_cast(grid->cellCount()); cellIndex++) { - if ( (*nativeVisibility)[cellIndex] ) + if ((*nativeVisibility)[cellIndex]) { - const RigCell& cell = grid->cell(cellIndex); - bool visibleDueToParentGrid = false; + const RigCell& cell = grid->cell(cellIndex); + bool visibleDueToParentGrid = false; if (lgr) { size_t parentGridCellIndex = cell.parentCellIndex(); - visibleDueToParentGrid = parentGridVisibilities->get(parentGridCellIndex); + visibleDueToParentGrid = parentGridVisibilities->get(parentGridCellIndex); } // Normal grid visibility @@ -767,31 +788,35 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType bool isInSubGridArea = cell.subGrid() != nullptr; grid->ijkFromCellIndex(cellIndex, &mainGridI, &mainGridJ, &mainGridK); - + bool nativeRangeVisibility = false; - + if (hasAdditiveRangeFilters) { nativeRangeVisibility = gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK, isInSubGridArea); } else { - // Special handling when no include filters are present. Use native visibility + // Special handling when no include filters are present. Use native visibility nativeRangeVisibility = (*nativeVisibility)[cellIndex]; } - - (*cellVisibility)[cellIndex] = (visibleDueToParentGrid || nativeRangeVisibility) - && !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea); + + (*cellVisibility)[cellIndex] = + (visibleDueToParentGrid || nativeRangeVisibility) && + !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea); } } } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, size_t timeStepIndex, - const cvf::UByteArray* rangeFilterVisibility, RimEclipsePropertyFilterCollection* propFilterColl) +void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVisibility, + const RigGridBase* grid, + size_t timeStepIndex, + const cvf::UByteArray* rangeFilterVisibility, + RimEclipsePropertyFilterCollection* propFilterColl) { CVF_ASSERT(cellVisibility != nullptr); CVF_ASSERT(rangeFilterVisibility != nullptr); @@ -801,7 +826,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis CVF_ASSERT(rangeFilterVisibility->size() == grid->cellCount()); // Copy if not equal - if (cellVisibility != rangeFilterVisibility ) (*cellVisibility) = *rangeFilterVisibility; + if (cellVisibility != rangeFilterVisibility) (*cellVisibility) = *rangeFilterVisibility; if (propFilterColl->hasActiveFilters()) { @@ -815,14 +840,15 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis RigEclipseCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->eclipseCaseData(); - cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition()); + cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultDefinition( + eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition()); CVF_ASSERT(resultAccessor.notNull()); if (propertyFilter->isCategorySelectionActive()) { std::vector integerVector = propertyFilter->selectedCategoryValues(); - std::set integerSet; + std::set integerSet; for (auto val : integerVector) { integerSet.insert(val); @@ -888,56 +914,65 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::updateCellColor(RivCellSetEnum geometryType, size_t timeStepIndex, cvf::Color4f color) { - RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex ); + RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex); pmgr->updateCellColor(color); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::updateCellResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors) +void RivReservoirViewPartMgr::updateCellResultColor(RivCellSetEnum geometryType, + size_t timeStepIndex, + RimEclipseCellColors* cellResultColors) { - RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex ); + RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex); pmgr->updateCellResultColor(timeStepIndex, cellResultColors); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors) +void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryType, + size_t timeStepIndex, + RimEclipseCellColors* cellResultColors, + RimCellEdgeColors* cellEdgeResultColors) { - RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex ); + RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex); pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::updateFaultCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors) +void RivReservoirViewPartMgr::updateFaultCellEdgeResultColor(RivCellSetEnum geometryType, + size_t timeStepIndex, + RimEclipseCellColors* cellResultColors, + RimCellEdgeColors* cellEdgeResultColors) { - RivReservoirPartMgr * pmgr = reservoirPartManager(geometryType, timeStepIndex); + RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex); pmgr->updateFaultCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -const cvf::UByteArray* RivReservoirViewPartMgr::cellVisibility(RivCellSetEnum geometryType, size_t gridIndex, size_t timeStepIndex) +const cvf::UByteArray* + RivReservoirViewPartMgr::cellVisibility(RivCellSetEnum geometryType, size_t gridIndex, size_t timeStepIndex) { ensureDynamicGeometryPartsCreated(geometryType, timeStepIndex); ensureStaticGeometryPartsCreated(geometryType); - RivReservoirPartMgr * pmgr = (const_cast(this))->reservoirPartManager( geometryType, timeStepIndex ); - + RivReservoirPartMgr* pmgr = (const_cast(this))->reservoirPartManager(geometryType, timeStepIndex); + return pmgr->cellVisibility(gridIndex).p(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RivReservoirPartMgr* RivReservoirViewPartMgr::reservoirPartManager(RivCellSetEnum geometryType, size_t timeStepIndex) { @@ -956,9 +991,11 @@ RivReservoirPartMgr* RivReservoirViewPartMgr::reservoirPartManager(RivCellSetEnu } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::updateFaultColors(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors) +void RivReservoirViewPartMgr::updateFaultColors(RivCellSetEnum geometryType, + size_t timeStepIndex, + RimEclipseCellColors* cellResultColors) { if (geometryType == PROPERTY_FILTERED && timeStepIndex >= m_propFilteredGeometryFrames.size()) { @@ -975,7 +1012,7 @@ void RivReservoirViewPartMgr::updateFaultColors(RivCellSetEnum geometryType, siz } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::appendFaultsStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType) { @@ -983,85 +1020,88 @@ void RivReservoirViewPartMgr::appendFaultsStaticGeometryPartsToModel(cvf::ModelB ensureStaticGeometryPartsCreated(geometryType); -/* - QString text; - switch (geometryType) - { - case OVERRIDDEN_CELL_VISIBILITY: - text = "OVERRIDDEN_CELL_VISIBILITY"; - break; - case ALL_CELLS: - text = "ALL_CELLS"; - break; - case ACTIVE: - text = "ACTIVE"; - break; - case ALL_WELL_CELLS: - text = "ALL_WELL_CELLS"; - break; - case VISIBLE_WELL_CELLS: - text = "VISIBLE_WELL_CELLS"; - break; - case VISIBLE_WELL_FENCE_CELLS: - text = "VISIBLE_WELL_FENCE_CELLS"; - break; - case INACTIVE: - text = "INACTIVE"; - break; - case RANGE_FILTERED: - text = "RANGE_FILTERED"; - break; - case RANGE_FILTERED_INACTIVE: - text = "RANGE_FILTERED_INACTIVE"; - break; - case RANGE_FILTERED_WELL_CELLS: - text = "RANGE_FILTERED_WELL_CELLS"; - break; - case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: - text = "VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER"; - break; - case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: - text = "VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER"; - break; - case PROPERTY_FILTERED: - text = "PROPERTY_FILTERED"; - break; - case PROPERTY_FILTERED_WELL_CELLS: - text = "PROPERTY_FILTERED_WELL_CELLS"; - break; - default: - break; - } + /* + QString text; + switch (geometryType) + { + case OVERRIDDEN_CELL_VISIBILITY: + text = "OVERRIDDEN_CELL_VISIBILITY"; + break; + case ALL_CELLS: + text = "ALL_CELLS"; + break; + case ACTIVE: + text = "ACTIVE"; + break; + case ALL_WELL_CELLS: + text = "ALL_WELL_CELLS"; + break; + case VISIBLE_WELL_CELLS: + text = "VISIBLE_WELL_CELLS"; + break; + case VISIBLE_WELL_FENCE_CELLS: + text = "VISIBLE_WELL_FENCE_CELLS"; + break; + case INACTIVE: + text = "INACTIVE"; + break; + case RANGE_FILTERED: + text = "RANGE_FILTERED"; + break; + case RANGE_FILTERED_INACTIVE: + text = "RANGE_FILTERED_INACTIVE"; + break; + case RANGE_FILTERED_WELL_CELLS: + text = "RANGE_FILTERED_WELL_CELLS"; + break; + case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: + text = "VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER"; + break; + case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: + text = "VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER"; + break; + case PROPERTY_FILTERED: + text = "PROPERTY_FILTERED"; + break; + case PROPERTY_FILTERED_WELL_CELLS: + text = "PROPERTY_FILTERED_WELL_CELLS"; + break; + default: + break; + } - qDebug() << text; -*/ + qDebug() << text; + */ m_geometries[geometryType].appendFaultPartsToModel(model); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex) +void RivReservoirViewPartMgr::appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + RivCellSetEnum geometryType, + size_t frameIndex) { if (geometryType == PROPERTY_FILTERED) { - //qDebug() << "PROPERTY_FILTERED"; + // qDebug() << "PROPERTY_FILTERED"; m_propFilteredGeometryFrames[frameIndex]->appendFaultPartsToModel(model); } else if (geometryType == PROPERTY_FILTERED_WELL_CELLS) { - //qDebug() << "PROPERTY_FILTERED_WELL_CELLS"; + // qDebug() << "PROPERTY_FILTERED_WELL_CELLS"; m_propFilteredWellGeometryFrames[frameIndex]->appendFaultPartsToModel(model); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RivCellSetEnum RivReservoirViewPartMgr::geometryTypeForFaultLabels(const std::set& geometryTypes, bool showFaultsOutsideFilters) const +RivCellSetEnum RivReservoirViewPartMgr::geometryTypeForFaultLabels(const std::set& geometryTypes, + bool showFaultsOutsideFilters) const { for (RivCellSetEnum cellSetType : geometryTypes) { @@ -1083,7 +1123,7 @@ RivCellSetEnum RivReservoirViewPartMgr::geometryTypeForFaultLabels(const std::se } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::appendFaultLabelsStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType) { @@ -1092,15 +1132,17 @@ void RivReservoirViewPartMgr::appendFaultLabelsStaticGeometryPartsToModel(cvf::M } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RivReservoirViewPartMgr::appendFaultLabelsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex) +void RivReservoirViewPartMgr::appendFaultLabelsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, + RivCellSetEnum geometryType, + size_t frameIndex) { m_propFilteredGeometryFrames[frameIndex]->appendFaultLabelPartsToModel(model); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::forceWatertightGeometryOnForType(RivCellSetEnum geometryType) { @@ -1126,7 +1168,7 @@ void RivReservoirViewPartMgr::forceWatertightGeometryOnForType(RivCellSetEnum ge } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::clearWatertightGeometryFlags() { diff --git a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilterCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilterCollection.cpp index 977d4baac6..754913ca0d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilterCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilterCollection.cpp @@ -3,17 +3,17 @@ // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -29,22 +29,21 @@ #include "cafPdmUiEditorHandle.h" - CAF_PDM_SOURCE_INIT(RimEclipsePropertyFilterCollection, "CellPropertyFilters"); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection() { CAF_PDM_InitObject("Property Filters", ":/CellFilter_Values.png", "", ""); - CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", ""); + CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", ""); propertyFilters.uiCapability()->setUiHidden(true); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipsePropertyFilterCollection::~RimEclipsePropertyFilterCollection() { @@ -52,7 +51,7 @@ RimEclipsePropertyFilterCollection::~RimEclipsePropertyFilterCollection() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseView* RimEclipsePropertyFilterCollection::reservoirView() { @@ -63,13 +62,12 @@ RimEclipseView* RimEclipsePropertyFilterCollection::reservoirView() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipsePropertyFilterCollection::loadAndInitializePropertyFilters() { - for (size_t i = 0; i < propertyFilters.size(); i++) + for (RimEclipsePropertyFilter* propertyFilter : propertyFilters) { - RimEclipsePropertyFilter* propertyFilter = propertyFilters[i]; propertyFilter->resultDefinition()->setEclipseCase(reservoirView()->eclipseCase()); propertyFilter->initAfterRead(); if (isActive() && propertyFilter->isActive()) @@ -81,7 +79,7 @@ void RimEclipsePropertyFilterCollection::loadAndInitializePropertyFilters() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipsePropertyFilterCollection::initAfterRead() { @@ -89,15 +87,14 @@ void RimEclipsePropertyFilterCollection::initAfterRead() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipsePropertyFilterCollection::hasActiveFilters() const { if (!isActive) return false; - for (size_t i = 0; i < propertyFilters.size(); i++) + for (RimEclipsePropertyFilter* propertyFilter : propertyFilters) { - RimEclipsePropertyFilter* propertyFilter = propertyFilters[i]; if (propertyFilter->isActive() && propertyFilter->resultDefinition()->hasResult()) return true; } @@ -111,36 +108,33 @@ bool RimEclipsePropertyFilterCollection::hasActiveDynamicFilters() const { if (!isActive) return false; - for (size_t i = 0; i < propertyFilters.size(); i++) + for (RimEclipsePropertyFilter* propertyFilter : propertyFilters) { - RimEclipsePropertyFilter* propertyFilter = propertyFilters[i]; if (propertyFilter->isActive() && propertyFilter->resultDefinition()->hasDynamicResult()) return true; } return false; } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipsePropertyFilterCollection::isUsingFormationNames() const { - if ( !isActive ) return false; + if (!isActive) return false; - for ( size_t i = 0; i < propertyFilters.size(); i++ ) + for (RimEclipsePropertyFilter* propertyFilter : propertyFilters) { - RimEclipsePropertyFilter* propertyFilter = propertyFilters[i]; - if ( propertyFilter->isActive() - && propertyFilter->resultDefinition()->resultType() == RiaDefines::FORMATION_NAMES - && propertyFilter->resultDefinition()->resultVariable() != RiaDefines::undefinedResultName()) return true; + if (propertyFilter->isActive() && propertyFilter->resultDefinition()->resultType() == RiaDefines::FORMATION_NAMES && + propertyFilter->resultDefinition()->resultVariable() != RiaDefines::undefinedResultName()) + return true; } return false; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipsePropertyFilterCollection::updateIconState() { @@ -151,8 +145,7 @@ void RimEclipsePropertyFilterCollection::updateIconState() if (view) { RimViewController* viewController = view->viewController(); - if (viewController && (viewController->isPropertyFilterOveridden() - || viewController->isVisibleCellsOveridden())) + if (viewController && (viewController->isPropertyFilterOveridden() || viewController->isVisibleCellsOveridden())) { activeIcon = false; } @@ -165,16 +158,15 @@ void RimEclipsePropertyFilterCollection::updateIconState() updateUiIconFromState(activeIcon); - for (size_t i = 0; i < propertyFilters.size(); i++) + for (RimEclipsePropertyFilter* cellFilter : propertyFilters) { - RimEclipsePropertyFilter* cellFilter = propertyFilters[i]; cellFilter->updateActiveState(); cellFilter->updateIconState(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep() { @@ -183,4 +175,3 @@ void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep() cellFilter->updateFromCurrentTimeStep(); } } - diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 11b20789bb..8760d5d3ff 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -3,17 +3,17 @@ // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -53,6 +53,8 @@ #include "RimFaultInViewCollection.h" #include "RimFlowCharacteristicsPlot.h" #include "RimFlowDiagSolution.h" +#include "RimFracture.h" +#include "RimFractureTemplateCollection.h" #include "RimGridCollection.h" #include "RimIntersection.h" #include "RimIntersectionCollection.h" @@ -60,77 +62,71 @@ #include "RimProject.h" #include "RimRegularLegendConfig.h" #include "RimReservoirCellResultsStorage.h" +#include "RimSimWellFracture.h" #include "RimSimWellInView.h" #include "RimSimWellInViewCollection.h" #include "RimStimPlanColors.h" #include "RimTernaryLegendConfig.h" #include "RimViewController.h" #include "RimViewLinker.h" +#include "RimViewNameConfig.h" #include "RimVirtualPerforationResults.h" #include "RimWellPathCollection.h" -#include "RimViewNameConfig.h" -#include "RiuMainWindow.h" #include "Riu3dSelectionManager.h" +#include "RiuMainWindow.h" #include "RiuViewer.h" #include "RivReservoirSimWellsPartMgr.h" #include "RivReservoirViewPartMgr.h" #include "RivSingleCellPartGenerator.h" #include "RivTernarySaturationOverlayItem.h" -#include "RivWellPathsPartMgr.h" - -#include "RimFracture.h" -#include "RimFractureTemplateCollection.h" -#include "RimSimWellFracture.h" #include "RivWellFracturePartMgr.h" - +#include "RivWellPathsPartMgr.h" #include "cafCadNavigation.h" #include "cafCeetronPlusNavigation.h" #include "cafDisplayCoordTransform.h" #include "cafFrameAnimationControl.h" -#include "cafPdmUiTreeOrdering.h" #include "cafOverlayScalarMapperLegend.h" +#include "cafPdmUiTreeOrdering.h" #include "cvfDrawable.h" #include "cvfModelBasicList.h" #include "cvfPart.h" #include "cvfScene.h" -#include "cvfViewport.h" +#include "cvfViewport.h" #include "cvfqtUtils.h" #include #include - - CAF_PDM_SOURCE_INIT(RimEclipseView, "ReservoirView"); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseView::RimEclipseView() { - RiaApplication* app = RiaApplication::instance(); + RiaApplication* app = RiaApplication::instance(); RiaPreferences* preferences = app->preferences(); CVF_ASSERT(preferences); CAF_PDM_InitObject("Reservoir View", ":/3DView16x16.png", "", ""); - - CAF_PDM_InitFieldNoDefault(&m_cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", ""); m_cellResult = new RimEclipseCellColors(); m_cellResult.uiCapability()->setUiHidden(true); m_cellResult->setDiffResultOptionsEnabled(true); - CAF_PDM_InitFieldNoDefault(&m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", ""); + CAF_PDM_InitFieldNoDefault(&m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", ""); m_cellEdgeResult = new RimCellEdgeColors(); m_cellEdgeResult.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault(&m_faultResultSettings, "FaultResultSettings", "Separate Fault Result", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_faultResultSettings, "FaultResultSettings", "Separate Fault Result", "", "", ""); m_faultResultSettings = new RimEclipseFaultColors(); m_faultResultSettings.uiCapability()->setUiHidden(true); - + CAF_PDM_InitFieldNoDefault(&m_fractureColors, "StimPlanColors", "Fracture", "", "", ""); m_fractureColors = new RimStimPlanColors(); m_fractureColors.uiCapability()->setUiHidden(true); @@ -156,12 +152,12 @@ RimEclipseView::RimEclipseView() m_propertyFilterCollection.uiCapability()->setUiHidden(true); // Visualization fields - CAF_PDM_InitField(&m_showMainGrid_OBSOLETE, "ShowMainGrid", true, "Show Main Grid", "", "", ""); + CAF_PDM_InitField(&m_showMainGrid_OBSOLETE, "ShowMainGrid", true, "Show Main Grid", "", "", ""); RiaFieldhandleTools::disableWriteAndSetFieldHidden(&m_showMainGrid_OBSOLETE); - CAF_PDM_InitField(&m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", ""); - CAF_PDM_InitField(&m_showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells", "", "", ""); - + CAF_PDM_InitField(&m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", ""); + CAF_PDM_InitField(&m_showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells", "", "", ""); + this->cellResult()->setReservoirView(this); this->cellEdgeResult()->setReservoirView(this); @@ -170,8 +166,8 @@ RimEclipseView::RimEclipseView() this->faultResultSettings()->setReservoirView(this); m_reservoirGridPartManager = new RivReservoirViewPartMgr(this); - m_simWellsPartManager = new RivReservoirSimWellsPartMgr(this); - m_eclipseCase = nullptr; + m_simWellsPartManager = new RivReservoirSimWellsPartMgr(this); + m_eclipseCase = nullptr; nameConfig()->setCustomName("3D View"); nameConfig()->hideCaseNameField(false); @@ -181,7 +177,7 @@ RimEclipseView::RimEclipseView() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseView::~RimEclipseView() { @@ -199,9 +195,8 @@ RimEclipseView::~RimEclipseView() m_eclipseCase = nullptr; } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseCellColors* RimEclipseView::cellResult() const { @@ -209,7 +204,7 @@ RimEclipseCellColors* RimEclipseView::cellResult() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimCellEdgeColors* RimEclipseView::cellEdgeResult() const { @@ -217,7 +212,7 @@ RimCellEdgeColors* RimEclipseView::cellEdgeResult() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseFaultColors* RimEclipseView::faultResultSettings() const { @@ -225,7 +220,7 @@ RimEclipseFaultColors* RimEclipseView::faultResultSettings() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimStimPlanColors* RimEclipseView::fractureColors() const { @@ -233,7 +228,7 @@ RimStimPlanColors* RimEclipseView::fractureColors() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimSimWellInViewCollection* RimEclipseView::wellCollection() const { @@ -241,7 +236,7 @@ RimSimWellInViewCollection* RimEclipseView::wellCollection() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimFaultInViewCollection* RimEclipseView::faultCollection() const { @@ -249,7 +244,7 @@ RimFaultInViewCollection* RimEclipseView::faultCollection() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimVirtualPerforationResults* RimEclipseView::virtualPerforationResult() const { @@ -261,19 +256,19 @@ RimVirtualPerforationResults* RimEclipseView::virtualPerforationResult() const //-------------------------------------------------------------------------------------------------- void RimEclipseView::clampCurrentTimestep() { - if (this->currentGridCellResults()) + if (this->currentGridCellResults()) { if (m_currentTimeStep() >= static_cast(this->currentGridCellResults()->maxTimeStepCount())) { - m_currentTimeStep = static_cast(this->currentGridCellResults()->maxTimeStepCount()) -1; + m_currentTimeStep = static_cast(this->currentGridCellResults()->maxTimeStepCount()) - 1; } } - if (m_currentTimeStep < 0 ) m_currentTimeStep = 0; + if (m_currentTimeStep < 0) m_currentTimeStep = 0; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::setVisibleGridParts(const std::vector& cellSets) { @@ -281,18 +276,18 @@ void RimEclipseView::setVisibleGridParts(const std::vector& cell } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::setVisibleGridPartsWatertight() { - for (RivCellSetEnum cellSetType : m_visibleGridParts) - { - m_reservoirGridPartManager->forceWatertightGeometryOnForType(cellSetType); - } + for (RivCellSetEnum cellSetType : m_visibleGridParts) + { + m_reservoirGridPartManager->forceWatertightGeometryOnForType(cellSetType); + } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { @@ -308,7 +303,7 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c else if (changedField == &m_showInactiveCells) { this->updateGridBoxData(); - + this->scheduleGeometryRegen(INACTIVE); this->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE); @@ -326,16 +321,16 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c this->scheduleGeometryRegen(PROPERTY_FILTERED); scheduleCreateDisplayModelAndRedraw(); - } + } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateScaleTransform() { cvf::Mat4d scale = cvf::Mat4d::IDENTITY; - scale(2, 2) = scaleZ(); + scale(2, 2) = scaleZ(); this->scaleTransform()->setLocalTransform(scale); m_simWellsPartManager->setScaleTransform(this->scaleTransform()); @@ -378,25 +373,22 @@ void RimEclipseView::createDisplayModel() { timeStepIndices.push_back(i); } - } - else if (this->cellResult()->hasStaticResult() - || this->cellEdgeResult()->hasResult() - || this->eclipsePropertyFilterCollection()->hasActiveFilters()) + } + else if (this->cellResult()->hasStaticResult() || this->cellEdgeResult()->hasResult() || + this->eclipsePropertyFilterCollection()->hasActiveFilters()) { // The one and only result entry timeStepIndices.push_back(0); } - - cvf::Collection frameModels; - size_t timeIdx; + size_t timeIdx; for (timeIdx = 0; timeIdx < timeStepIndices.size(); timeIdx++) { frameModels.push_back(new cvf::ModelBasicList); } - // Remove all existing animation frames from the viewer. + // Remove all existing animation frames from the viewer. // The parts are still cached in the RivReservoir geometry and friends m_viewer->removeAllFrames(); @@ -406,15 +398,13 @@ void RimEclipseView::createDisplayModel() std::vector gridIndices = this->indicesToVisibleGrids(); /// - // Get or create the parts for "static" type geometry. The same geometry is used + // Get or create the parts for "static" type geometry. The same geometry is used // for the different frames. updateCurrentTimeStep updates the colors etc. - // For property filtered geometry : just set all the models as empty scenes + // For property filtered geometry : just set all the models as empty scenes // updateCurrentTimeStep requests the actual parts - - if (!this->eclipsePropertyFilterCollection()->hasActiveFilters() - || ( this->viewController() - && this->viewController()->isVisibleCellsOveridden()) ) + if (!this->eclipsePropertyFilterCollection()->hasActiveFilters() || + (this->viewController() && this->viewController()->isVisibleCellsOveridden())) { std::vector geometryTypesToAdd; @@ -458,7 +448,7 @@ void RimEclipseView::createDisplayModel() } } - // NOTE: This assignment must be done here, as m_visibleGridParts is used in code triggered by + // NOTE: This assignment must be done here, as m_visibleGridParts is used in code triggered by // m_reservoirGridPartManager->appendStaticGeometryPartsToModel() setVisibleGridParts(geometryTypesToAdd); @@ -467,20 +457,21 @@ void RimEclipseView::createDisplayModel() { for (size_t gtIdx = 0; gtIdx < geometryTypesToAdd.size(); ++gtIdx) { - if ( isGridVisualizationMode() ) + if (isGridVisualizationMode()) { - m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices); + m_reservoirGridPartManager->appendStaticGeometryPartsToModel( + frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices); } else { - m_reservoirGridPartManager->ensureStaticGeometryPartsCreated( geometryTypesToAdd[gtIdx]); + m_reservoirGridPartManager->ensureStaticGeometryPartsCreated(geometryTypesToAdd[gtIdx]); } } } - // Set static colors + // Set static colors this->updateStaticCellColors(); } - else + else { std::vector empty; setVisibleGridParts(empty); @@ -488,20 +479,20 @@ void RimEclipseView::createDisplayModel() m_reservoirGridPartManager->clearWatertightGeometryFlags(); - if ( faultCollection()->showFaultCollection() - || !this->eclipsePropertyFilterCollection()->hasActiveFilters() ) + if (faultCollection()->showFaultCollection() || !this->eclipsePropertyFilterCollection()->hasActiveFilters()) { setVisibleGridPartsWatertight(); std::set faultGeometryTypesToAppend = allVisibleFaultGeometryTypes(); - RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters()); + RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels( + faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters()); for (size_t frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx) { for (RivCellSetEnum geometryType : faultGeometryTypesToAppend) { if (geometryType == PROPERTY_FILTERED || geometryType == PROPERTY_FILTERED_WELL_CELLS) continue; - + m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryType); } @@ -509,7 +500,6 @@ void RimEclipseView::createDisplayModel() } } - // Cross sections m_crossSectionVizModel->removeAllParts(); @@ -527,14 +517,14 @@ void RimEclipseView::createDisplayModel() addWellPathsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox()); - m_wellPathsPartManager->appendStaticFracturePartsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox()); + m_wellPathsPartManager->appendStaticFracturePartsToModel(m_wellPathPipeVizModel.p(), + currentActiveCellInfo()->geometryBoundingBox()); m_wellPathPipeVizModel->updateBoundingBoxesRecursive(); m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p()); // Create Scenes from the frameModels // Animation frames for results display, starts from frame 1 - size_t frameIndex; for (frameIndex = 0; frameIndex < frameModels.size(); frameIndex++) { @@ -576,7 +566,7 @@ void RimEclipseView::createDisplayModel() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateCurrentTimeStep() { @@ -620,8 +610,10 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors() if (isGridVisualizationMode()) { - m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED, m_currentTimeStep, gridIndices); - m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices); + m_reservoirGridPartManager->appendDynamicGeometryPartsToModel( + frameParts.p(), PROPERTY_FILTERED, m_currentTimeStep, gridIndices); + m_reservoirGridPartManager->appendDynamicGeometryPartsToModel( + frameParts.p(), PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices); } else { @@ -637,7 +629,8 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors() { if (geometryType == PROPERTY_FILTERED || geometryType == PROPERTY_FILTERED_WELL_CELLS) { - m_reservoirGridPartManager->appendFaultsDynamicGeometryPartsToModel(frameParts.p(), geometryType, m_currentTimeStep); + m_reservoirGridPartManager->appendFaultsDynamicGeometryPartsToModel( + frameParts.p(), geometryType, m_currentTimeStep); } else { @@ -645,10 +638,12 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors() } } - RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters()); + RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels( + faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters()); if (faultLabelType == PROPERTY_FILTERED) { - m_reservoirGridPartManager->appendFaultLabelsDynamicGeometryPartsToModel(frameParts.p(), faultLabelType, m_currentTimeStep); + m_reservoirGridPartManager->appendFaultLabelsDynamicGeometryPartsToModel( + frameParts.p(), faultLabelType, m_currentTimeStep); } else { @@ -656,15 +651,17 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors() } // Set the transparency on all the Wellcell parts before setting the result color - float opacity = static_cast (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0)); - m_reservoirGridPartManager->updateCellColor(PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity)); - + float opacity = static_cast(1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0)); + m_reservoirGridPartManager->updateCellColor( + PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity)); if (this->showInactiveCells()) { - if (this->rangeFilterCollection()->hasActiveFilters()) // Wells not considered, because we do not have a INACTIVE_WELL_CELLS group yet. + if (this->rangeFilterCollection() + ->hasActiveFilters()) // Wells not considered, because we do not have a INACTIVE_WELL_CELLS group yet. { - m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RANGE_FILTERED_INACTIVE, gridIndices); + m_reservoirGridPartManager->appendStaticGeometryPartsToModel( + frameParts.p(), RANGE_FILTERED_INACTIVE, gridIndices); if (!faultCollection()->isShowingFaultsAndFaultsOutsideFilters()) { @@ -720,9 +717,11 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors() { if (this->hasUserRequestedAnimation() && this->cellEdgeResult()->hasResult()) { - m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult()); + m_reservoirGridPartManager->updateCellEdgeResultColor( + geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult()); } - else if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected()) + else if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || + this->cellResult()->isTernarySaturationSelected()) { m_reservoirGridPartManager->updateCellResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult()); } @@ -734,12 +733,12 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors() this->updateFaultColors(); - - if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected()) + if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || + this->cellResult()->isTernarySaturationSelected()) { m_crossSectionCollection->updateCellResultColor(m_currentTimeStep, - this->cellResult()->legendConfig()->scalarMapper(), - this->cellResult()->ternaryLegendConfig()->scalarMapper()); + this->cellResult()->legendConfig()->scalarMapper(), + this->cellResult()->ternaryLegendConfig()->scalarMapper()); } else { @@ -805,7 +804,8 @@ void RimEclipseView::appendWellsAndFracturesToModel() f->firstAncestorOrThisOfType(simWell); if (simWell) { - bool isAnyGeometryPresent = simWell->isWellPipeVisible(m_currentTimeStep) || simWell->isWellSpheresVisible(m_currentTimeStep); + bool isAnyGeometryPresent = + simWell->isWellPipeVisible(m_currentTimeStep) || simWell->isWellSpheresVisible(m_currentTimeStep); if (!isAnyGeometryPresent) { continue; @@ -823,7 +823,7 @@ void RimEclipseView::appendWellsAndFracturesToModel() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::onLoadDataAndUpdate() { @@ -833,10 +833,10 @@ void RimEclipseView::onLoadDataAndUpdate() { if (!m_eclipseCase->openReserviorCase()) { - QMessageBox::warning(RiuMainWindow::instance(), - "Error when opening project file", - "Could not open the Eclipse Grid file: \n"+ m_eclipseCase->gridFileName()); - this->setEclipseCase( nullptr); + QMessageBox::warning(RiuMainWindow::instance(), + "Error when opening project file", + "Could not open the Eclipse Grid file: \n" + m_eclipseCase->gridFileName()); + this->setEclipseCase(nullptr); return; } } @@ -862,10 +862,10 @@ void RimEclipseView::onLoadDataAndUpdate() syncronizeWellsWithResults(); syncronizeLocalAnnotationsFromGlobal(); - + { // Update simulation well fractures after well cell results are imported - + std::vector simFractures; this->descendantsIncludingThisOfType(simFractures); for (auto fracture : simFractures) @@ -882,8 +882,6 @@ void RimEclipseView::onLoadDataAndUpdate() this->scheduleCreateDisplayModelAndRedraw(); } - - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -893,7 +891,7 @@ caf::PdmFieldHandle* RimEclipseView::userDescriptionField() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::initAfterRead() { @@ -911,27 +909,26 @@ void RimEclipseView::initAfterRead() this->updateUiIconFromToggleField(); } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateStaticCellColors() { - updateStaticCellColors( OVERRIDDEN_CELL_VISIBILITY); - updateStaticCellColors( ACTIVE); - updateStaticCellColors( ALL_WELL_CELLS); - updateStaticCellColors( VISIBLE_WELL_CELLS); - updateStaticCellColors( VISIBLE_WELL_FENCE_CELLS); - updateStaticCellColors( VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); - updateStaticCellColors( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); - updateStaticCellColors( INACTIVE); - updateStaticCellColors( RANGE_FILTERED); - updateStaticCellColors( RANGE_FILTERED_WELL_CELLS); - updateStaticCellColors( RANGE_FILTERED_INACTIVE); + updateStaticCellColors(OVERRIDDEN_CELL_VISIBILITY); + updateStaticCellColors(ACTIVE); + updateStaticCellColors(ALL_WELL_CELLS); + updateStaticCellColors(VISIBLE_WELL_CELLS); + updateStaticCellColors(VISIBLE_WELL_FENCE_CELLS); + updateStaticCellColors(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); + updateStaticCellColors(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); + updateStaticCellColors(INACTIVE); + updateStaticCellColors(RANGE_FILTERED); + updateStaticCellColors(RANGE_FILTERED_WELL_CELLS); + updateStaticCellColors(RANGE_FILTERED_INACTIVE); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateStaticCellColors(RivCellSetEnum geometryType) { @@ -950,27 +947,45 @@ void RimEclipseView::updateStaticCellColors(RivCellSetEnum geometryType) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- cvf::Color4f RimEclipseView::colorFromCellCategory(RivCellSetEnum geometryType) const { - float opacity = static_cast (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0)); + float opacity = static_cast(1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0)); cvf::Color4f color(cvf::Color3::ORANGE); switch (geometryType) { - case ACTIVE: color = cvf::Color4f(cvf::Color3::ORANGE); break; - case ALL_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break; - case VISIBLE_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break; - case VISIBLE_WELL_FENCE_CELLS: color = cvf::Color4f(cvf::Color3::ORANGE); break; - case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: - color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break; - case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: - color = cvf::Color4f(cvf::Color3::ORANGE); break; - case INACTIVE: color = cvf::Color4f(RiaColorTables::undefinedCellColor()); break; - case RANGE_FILTERED: color = cvf::Color4f(cvf::Color3::ORANGE); break; - case RANGE_FILTERED_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break; - case RANGE_FILTERED_INACTIVE: color = cvf::Color4f(RiaColorTables::undefinedCellColor()); break; + case ACTIVE: + color = cvf::Color4f(cvf::Color3::ORANGE); + break; + case ALL_WELL_CELLS: + color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); + break; + case VISIBLE_WELL_CELLS: + color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); + break; + case VISIBLE_WELL_FENCE_CELLS: + color = cvf::Color4f(cvf::Color3::ORANGE); + break; + case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: + color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); + break; + case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: + color = cvf::Color4f(cvf::Color3::ORANGE); + break; + case INACTIVE: + color = cvf::Color4f(RiaColorTables::undefinedCellColor()); + break; + case RANGE_FILTERED: + color = cvf::Color4f(cvf::Color3::ORANGE); + break; + case RANGE_FILTERED_WELL_CELLS: + color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); + break; + case RANGE_FILTERED_INACTIVE: + color = cvf::Color4f(RiaColorTables::undefinedCellColor()); + break; } return color; @@ -1011,7 +1026,7 @@ QString RimEclipseView::createAutoName() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateDisplayModelVisibility() { @@ -1041,13 +1056,11 @@ RigCaseCellResultsData* RimEclipseView::currentGridCellResults() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- const RigActiveCellInfo* RimEclipseView::currentActiveCellInfo() const { - if (m_eclipseCase && - m_eclipseCase->eclipseCaseData() - ) + if (m_eclipseCase && m_eclipseCase->eclipseCaseData()) { return m_eclipseCase->eclipseCaseData()->activeCellInfo(cellResult()->porosityModel()); } @@ -1055,9 +1068,8 @@ const RigActiveCellInfo* RimEclipseView::currentActiveCellInfo() const return nullptr; } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::scheduleGeometryRegen(RivCellSetEnum geometryType) { @@ -1076,7 +1088,7 @@ void RimEclipseView::scheduleGeometryRegen(RivCellSetEnum geometryType) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::scheduleReservoirGridGeometryRegen() { @@ -1092,9 +1104,8 @@ void RimEclipseView::scheduleSimWellGeometryRegen() m_simWellsPartManager->scheduleGeometryRegen(); } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- std::vector RimEclipseView::indicesToVisibleGrids() const { @@ -1104,7 +1115,7 @@ std::vector RimEclipseView::indicesToVisibleGrids() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateLegends() { @@ -1113,7 +1124,7 @@ void RimEclipseView::updateLegends() m_viewer->removeAllColorLegends(); } - if (!m_eclipseCase || !m_viewer || !m_eclipseCase->eclipseCaseData() ) + if (!m_eclipseCase || !m_viewer || !m_eclipseCase->eclipseCaseData()) { return; } @@ -1146,14 +1157,16 @@ void RimEclipseView::updateLegends() this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax); this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero); - this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero); + this->cellEdgeResult()->legendConfig()->setClosestToZeroValues( + globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero); this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax); if (this->cellEdgeResult()->hasCategoryResult()) { if (cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RiaDefines::FORMATION_NAMES) { - cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->eclipseResultAddress())); + cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues( + cellEdgeResult()->singleVarEdgeResultColors()->eclipseResultAddress())); } else { @@ -1163,13 +1176,15 @@ void RimEclipseView::updateLegends() } } - this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName()); + this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") + + this->cellEdgeResult()->resultVariableUiShortName()); m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->titledOverlayFrame()); } else { this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(0, 0, 0, 0); - this->cellEdgeResult()->legendConfig()->setAutomaticRanges(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE); + this->cellEdgeResult()->legendConfig()->setAutomaticRanges( + cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE); } } @@ -1177,13 +1192,13 @@ void RimEclipseView::updateLegends() if (stimPlanLegend && stimPlanLegend->showLegend()) { fractureColors()->updateLegendData(); - + if (fractureColors()->isChecked() && stimPlanLegend->titledOverlayFrame()) { m_viewer->addColorLegendToBottomLeftCorner(stimPlanLegend->titledOverlayFrame()); } } - + if (m_virtualPerforationResult->showConnectionFactors() && m_virtualPerforationResult->legendConfig()->showLegend()) { updateVirtualConnectionLegendRanges(); @@ -1194,10 +1209,10 @@ void RimEclipseView::updateLegends() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, - RimEclipseCellColors* resultColors, +void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, + RimEclipseCellColors* resultColors, RigCaseCellResultsData* cellResultsData) { resultColors->updateLegendData(m_currentTimeStep); @@ -1209,7 +1224,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, { title += QString("\n%1").arg(resultColors->diffResultUiShortName()); } - + resultColors->legendConfig()->setTitle(title); m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->titledOverlayFrame()); } @@ -1226,19 +1241,19 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::setEclipseCase(RimEclipseCase* reservoir) { m_eclipseCase = reservoir; cellResult()->setEclipseCase(reservoir); faultResultSettings()->customFaultResult()->setEclipseCase(reservoir); - + cellEdgeResult()->setEclipseCase(reservoir); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseCase* RimEclipseView::eclipseCase() const { @@ -1249,9 +1264,9 @@ RimEclipseCase* RimEclipseView::eclipseCase() const // /* wells vs wellres - For all wellres + For all wellres find well - if no well, create new + if no well, create new connect well and wellres for all wells not connected Delete ? @@ -1260,12 +1275,11 @@ RimEclipseCase* RimEclipseView::eclipseCase() const //-------------------------------------------------------------------------------------------------- void RimEclipseView::syncronizeWellsWithResults() { - if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData()) ) return; + if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData())) return; cvf::Collection wellResults = m_eclipseCase->eclipseCaseData()->wellResults(); - - std::vector > newWells; + std::vector> newWells; // Clear the possible well results data present for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx) @@ -1284,7 +1298,7 @@ void RimEclipseView::syncronizeWellsWithResults() if (!well) { - well = new RimSimWellInView; + well = new RimSimWellInView; well->name = wellResults[wIdx]->m_wellName; isAnyWellCreated = true; @@ -1298,8 +1312,8 @@ void RimEclipseView::syncronizeWellsWithResults() for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx) { - RimSimWellInView* well = this->wellCollection()->wells()[wIdx]; - RigSimWellData* simWellData = well->simWellData(); + RimSimWellInView* well = this->wellCollection()->wells()[wIdx]; + RigSimWellData* simWellData = well->simWellData(); if (simWellData == nullptr) { delete well; @@ -1323,7 +1337,7 @@ void RimEclipseView::syncronizeWellsWithResults() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::syncronizeLocalAnnotationsFromGlobal() { @@ -1339,7 +1353,7 @@ void RimEclipseView::syncronizeLocalAnnotationsFromGlobal() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- const RivReservoirViewPartMgr* RimEclipseView::reservoirGridPartManager() const { @@ -1347,17 +1361,17 @@ const RivReservoirViewPartMgr* RimEclipseView::reservoirGridPartManager() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RivReservoirViewPartMgr * RimEclipseView::reservoirGridPartManager() +RivReservoirViewPartMgr* RimEclipseView::reservoirGridPartManager() { return m_reservoirGridPartManager.p(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase * grid) +void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase* grid) { CVF_ASSERT(visibleCells != nullptr); @@ -1375,13 +1389,13 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC // Loop over the wells and find their contribution for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx) { - RimSimWellInView* well = this->wellCollection()->wells()[wIdx]; + RimSimWellInView* well = this->wellCollection()->wells()[wIdx]; if (well->isWellCellsVisible()) { RigSimWellData* simWellData = well->simWellData(); if (!simWellData) continue; - const std::vector< RigWellResultFrame >& wellResFrames = simWellData->m_wellCellsTimeSteps; + const std::vector& wellResFrames = simWellData->m_wellCellsTimeSteps; for (size_t wfIdx = 0; wfIdx < wellResFrames.size(); ++wfIdx) { // Add all the cells from the branches @@ -1390,7 +1404,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx) { const std::vector& wsResCells = wellResSegments[wsIdx].m_branchResultPoints; - for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx) + for (size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx) { if (wsResCells[cIdx].m_gridIndex == grid->gridIndex()) { @@ -1399,7 +1413,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC continue; } - size_t gridCellIndex = wsResCells[cIdx].m_gridCellIndex; + size_t gridCellIndex = wsResCells[cIdx].m_gridCellIndex; (*visibleCells)[gridCellIndex] = true; // Calculate well fence cells @@ -1408,31 +1422,31 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC size_t i, j, k; grid->ijkFromCellIndex(gridCellIndex, &i, &j, &k); - size_t* pI = &i; - size_t *pJ = &j; - size_t *pK = &k; - size_t cellCountFenceDirection = 0; - size_t fIdx = 0; + size_t* pI = &i; + size_t* pJ = &j; + size_t* pK = &k; + size_t cellCountFenceDirection = 0; + size_t fIdx = 0; if (this->wellCollection()->wellCellFenceType == RimSimWellInViewCollection::K_DIRECTION) { cellCountFenceDirection = grid->cellCountK(); - pK = &fIdx; + pK = &fIdx; } else if (this->wellCollection()->wellCellFenceType == RimSimWellInViewCollection::J_DIRECTION) { cellCountFenceDirection = grid->cellCountJ(); - pJ = &fIdx; + pJ = &fIdx; } else if (this->wellCollection()->wellCellFenceType == RimSimWellInViewCollection::I_DIRECTION) { cellCountFenceDirection = grid->cellCountI(); - pI = &fIdx; + pI = &fIdx; } - for ( fIdx = 0; fIdx < cellCountFenceDirection; ++fIdx) + for (fIdx = 0; fIdx < cellCountFenceDirection; ++fIdx) { - size_t fenceCellIndex = grid->cellIndexFromIJK(*pI,*pJ,*pK); + size_t fenceCellIndex = grid->cellIndexFromIJK(*pI, *pJ, *pK); size_t reservoirCellIndex = grid->reservoirCellIndex(fenceCellIndex); if (activeCellInfo && activeCellInfo->isActive(reservoirCellIndex)) @@ -1450,7 +1464,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateDisplayModelForWellResults() { @@ -1467,13 +1481,11 @@ void RimEclipseView::updateDisplayModelForWellResults() m_viewer->animationControl()->setCurrentFrame(m_currentTimeStep); } - RiuMainWindow::instance()->refreshAnimationActions(); - + RiuMainWindow::instance()->refreshAnimationActions(); } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::calculateCompletionTypeAndRedrawIfRequired() { @@ -1517,7 +1529,7 @@ void RimEclipseView::calculateCompletionTypeAndRedrawIfRequired() std::vector intersections = m_crossSectionCollection->intersections(); for (auto intersection : intersections) { - if ( intersection && intersection->correspondingIntersectionView() ) + if (intersection && intersection->correspondingIntersectionView()) { intersection->correspondingIntersectionView()->scheduleCreateDisplayModelAndRedraw(); } @@ -1534,7 +1546,7 @@ void RimEclipseView::calculateCompletionTypeAndRedrawIfRequired() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipseView::isVirtualConnectionFactorGeometryVisible() const { @@ -1548,12 +1560,13 @@ bool RimEclipseView::isVirtualConnectionFactorGeometryVisible() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipseView::isMainGridVisible() const { auto indicesToVisibleGrids = m_gridCollection->indicesToVisibleGrids(); - bool isMainGridVisible = std::find(indicesToVisibleGrids.begin(), indicesToVisibleGrids.end(), 0) != indicesToVisibleGrids.end(); + bool isMainGridVisible = + std::find(indicesToVisibleGrids.begin(), indicesToVisibleGrids.end(), 0) != indicesToVisibleGrids.end(); if (!isMainGridVisible) return false; @@ -1561,7 +1574,7 @@ bool RimEclipseView::isMainGridVisible() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- const std::vector& RimEclipseView::visibleGridParts() const { @@ -1569,7 +1582,7 @@ const std::vector& RimEclipseView::visibleGridParts() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { @@ -1586,7 +1599,7 @@ void RimEclipseView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) { @@ -1601,7 +1614,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering RimProject* project = RiaApplication::instance()->project(); CVF_ASSERT(project); RimOilField* oilfield = project->activeOilField(); - + if (oilfield && oilfield->fractureDefinitionCollection()) { if (!oilfield->fractureDefinitionCollection()->fractureTemplates().empty()) @@ -1615,14 +1628,14 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering uiTreeOrdering.add(faultCollection()); uiTreeOrdering.add(annotationCollection()); uiTreeOrdering.add(crossSectionCollection()); - + uiTreeOrdering.add(m_rangeFilterCollection()); uiTreeOrdering.add(m_propertyFilterCollection()); uiTreeOrdering.skipRemainingChildren(true); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- std::set RimEclipseView::allVisibleFaultGeometryTypes() const { @@ -1644,7 +1657,7 @@ std::set RimEclipseView::allVisibleFaultGeometryTypes() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateFaultColors() { @@ -1656,7 +1669,8 @@ void RimEclipseView::updateFaultColors() { if (this->hasUserRequestedAnimation() && this->cellEdgeResult()->hasResult()) { - m_reservoirGridPartManager->updateFaultCellEdgeResultColor(cellSetType, m_currentTimeStep, faultResultColors, this->cellEdgeResult()); + m_reservoirGridPartManager->updateFaultCellEdgeResultColor( + cellSetType, m_currentTimeStep, faultResultColors, this->cellEdgeResult()); } else { @@ -1665,20 +1679,19 @@ void RimEclipseView::updateFaultColors() } } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipseView::isTimeStepDependentDataVisible() const { if (this->cellResult()->hasDynamicResult()) return true; if (this->eclipsePropertyFilterCollection()->hasActiveDynamicFilters()) return true; - + if (this->wellCollection()->hasVisibleWellPipes()) return true; if (this->cellResult()->isTernarySaturationSelected()) return true; - + if (this->faultResultSettings()->showCustomFaultResult()) { if (this->faultResultSettings()->customFaultResult()->hasDynamicResult()) return true; @@ -1693,9 +1706,8 @@ bool RimEclipseView::isTimeStepDependentDataVisible() const return false; } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseCellColors* RimEclipseView::currentFaultResultColors() { @@ -1710,7 +1722,7 @@ RimEclipseCellColors* RimEclipseView::currentFaultResultColors() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::resetLegendsInViewer() { @@ -1721,7 +1733,7 @@ void RimEclipseView::resetLegendsInViewer() this->cellEdgeResult()->legendConfig()->recreateLegend(); m_viewer->removeAllColorLegends(); - + if (cellResultNormalLegendConfig) { m_viewer->addColorLegendToBottomLeftCorner(cellResultNormalLegendConfig->titledOverlayFrame()); @@ -1731,17 +1743,18 @@ void RimEclipseView::resetLegendsInViewer() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::updateVirtualConnectionLegendRanges() { if (!eclipseCase()) return; - const RigVirtualPerforationTransmissibilities* virtualTransmissibilities = eclipseCase()->computeAndGetVirtualPerforationTransmissibilities(); + const RigVirtualPerforationTransmissibilities* virtualTransmissibilities = + eclipseCase()->computeAndGetVirtualPerforationTransmissibilities(); if (virtualTransmissibilities) { - double minValue = HUGE_VAL; - double maxValue = -HUGE_VAL; + double minValue = HUGE_VAL; + double maxValue = -HUGE_VAL; double posClosestToZero = HUGE_VAL; double negClosestToZero = -HUGE_VAL; @@ -1758,7 +1771,7 @@ void RimEclipseView::updateVirtualConnectionLegendRanges() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- cvf::Transform* RimEclipseView::scaleTransform() { @@ -1766,7 +1779,7 @@ cvf::Transform* RimEclipseView::scaleTransform() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimCase* RimEclipseView::ownerCase() const { @@ -1774,7 +1787,7 @@ RimCase* RimEclipseView::ownerCase() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RigMainGrid* RimEclipseView::mainGrid() const { @@ -1787,7 +1800,7 @@ RigMainGrid* RimEclipseView::mainGrid() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipsePropertyFilterCollection* RimEclipseView::eclipsePropertyFilterCollection() { @@ -1802,7 +1815,7 @@ RimEclipsePropertyFilterCollection* RimEclipseView::eclipsePropertyFilterCollect } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- const RimEclipsePropertyFilterCollection* RimEclipseView::eclipsePropertyFilterCollection() const { @@ -1817,7 +1830,7 @@ const RimEclipsePropertyFilterCollection* RimEclipseView::eclipsePropertyFilterC } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::setOverridePropertyFilterCollection(RimEclipsePropertyFilterCollection* pfc) { @@ -1832,7 +1845,7 @@ void RimEclipseView::setOverridePropertyFilterCollection(RimEclipsePropertyFilte } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStep) { @@ -1844,14 +1857,15 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV for (size_t gridIdx = 0; gridIdx < gridCount; ++gridIdx) { - RigGridBase * grid = this->eclipseCase()->eclipseCaseData()->grid(gridIdx); - int gridCellCount = static_cast(grid->cellCount()); + RigGridBase* grid = this->eclipseCase()->eclipseCaseData()->grid(gridIdx); + int gridCellCount = static_cast(grid->cellCount()); for (size_t gpIdx = 0; gpIdx < m_visibleGridParts.size(); ++gpIdx) { - const cvf::UByteArray* visibility = m_reservoirGridPartManager->cellVisibility(m_visibleGridParts[gpIdx], gridIdx, timeStep); + const cvf::UByteArray* visibility = + m_reservoirGridPartManager->cellVisibility(m_visibleGridParts[gpIdx], gridIdx, timeStep); - for (int lcIdx = 0; lcIdx < gridCellCount; ++ lcIdx) + for (int lcIdx = 0; lcIdx < gridCellCount; ++lcIdx) { (*totalVisibility)[grid->reservoirCellIndex(lcIdx)] |= (*visibility)[lcIdx]; } @@ -1860,7 +1874,7 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- std::vector RimEclipseView::legendConfigs() const { @@ -1878,7 +1892,7 @@ std::vector RimEclipseView::legendConfigs() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipseView::showActiveCellsOnly() { @@ -1886,11 +1900,11 @@ bool RimEclipseView::showActiveCellsOnly() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEclipseView::createPartCollectionFromSelection(cvf::Collection* parts) { - Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance(); + Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance(); std::vector items; riuSelManager->selectedItems(items); @@ -1904,7 +1918,9 @@ void RimEclipseView::createPartCollectionFromSelection(cvf::Collectionm_view->eclipseCase()); CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData()); - RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_gridLocalCellIndex); + RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData(), + eclipseSelItem->m_gridIndex, + eclipseSelItem->m_gridLocalCellIndex); cvf::ref part = partGen.createPart(eclipseSelItem->m_color); part->setTransform(this->scaleTransform()); @@ -1916,7 +1932,7 @@ void RimEclipseView::createPartCollectionFromSelection(cvf::CollectionresultType() == RiaDefines::FORMATION_NAMES)) return true; - + return eclipsePropertyFilterCollection()->isUsingFormationNames(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipseView::showInvalidCells() const { @@ -1959,7 +1975,7 @@ bool RimEclipseView::showInvalidCells() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEclipseView::showInactiveCells() const { @@ -1967,7 +1983,7 @@ bool RimEclipseView::showInactiveCells() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- const RimPropertyFilterCollection* RimEclipseView::propertyFilterCollection() const {