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
@@ -483,7 +483,7 @@ QStringList RimGeoMechCase::timeStepStrings() const
|
||||
const RigGeoMechCaseData* rigCaseData = geoMechData();
|
||||
if ( rigCaseData && rigCaseData->femPartResults() )
|
||||
{
|
||||
std::vector<std::string> stepNames = rigCaseData->femPartResults()->filteredStepNames();
|
||||
std::vector<std::string> stepNames = rigCaseData->femPartResults()->stepNames();
|
||||
for ( size_t i = 0; i < stepNames.size(); i++ )
|
||||
{
|
||||
stringList += QString::fromStdString( stepNames[i] );
|
||||
@@ -496,15 +496,15 @@ QStringList RimGeoMechCase::timeStepStrings() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGeoMechCase::timeStepName( int frameIdx ) const
|
||||
QString RimGeoMechCase::timeStepName( int timeStepIdx ) const
|
||||
{
|
||||
const RigGeoMechCaseData* rigCaseData = geoMechData();
|
||||
if ( rigCaseData && rigCaseData->femPartResults() )
|
||||
{
|
||||
std::vector<std::string> stepNames = rigCaseData->femPartResults()->filteredStepNames();
|
||||
if ( frameIdx < static_cast<int>( stepNames.size() ) )
|
||||
std::vector<std::string> stepNames = rigCaseData->femPartResults()->stepNames();
|
||||
if ( timeStepIdx < static_cast<int>( stepNames.size() ) )
|
||||
{
|
||||
return QString::fromStdString( stepNames[frameIdx] );
|
||||
return QString::fromStdString( stepNames[timeStepIdx] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,28 +519,31 @@ cvf::BoundingBox RimGeoMechCase::reservoirBoundingBox()
|
||||
cvf::BoundingBox boundingBox;
|
||||
|
||||
RigGeoMechCaseData* rigCaseData = this->geoMechData();
|
||||
if ( rigCaseData && rigCaseData->femPartResults() && rigCaseData->femParts()->part( 0 ) )
|
||||
if ( rigCaseData && rigCaseData->femPartResults() && rigCaseData->femParts() )
|
||||
{
|
||||
RigFemPart* femPart = rigCaseData->femParts()->part( 0 );
|
||||
const RigFemPartGrid* femPartGrid = femPart->getOrCreateStructGrid();
|
||||
|
||||
RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "" );
|
||||
const std::vector<float>& resultValues = rigCaseData->femPartResults()->resultValues( porBarAddr, 0, 0 );
|
||||
|
||||
for ( int i = 0; i < femPart->elementCount(); ++i )
|
||||
for ( int p = 0; p < rigCaseData->femParts()->partCount(); p++ )
|
||||
{
|
||||
size_t resValueIdx = femPart->elementNodeResultIdx( (int)i, 0 );
|
||||
CVF_ASSERT( resValueIdx < resultValues.size() );
|
||||
double scalarValue = resultValues[resValueIdx];
|
||||
bool validPorValue = scalarValue != std::numeric_limits<double>::infinity();
|
||||
RigFemPart* femPart = rigCaseData->femParts()->part( p );
|
||||
const RigFemPartGrid* femPartGrid = femPart->getOrCreateStructGrid();
|
||||
|
||||
if ( validPorValue )
|
||||
RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "" );
|
||||
const std::vector<float>& resultValues = rigCaseData->femPartResults()->resultValues( porBarAddr, p, 0, 0 );
|
||||
|
||||
for ( int i = 0; i < femPart->elementCount(); ++i )
|
||||
{
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
femPartGrid->cellCornerVertices( i, hexCorners.data() );
|
||||
for ( size_t c = 0; c < 8; ++c )
|
||||
size_t resValueIdx = femPart->elementNodeResultIdx( (int)i, 0 );
|
||||
CVF_ASSERT( resValueIdx < resultValues.size() );
|
||||
double scalarValue = resultValues[resValueIdx];
|
||||
bool validPorValue = scalarValue != std::numeric_limits<double>::infinity();
|
||||
|
||||
if ( validPorValue )
|
||||
{
|
||||
boundingBox.add( hexCorners[c] );
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
femPartGrid->cellCornerVertices( i, hexCorners.data() );
|
||||
for ( size_t c = 0; c < 8; ++c )
|
||||
{
|
||||
boundingBox.add( hexCorners[c] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
|
||||
std::vector<QDateTime> timeStepDates() const override;
|
||||
QStringList timeStepStrings() const override;
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
QString timeStepName( int timeStepIdx ) const override;
|
||||
|
||||
cvf::BoundingBox reservoirBoundingBox() override;
|
||||
cvf::BoundingBox activeCellsBoundingBox() const override;
|
||||
|
||||
@@ -159,9 +159,12 @@ cvf::ref<cvf::UByteArray> RimGeoMechContourMapProjection::getCellVisibility() co
|
||||
}
|
||||
if ( view()->propertyFilterCollection()->isActive() )
|
||||
{
|
||||
auto [stepIdx, frameIdx] = view()->currentStepAndDataFrame();
|
||||
|
||||
RivFemElmVisibilityCalculator::computePropertyVisibility( cellGridIdxVisibility.p(),
|
||||
m_femPart.p(),
|
||||
view()->currentTimeStep(),
|
||||
stepIdx,
|
||||
frameIdx,
|
||||
cellGridIdxVisibility.p(),
|
||||
view()->geoMechPropertyFilterCollection() );
|
||||
}
|
||||
@@ -172,7 +175,7 @@ cvf::ref<cvf::UByteArray> RimGeoMechContourMapProjection::getCellVisibility() co
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimGeoMechContourMapProjection::calculateExpandedPorBarBBox( int timeStep ) const
|
||||
cvf::BoundingBox RimGeoMechContourMapProjection::calculateExpandedPorBarBBox( int timeStep, int frameIndex ) const
|
||||
{
|
||||
RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL,
|
||||
"POR-Bar",
|
||||
@@ -180,7 +183,7 @@ cvf::BoundingBox RimGeoMechContourMapProjection::calculateExpandedPorBarBBox( in
|
||||
RigGeoMechCaseData* caseData = geoMechCase()->geoMechData();
|
||||
RigFemPartResultsCollection* resultCollection = caseData->femPartResults();
|
||||
|
||||
const std::vector<float>& resultValues = resultCollection->resultValues( porBarAddr, 0, timeStep );
|
||||
const std::vector<float>& resultValues = resultCollection->resultValues( porBarAddr, 0, timeStep, frameIndex );
|
||||
cvf::BoundingBox boundingBox;
|
||||
|
||||
if ( resultValues.empty() )
|
||||
@@ -230,7 +233,9 @@ void RimGeoMechContourMapProjection::updateGridInformation()
|
||||
|
||||
if ( m_limitToPorePressureRegions )
|
||||
{
|
||||
m_expandedBoundingBox = calculateExpandedPorBarBBox( view()->currentTimeStep() );
|
||||
auto [stepIdx, frameIdx] = view()->currentStepAndDataFrame();
|
||||
|
||||
m_expandedBoundingBox = calculateExpandedPorBarBBox( stepIdx, frameIdx );
|
||||
if ( !m_expandedBoundingBox.isValid() )
|
||||
{
|
||||
m_limitToPorePressureRegions = false;
|
||||
@@ -333,12 +338,13 @@ std::vector<double> RimGeoMechContourMapProjection::retrieveParameterWeights()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimGeoMechContourMapProjection::generateResults( int timeStep )
|
||||
std::vector<double> RimGeoMechContourMapProjection::generateResults( int viewerStepIndex )
|
||||
{
|
||||
RimGeoMechCellColors* cellColors = view()->cellResult();
|
||||
RigFemResultAddress resultAddress = cellColors->resultAddress();
|
||||
|
||||
std::vector<double> aggregatedResults = generateResultsFromAddress( resultAddress, m_mapCellVisibility, timeStep );
|
||||
std::vector<double> aggregatedResults =
|
||||
generateResultsFromAddress( resultAddress, m_mapCellVisibility, viewerStepIndex );
|
||||
|
||||
return aggregatedResults;
|
||||
}
|
||||
@@ -348,13 +354,15 @@ std::vector<double> RimGeoMechContourMapProjection::generateResults( int timeSte
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimGeoMechContourMapProjection::generateResultsFromAddress( RigFemResultAddress resultAddress,
|
||||
const std::vector<bool>& mapCellVisibility,
|
||||
int timeStep )
|
||||
int viewerStepIndex )
|
||||
{
|
||||
RigGeoMechCaseData* caseData = geoMechCase()->geoMechData();
|
||||
RigFemPartResultsCollection* resultCollection = caseData->femPartResults();
|
||||
size_t nCells = numberOfCells();
|
||||
std::vector<double> aggregatedResults = std::vector<double>( nCells, std::numeric_limits<double>::infinity() );
|
||||
|
||||
auto [stepIdx, frameIdx] = caseData->femPartResults()->stepListIndexToTimeStepAndDataFrameIndex( viewerStepIndex );
|
||||
|
||||
bool wasInvalid = false;
|
||||
if ( !resultAddress.isValid() )
|
||||
{
|
||||
@@ -375,7 +383,7 @@ std::vector<double> RimGeoMechContourMapProjection::generateResultsFromAddress(
|
||||
resultAddress.resultPosType = RIG_ELEMENT_NODAL; // formation indices are stored per element node result.
|
||||
}
|
||||
|
||||
std::vector<float> resultValuesF = resultCollection->resultValues( resultAddress, 0, timeStep );
|
||||
std::vector<float> resultValuesF = resultCollection->resultValues( resultAddress, 0, stepIdx, frameIdx );
|
||||
if ( resultValuesF.empty() ) return aggregatedResults;
|
||||
|
||||
std::vector<double> resultValues = gridCellValues( resultAddress, resultValuesF );
|
||||
@@ -672,3 +680,32 @@ void RimGeoMechContourMapProjection::defineEditorAttribute( const caf::PdmFieldH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<double, double> RimGeoMechContourMapProjection::minmaxValuesAllTimeSteps()
|
||||
{
|
||||
if ( !resultRangeIsValid() )
|
||||
{
|
||||
clearTimeStepRange();
|
||||
|
||||
m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, minValue( m_aggregatedResults ) );
|
||||
m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, maxValue( m_aggregatedResults ) );
|
||||
|
||||
if ( geoMechCase() && geoMechCase()->geoMechData() && geoMechCase()->geoMechData()->femPartResults() )
|
||||
{
|
||||
int steps = geoMechCase()->geoMechData()->femPartResults()->totalSteps();
|
||||
|
||||
for ( int stepIdx = 0; stepIdx < steps; stepIdx++ )
|
||||
{
|
||||
if ( stepIdx == m_currentResultTimestep ) continue;
|
||||
|
||||
std::vector<double> aggregatedResults = generateResults( stepIdx );
|
||||
m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, minValue( aggregatedResults ) );
|
||||
m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, maxValue( aggregatedResults ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::make_pair( m_minResultAllTimeSteps, m_maxResultAllTimeSteps );
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ protected:
|
||||
|
||||
// GeoMech implementation specific data generation methods
|
||||
cvf::ref<cvf::UByteArray> getCellVisibility() const override;
|
||||
cvf::BoundingBox calculateExpandedPorBarBBox( int timeStep ) const;
|
||||
cvf::BoundingBox calculateExpandedPorBarBBox( int timeStep, int frameIndex ) const;
|
||||
void updateGridInformation() override;
|
||||
std::vector<bool> getMapCellVisibility() override;
|
||||
std::vector<double> retrieveParameterWeights() override;
|
||||
std::vector<double> generateResults( int timeStep ) override;
|
||||
std::vector<double> generateResults( int viewerStepIndex ) override;
|
||||
std::vector<double> generateResultsFromAddress( RigFemResultAddress resultAddress,
|
||||
const std::vector<bool>& mapCellVisibility,
|
||||
int timeStep );
|
||||
int viewerStepIndex );
|
||||
bool resultVariableChanged() const override;
|
||||
void clearResultVariable() override;
|
||||
RimGridView* baseView() const override;
|
||||
@@ -85,6 +85,8 @@ protected:
|
||||
RimGeoMechCase* geoMechCase() const;
|
||||
RimGeoMechContourMapView* view() const;
|
||||
|
||||
std::pair<double, double> minmaxValuesAllTimeSteps() override;
|
||||
|
||||
void updateAfterResultGeneration( int timeStep ) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -260,7 +260,7 @@ void RimGeoMechContourMapView::updateGeometry()
|
||||
{ // Step 1: generate results. About 30% of the time.
|
||||
if ( m_contourMapProjection->isChecked() )
|
||||
{
|
||||
m_contourMapProjection->generateResultsIfNecessary( m_currentTimeStep() );
|
||||
m_contourMapProjection->generateResultsIfNecessary( m_currentTimeStep );
|
||||
}
|
||||
onUpdateLegends();
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
std::vector<std::string> stepNames;
|
||||
if ( m_geomCase->geoMechData() )
|
||||
{
|
||||
stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames();
|
||||
stepNames = m_geomCase->geoMechData()->femPartResults()->stepNames();
|
||||
}
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( QString( "Disabled" ), RigFemResultAddress::noTimeLapseValue() ) );
|
||||
@@ -265,7 +265,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
std::vector<std::string> stepNames;
|
||||
if ( m_geomCase->geoMechData() )
|
||||
{
|
||||
stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames();
|
||||
stepNames = m_geomCase->geoMechData()->femPartResults()->stepNames();
|
||||
}
|
||||
|
||||
for ( size_t stepIdx = 0; stepIdx < stepNames.size(); ++stepIdx )
|
||||
@@ -698,14 +698,14 @@ QString RimGeoMechResultDefinition::diffResultUiName() const
|
||||
{
|
||||
if ( referenceCaseDependentResultSelected() )
|
||||
{
|
||||
std::vector<std::string> stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames();
|
||||
QString timeStepString = QString::fromStdString( stepNames[m_referenceTimeStep()] );
|
||||
std::vector<std::string> timeStepNames = m_geomCase->geoMechData()->femPartResults()->stepNames();
|
||||
QString timeStepString = QString::fromStdString( timeStepNames[m_referenceTimeStep()] );
|
||||
diffResultString += QString( "<b>Reference Time Step</b>: %1" ).arg( timeStepString );
|
||||
}
|
||||
else if ( m_timeLapseBaseTimestep != RigFemResultAddress::noTimeLapseValue() )
|
||||
{
|
||||
std::vector<std::string> stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames();
|
||||
QString timeStepString = QString::fromStdString( stepNames[m_timeLapseBaseTimestep()] );
|
||||
std::vector<std::string> timeStepNames = m_geomCase->geoMechData()->femPartResults()->stepNames();
|
||||
QString timeStepString = QString::fromStdString( timeStepNames[m_timeLapseBaseTimestep()] );
|
||||
diffResultString += QString( "<b>Base Time Step</b>: %1" ).arg( timeStepString );
|
||||
}
|
||||
}
|
||||
@@ -943,7 +943,7 @@ void RimGeoMechResultDefinition::setResultAddress( const RigFemResultAddress& re
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechResultDefinition::updateLegendTextAndRanges( RimRegularLegendConfig* legendConfigToUpdate,
|
||||
const QString& legendHeading,
|
||||
int timeStepIndex )
|
||||
int viewerStepIndex )
|
||||
{
|
||||
if ( !this->ownerCaseData() || !( this->resultAddress().isValid() ) )
|
||||
{
|
||||
@@ -960,8 +960,14 @@ void RimGeoMechResultDefinition::updateLegendTextAndRanges( RimRegularLegendConf
|
||||
|
||||
RigFemResultAddress resVarAddress = this->resultAddress();
|
||||
|
||||
gmCase->femPartResults()->minMaxScalarValues( resVarAddress, timeStepIndex, &localMin, &localMax );
|
||||
gmCase->femPartResults()->posNegClosestToZero( resVarAddress, timeStepIndex, &localPosClosestToZero, &localNegClosestToZero );
|
||||
auto [stepIdx, frameIdx] = gmCase->femPartResults()->stepListIndexToTimeStepAndDataFrameIndex( viewerStepIndex );
|
||||
|
||||
gmCase->femPartResults()->minMaxScalarValues( resVarAddress, stepIdx, frameIdx, &localMin, &localMax );
|
||||
gmCase->femPartResults()->posNegClosestToZero( resVarAddress,
|
||||
stepIdx,
|
||||
frameIdx,
|
||||
&localPosClosestToZero,
|
||||
&localNegClosestToZero );
|
||||
|
||||
gmCase->femPartResults()->minMaxScalarValues( resVarAddress, &globalMin, &globalMax );
|
||||
gmCase->femPartResults()->posNegClosestToZero( resVarAddress, &globalPosClosestToZero, &globalNegClosestToZero );
|
||||
|
||||
@@ -83,6 +83,8 @@ CAF_PDM_SOURCE_INIT( RimGeoMechView, "GeoMechView" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechView::RimGeoMechView( void )
|
||||
: m_currentInternalTimeStep( 0 )
|
||||
, m_currentDataFrameIndex( -1 )
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Geomechanical View", ":/3DViewGeoMech16x16.png", "", "The Geomechanical 3d View" );
|
||||
|
||||
@@ -277,10 +279,9 @@ void RimGeoMechView::onCreateDisplayModel()
|
||||
|
||||
if ( isTimeStepDependentDataVisibleInThisOrComparisonView() )
|
||||
{
|
||||
// Create empty frames in the viewer
|
||||
|
||||
int frameCount = geoMechCase()->geoMechData()->femPartResults()->frameCount();
|
||||
for ( int frameIndex = 0; frameIndex < frameCount; frameIndex++ )
|
||||
// Create empty frames in the viewer, one per global timestep
|
||||
const int totalSteps = geoMechCase()->geoMechData()->femPartResults()->totalSteps();
|
||||
for ( int timeStepIndex = 0; timeStepIndex < totalSteps; timeStepIndex++ )
|
||||
{
|
||||
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
||||
cvf::ref<cvf::ModelBasicList> emptyModel = new cvf::ModelBasicList;
|
||||
@@ -370,7 +371,11 @@ void RimGeoMechView::updateElementDisplacements()
|
||||
{
|
||||
std::string errmsg;
|
||||
std::vector<cvf::Vec3f> displacements;
|
||||
m_geomechCase->geoMechData()->readDisplacements( &errmsg, part->partId(), m_currentTimeStep, &displacements );
|
||||
m_geomechCase->geoMechData()->readDisplacements( &errmsg,
|
||||
part->partId(),
|
||||
m_currentInternalTimeStep,
|
||||
m_currentDataFrameIndex,
|
||||
&displacements );
|
||||
part->setDisplacements( displacements );
|
||||
}
|
||||
}
|
||||
@@ -381,6 +386,15 @@ void RimGeoMechView::updateElementDisplacements()
|
||||
m_vizLogic->scheduleGeometryRegenOfVisiblePartMgrs( m_currentTimeStep );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<int, int> RimGeoMechView::viewerStepToTimeStepAndFrameIndex( int viewerTimeStep )
|
||||
{
|
||||
// assuming callers check if the case etc. exists
|
||||
return m_geomechCase->geoMechData()->femPartResults()->stepListIndexToTimeStepAndDataFrameIndex( viewerTimeStep );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -431,7 +445,10 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep()
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
|
||||
frameParts->setName( name );
|
||||
m_tensorPartMgr->appendDynamicGeometryPartsToModel( frameParts.p(), m_currentTimeStep );
|
||||
m_tensorPartMgr->appendDynamicGeometryPartsToModel( frameParts.p(),
|
||||
m_currentTimeStep,
|
||||
m_currentInternalTimeStep,
|
||||
m_currentDataFrameIndex );
|
||||
frameParts->updateBoundingBoxesRecursive();
|
||||
|
||||
if ( frameParts->partCount() != 0 )
|
||||
@@ -445,7 +462,10 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep()
|
||||
bool hasGeneralCellResult = this->cellResult()->hasResult();
|
||||
|
||||
if ( hasGeneralCellResult )
|
||||
m_vizLogic->updateCellResultColor( m_currentTimeStep(), this->cellResult() );
|
||||
m_vizLogic->updateCellResultColor( m_currentTimeStep(),
|
||||
m_currentInternalTimeStep,
|
||||
m_currentDataFrameIndex,
|
||||
this->cellResult() );
|
||||
else
|
||||
m_vizLogic->updateStaticCellColors( m_currentTimeStep() );
|
||||
|
||||
@@ -466,8 +486,8 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep()
|
||||
{
|
||||
m_vizLogic->updateStaticCellColors( -1 );
|
||||
|
||||
m_intersectionCollection->updateCellResultColor( false, m_currentTimeStep );
|
||||
if ( m_surfaceCollection ) m_surfaceCollection->updateCellResultColor( false, m_currentTimeStep );
|
||||
m_intersectionCollection->updateCellResultColor( false, m_currentInternalTimeStep );
|
||||
if ( m_surfaceCollection ) m_surfaceCollection->updateCellResultColor( false, m_currentInternalTimeStep );
|
||||
|
||||
nativeOrOverrideViewer()->animationControl()->slotPause(); // To avoid animation timer spinning in the background
|
||||
}
|
||||
@@ -589,7 +609,7 @@ void RimGeoMechView::onUpdateLegends()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::updateTensorLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int timeStepIndex )
|
||||
void RimGeoMechView::updateTensorLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int viewerTimeStep )
|
||||
{
|
||||
if ( !m_geomechCase || !m_geomechCase->geoMechData() ) return;
|
||||
|
||||
@@ -606,9 +626,16 @@ void RimGeoMechView::updateTensorLegendTextAndRanges( RimRegularLegendConfig* le
|
||||
|
||||
RigFemResultAddress resVarAddress( resPos, resFieldName.toStdString(), "" );
|
||||
|
||||
gmCase->femPartResults()->minMaxScalarValuesOverAllTensorComponents( resVarAddress, timeStepIndex, &localMin, &localMax );
|
||||
auto [timeStepIndex, frameIndex] = gmCase->femPartResults()->stepListIndexToTimeStepAndDataFrameIndex( viewerTimeStep );
|
||||
|
||||
gmCase->femPartResults()->minMaxScalarValuesOverAllTensorComponents( resVarAddress,
|
||||
timeStepIndex,
|
||||
frameIndex,
|
||||
&localMin,
|
||||
&localMax );
|
||||
gmCase->femPartResults()->posNegClosestToZeroOverAllTensorComponents( resVarAddress,
|
||||
timeStepIndex,
|
||||
frameIndex,
|
||||
&localPosClosestToZero,
|
||||
&localNegClosestToZero );
|
||||
|
||||
@@ -793,15 +820,16 @@ RimGeoMechCase* RimGeoMechView::geoMechCase() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::onClampCurrentTimestep()
|
||||
{
|
||||
int maxFrameCount = 0;
|
||||
int maxSteps = 0;
|
||||
|
||||
if ( m_geomechCase )
|
||||
{
|
||||
maxFrameCount = m_geomechCase->geoMechData()->femPartResults()->frameCount();
|
||||
maxSteps = m_geomechCase->geoMechData()->femPartResults()->totalSteps();
|
||||
}
|
||||
|
||||
if ( m_currentTimeStep >= maxFrameCount ) m_currentTimeStep = maxFrameCount - 1;
|
||||
if ( m_currentTimeStep >= maxSteps ) m_currentTimeStep = maxSteps - 1;
|
||||
if ( m_currentTimeStep < 0 ) m_currentTimeStep = 0;
|
||||
|
||||
std::tie( m_currentInternalTimeStep, m_currentDataFrameIndex ) = viewerStepToTimeStepAndFrameIndex( m_currentTimeStep );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -811,7 +839,7 @@ size_t RimGeoMechView::onTimeStepCountRequested()
|
||||
{
|
||||
if ( m_geomechCase && m_geomechCase->geoMechData() && m_geomechCase->geoMechData()->femPartResults() )
|
||||
{
|
||||
return m_geomechCase->geoMechData()->femPartResults()->frameCount();
|
||||
return m_geomechCase->geoMechData()->femPartResults()->totalSteps();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -963,9 +991,9 @@ const RimGeoMechPropertyFilterCollection* RimGeoMechView::geoMechPropertyFilterC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep )
|
||||
void RimGeoMechView::calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int viewerTimeStep )
|
||||
{
|
||||
m_vizLogic->calculateCurrentTotalCellVisibility( totalVisibility, timeStep );
|
||||
m_vizLogic->calculateCurrentTotalCellVisibility( totalVisibility, viewerTimeStep );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1063,6 +1091,14 @@ const RimGeoMechPartCollection* RimGeoMechView::partsCollection() const
|
||||
return m_partsCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<int, int> RimGeoMechView::currentStepAndDataFrame() const
|
||||
{
|
||||
return std::make_pair( m_currentInternalTimeStep, m_currentDataFrameIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -93,9 +93,9 @@ public:
|
||||
|
||||
bool isUsingFormationNames() const override;
|
||||
|
||||
void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep ) override;
|
||||
void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int viewerTimeStep ) override;
|
||||
|
||||
void updateLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int timeStepIndex );
|
||||
void updateLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int viewerTimeStep );
|
||||
|
||||
const cvf::ref<RivGeoMechVizLogic> vizLogic() const;
|
||||
const RimTensorResults* tensorResults() const;
|
||||
@@ -112,6 +112,8 @@ public:
|
||||
bool showDisplacements() const;
|
||||
void setShowDisplacementsAndUpdate( bool show );
|
||||
|
||||
std::pair<int, int> currentStepAndDataFrame() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
@@ -138,10 +140,12 @@ private:
|
||||
|
||||
void onUpdateLegends() override;
|
||||
|
||||
void updateTensorLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int timeStepIndex );
|
||||
void updateTensorLegendTextAndRanges( RimRegularLegendConfig* legendConfig, int viewerTimeStep );
|
||||
|
||||
void updateElementDisplacements();
|
||||
|
||||
std::pair<int, int> viewerStepToTimeStepAndFrameIndex( int viewerTimeStep );
|
||||
|
||||
caf::PdmChildField<RimTensorResults*> m_tensorResults;
|
||||
caf::PdmChildField<RimGeoMechPropertyFilterCollection*> m_propertyFilterCollection;
|
||||
caf::PdmPointer<RimGeoMechPropertyFilterCollection> m_overridePropertyFilterCollection;
|
||||
@@ -154,4 +158,7 @@ private:
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
|
||||
cvf::ref<RivTensorResultPartMgr> m_tensorPartMgr;
|
||||
|
||||
int m_currentInternalTimeStep;
|
||||
int m_currentDataFrameIndex;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user