mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
HDF : Create ESmry reader in try catch block
This commit is contained in:
parent
7f35fb23c4
commit
30687e18bc
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "RifHdf5SummaryExporter.h"
|
#include "RifHdf5SummaryExporter.h"
|
||||||
|
|
||||||
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
#include "RifHdf5Exporter.h"
|
#include "RifHdf5Exporter.h"
|
||||||
#include "RifSummaryReaderInterface.h"
|
#include "RifSummaryReaderInterface.h"
|
||||||
|
|
||||||
@ -39,16 +41,28 @@ bool RifHdf5SummaryExporter::ensureHdf5FileIsCreated( const std::string& smspecF
|
|||||||
// TODO: Use time stamp of file to make sure the smspec file is older than the h5 file
|
// TODO: Use time stamp of file to make sure the smspec file is older than the h5 file
|
||||||
if ( !QFile::exists( QString::fromStdString( h5FileName ) ) )
|
if ( !QFile::exists( QString::fromStdString( h5FileName ) ) )
|
||||||
{
|
{
|
||||||
Opm::EclIO::ESmry sourceSummaryData( smspecFileName );
|
try
|
||||||
|
{
|
||||||
|
Opm::EclIO::ESmry sourceSummaryData( smspecFileName );
|
||||||
|
|
||||||
// Read all data summary data before starting export to HDF. Loading one and one summary vector causes huge
|
// Read all data summary data before starting export to HDF. Loading one and one summary vector causes huge
|
||||||
// performance penalty
|
// performance penalty
|
||||||
sourceSummaryData.LoadData();
|
sourceSummaryData.LoadData();
|
||||||
|
|
||||||
RifHdf5Exporter exporter( h5FileName );
|
RifHdf5Exporter exporter( h5FileName );
|
||||||
|
|
||||||
writeGeneralSection( exporter, sourceSummaryData );
|
writeGeneralSection( exporter, sourceSummaryData );
|
||||||
writeSummaryVectors( exporter, sourceSummaryData );
|
writeSummaryVectors( exporter, sourceSummaryData );
|
||||||
|
}
|
||||||
|
catch ( std::exception& e )
|
||||||
|
{
|
||||||
|
QString txt =
|
||||||
|
QString( "HDF export to file %1 failed : %3" ).arg( QString::fromStdString( smspecFileName ), e.what() );
|
||||||
|
|
||||||
|
RiaLogging::error( txt );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user