Crash protection

This commit is contained in:
Jon Jenssen 2021-10-06 16:49:39 +02:00 committed by jonjenssen
parent 7cf56e1e87
commit a2acadf3f4
2 changed files with 18 additions and 2 deletions

View File

@ -182,8 +182,13 @@ cvf::BoundingBox RimGeoMechContourMapProjection::calculateExpandedPorBarBBox( in
RigFemPartResultsCollection* resultCollection = caseData->femPartResults();
const std::vector<float>& resultValues = resultCollection->resultValues( porBarAddr, 0, timeStep );
cvf::BoundingBox boundingBox;
if ( resultValues.empty() )
{
return boundingBox;
}
cvf::BoundingBox boundingBox;
for ( int i = 0; i < m_femPart->elementCount(); ++i )
{
size_t resValueIdx = m_femPart->elementNodeResultIdx( (int)i, 0 );
@ -227,11 +232,17 @@ void RimGeoMechContourMapProjection::updateGridInformation()
if ( m_limitToPorePressureRegions )
{
m_expandedBoundingBox = calculateExpandedPorBarBBox( view()->currentTimeStep() );
if ( !m_expandedBoundingBox.isValid() )
{
m_limitToPorePressureRegions = false;
}
}
else
if ( !m_limitToPorePressureRegions )
{
m_expandedBoundingBox = m_gridBoundingBox;
}
cvf::Vec3d minExpandedPoint = m_expandedBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 );
cvf::Vec3d maxExpandedPoint = m_expandedBoundingBox.max() + cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 );
if ( m_limitToPorePressureRegions && !m_applyPPRegionLimitVertically )

View File

@ -1344,6 +1344,11 @@ std::vector<RimContourMapProjection::CellIndexAndResult>
std::vector<std::vector<size_t>> kLayerCellIndexVector;
kLayerCellIndexVector.resize( kLayers() );
if ( kLayerCellIndexVector.empty() )
{
return matchingVisibleCellsAndWeight;
}
for ( size_t globalCellIdx : allCellIndices )
{
if ( ( *m_cellGridIdxVisibility )[globalCellIdx] )