mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
wip import pvd
This commit is contained in:
@@ -119,6 +119,12 @@ void RimFractureSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
bool RimFractureSurface::updateSurfaceData()
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
if ( m_surfacePerTimeStep.empty() )
|
||||
{
|
||||
loadDataFromFile();
|
||||
}
|
||||
|
||||
/*
|
||||
if ( m_vertices.empty() )
|
||||
{
|
||||
@@ -157,6 +163,9 @@ bool RimFractureSurface::updateSurfaceData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureSurface::clearCachedNativeData()
|
||||
{
|
||||
m_secondsSinceSimulationStart.clear();
|
||||
m_surfacePerTimeStep.clear();
|
||||
|
||||
/*
|
||||
m_vertices.clear();
|
||||
m_tringleIndices.clear();
|
||||
@@ -168,6 +177,18 @@ void RimFractureSurface::clearCachedNativeData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFractureSurface::loadDataFromFile()
|
||||
{
|
||||
auto surfaceInfo = RifVtkSurfaceImporter::parsePvdDatasets( m_surfaceDefinitionFilePath().path().toStdString() );
|
||||
|
||||
for ( const auto& s : surfaceInfo )
|
||||
{
|
||||
RigGocadData gocadData;
|
||||
if ( RifVtkSurfaceImporter::importFromFile( s.filename, &gocadData ) )
|
||||
{
|
||||
m_secondsSinceSimulationStart.push_back( s.timestep );
|
||||
m_surfacePerTimeStep.push_back( gocadData );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
/*
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
|
||||
#include "RimSurface.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
class RimFileSurface;
|
||||
class RigGocadData;
|
||||
|
||||
class RimFractureSurface : public RimSurface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
@@ -45,4 +50,7 @@ private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
caf::PdmField<caf::FilePath> m_surfaceDefinitionFilePath;
|
||||
|
||||
std::vector<size_t> m_secondsSinceSimulationStart;
|
||||
std::vector<RigGocadData> m_surfacePerTimeStep;
|
||||
};
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
#include "RimFractureSurface.h"
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
@@ -142,14 +143,26 @@ RimSurface* RimSurfaceCollection::importSurfacesFromFiles( const QStringList& fi
|
||||
|
||||
for ( const QString& newFileName : fileNames )
|
||||
{
|
||||
RimFileSurface* newSurface = new RimFileSurface;
|
||||
RimSurface* newSurface = nullptr;
|
||||
|
||||
if ( newFileName.endsWith( ".pvd" ) )
|
||||
{
|
||||
RimFractureSurface* fractureSurface = new RimFractureSurface;
|
||||
fractureSurface->setSurfaceFilePath( newFileName );
|
||||
|
||||
newSurface = fractureSurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
RimFileSurface* fileSurface = new RimFileSurface;
|
||||
|
||||
fileSurface->setSurfaceFilePath( newFileName );
|
||||
newSurface = fileSurface;
|
||||
}
|
||||
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f( existingSurfCount + newSurfCount );
|
||||
|
||||
newSurface->setSurfaceFilePath( newFileName );
|
||||
newSurface->setUserDescription( QFileInfo( newFileName ).fileName() );
|
||||
|
||||
newSurface->setColor( newColor );
|
||||
newSurface->setUserDescription( QFileInfo( newFileName ).fileName() );
|
||||
|
||||
if ( !newSurface->onLoadData() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user