mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Geomech frames support (#9678)
Support for showing frames in geomech data.
This commit is contained in:
committed by
Magne Sjaastad
parent
05bf744197
commit
dc5d53ad20
@@ -91,6 +91,7 @@ void RivFemElmVisibilityCalculator::computeRangeVisibility( cvf::UByteArray*
|
||||
void RivFemElmVisibilityCalculator::computePropertyVisibility( cvf::UByteArray* cellVisibility,
|
||||
const RigFemPart* part,
|
||||
int timeStepIndex,
|
||||
int frameIndex,
|
||||
const cvf::UByteArray* rangeFilterVisibility,
|
||||
RimGeoMechPropertyFilterCollection* propFilterColl )
|
||||
{
|
||||
@@ -124,7 +125,7 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility( cvf::UByteArray*
|
||||
resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
|
||||
|
||||
const std::vector<float>& resVals =
|
||||
caseData->femPartResults()->resultValues( resVarAddress, part->elementPartId(), timeStepIndex );
|
||||
caseData->femPartResults()->resultValues( resVarAddress, part->elementPartId(), timeStepIndex, frameIndex );
|
||||
|
||||
if ( !propertyFilter->isActive() ) continue;
|
||||
if ( !propertyFilter->resultDefinition->hasResult() ) continue;
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
static void computePropertyVisibility( cvf::UByteArray* cellVisibility,
|
||||
const RigFemPart* grid,
|
||||
int timeStepIndex,
|
||||
int frameIndex,
|
||||
const cvf::UByteArray* rangeFilterVisibility,
|
||||
RimGeoMechPropertyFilterCollection* propFilterColl );
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ void RivFemPartPartMgr::updateCellColor( cvf::Color4f color )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemPartPartMgr::updateCellResultColor( size_t timeStepIndex, RimGeoMechCellColors* cellResultColors )
|
||||
void RivFemPartPartMgr::updateCellResultColor( int timeStepIndex, int frameIndex, RimGeoMechCellColors* cellResultColors )
|
||||
{
|
||||
CVF_ASSERT( cellResultColors );
|
||||
|
||||
@@ -297,7 +297,7 @@ void RivFemPartPartMgr::updateCellResultColor( size_t timeStepIndex, RimGeoMechC
|
||||
}
|
||||
|
||||
const std::vector<float>& resultValues =
|
||||
caseData->femPartResults()->resultValues( resVarAddress, m_partIdx, (int)timeStepIndex );
|
||||
caseData->femPartResults()->resultValues( resVarAddress, m_partIdx, timeStepIndex, frameIndex );
|
||||
|
||||
const std::vector<size_t>* vxToResultMapping = nullptr;
|
||||
int vxCount = 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void setDisplacements( bool useDisplacements, double scalingFactor, const std::vector<cvf::Vec3f>& displacements );
|
||||
|
||||
void updateCellColor( cvf::Color4f color );
|
||||
void updateCellResultColor( size_t timeStepIndex, RimGeoMechCellColors* cellResultColors );
|
||||
void updateCellResultColor( int timeStepIndex, int frameIndex, RimGeoMechCellColors* cellResultColors );
|
||||
|
||||
void appendPartsToModel( cvf::ModelBasicList* model );
|
||||
|
||||
|
||||
@@ -116,11 +116,11 @@ void RivGeoMechPartMgr::updateCellColor( cvf::Color4f color )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechPartMgr::updateCellResultColor( size_t timeStepIndex, RimGeoMechCellColors* cellResultColors )
|
||||
void RivGeoMechPartMgr::updateCellResultColor( int timeStepIndex, int frameIndex, RimGeoMechCellColors* cellResultColors )
|
||||
{
|
||||
for ( size_t i = 0; i < m_femPartPartMgrs.size(); ++i )
|
||||
{
|
||||
m_femPartPartMgrs[i]->updateCellResultColor( timeStepIndex, cellResultColors );
|
||||
m_femPartPartMgrs[i]->updateCellResultColor( timeStepIndex, frameIndex, cellResultColors );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
cvf::ref<cvf::UByteArray> cellVisibility( size_t partIndex );
|
||||
|
||||
void updateCellColor( cvf::Color4f color );
|
||||
void updateCellResultColor( size_t timeStepIndex, RimGeoMechCellColors* cellResultColors );
|
||||
void updateCellResultColor( int timeStepIndex, int frameIndex, RimGeoMechCellColors* cellResultColors );
|
||||
|
||||
void appendGridPartsToModel( cvf::ModelBasicList* model, const std::vector<size_t>& partIndices );
|
||||
void appendGridPartsToModel( cvf::ModelBasicList* model );
|
||||
|
||||
@@ -87,10 +87,10 @@ RivGeoMechPartMgr* RivGeoMechPartMgrCache::partMgr( const Key& key )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechPartMgrCache::Key::set( RivCellSetEnum aGeometryType, int aFrameIndex )
|
||||
void RivGeoMechPartMgrCache::Key::set( RivCellSetEnum aGeometryType, int aViewerTimeStep )
|
||||
{
|
||||
m_frameIndex = aFrameIndex;
|
||||
m_geometryType = aGeometryType;
|
||||
m_viewerStepIndex = aViewerTimeStep;
|
||||
m_geometryType = aGeometryType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -98,9 +98,9 @@ void RivGeoMechPartMgrCache::Key::set( RivCellSetEnum aGeometryType, int aFrameI
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivGeoMechPartMgrCache::Key::operator<( const Key& other ) const
|
||||
{
|
||||
if ( m_frameIndex != other.m_frameIndex )
|
||||
if ( m_viewerStepIndex != other.m_viewerStepIndex )
|
||||
{
|
||||
return ( m_frameIndex < other.m_frameIndex );
|
||||
return ( m_viewerStepIndex < other.m_viewerStepIndex );
|
||||
}
|
||||
return ( m_geometryType < other.m_geometryType );
|
||||
}
|
||||
@@ -108,8 +108,8 @@ bool RivGeoMechPartMgrCache::Key::operator<( const Key& other ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGeoMechPartMgrCache::Key::Key( RivCellSetEnum aGeometryType, int aFrameIndex )
|
||||
RivGeoMechPartMgrCache::Key::Key( RivCellSetEnum aGeometryType, int aViewerTimeStep )
|
||||
: m_geometryType( aGeometryType )
|
||||
, m_frameIndex( aFrameIndex )
|
||||
, m_viewerStepIndex( aViewerTimeStep )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,21 +40,21 @@ public:
|
||||
public:
|
||||
Key()
|
||||
: m_geometryType( -1 )
|
||||
, m_frameIndex( -1 )
|
||||
, m_viewerStepIndex( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
Key( RivCellSetEnum aGeometryType, int aFrameIndex );
|
||||
Key( RivCellSetEnum aGeometryType, int aViewerTimeStep );
|
||||
|
||||
void set( RivCellSetEnum aGeometryType, int aFrameIndex );
|
||||
void set( RivCellSetEnum aGeometryType, int aViewerTimeStep );
|
||||
|
||||
int frameIndex() const { return m_frameIndex; }
|
||||
int viewerStepIndex() const { return m_viewerStepIndex; }
|
||||
unsigned short geometryType() const { return m_geometryType; }
|
||||
|
||||
bool operator<( const Key& other ) const;
|
||||
|
||||
private:
|
||||
int m_frameIndex;
|
||||
int m_viewerStepIndex;
|
||||
unsigned short m_geometryType;
|
||||
};
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ void RivGeoMechVizLogic::appendNoAnimPartsToModel( cvf::ModelBasicList* model )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::appendPartsToModel( int timeStepIndex, cvf::ModelBasicList* model )
|
||||
void RivGeoMechVizLogic::appendPartsToModel( int viewerStepIndex, cvf::ModelBasicList* model )
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( timeStepIndex );
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( viewerStepIndex );
|
||||
for ( size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx )
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = getUpdatedPartMgr( visiblePartMgrs[pmIdx] );
|
||||
@@ -83,22 +83,25 @@ void RivGeoMechVizLogic::appendPartsToModel( int timeStepIndex, cvf::ModelBasicL
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::updateCellResultColor( int timeStepIndex, RimGeoMechCellColors* cellResultColors )
|
||||
void RivGeoMechVizLogic::updateCellResultColor( int viewerStepIndex,
|
||||
int timeStepIndex,
|
||||
int frameIndex,
|
||||
RimGeoMechCellColors* cellResultColors )
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( timeStepIndex );
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( viewerStepIndex );
|
||||
for ( size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx )
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = m_partMgrCache->partMgr( visiblePartMgrs[pmIdx] );
|
||||
partMgr->updateCellResultColor( timeStepIndex, cellResultColors );
|
||||
partMgr->updateCellResultColor( timeStepIndex, frameIndex, cellResultColors );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::updateStaticCellColors( int timeStepIndex )
|
||||
void RivGeoMechVizLogic::updateStaticCellColors( int viewerStepIndex )
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( timeStepIndex );
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( viewerStepIndex );
|
||||
for ( size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx )
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = m_partMgrCache->partMgr( visiblePartMgrs[pmIdx] );
|
||||
@@ -114,15 +117,18 @@ void RivGeoMechVizLogic::scheduleGeometryRegen( RivCellSetEnum geometryType )
|
||||
{
|
||||
this->scheduleRegenOfDirectlyDependentGeometry( geometryType );
|
||||
|
||||
int frameCount = 0;
|
||||
if ( m_geomechView->geoMechCase() && m_geomechView->geoMechCase()->geoMechData() )
|
||||
bool resultsOk = ( m_geomechView->geoMechCase() && m_geomechView->geoMechCase()->geoMechData() &&
|
||||
m_geomechView->geoMechCase()->geoMechData()->femPartResults() );
|
||||
|
||||
int stepCount = 0;
|
||||
if ( resultsOk )
|
||||
{
|
||||
frameCount = m_geomechView->geoMechCase()->geoMechData()->femPartResults()->frameCount();
|
||||
stepCount = m_geomechView->geoMechCase()->geoMechData()->femPartResults()->totalSteps();
|
||||
}
|
||||
|
||||
for ( int fIdx = -1; fIdx < frameCount; ++fIdx )
|
||||
for ( int stepIdx = -1; stepIdx < stepCount; stepIdx++ )
|
||||
{
|
||||
RivGeoMechPartMgrCache::Key geomToRegen( geometryType, fIdx );
|
||||
RivGeoMechPartMgrCache::Key geomToRegen( geometryType, stepIdx );
|
||||
m_partMgrCache->scheduleRegeneration( geomToRegen );
|
||||
}
|
||||
}
|
||||
@@ -130,9 +136,9 @@ void RivGeoMechVizLogic::scheduleGeometryRegen( RivCellSetEnum geometryType )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::scheduleGeometryRegenOfVisiblePartMgrs( int timeStepIndex )
|
||||
void RivGeoMechVizLogic::scheduleGeometryRegenOfVisiblePartMgrs( int viewerStepIndex )
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( timeStepIndex );
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( viewerStepIndex );
|
||||
for ( size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx )
|
||||
{
|
||||
m_partMgrCache->scheduleRegeneration( visiblePartMgrs[pmIdx] );
|
||||
@@ -153,7 +159,7 @@ void RivGeoMechVizLogic::scheduleRegenOfDirectlyDependentGeometry( RivCellSetEnu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RivGeoMechPartMgrCache::Key> RivGeoMechVizLogic::keysToVisiblePartMgrs( int timeStepIndex ) const
|
||||
std::vector<RivGeoMechPartMgrCache::Key> RivGeoMechVizLogic::keysToVisiblePartMgrs( int viewerStepIndex ) const
|
||||
{
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs;
|
||||
if ( m_geomechView->viewController() && m_geomechView->viewController()->isVisibleCellsOveridden() )
|
||||
@@ -162,9 +168,9 @@ std::vector<RivGeoMechPartMgrCache::Key> RivGeoMechVizLogic::keysToVisiblePartMg
|
||||
}
|
||||
else if ( m_geomechView->isGridVisualizationMode() )
|
||||
{
|
||||
if ( timeStepIndex >= 0 && m_geomechView->geoMechPropertyFilterCollection()->hasActiveFilters() )
|
||||
if ( viewerStepIndex >= 0 && m_geomechView->geoMechPropertyFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
visiblePartMgrs.push_back( RivGeoMechPartMgrCache::Key( PROPERTY_FILTERED, timeStepIndex ) );
|
||||
visiblePartMgrs.push_back( RivGeoMechPartMgrCache::Key( PROPERTY_FILTERED, viewerStepIndex ) );
|
||||
}
|
||||
else if ( m_geomechView->cellFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
@@ -207,10 +213,15 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr( RivGeoMechPartMgrCache
|
||||
RivGeoMechPartMgr* partMgrToUpdate = m_partMgrCache->partMgr( pMgrKey );
|
||||
int partCount = 0;
|
||||
RigGeoMechCaseData* caseData = nullptr;
|
||||
int timeStepIdx = -1;
|
||||
int frameIdx = -1;
|
||||
|
||||
if ( m_geomechView->geoMechCase() )
|
||||
{
|
||||
caseData = m_geomechView->geoMechCase()->geoMechData();
|
||||
partCount = caseData->femParts()->partCount();
|
||||
std::tie( timeStepIdx, frameIdx ) =
|
||||
caseData->femPartResults()->stepListIndexToTimeStepAndDataFrameIndex( pMgrKey.viewerStepIndex() );
|
||||
}
|
||||
|
||||
if ( partMgrToUpdate->initializedFemPartCount() != partCount )
|
||||
@@ -251,7 +262,8 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr( RivGeoMechPartMgrCache
|
||||
|
||||
RivFemElmVisibilityCalculator::computePropertyVisibility( elmVisibility.p(),
|
||||
caseData->femParts()->part( femPartIdx ),
|
||||
pMgrKey.frameIndex(),
|
||||
timeStepIdx,
|
||||
frameIdx,
|
||||
rangeFiltVisibility.p(),
|
||||
m_geomechView->geoMechPropertyFilterCollection() );
|
||||
}
|
||||
@@ -282,7 +294,7 @@ RivGeoMechPartMgr* RivGeoMechVizLogic::getUpdatedPartMgr( RivGeoMechPartMgrCache
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStepIndex )
|
||||
void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int viewerStepIndex )
|
||||
{
|
||||
if ( !m_geomechView->geoMechCase() ) return;
|
||||
|
||||
@@ -298,7 +310,7 @@ void RivGeoMechVizLogic::calculateCurrentTotalCellVisibility( cvf::UByteArray* t
|
||||
totalVisibility->resize( elmCount );
|
||||
totalVisibility->setAll( false );
|
||||
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( timeStepIndex );
|
||||
std::vector<RivGeoMechPartMgrCache::Key> visiblePartMgrs = keysToVisiblePartMgrs( viewerStepIndex );
|
||||
for ( size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx )
|
||||
{
|
||||
RivGeoMechPartMgr* partMgr = getUpdatedPartMgr( visiblePartMgrs[pmIdx] );
|
||||
|
||||
@@ -43,13 +43,13 @@ public:
|
||||
~RivGeoMechVizLogic() override;
|
||||
|
||||
void appendNoAnimPartsToModel( cvf::ModelBasicList* model );
|
||||
void appendPartsToModel( int timeStepIndex, cvf::ModelBasicList* model );
|
||||
void updateCellResultColor( int timeStepIndex, RimGeoMechCellColors* cellResultColors );
|
||||
void updateStaticCellColors( int timeStepIndex );
|
||||
void appendPartsToModel( int viewerStepIndex, cvf::ModelBasicList* model );
|
||||
void updateCellResultColor( int viewerStepIndex, int timeStepIndex, int frameIndex, RimGeoMechCellColors* cellResultColors );
|
||||
void updateStaticCellColors( int viewerStepIndex );
|
||||
void scheduleGeometryRegen( RivCellSetEnum geometryType );
|
||||
void scheduleGeometryRegenOfVisiblePartMgrs( int timeStepIndex );
|
||||
void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStepIndex );
|
||||
std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs( int timeStepIndex ) const;
|
||||
void scheduleGeometryRegenOfVisiblePartMgrs( int viewerStepIndex );
|
||||
void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int viewerStepIndex );
|
||||
std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs( int viewerStepIndex ) const;
|
||||
const cvf::ref<RivGeoMechPartMgrCache> partMgrCache() const;
|
||||
|
||||
static cvf::Color3f staticCellColor();
|
||||
|
||||
Reference in New Issue
Block a user