mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #8168 from OPM/intersection_displacement
GeoMech: Support showing displacements on intersections, too
This commit is contained in:
@@ -91,7 +91,7 @@ void RimGeoMechPart::setDisplacements( const std::vector<cvf::Vec3f>& displaceme
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<cvf::Vec3f> RimGeoMechPart::displacements() const
|
||||
const std::vector<cvf::Vec3f>& RimGeoMechPart::displacements() const
|
||||
{
|
||||
return m_displacements;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ public:
|
||||
void setPartId( int partId );
|
||||
int partId() const;
|
||||
|
||||
void setDisplacements( const std::vector<cvf::Vec3f>& displacements );
|
||||
const std::vector<cvf::Vec3f> displacements() const;
|
||||
void setDisplacements( const std::vector<cvf::Vec3f>& displacements );
|
||||
const std::vector<cvf::Vec3f>& displacements() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
@@ -39,6 +39,7 @@ RimGeoMechPartCollection::RimGeoMechPartCollection()
|
||||
, m_currentDisplacementTimeStep( -1 )
|
||||
, m_displacementsUsed( false )
|
||||
, m_currentScaleFactor( 1.0 )
|
||||
, m_noDisplacements()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Parts", ":/GeoMechCase24x24.png", "", "" );
|
||||
|
||||
@@ -145,12 +146,20 @@ int RimGeoMechPartCollection::currentDisplacementTimeStep() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<cvf::Vec3f> RimGeoMechPartCollection::displacements( int partId ) const
|
||||
double RimGeoMechPartCollection::currentDisplacementScaleFactor() const
|
||||
{
|
||||
return m_currentScaleFactor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<cvf::Vec3f>& RimGeoMechPartCollection::displacements( int partId ) const
|
||||
{
|
||||
RimGeoMechPart* thepart = part( partId );
|
||||
if ( thepart ) return thepart->displacements();
|
||||
|
||||
return std::vector<cvf::Vec3f>();
|
||||
return m_noDisplacements;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -44,11 +44,12 @@ public:
|
||||
|
||||
bool isPartEnabled( int partId ) const;
|
||||
|
||||
const std::vector<cvf::Vec3f> displacements( int partId ) const;
|
||||
const std::vector<cvf::Vec3f>& displacements( int partId ) const;
|
||||
|
||||
void setCurrentDisplacementSettings( int currentTimeStep, bool showDisplacement, double scaleFactor );
|
||||
bool isDisplacementsUsed() const;
|
||||
int currentDisplacementTimeStep() const;
|
||||
void setCurrentDisplacementSettings( int currentTimeStep, bool showDisplacement, double scaleFactor );
|
||||
bool isDisplacementsUsed() const;
|
||||
int currentDisplacementTimeStep() const;
|
||||
double currentDisplacementScaleFactor() const;
|
||||
|
||||
std::vector<RimGeoMechPart*> parts() const;
|
||||
|
||||
@@ -61,4 +62,6 @@ private:
|
||||
int m_currentDisplacementTimeStep;
|
||||
double m_currentScaleFactor;
|
||||
bool m_displacementsUsed;
|
||||
|
||||
std::vector<cvf::Vec3f> m_noDisplacements;
|
||||
};
|
||||
|
||||
@@ -434,14 +434,21 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep()
|
||||
}
|
||||
}
|
||||
|
||||
if ( this->cellResult()->hasResult() )
|
||||
bool hasGeneralCellResult = this->cellResult()->hasResult();
|
||||
|
||||
if ( hasGeneralCellResult )
|
||||
m_vizLogic->updateCellResultColor( m_currentTimeStep(), this->cellResult() );
|
||||
else
|
||||
m_vizLogic->updateStaticCellColors( m_currentTimeStep() );
|
||||
|
||||
bool hasGeneralCellResult = this->cellResult()->hasResult();
|
||||
// Intersections
|
||||
{
|
||||
m_intersectionVizModel->removeAllParts();
|
||||
m_intersectionCollection->rebuildGeometry();
|
||||
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
|
||||
m_intersectionCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
|
||||
}
|
||||
|
||||
m_intersectionCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
|
||||
if ( m_surfaceCollection )
|
||||
{
|
||||
m_surfaceCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
|
||||
|
||||
@@ -185,6 +185,9 @@ void RimIntersection::updateDefaultSeparateDataSource()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterface()
|
||||
{
|
||||
RimGeoMechView* geoView;
|
||||
this->firstAncestorOrThisOfType( geoView );
|
||||
|
||||
RimIntersectionResultDefinition* resDef = activeSeparateResultDefinition();
|
||||
if ( resDef && resDef->activeCase() )
|
||||
{
|
||||
@@ -203,9 +206,9 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
|
||||
|
||||
auto* geomCase = dynamic_cast<RimGeoMechCase*>( resDef->activeCase() );
|
||||
|
||||
if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() )
|
||||
if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() && geoView )
|
||||
{
|
||||
return new RivFemIntersectionGrid( geomCase->geoMechData()->femParts() );
|
||||
return new RivFemIntersectionGrid( geomCase->geoMechData()->femParts(), geoView->partsCollection() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,11 +221,9 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
|
||||
return new RivEclipseIntersectionGrid( grid, eclipseView->currentActiveCellInfo(), this->isInactiveCellsVisible() );
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
this->firstAncestorOrThisOfType( geoView );
|
||||
if ( geoView && geoView->femParts() )
|
||||
{
|
||||
return new RivFemIntersectionGrid( geoView->femParts() );
|
||||
return new RivFemIntersectionGrid( geoView->femParts(), geoView->partsCollection() );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user