working concept with time steps

This commit is contained in:
Magne Sjaastad 2025-01-31 15:57:32 +01:00
parent d3bd64d91d
commit adeee78c03
11 changed files with 52 additions and 81 deletions

View File

@ -195,7 +195,7 @@ void RimGeoMechView::onLoadDataAndUpdate()
geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection();
if ( m_surfaceCollection ) m_surfaceCollection->loadData();
if ( m_surfaceCollection ) m_surfaceCollection->loadData( m_currentTimeStep );
if ( m_partsCollection ) m_partsCollection->syncWithCase( m_geomechCase );

View File

@ -877,6 +877,8 @@ void RimEclipseView::onUpdateDisplayModelForCurrentTimeStep()
appendIntersectionsForCurrentTimeStep();
}
if ( surfaceInViewCollection() ) surfaceInViewCollection()->loadData( m_currentTimeStep );
updateVisibleCellColors();
wellCollection()->scaleWellDisks();
@ -1197,7 +1199,7 @@ void RimEclipseView::onLoadDataAndUpdate()
m_wellCollection->scaleWellDisks();
if ( m_surfaceCollection ) m_surfaceCollection->loadData();
if ( m_surfaceCollection ) m_surfaceCollection->loadData( m_currentTimeStep );
scheduleReservoirGridGeometryRegen();
m_simWellsPartManager->clearGeometryCache();

View File

@ -413,7 +413,7 @@ void RimSeismicView::onLoadDataAndUpdate()
updateMdiWindowVisibility();
if ( m_surfaceCollection ) m_surfaceCollection->loadData();
if ( m_surfaceCollection ) m_surfaceCollection->loadData( m_currentTimeStep );
scheduleCreateDisplayModelAndRedraw();
}

View File

@ -94,6 +94,33 @@ RimSurface* RimFractureSurface::createCopy()
return newSurface;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureSurface::loadSurfaceDataForTimeStep( int timeStep )
{
if ( m_surfacePerTimeStep.empty() )
{
loadDataFromFile();
}
if ( timeStep >= m_surfacePerTimeStep.size() ) return;
auto surface = new RigSurface;
auto gocadData = m_surfacePerTimeStep[timeStep];
const auto& [coordinates, indices] = gocadData.gocadGeometry();
surface->setTriangleData( indices, coordinates );
auto propertyNames = gocadData.propertyNames();
for ( const auto& name : propertyNames )
{
auto values = gocadData.propertyValues( name );
surface->addVerticeResult( name, values );
}
setSurfaceData( surface );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -118,44 +145,9 @@ void RimFractureSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
//--------------------------------------------------------------------------------------------------
bool RimFractureSurface::updateSurfaceData()
{
bool result = true;
loadSurfaceDataForTimeStep( 0 );
if ( m_surfacePerTimeStep.empty() )
{
loadDataFromFile();
}
/*
if ( m_vertices.empty() )
{
result = loadDataFromFile();
}
std::vector<cvf::Vec3d> vertices{ m_vertices };
std::vector<unsigned> tringleIndices{ m_tringleIndices };
auto surface = new RigSurface;
if ( !vertices.empty() && !tringleIndices.empty() )
{
RimSurface::applyDepthOffsetIfNeeded( &vertices );
surface->setTriangleData( tringleIndices, vertices );
}
if ( m_gocadData )
{
auto propertyNames = m_gocadData->propertyNames();
for ( const auto& name : propertyNames )
{
auto values = m_gocadData->propertyValues( name );
surface->addVerticeResult( name, values );
}
}
setSurfaceData( surface );
*/
return result;
return true;
}
//--------------------------------------------------------------------------------------------------
@ -190,39 +182,4 @@ bool RimFractureSurface::loadDataFromFile()
}
return false;
/*
std::pair<std::vector<cvf::Vec3d>, std::vector<unsigned>> surface;
QString filePath = surfaceFilePath();
if ( filePath.endsWith( "ptl", Qt::CaseInsensitive ) )
{
surface = RifSurfaceImporter::readPetrelFile( filePath );
}
else if ( filePath.endsWith( "ts", Qt::CaseInsensitive ) )
{
m_gocadData = std::make_unique<RigGocadData>();
RifSurfaceImporter::readGocadFile( filePath, m_gocadData.get() );
surface = m_gocadData->gocadGeometry();
}
else if ( filePath.endsWith( "vtu", Qt::CaseInsensitive ) )
{
m_gocadData = std::make_unique<RigGocadData>();
RifVtkSurfaceImporter::importFromFile( filePath.toStdString(), m_gocadData.get() );
surface = m_gocadData->gocadGeometry();
}
else if ( filePath.endsWith( "dat", Qt::CaseInsensitive ) || filePath.endsWith( "xyz", Qt::CaseInsensitive ) )
{
double resamplingDistance = RiaPreferences::current()->surfaceImportResamplingDistance();
surface = RifSurfaceImporter::readOpenWorksXyzFile( filePath, resamplingDistance );
}
m_vertices = surface.first;
m_tringleIndices = surface.second;
return !( m_vertices.empty() || m_tringleIndices.empty() );
*/
}

View File

@ -39,6 +39,8 @@ public:
bool onLoadData() override;
RimSurface* createCopy() override;
void loadSurfaceDataForTimeStep( int timeStep ) override;
protected:
bool updateSurfaceData() override;
void clearCachedNativeData() override;

View File

@ -221,6 +221,13 @@ RigSurface* RimSurface::surfaceData()
return m_surfaceData.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurface::loadSurfaceDataForTimeStep( int timeStep )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -60,6 +60,7 @@ public:
QString userDescription();
void setUserDescription( const QString& description );
virtual void loadSurfaceDataForTimeStep( int timeStep );
virtual QString fullName() const;
virtual bool onLoadData() = 0;
virtual RimSurface* createCopy() = 0;

View File

@ -32,6 +32,7 @@
#include "RivSurfacePartMgr.h"
#include "RiaApplication.h"
#include "cafPdmUiDoubleSliderEditor.h"
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
@ -166,11 +167,12 @@ const RivIntersectionGeometryGeneratorInterface* RimSurfaceInView::intersectionG
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceInView::loadDataAndUpdate()
void RimSurfaceInView::loadDataAndUpdate( int timeStep )
{
if ( surface() )
{
surface()->loadDataIfRequired();
surface()->loadSurfaceDataForTimeStep( timeStep );
if ( surface()->surfaceData() && surface()->surfaceData()->propertyNames().empty() )
{

View File

@ -56,7 +56,7 @@ public:
RivSurfacePartMgr* nativeSurfacePartMgr();
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const override;
void loadDataAndUpdate();
void loadDataAndUpdate( int timeStep );
void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer );

View File

@ -243,18 +243,18 @@ void RimSurfaceInViewCollection::updateFromSurfaceCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceInViewCollection::loadData()
void RimSurfaceInViewCollection::loadData( int timeStep )
{
for ( RimSurfaceInViewCollection* coll : m_collectionsInView )
{
coll->loadData();
coll->loadData( timeStep );
}
for ( RimSurfaceInView* surf : m_surfacesInView )
{
if ( surf->isActive() )
{
surf->loadDataAndUpdate();
surf->loadDataAndUpdate( timeStep );
}
}
}

View File

@ -54,7 +54,7 @@ public:
void setSurfaceCollection( RimSurfaceCollection* surfcoll );
void updateFromSurfaceCollection();
void loadData();
void loadData( int timeStep );
void clearGeometry();
void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform, bool onlyNativeParts = false );