mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix geomech reload issues
This commit is contained in:
parent
38897249a6
commit
c70ad2f9a8
@ -332,3 +332,11 @@ void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility( cvf::UByteArray* t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RivGeoMechVizLogic::resetPartMgrs()
|
||||||
|
{
|
||||||
|
m_partMgrCache = new RivGeoMechPartMgrCache;
|
||||||
|
}
|
||||||
|
@ -49,6 +49,8 @@ public:
|
|||||||
void scheduleGeometryRegen( RivCellSetEnum geometryType );
|
void scheduleGeometryRegen( RivCellSetEnum geometryType );
|
||||||
void scheduleGeometryRegenOfVisiblePartMgrs( int viewerStepIndex );
|
void scheduleGeometryRegenOfVisiblePartMgrs( int viewerStepIndex );
|
||||||
void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int viewerStepIndex );
|
void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int viewerStepIndex );
|
||||||
|
void resetPartMgrs();
|
||||||
|
|
||||||
std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs( int viewerStepIndex ) const;
|
std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs( int viewerStepIndex ) const;
|
||||||
const cvf::ref<RivGeoMechPartMgrCache> partMgrCache() const;
|
const cvf::ref<RivGeoMechPartMgrCache> partMgrCache() const;
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ void RivTensorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBasicL
|
|||||||
{
|
{
|
||||||
const RivGeoMechPartMgr* partMgr = partMgrCache->partMgr( partKey );
|
const RivGeoMechPartMgr* partMgr = partMgrCache->partMgr( partKey );
|
||||||
|
|
||||||
auto mgr = partMgr->femPartMgrs()[partIdx];
|
auto& mgr = partMgr->femPartMgrs()[partIdx];
|
||||||
{
|
{
|
||||||
const RivFemPartGeometryGenerator* surfaceGenerator = mgr->surfaceGenerator();
|
const RivFemPartGeometryGenerator* surfaceGenerator = mgr->surfaceGenerator();
|
||||||
const std::vector<size_t>& quadVerticesToNodeIdxMapping = surfaceGenerator->quadVerticesToNodeIdxMapping();
|
const std::vector<size_t>& quadVerticesToNodeIdxMapping = surfaceGenerator->quadVerticesToNodeIdxMapping();
|
||||||
|
@ -234,8 +234,9 @@ void RimGeoMechCase::reloadDataAndUpdate()
|
|||||||
{
|
{
|
||||||
RiaLogging::error( QString::fromStdString( errMsg ) );
|
RiaLogging::error( QString::fromStdString( errMsg ) );
|
||||||
}
|
}
|
||||||
for ( auto v : geoMechViews() )
|
for ( auto& v : geoMechViews() )
|
||||||
{
|
{
|
||||||
|
v->resetVizLogic();
|
||||||
v->loadDataAndUpdate();
|
v->loadDataAndUpdate();
|
||||||
v->setCurrentTimeStep( v->currentTimeStep() );
|
v->setCurrentTimeStep( v->currentTimeStep() );
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,6 @@ void RimGeoMechPartCollection::syncWithCase( RimGeoMechCase* geoCase )
|
|||||||
{
|
{
|
||||||
const int count = geoCase->geoMechData()->femParts()->partCount();
|
const int count = geoCase->geoMechData()->femParts()->partCount();
|
||||||
|
|
||||||
if ( count != (int)m_parts.size() )
|
|
||||||
{
|
|
||||||
m_parts.deleteChildren();
|
m_parts.deleteChildren();
|
||||||
|
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( int i = 0; i < count; i++ )
|
||||||
@ -82,7 +80,6 @@ void RimGeoMechPartCollection::syncWithCase( RimGeoMechCase* geoCase )
|
|||||||
m_parts.push_back( part );
|
m_parts.push_back( part );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateConnectedEditors();
|
updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,33 +170,25 @@ bool RimGeoMechPartCollection::isDisplacementsUsed() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimGeoMechPartCollection::shouldRebuildPartVisualization( int currentTimeStep, bool showDisplacement, double scaleFactor )
|
std::pair<bool, bool>
|
||||||
|
RimGeoMechPartCollection::needsReloadOrRebuildUpdate( int currentTimeStep, bool showDisplacement, double scaleFactor )
|
||||||
{
|
{
|
||||||
// if show flag has changed, we need to rebuild grid viz.
|
bool rebuild = m_displacementsUsed != showDisplacement || ( m_currentDisplacementTimeStep != currentTimeStep ) ||
|
||||||
bool retVal = m_displacementsUsed != showDisplacement;
|
|
||||||
|
|
||||||
// if scaling or timestep has changed, we need to rebuild grid if the displacement should be visible
|
|
||||||
if ( showDisplacement )
|
|
||||||
retVal = retVal || ( m_currentDisplacementTimeStep != currentTimeStep ) ||
|
|
||||||
( std::abs( m_currentScaleFactor - scaleFactor ) > 0.0001 );
|
( std::abs( m_currentScaleFactor - scaleFactor ) > 0.0001 );
|
||||||
|
|
||||||
return retVal;
|
bool reload = false;
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
if ( showDisplacement )
|
||||||
///
|
{
|
||||||
//--------------------------------------------------------------------------------------------------
|
bool missingDisplacement = false;
|
||||||
bool RimGeoMechPartCollection::shouldReloadDisplacements( int currentTimeStep, bool showDisplacement, double scaleFactor )
|
|
||||||
{
|
|
||||||
// no need to reload something we are not showing
|
|
||||||
if ( !showDisplacement ) return false;
|
|
||||||
|
|
||||||
// if we have no displacements at all, we need to reload.
|
|
||||||
for ( const auto& part : m_parts )
|
for ( const auto& part : m_parts )
|
||||||
{
|
{
|
||||||
if ( part->displacements().size() == 0 ) return true;
|
missingDisplacement = missingDisplacement || ( part->displacements().size() == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// if timestep has changed we need to reload
|
rebuild = rebuild || missingDisplacement;
|
||||||
return m_currentDisplacementTimeStep != currentTimeStep;
|
reload = ( m_currentDisplacementTimeStep != currentTimeStep ) || missingDisplacement;
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_pair( reload, rebuild );
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "cvfVector3.h"
|
#include "cvfVector3.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RimGeoMechPart;
|
class RimGeoMechPart;
|
||||||
@ -38,8 +39,8 @@ public:
|
|||||||
|
|
||||||
void syncWithCase( RimGeoMechCase* geoCase );
|
void syncWithCase( RimGeoMechCase* geoCase );
|
||||||
|
|
||||||
bool shouldRebuildPartVisualization( int currentTimeStep, bool showDisplacement, double scaleFactor );
|
std::pair<bool, bool> needsReloadOrRebuildUpdate( int currentTimeStep, bool showDisplacement, double scaleFactor );
|
||||||
bool shouldReloadDisplacements( int currentTimeStep, bool showDisplacement, double scaleFactor );
|
|
||||||
bool shouldBeVisibleInTree() const;
|
bool shouldBeVisibleInTree() const;
|
||||||
|
|
||||||
bool isPartEnabled( int partId ) const;
|
bool isPartEnabled( int partId ) const;
|
||||||
|
@ -362,10 +362,12 @@ RimPropertyFilterCollection* RimGeoMechView::nativePropertyFilterCollection()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGeoMechView::updateElementDisplacements()
|
void RimGeoMechView::updateElementDisplacements()
|
||||||
{
|
{
|
||||||
if ( !m_partsCollection->shouldRebuildPartVisualization( m_currentTimeStep, m_showDisplacement, m_displacementScaling ) )
|
auto [reload, rebuild] =
|
||||||
return;
|
m_partsCollection->needsReloadOrRebuildUpdate( m_currentTimeStep, m_showDisplacement, m_displacementScaling );
|
||||||
|
|
||||||
if ( m_partsCollection->shouldReloadDisplacements( m_currentTimeStep, m_showDisplacement, m_displacementScaling ) )
|
if ( !rebuild ) return;
|
||||||
|
|
||||||
|
if ( reload )
|
||||||
{
|
{
|
||||||
for ( auto part : m_partsCollection->parts() )
|
for ( auto part : m_partsCollection->parts() )
|
||||||
{
|
{
|
||||||
@ -1123,3 +1125,14 @@ void RimGeoMechView::setShowDisplacementsAndUpdate( bool show )
|
|||||||
m_showDisplacement = show;
|
m_showDisplacement = show;
|
||||||
createDisplayModelAndRedraw();
|
createDisplayModelAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGeoMechView::resetVizLogic()
|
||||||
|
{
|
||||||
|
if ( m_vizLogic.notNull() )
|
||||||
|
{
|
||||||
|
m_vizLogic->resetPartMgrs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -114,6 +114,8 @@ public:
|
|||||||
|
|
||||||
std::pair<int, int> currentStepAndDataFrame() const;
|
std::pair<int, int> currentStepAndDataFrame() const;
|
||||||
|
|
||||||
|
void resetVizLogic();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user