mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
GeoMech: show deformations in grid view (#8123)
Enable support in geomech view to show grid deformations
This commit is contained in:
@@ -19,12 +19,15 @@
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "RivFemPartPartMgr.h"
|
||||
|
||||
#include "RivGeoMechPartMgr.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifGeoMechReaderInterface.h"
|
||||
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigFemScalarResultFrames.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
@@ -103,6 +106,33 @@ void RivFemPartPartMgr::setCellVisibility( cvf::UByteArray* cellVisibilities )
|
||||
generatePartGeometry( m_surfaceGenerator );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemPartPartMgr::setDisplacements( bool useDisplacements,
|
||||
double scalingFactor,
|
||||
const std::vector<cvf::Vec3f>& displacements )
|
||||
{
|
||||
size_t nodeCount = m_part->nodes().coordinates.size();
|
||||
m_displacedNodeCoordinates.resize( nodeCount );
|
||||
const auto coords = m_part->nodes().coordinates;
|
||||
|
||||
if ( useDisplacements )
|
||||
{
|
||||
for ( size_t i = 0; i < nodeCount; i++ )
|
||||
{
|
||||
m_displacedNodeCoordinates[i] = coords[i] + displacements[i] * scalingFactor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( size_t i = 0; i < nodeCount; i++ )
|
||||
{
|
||||
m_displacedNodeCoordinates[i] = coords[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -113,7 +143,7 @@ void RivFemPartPartMgr::generatePartGeometry( RivFemPartGeometryGenerator& geoBu
|
||||
{
|
||||
m_surfaceFaces = nullptr; // To possibly free memory before adding the new stuff
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = geoBuilder.generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> geo = geoBuilder.generateSurface( m_displacedNodeCoordinates );
|
||||
if ( geo.notNull() )
|
||||
{
|
||||
geo->computeNormals();
|
||||
|
||||
Reference in New Issue
Block a user