mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6773 Regression Test : Add more input validation due to missing files
Running regression tests without valid external files revealed several crashes. Add guarding and remove asserts to make sure regression tests can be executed without crash.
This commit is contained in:
parent
b4a879c637
commit
a6af4fbd00
@ -235,7 +235,7 @@ void RivGridBoxGenerator::updateFromCamera( const cvf::Camera* camera )
|
|||||||
{
|
{
|
||||||
m_gridBoxModel->removeAllParts();
|
m_gridBoxModel->removeAllParts();
|
||||||
|
|
||||||
if ( m_gridBoxFaceParts.size() == 0 ) return;
|
if ( m_gridBoxFaceParts.empty() ) return;
|
||||||
|
|
||||||
std::vector<bool> faceVisibility( 6, false );
|
std::vector<bool> faceVisibility( 6, false );
|
||||||
for ( size_t i = POS_X; i <= NEG_Z; i++ )
|
for ( size_t i = POS_X; i <= NEG_Z; i++ )
|
||||||
@ -263,17 +263,20 @@ void RivGridBoxGenerator::updateFromCamera( const cvf::Camera* camera )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<bool> edgeVisibility( 12, false );
|
if ( !m_gridBoxLegendParts.empty() )
|
||||||
computeEdgeVisibility( faceVisibility, edgeVisibility );
|
|
||||||
|
|
||||||
CVF_ASSERT( m_gridBoxLegendParts.size() == ( NEG_X_NEG_Y + 1 ) * 2 );
|
|
||||||
for ( size_t i = POS_Z_POS_X; i <= NEG_X_NEG_Y; i++ )
|
|
||||||
{
|
{
|
||||||
if ( edgeVisibility[i] )
|
std::vector<bool> edgeVisibility( 12, false );
|
||||||
|
computeEdgeVisibility( faceVisibility, edgeVisibility );
|
||||||
|
|
||||||
|
CVF_ASSERT( m_gridBoxLegendParts.size() == ( NEG_X_NEG_Y + 1 ) * 2 );
|
||||||
|
for ( size_t i = POS_Z_POS_X; i <= NEG_X_NEG_Y; i++ )
|
||||||
{
|
{
|
||||||
// We have two parts for each edge - line and text
|
if ( edgeVisibility[i] )
|
||||||
m_gridBoxModel->addPart( m_gridBoxLegendParts[2 * i].p() );
|
{
|
||||||
m_gridBoxModel->addPart( m_gridBoxLegendParts[2 * i + 1].p() );
|
// We have two parts for each edge - line and text
|
||||||
|
m_gridBoxModel->addPart( m_gridBoxLegendParts[2 * i].p() );
|
||||||
|
m_gridBoxModel->addPart( m_gridBoxLegendParts[2 * i + 1].p() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,6 +495,11 @@ void RivGridBoxGenerator::createLegend( EdgeType edge, cvf::Collection<cvf::Part
|
|||||||
cvf::Vec3d min = m_displayCoordsBoundingBox.min();
|
cvf::Vec3d min = m_displayCoordsBoundingBox.min();
|
||||||
cvf::Vec3d max = m_displayCoordsBoundingBox.max();
|
cvf::Vec3d max = m_displayCoordsBoundingBox.max();
|
||||||
|
|
||||||
|
if ( min == max )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AxisType axis = X_AXIS;
|
AxisType axis = X_AXIS;
|
||||||
|
|
||||||
cvf::Vec3f tickMarkDir = cvf::Vec3f::X_AXIS;
|
cvf::Vec3f tickMarkDir = cvf::Vec3f::X_AXIS;
|
||||||
|
@ -721,6 +721,8 @@ std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps()
|
|||||||
|
|
||||||
for ( RimSummaryCase* sumCase : timestepDefiningSourceCases() )
|
for ( RimSummaryCase* sumCase : timestepDefiningSourceCases() )
|
||||||
{
|
{
|
||||||
|
if ( !sumCase || !sumCase->summaryReader() ) continue;
|
||||||
|
|
||||||
const std::vector<time_t>& timeSteps = sumCase->summaryReader()->timeSteps( RifEclipseSummaryAddress() );
|
const std::vector<time_t>& timeSteps = sumCase->summaryReader()->timeSteps( RifEclipseSummaryAddress() );
|
||||||
|
|
||||||
for ( time_t t : timeSteps )
|
for ( time_t t : timeSteps )
|
||||||
|
@ -650,6 +650,7 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
|
|||||||
if ( m_flowDiagSolution && m_flowCharPlotWidget )
|
if ( m_flowDiagSolution && m_flowCharPlotWidget )
|
||||||
{
|
{
|
||||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||||
|
if ( !flowResult ) return;
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps( RigFlowDiagResultAddress::PHASE_ALL );
|
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps( RigFlowDiagResultAddress::PHASE_ALL );
|
||||||
|
@ -100,7 +100,10 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
|
|||||||
RimEclipseResultCase* eclCase;
|
RimEclipseResultCase* eclCase;
|
||||||
this->firstAncestorOrThisOfType( eclCase );
|
this->firstAncestorOrThisOfType( eclCase );
|
||||||
|
|
||||||
CVF_ASSERT( eclCase && eclCase->eclipseCaseData() );
|
if ( !eclCase || !eclCase->eclipseCaseData() )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
timeStepCount =
|
timeStepCount =
|
||||||
eclCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->maxTimeStepCount();
|
eclCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->maxTimeStepCount();
|
||||||
|
@ -555,15 +555,18 @@ std::set<QDateTime> RimWellPlotTools::availableSimWellTimesteps( RimEclipseCase*
|
|||||||
{
|
{
|
||||||
std::set<QDateTime> availebleTimeSteps;
|
std::set<QDateTime> availebleTimeSteps;
|
||||||
|
|
||||||
std::vector<QDateTime> allTimeSteps =
|
if ( eclCase && eclCase->eclipseCaseData() )
|
||||||
eclCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->timeStepDates();
|
|
||||||
const RigSimWellData* simWell = eclCase->eclipseCaseData()->findSimWellData( simWellName );
|
|
||||||
|
|
||||||
for ( size_t tsIdx = 0; tsIdx < allTimeSteps.size(); ++tsIdx )
|
|
||||||
{
|
{
|
||||||
if ( simWell->hasWellResult( tsIdx ) || ( addFirstReportTimestep && tsIdx == 0 ) )
|
std::vector<QDateTime> allTimeSteps =
|
||||||
|
eclCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->timeStepDates();
|
||||||
|
const RigSimWellData* simWell = eclCase->eclipseCaseData()->findSimWellData( simWellName );
|
||||||
|
|
||||||
|
for ( size_t tsIdx = 0; tsIdx < allTimeSteps.size(); ++tsIdx )
|
||||||
{
|
{
|
||||||
availebleTimeSteps.insert( allTimeSteps[tsIdx] );
|
if ( simWell->hasWellResult( tsIdx ) || ( addFirstReportTimestep && tsIdx == 0 ) )
|
||||||
|
{
|
||||||
|
availebleTimeSteps.insert( allTimeSteps[tsIdx] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,11 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
|
|||||||
std::set<RiaEclipseUnitTools::UnitSystem> presentUnitSystems;
|
std::set<RiaEclipseUnitTools::UnitSystem> presentUnitSystems;
|
||||||
for ( const RifDataSourceForRftPlt& source : m_selectedSources.v() )
|
for ( const RifDataSourceForRftPlt& source : m_selectedSources.v() )
|
||||||
{
|
{
|
||||||
if ( source.eclCase() ) presentUnitSystems.insert( source.eclCase()->eclipseCaseData()->unitsType() );
|
if ( source.eclCase() && source.eclCase()->eclipseCaseData() )
|
||||||
|
{
|
||||||
|
presentUnitSystems.insert( source.eclCase()->eclipseCaseData()->unitsType() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( source.wellLogFile() )
|
if ( source.wellLogFile() )
|
||||||
{
|
{
|
||||||
if ( source.wellLogFile()->wellLogFileData() )
|
if ( source.wellLogFile()->wellLogFileData() )
|
||||||
|
@ -1075,7 +1075,7 @@ QString RimEclipseCase::timeStepName( int frameIdx ) const
|
|||||||
double RimEclipseCase::characteristicCellSize() const
|
double RimEclipseCase::characteristicCellSize() const
|
||||||
{
|
{
|
||||||
const RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
|
const RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
|
||||||
if ( rigEclipseCase )
|
if ( rigEclipseCase && rigEclipseCase->mainGrid() )
|
||||||
{
|
{
|
||||||
return rigEclipseCase->mainGrid()->characteristicIJCellSize();
|
return rigEclipseCase->mainGrid()->characteristicIJCellSize();
|
||||||
}
|
}
|
||||||
|
@ -1884,15 +1884,12 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CVF_ASSERT( rimEclipseCase );
|
|
||||||
if ( !rimEclipseCase ) return;
|
if ( !rimEclipseCase ) return;
|
||||||
|
|
||||||
RigEclipseCaseData* eclipseCaseData = rimEclipseCase->eclipseCaseData();
|
RigEclipseCaseData* eclipseCaseData = rimEclipseCase->eclipseCaseData();
|
||||||
CVF_ASSERT( eclipseCaseData );
|
|
||||||
if ( !eclipseCaseData ) return;
|
if ( !eclipseCaseData ) return;
|
||||||
|
|
||||||
RigCaseCellResultsData* cellResultsData = eclipseCaseData->results( this->porosityModel() );
|
RigCaseCellResultsData* cellResultsData = eclipseCaseData->results( this->porosityModel() );
|
||||||
CVF_ASSERT( cellResultsData );
|
|
||||||
|
|
||||||
double globalMin, globalMax;
|
double globalMin, globalMax;
|
||||||
double globalPosClosestToZero, globalNegClosestToZero;
|
double globalPosClosestToZero, globalNegClosestToZero;
|
||||||
@ -2039,11 +2036,9 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
|
|||||||
|
|
||||||
// Ternary legend update
|
// Ternary legend update
|
||||||
{
|
{
|
||||||
CVF_ASSERT( rimEclipseCase );
|
|
||||||
if ( !rimEclipseCase ) return;
|
if ( !rimEclipseCase ) return;
|
||||||
|
|
||||||
RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData();
|
RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData();
|
||||||
CVF_ASSERT( eclipseCase );
|
|
||||||
if ( !eclipseCase ) return;
|
if ( !eclipseCase ) return;
|
||||||
|
|
||||||
RigCaseCellResultsData* cellResultsData = eclipseCase->results( this->porosityModel() );
|
RigCaseCellResultsData* cellResultsData = eclipseCase->results( this->porosityModel() );
|
||||||
|
@ -210,9 +210,10 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
|
|||||||
|
|
||||||
RimEclipseView* eclipseView;
|
RimEclipseView* eclipseView;
|
||||||
this->firstAncestorOrThisOfType( eclipseView );
|
this->firstAncestorOrThisOfType( eclipseView );
|
||||||
if ( eclipseView )
|
if ( eclipseView && eclipseView->mainGrid() )
|
||||||
{
|
{
|
||||||
RigMainGrid* grid = eclipseView->mainGrid();
|
RigMainGrid* grid = eclipseView->mainGrid();
|
||||||
|
|
||||||
return new RivEclipseIntersectionGrid( grid, eclipseView->currentActiveCellInfo(), this->isInactiveCellsVisible() );
|
return new RivEclipseIntersectionGrid( grid, eclipseView->currentActiveCellInfo(), this->isInactiveCellsVisible() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +215,11 @@ void RimSimWellInView::wellHeadTopBottomPosition( int frameIndex, cvf::Vec3d* to
|
|||||||
RimEclipseView* m_rimReservoirView;
|
RimEclipseView* m_rimReservoirView;
|
||||||
firstAncestorOrThisOfTypeAsserted( m_rimReservoirView );
|
firstAncestorOrThisOfTypeAsserted( m_rimReservoirView );
|
||||||
|
|
||||||
|
if ( !m_rimReservoirView->eclipseCase() || !m_rimReservoirView->eclipseCase()->eclipseCaseData() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
|
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
|
||||||
|
|
||||||
const RigWellResultFrame* wellResultFramePtr = nullptr;
|
const RigWellResultFrame* wellResultFramePtr = nullptr;
|
||||||
|
@ -864,7 +864,7 @@ bool RimViewController::isRangeFilterMappingApplicable() const
|
|||||||
|
|
||||||
if ( eclipseView && geomView )
|
if ( eclipseView && geomView )
|
||||||
{
|
{
|
||||||
if ( eclipseView->eclipseCase()->eclipseCaseData() && geomView->geoMechCase() &&
|
if ( eclipseView->eclipseCase() && eclipseView->eclipseCase()->eclipseCaseData() && geomView->geoMechCase() &&
|
||||||
geomView->geoMechCase()->geoMechData() )
|
geomView->geoMechCase()->geoMechData() )
|
||||||
{
|
{
|
||||||
RigMainGrid* eclGrid = eclipseView->mainGrid();
|
RigMainGrid* eclGrid = eclipseView->mainGrid();
|
||||||
|
@ -232,7 +232,7 @@ public:
|
|||||||
QString porosityModelName = args[4];
|
QString porosityModelName = args[4];
|
||||||
|
|
||||||
RimEclipseCase* rimCase = server->findReservoir( caseId );
|
RimEclipseCase* rimCase = server->findReservoir( caseId );
|
||||||
if ( rimCase == nullptr )
|
if ( !rimCase || !rimCase->eclipseCaseData() )
|
||||||
{
|
{
|
||||||
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
|
server->showErrorMessage( RiaSocketServer::tr( "ResInsight SocketServer: \n" ) +
|
||||||
RiaSocketServer::tr( "Could not find the case with ID: \"%1\"" ).arg( caseId ) );
|
RiaSocketServer::tr( "Could not find the case with ID: \"%1\"" ).arg( caseId ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user