mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7512 Optimized summary reader : Release memory after writing LODSMRY
Creating the LODSMRY file requires all data to be loaded into memory. Close this file object after the file has been written to disk.
This commit is contained in:
parent
fd8d38c4f0
commit
2f43a64d36
@ -81,18 +81,7 @@ size_t RifOpmCommonEclipseSummary::numberOfLodFilesCreated()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifOpmCommonEclipseSummary::open( const QString& headerFileName, bool includeRestartFiles )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_eSmry =
|
||||
std::make_unique<Opm::EclIO::ESmry>( headerFileName.toStdString(), includeRestartFiles, m_useLodsmryFiles );
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
{
|
||||
QString txt = QString( "Optimized Summary Reader error : %1" ).arg( e.what() );
|
||||
RiaLogging::error( txt );
|
||||
|
||||
return false;
|
||||
}
|
||||
if ( !openESmryFile( headerFileName, includeRestartFiles ) ) return false;
|
||||
|
||||
if ( m_createLodsmryFiles && !includeRestartFiles )
|
||||
{
|
||||
@ -102,6 +91,12 @@ bool RifOpmCommonEclipseSummary::open( const QString& headerFileName, bool inclu
|
||||
if ( hasFileBeenCreated )
|
||||
{
|
||||
RifOpmCommonEclipseSummary::increaseLodFileCount();
|
||||
|
||||
// If a LODSMRY file has been created, all data for all vectors has now been loaded into the summary file
|
||||
// object. Close the file object to make sure allocated data is released, and create a new file object
|
||||
// that will import only the meta data and no curve data. This is a relatively fast operation.
|
||||
|
||||
if ( !openESmryFile( headerFileName, includeRestartFiles ) ) return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,6 +194,27 @@ void RifOpmCommonEclipseSummary::buildMetaData()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifOpmCommonEclipseSummary::openESmryFile( const QString& headerFileName, bool includeRestartFiles )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_eSmry =
|
||||
std::make_unique<Opm::EclIO::ESmry>( headerFileName.toStdString(), includeRestartFiles, m_useLodsmryFiles );
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
{
|
||||
QString txt = QString( "Optimized Summary Reader error : %1" ).arg( e.what() );
|
||||
RiaLogging::error( txt );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -53,8 +53,8 @@ public:
|
||||
|
||||
void useLodsmaryFiles( bool enable );
|
||||
void createLodsmaryFiles( bool enable );
|
||||
|
||||
static void resetLodCount();
|
||||
|
||||
static void resetLodCount();
|
||||
static size_t numberOfLodFilesCreated();
|
||||
|
||||
bool open( const QString& headerFileName, bool includeRestartFiles );
|
||||
@ -66,6 +66,7 @@ public:
|
||||
|
||||
private:
|
||||
void buildMetaData();
|
||||
bool openESmryFile( const QString& headerFileName, bool includeRestartFiles );
|
||||
|
||||
static void increaseLodFileCount();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user