#1068 Access mainGrid directly from RimEclipseView

This commit is contained in:
Magne Sjaastad 2017-01-09 15:15:08 +01:00
parent 5ffb1daeca
commit 9cacf0db6c
6 changed files with 30 additions and 40 deletions

View File

@ -107,16 +107,13 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
RigMainGrid* RimCellRangeFilterCollection::mainGrid() const
{
RimEclipseView* eclipseView = this->eclipseView();
if (eclipseView &&
eclipseView->eclipseCase() &&
eclipseView->eclipseCase()->reservoirData() &&
eclipseView->eclipseCase()->reservoirData()->mainGrid())
if (eclipseView && eclipseView->mainGrid())
{
return eclipseView->eclipseCase()->reservoirData()->mainGrid();
return eclipseView->mainGrid();
}
return NULL;
return nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@ -465,7 +465,7 @@ void RimEclipseView::createDisplayModel()
*/
// Well path model
RigMainGrid* mainGrid = eclipseCase()->reservoirData()->mainGrid();
RigMainGrid* mainGrid = this->mainGrid();
m_wellPathPipeVizModel->removeAllParts();
addWellPathsToModel(m_wellPathPipeVizModel.p(),
@ -1589,7 +1589,7 @@ void RimEclipseView::setOverridePropertyFilterCollection(RimEclipsePropertyFilte
void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility)
{
size_t gridCount = this->eclipseCase()->reservoirData()->gridCount();
size_t cellCount = this->eclipseCase()->reservoirData()->mainGrid()->globalCellArray().size();
size_t cellCount = this->mainGrid()->globalCellArray().size();
totalVisibility->resize(cellCount);
totalVisibility->setAll(false);

View File

@ -185,11 +185,11 @@ bool faultComparator(const cvf::ref<RigFault>& a, const cvf::ref<RigFault>& b)
//--------------------------------------------------------------------------------------------------
void RimFaultCollection::syncronizeFaults()
{
if (!(m_reservoirView && m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData() && m_reservoirView->eclipseCase()->reservoirData()->mainGrid()) ) return;
if (!(m_reservoirView && m_reservoirView->mainGrid()) ) return;
cvf::ref<cvf::Color3fArray> partColors = RivColorTableArray::colorTableArray();
const cvf::Collection<RigFault> constRigFaults = m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->faults();
const cvf::Collection<RigFault> constRigFaults = m_reservoirView->mainGrid()->faults();
cvf::Collection<RigFault> rigFaults;
{
@ -270,7 +270,7 @@ void RimFaultCollection::syncronizeFaults()
// NNCs
this->noCommonAreaNnncCollection()->noCommonAreaNncs().deleteAllChildObjects();
RigMainGrid* mainGrid = m_reservoirView->eclipseCase()->reservoirData()->mainGrid();
RigMainGrid* mainGrid = m_reservoirView->mainGrid();
std::vector<RigConnection>& nncConnections = mainGrid->nncData()->connections();
for (size_t i = 0; i < nncConnections.size(); i++)
{
@ -397,7 +397,7 @@ void RimFaultCollection::setShowFaultsOutsideFilters(bool enableState)
//--------------------------------------------------------------------------------------------------
void RimFaultCollection::addMockData()
{
if (!(m_reservoirView && m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData() && m_reservoirView->eclipseCase()->reservoirData()->mainGrid())) return;
if (!(m_reservoirView && m_reservoirView->mainGrid())) return;
}

View File

@ -21,7 +21,7 @@
#include "RiaApplication.h"
#include "RigCaseData.h"
//#include "RigCaseData.h"
#include "RigCaseToCaseCellMapper.h"
#include "RigCaseToCaseRangeFilterMapper.h"
#include "RigFemPartCollection.h"
@ -570,14 +570,14 @@ const RigCaseToCaseCellMapper* RimViewController::cellMapper()
RigFemPart* masterFemPart = NULL;
RigFemPart* dependFemPart = NULL;
if (masterEclipseView && masterEclipseView->eclipseCase()->reservoirData())
if (masterEclipseView)
{
masterEclGrid = masterEclipseView->eclipseCase()->reservoirData()->mainGrid();
masterEclGrid = masterEclipseView->mainGrid();
}
if (dependEclipseView && dependEclipseView->eclipseCase()->reservoirData())
if (dependEclipseView)
{
dependEclGrid = dependEclipseView->eclipseCase()->reservoirData()->mainGrid();
dependEclGrid = dependEclipseView->mainGrid();
}
if (masterGeomechView && masterGeomechView->geoMechCase()->geoMechData()
@ -971,9 +971,9 @@ void RimViewController::updateRangeFilterOverrides(RimCellRangeFilter* changedRa
if (eclipseMasterView && depGeomView)
{
if (eclipseMasterView->eclipseCase()->reservoirData())
if (eclipseMasterView->mainGrid())
{
RigMainGrid* srcEclGrid = eclipseMasterView->eclipseCase()->reservoirData()->mainGrid();
RigMainGrid* srcEclGrid = eclipseMasterView->mainGrid();
RigFemPart* dstFemPart = depGeomView->geoMechCase()->geoMechData()->femParts()->part(0);
for (size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx)
{
@ -986,10 +986,10 @@ void RimViewController::updateRangeFilterOverrides(RimCellRangeFilter* changedRa
}
else if (geoMasterView && depEclView)
{
if (depEclView->eclipseCase()->reservoirData())
if (depEclView->mainGrid())
{
RigFemPart* srcFemPart = geoMasterView->geoMechCase()->geoMechData()->femParts()->part(0);
RigMainGrid* dstEclGrid = depEclView->eclipseCase()->reservoirData()->mainGrid();
RigMainGrid* dstEclGrid = depEclView->mainGrid();
for (size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx)
{
RimCellRangeFilter* srcRFilter = sourceFilterCollection->rangeFilters[rfIdx];

View File

@ -21,7 +21,7 @@
#include "RiaApplication.h"
#include "RigCaseData.h"
#include "RigMainGrid.h"
#include "RimCase.h"
#include "RimEclipseCellColors.h"
@ -547,12 +547,9 @@ void RimViewLinker::updateCamera(RimView* sourceView)
cvf::BoundingBox sourceSceneBB = sourceView->viewer()->currentScene()->boundingBox();
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(sourceView);
if (eclipseView
&& eclipseView->eclipseCase()
&& eclipseView->eclipseCase()->reservoirData()
&& eclipseView->eclipseCase()->reservoirData()->mainGrid())
if (eclipseView && eclipseView->mainGrid())
{
cvf::Vec3d offset = eclipseView->eclipseCase()->reservoirData()->mainGrid()->displayModelOffset();
cvf::Vec3d offset = eclipseView->mainGrid()->displayModelOffset();
offset.z() *= eclipseView->scaleZ();
sourceCamGlobalEye += offset;
@ -578,12 +575,9 @@ void RimViewLinker::updateCamera(RimView* sourceView)
cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox();
RimEclipseView* destEclipseView = dynamic_cast<RimEclipseView*>(destinationView);
if (destEclipseView
&& destEclipseView->eclipseCase()
&& destEclipseView->eclipseCase()->reservoirData()
&& destEclipseView->eclipseCase()->reservoirData()->mainGrid())
if (destEclipseView && destEclipseView->mainGrid())
{
cvf::Vec3d destOffset = destEclipseView->eclipseCase()->reservoirData()->mainGrid()->displayModelOffset();
cvf::Vec3d destOffset = destEclipseView->mainGrid()->displayModelOffset();
destOffset.z() *= destEclipseView->scaleZ();
cvf::Vec3d destinationCamEye = sourceCamGlobalEye - destOffset;

View File

@ -32,6 +32,7 @@
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
#include "RigGeoMechCaseData.h"
#include "RigMainGrid.h"
#include "RimCellEdgeColors.h"
#include "RimContextCommandBuilder.h"
@ -254,8 +255,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
}
// Hide faults command
const RigCaseData* reservoir = eclipseView->eclipseCase()->reservoirData();
const RigFault* fault = reservoir->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
const RigFault* fault = eclipseView->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
if (fault)
{
menu.addSeparator();
@ -400,8 +400,7 @@ void RiuViewerCommands::slotHideFault()
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
if(!eclipseView) return;
const RigCaseData* reservoir = eclipseView->eclipseCase()->reservoirData();
const RigFault* fault = reservoir->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
const RigFault* fault = eclipseView->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
if (fault)
{
QString faultName = fault->name();
@ -641,7 +640,7 @@ void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* cr
{
size_t globalCellIndex = crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
const RigCell& cell = eclipseView->eclipseCase()->reservoirData()->mainGrid()->globalCellArray()[globalCellIndex];
const RigCell& cell = eclipseView->mainGrid()->globalCellArray()[globalCellIndex];
*cellIndex = cell.gridLocalCellIndex();
*gridIndex = cell.hostGrid()->gridIndex();
}
@ -665,7 +664,7 @@ void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionBoxSourceInfo*
{
size_t globalCellIndex = intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
const RigCell& cell = eclipseView->eclipseCase()->reservoirData()->mainGrid()->globalCellArray()[globalCellIndex];
const RigCell& cell = eclipseView->mainGrid()->globalCellArray()[globalCellIndex];
*cellIndex = cell.gridLocalCellIndex();
*gridIndex = cell.hostGrid()->gridIndex();
}
@ -691,9 +690,9 @@ void RiuViewerCommands::extractIntersectionData(const cvf::HitItemCollection& hi
{
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
if (eclipseView && eclipseView->eclipseCase())
if (eclipseView && eclipseView->mainGrid())
{
double characteristicCellSize = eclipseView->eclipseCase()->reservoirData()->mainGrid()->characteristicIJCellSize();
double characteristicCellSize = eclipseView->mainGrid()->characteristicIJCellSize();
pickDepthThresholdSquared = characteristicCellSize / 100.0;
pickDepthThresholdSquared = pickDepthThresholdSquared * pickDepthThresholdSquared;
}