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:
@@ -21,11 +21,14 @@
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
|
||||
#include "RimGeoMechPartCollection.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFemIntersectionGrid::RivFemIntersectionGrid( const RigFemPartCollection* femParts )
|
||||
RivFemIntersectionGrid::RivFemIntersectionGrid( const RigFemPartCollection* femParts, const RimGeoMechPartCollection* parts )
|
||||
: m_femParts( femParts )
|
||||
, m_parts( parts )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -83,12 +86,27 @@ void RivFemIntersectionGrid::cellCornerVertices( size_t globalCellIndex, cvf::Ve
|
||||
{
|
||||
auto [part, elementIdx] = m_femParts->partAndElementIndex( globalCellIndex );
|
||||
|
||||
const bool useDisplacements = m_parts->isDisplacementsUsed();
|
||||
|
||||
const std::vector<cvf::Vec3f>& nodeCoords = part->nodes().coordinates;
|
||||
const int* cornerIndices = part->connectivities( elementIdx );
|
||||
|
||||
for ( int i = 0; i < 8; i++ )
|
||||
if ( useDisplacements )
|
||||
{
|
||||
cellCorners[i] = cvf::Vec3d( nodeCoords[cornerIndices[i]] );
|
||||
const double scaleFactor = m_parts->currentDisplacementScaleFactor();
|
||||
const std::vector<cvf::Vec3f>& displacements = m_parts->displacements( part->elementPartId() );
|
||||
for ( int i = 0; i < 8; i++ )
|
||||
{
|
||||
const int idx = cornerIndices[i];
|
||||
cellCorners[i] = cvf::Vec3d( nodeCoords[idx] + displacements[idx] * scaleFactor );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < 8; i++ )
|
||||
{
|
||||
cellCorners[i] = cvf::Vec3d( nodeCoords[cornerIndices[i]] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,12 @@
|
||||
class RigFemPart;
|
||||
class RigFemPartCollection;
|
||||
class RigFault;
|
||||
class RimGeoMechPartCollection;
|
||||
|
||||
class RivFemIntersectionGrid : public RivIntersectionHexGridInterface
|
||||
{
|
||||
public:
|
||||
explicit RivFemIntersectionGrid( const RigFemPartCollection* femParts );
|
||||
explicit RivFemIntersectionGrid( const RigFemPartCollection* femParts, const RimGeoMechPartCollection* parts );
|
||||
|
||||
cvf::Vec3d displayOffset() const override;
|
||||
cvf::BoundingBox boundingBox() const override;
|
||||
@@ -49,4 +50,5 @@ public:
|
||||
|
||||
private:
|
||||
cvf::cref<RigFemPartCollection> m_femParts;
|
||||
const RimGeoMechPartCollection* m_parts;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user