mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Parallelize initial import of OSDU well path.
This commit is contained in:
parent
0216d9b57b
commit
9bea739252
@ -20,6 +20,7 @@
|
||||
|
||||
#include "Cloud/RiaOsduConnector.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
@ -37,6 +38,7 @@
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuWellImportWizard.h"
|
||||
|
||||
#include "cafDataLoadController.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
@ -72,34 +74,35 @@ void RicWellPathsImportOsduFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RiuWellImportWizard::WellInfo> importedWells = wellImportwizard.importedWells();
|
||||
|
||||
caf::ProgressInfo progress( importedWells.size(), "Importing wells from OSDU" );
|
||||
caf::ProgressInfo progress( importedWells.size(), "Importing wells from OSDU", false, true );
|
||||
int colorIndex = 0;
|
||||
std::vector<RimOsduWellPath*> newWells;
|
||||
for ( auto w : importedWells )
|
||||
{
|
||||
auto task = progress.task( QString( "Importing well: %1" ).arg( w.name ) );
|
||||
auto wellPath = new RimOsduWellPath;
|
||||
wellPath->setName( w.name );
|
||||
wellPath->setWellId( w.wellId );
|
||||
wellPath->setWellboreId( w.wellboreId );
|
||||
wellPath->setWellboreTrajectoryId( w.wellboreTrajectoryId );
|
||||
wellPath->setDatumElevationFromOsdu( w.datumElevation );
|
||||
wellPath->setWellPathColor( RiaColorTables::wellPathsPaletteColors().cycledColor3f( colorIndex++ ) );
|
||||
|
||||
auto [wellPathGeometry, errorMessage] =
|
||||
RimWellPathCollection::loadWellPathGeometryFromOsdu( osduConnector, w.wellboreTrajectoryId, w.datumElevation );
|
||||
if ( wellPathGeometry.notNull() )
|
||||
{
|
||||
auto wellPath = new RimOsduWellPath;
|
||||
wellPath->setName( w.name );
|
||||
wellPath->setWellId( w.wellId );
|
||||
wellPath->setWellboreId( w.wellboreId );
|
||||
wellPath->setWellboreTrajectoryId( w.wellboreTrajectoryId );
|
||||
wellPath->setDatumElevationFromOsdu( w.datumElevation );
|
||||
|
||||
oilField->wellPathCollection->addWellPath( wellPath );
|
||||
|
||||
wellPath->setWellPathGeometry( wellPathGeometry.p() );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::error( "Importing OSDU well failed: " + errorMessage );
|
||||
}
|
||||
|
||||
oilField->wellPathCollection->updateConnectedEditors();
|
||||
newWells.push_back( wellPath );
|
||||
oilField->wellPathCollection->addWellPath( wellPath );
|
||||
}
|
||||
|
||||
const QString wellPathGeometryKeyword = "WELL_PATH_GEOMETRY";
|
||||
|
||||
caf::DataLoadController* dataLoadController = caf::DataLoadController::instance();
|
||||
progress.setProgressDescription( QString( "Reading well path geometry." ) );
|
||||
for ( RimWellPath* wellPath : newWells )
|
||||
{
|
||||
dataLoadController->loadData( *wellPath, wellPathGeometryKeyword, progress );
|
||||
}
|
||||
dataLoadController->blockUntilDone( wellPathGeometryKeyword );
|
||||
|
||||
oilField->wellPathCollection->updateConnectedEditors();
|
||||
|
||||
project->updateConnectedEditors();
|
||||
app->project()->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
@ -63,10 +63,10 @@ void RimOsduWellPathDataLoader::loadData( caf::PdmObject& pdmObject, const QStri
|
||||
auto oWPath = dynamic_cast<RimOsduWellPath*>( &pdmObject );
|
||||
if ( oWPath )
|
||||
{
|
||||
QString trajectoryId = oWPath->wellboreTrajectoryId();
|
||||
osduConnector->requestWellboreTrajectoryParquetDataById( trajectoryId );
|
||||
QString trajectoryId = oWPath->wellboreTrajectoryId();
|
||||
m_wellPaths[trajectoryId] = oWPath;
|
||||
m_taskIds[trajectoryId] = taskId;
|
||||
osduConnector->requestWellboreTrajectoryParquetDataById( trajectoryId );
|
||||
}
|
||||
QApplication::processEvents();
|
||||
}
|
||||
@ -100,7 +100,7 @@ void RimOsduWellPathDataLoader::parquetDownloadComplete( const QByteArray& conte
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
if ( m_wellPaths.find( id ) != m_wellPaths.end() )
|
||||
if ( m_wellPaths.find( id ) != m_wellPaths.end() && m_taskIds.find( id ) != m_taskIds.end() )
|
||||
{
|
||||
RiaLogging::info( QString( "Parquet download complete. Id: %1 Size: %2" ).arg( id ).arg( contents.size() ) );
|
||||
int taskId = m_taskIds[id];
|
||||
|
@ -143,5 +143,5 @@ void DataLoadController::onTaskFinished( const caf::SignalEmitter* emitter, QStr
|
||||
{
|
||||
QMutexLocker locker( &m_mutex );
|
||||
m_pendingTasksByType[dataType]--;
|
||||
m_progressInfos[dataType]->incrementProgress();
|
||||
if ( m_progressInfos.find( dataType ) != m_progressInfos.end() ) m_progressInfos[dataType]->incrementProgress();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user