Summary performance improvements

* Check flag before rebuilding summary address nodes
* Performance: Use vector instead of set and map locally in thread
* Performance: Skip looking for restart summary filenames for opm-common
* Move adding of case realization parameters to OpenMP loop
* Add unit test for file path operations
* Performance: Avoid using cdUp() function when splitting path into strings
This commit is contained in:
Magne Sjaastad
2024-03-18 11:46:43 +01:00
committed by GitHub
parent 63defd0f1a
commit a880a42752
10 changed files with 131 additions and 41 deletions

View File

@@ -1,5 +1,6 @@
#include "gtest/gtest.h"
#include "RiaEnsembleNameTools.h"
#include "RiaFilePathTools.h"
#include <iostream>
@@ -112,3 +113,90 @@ TEST( RiaFilePathTools, removeDuplicatePathSeparators )
EXPECT_STRCASEEQ( expectedPath.toLatin1(), resultRootPath.toLatin1() );
}
}
//--------------------------------------------------------------------------------------------------
TEST( RiaFilePathTools, splitIntoComponets )
{
{
QString testPath( "e:/models/from_equinor_sftp/drogon3d_ahm/realization-0/iter-3/eclipse/model/DROGON-0.SMSPEC" );
auto words = RiaFilePathTools::splitPathIntoComponents( testPath );
EXPECT_EQ( 8, words.size() );
EXPECT_EQ( QString( "models" ), words[0] );
EXPECT_EQ( QString( "from_equinor_sftp" ), words[1] );
EXPECT_EQ( QString( "drogon3d_ahm" ), words[2] );
EXPECT_EQ( QString( "realization-0" ), words[3] );
EXPECT_EQ( QString( "iter-3" ), words[4] );
EXPECT_EQ( QString( "eclipse" ), words[5] );
EXPECT_EQ( QString( "model" ), words[6] );
EXPECT_EQ( QString( "DROGON-0.SMSPEC" ), words[7] );
}
{
QString testPath( "/home/builder/models/realization-0/iter-3/eclipse/model/DROGON-0.SMSPEC" );
auto words = RiaFilePathTools::splitPathIntoComponents( testPath );
EXPECT_EQ( 8, words.size() );
EXPECT_EQ( QString( "home" ), words[0] );
EXPECT_EQ( QString( "builder" ), words[1] );
EXPECT_EQ( QString( "models" ), words[2] );
EXPECT_EQ( QString( "realization-0" ), words[3] );
EXPECT_EQ( QString( "iter-3" ), words[4] );
EXPECT_EQ( QString( "eclipse" ), words[5] );
EXPECT_EQ( QString( "model" ), words[6] );
EXPECT_EQ( QString( "DROGON-0.SMSPEC" ), words[7] );
}
}
//--------------------------------------------------------------------------------------------------
TEST( RiaFilePathTools, EnsembleName )
{
{
QString testPath1( "e:/models/from_equinor_sftp/drogon3d_ahm/realization-0/iter-3/eclipse/model/DROGON-0.SMSPEC" );
QString testPath2( "e:/models/from_equinor_sftp/drogon3d_ahm/realization-1/iter-3/eclipse/model/DROGON-1.SMSPEC" );
QStringList allPaths = { testPath1, testPath2 };
auto ensembleName =
RiaEnsembleNameTools::findSuitableEnsembleName( allPaths, RiaEnsembleNameTools::EnsembleGroupingMode::FMU_FOLDER_STRUCTURE );
EXPECT_EQ( QString( "iter-3" ), ensembleName );
}
}
//--------------------------------------------------------------------------------------------------
TEST( RiaFilePathTools, RealizationName )
{
{
QString testPath0( "e:/models/from_equinor_sftp/drogon3d_ahm/realization-0/iter-3/eclipse/model/DROGON-0.SMSPEC" );
QString testPath1( "e:/models/from_equinor_sftp/drogon3d_ahm/realization-1/iter-3/eclipse/model/DROGON-1.SMSPEC" );
QStringList allPaths = { testPath0, testPath1 };
QString fileName = "DROGON-0.SMSPEC";
auto name = RiaEnsembleNameTools::uniqueShortName( testPath1, allPaths, fileName );
EXPECT_EQ( QString( "real-1" ), name );
}
}
//--------------------------------------------------------------------------------------------------
TEST( RiaFilePathTools, keyPathComponentsForEachFilePath )
{
{
QString testPath0( "e:/models/from_equinor_sftp/drogon3d_ahm/realization-0/iter-3/eclipse/model/DROGON-0.SMSPEC" );
QString testPath1( "e:/models/from_equinor_sftp/drogon3d_ahm/realization-1/iter-3/eclipse/model/DROGON-1.SMSPEC" );
QStringList allPaths = { testPath0, testPath1 };
auto keyComponents = RiaFilePathTools::keyPathComponentsForEachFilePath( allPaths );
auto test0 = keyComponents[testPath0];
EXPECT_EQ( QString( "realization-0" ), test0.front() );
auto test1 = keyComponents[testPath1];
EXPECT_EQ( QString( "realization-1" ), test1.front() );
}
}