Summary calculation data sources fixes

* File Summary Case: set up multiple readers correctly for multithreaded configuration.
* Summary Data Sources: fix sorting of vectors.
This commit is contained in:
Kristian Bendiksen 2023-02-27 11:17:45 +01:00 committed by GitHub
parent f8c5cf389f
commit 42c4e4a0c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 15 deletions

View File

@ -107,6 +107,11 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLo
m_multiSummaryReader->addReader( m_fileSummaryReader.p() );
openAndAttachAdditionalReader();
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
}
//--------------------------------------------------------------------------------------------------
@ -115,18 +120,7 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLo
void RimFileSummaryCase::createSummaryReaderInterface()
{
RiaThreadSafeLogger threadSafeLogger;
m_fileSummaryReader =
RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(), m_includeRestartFiles, &threadSafeLogger );
RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection();
m_calculatedSummaryReader = new RifCalculatedSummaryCurveReader( calcColl, this );
m_multiSummaryReader = new RifMultipleSummaryReaders;
m_multiSummaryReader->addReader( m_fileSummaryReader.p() );
openAndAttachAdditionalReader();
m_multiSummaryReader->addReader( m_calculatedSummaryReader.p() );
createSummaryReaderInterfaceThreadSafe( &threadSafeLogger );
auto messages = threadSafeLogger.messages();
for ( const auto& m : messages )

View File

@ -184,10 +184,20 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::set<RifEclip
std::vector<RifEclipseSummaryAddress> sortedAddresses( addresses.size() );
std::copy( addresses.begin(), addresses.end(), sortedAddresses.begin() );
std::sort( sortedAddresses.begin(), sortedAddresses.end(), []( const RifEclipseSummaryAddress& a, const RifEclipseSummaryAddress& b ) -> bool {
if ( a.category() < b.category() ) return false;
if ( a.category() != b.category() ) return a.category() < b.category();
if ( a.wellName() != b.wellName() ) return a.wellName() < b.wellName();
if ( a.regionNumber() != b.regionNumber() ) return a.regionNumber() < b.regionNumber();
if ( a.regionNumber2() != b.regionNumber2() ) return a.regionNumber2() < b.regionNumber2();
if ( a.groupName() != b.groupName() ) return a.groupName() < b.groupName();
if ( a.lgrName() != b.lgrName() ) return a.lgrName() < b.lgrName();
if ( a.cellK() != b.cellK() ) return a.cellK() < b.cellK();
if ( a.cellJ() != b.cellJ() ) return a.cellJ() < b.cellJ();
if ( a.cellI() != b.cellI() ) return a.cellI() < b.cellI();
if ( a.wellSegmentNumber() != b.wellSegmentNumber() ) return a.wellSegmentNumber() < b.wellSegmentNumber();
if ( a.aquiferNumber() != b.aquiferNumber() ) return a.aquiferNumber() < b.aquiferNumber();
// Calculated results are sorted last.
if ( a.isCalculated() && !b.isCalculated() ) return false;
if ( !a.isCalculated() && b.isCalculated() ) return true;
if ( a.isCalculated() != b.isCalculated() ) return a.isCalculated() < b.isCalculated();
return a.vectorName() < b.vectorName();
} );