diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp index 22afc35215..18b0e19d7b 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp @@ -86,7 +86,9 @@ void RivIntersectionBoxPartMgr::updateCellResultColor( size_t { if ( !m_intersectionBoxGenerator->isAnyGeometryPresent() ) return; - RimEclipseView* eclipseView; + CVF_ASSERT( scalarColorMapper ); + + RimEclipseView* eclipseView = nullptr; m_rimIntersectionBox->firstAncestorOrThisOfType( eclipseView ); if ( eclipseView ) diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp index 8271586c30..897b4c079b 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp @@ -152,27 +152,29 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t const cvf::ScalarMapper* scalarColorMapper, const RivTernaryScalarMapper* ternaryColorMapper ) { - CVF_ASSERT( scalarColorMapper ); - - if ( m_crossSectionGenerator.isNull() ) return; - if ( !m_crossSectionGenerator->isAnyGeometryPresent() ) return; + CVF_ASSERT( scalarColorMapper ); + RimEclipseView* eclipseView = nullptr; m_rimCrossSection->firstAncestorOrThisOfType( eclipseView ); if ( eclipseView ) { - RimEclipseCellColors* cellResultColors = eclipseView->cellResult(); - CVF_ASSERT( cellResultColors ); - CVF_ASSERT( ternaryColorMapper ); + bool isLightingDisabled = eclipseView->isLightingDisabled(); + + RimEclipseResultDefinition* eclipseResDef = eclipseView->cellResult(); + bool isTernaryResult = eclipseResDef->isTernarySaturationSelected(); + RigEclipseCaseData* eclipseCaseData = eclipseResDef->eclipseCase()->eclipseCaseData(); + + CVF_ASSERT( eclipseResDef ); // CrossSections if ( m_crossSectionFaces.notNull() ) { - if ( cellResultColors->isTernarySaturationSelected() ) + if ( isTernaryResult ) { - RivTernaryTextureCoordsCreator texturer( cellResultColors, ternaryColorMapper, timeStepIndex ); + RivTernaryTextureCoordsCreator texturer( eclipseResDef, ternaryColorMapper, timeStepIndex ); texturer.createTextureCoords( m_crossSectionFacesTextureCoords.p(), m_crossSectionGenerator->triangleToCellIndex() ); @@ -182,7 +184,7 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t ternaryColorMapper, 1.0, caf::FC_NONE, - eclipseView->isLightingDisabled() ); + isLightingDisabled ); } else { @@ -190,19 +192,16 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t cvf::ref resultAccessor; - if ( RiaDefines::isPerCellFaceResult( cellResultColors->resultVariable() ) ) + if ( RiaDefines::isPerCellFaceResult( eclipseResDef->resultVariable() ) ) { resultAccessor = new RigHugeValResultAccessor; } else { - resultAccessor = RigResultAccessorFactory::createFromResultDefinition( cellResultColors - ->reservoirView() - ->eclipseCase() - ->eclipseCaseData(), + resultAccessor = RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData, 0, timeStepIndex, - cellResultColors ); + eclipseResDef ); } RivIntersectionPartMgr::calculateEclipseTextureCoordinates( m_crossSectionFacesTextureCoords.p(), @@ -215,7 +214,7 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t scalarColorMapper, 1.0, caf::FC_NONE, - eclipseView->isLightingDisabled() ); + isLightingDisabled ); } } } @@ -225,13 +224,18 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t if ( geoView ) { - RimGeoMechCellColors* cellResultColors = geoView->cellResult(); - RigGeoMechCaseData* caseData = cellResultColors->ownerCaseData(); + bool isLightingDisabled = geoView->isLightingDisabled(); + + RigGeoMechCaseData* caseData = nullptr; + RigFemResultAddress resVarAddress; + { + RimGeoMechResultDefinition* geomResultDef = geoView->cellResult(); + caseData = geomResultDef->ownerCaseData(); + resVarAddress = geomResultDef->resultAddress(); + } if ( !caseData ) return; - RigFemResultAddress resVarAddress = cellResultColors->resultAddress(); - if ( resVarAddress.resultPosType == RIG_ELEMENT ) { const std::vector& resultValues = caseData->femPartResults()->resultValues( resVarAddress, @@ -298,7 +302,7 @@ void RivIntersectionPartMgr::updateCellResultColor( size_t scalarColorMapper, 1.0, caf::FC_NONE, - geoView->isLightingDisabled() ); + isLightingDisabled ); } }