GeoMech Intersection updates: support multiple parts (#8160)

* Rearrange intersection classes, split single file into one-per-class

* Support multi-part geomech case intersections
This commit is contained in:
jonjenssen 2021-10-15 16:57:18 +02:00 committed by GitHub
parent afadaf27d5
commit b169900c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 741 additions and 397 deletions

View File

@ -92,6 +92,14 @@ int RigFemPart::elementCount() const
return static_cast<int>( m_elementId.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RigFemPart::allConnectivitiesCount() const
{
return static_cast<int>( m_allElementConnectivities.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -57,6 +57,7 @@ public:
void appendElement( RigElementType elmType, int elementId, const int* connectivities );
int elementCount() const;
int allConnectivitiesCount() const;
int elmId( size_t elementIdx ) const;
RigElementType elementType( size_t elementIdx ) const;

View File

@ -39,7 +39,24 @@ RigFemPartCollection::~RigFemPartCollection()
//--------------------------------------------------------------------------------------------------
void RigFemPartCollection::addFemPart( RigFemPart* part )
{
size_t globalElementOffset = 0;
size_t globalNodeOffset = 0;
size_t globalConnectivityOffset = 0;
if ( m_femParts.size() > 0 )
{
size_t lastIndex = m_femParts.size() - 1;
globalElementOffset += m_femParts[lastIndex]->elementCount();
globalElementOffset += m_partElementOffset[lastIndex];
globalNodeOffset += m_femParts[lastIndex]->nodes().nodeIds.size();
globalNodeOffset += m_partNodeOffset[lastIndex];
globalConnectivityOffset += m_femParts[lastIndex]->allConnectivitiesCount();
globalConnectivityOffset += m_partConnectivityOffset[lastIndex];
}
m_femParts.push_back( part );
m_partElementOffset.push_back( globalElementOffset );
m_partNodeOffset.push_back( globalNodeOffset );
m_partConnectivityOffset.push_back( globalConnectivityOffset );
}
//--------------------------------------------------------------------------------------------------
@ -108,3 +125,74 @@ cvf::BoundingBox RigFemPartCollection::boundingBox() const
}
return bBox;
}
//--------------------------------------------------------------------------------------------------
/// convert from global element index to part and part-local index
//--------------------------------------------------------------------------------------------------
std::pair<int, size_t> RigFemPartCollection::partIdAndElementIndex( size_t globalIndex ) const
{
const size_t nParts = m_partElementOffset.size();
CVF_ASSERT( nParts > 0 );
for ( size_t i = 1; i < nParts; i++ )
{
if ( globalIndex < m_partElementOffset[i] )
{
return std::make_pair( (int)( i - 1 ), globalIndex - m_partElementOffset[i - 1] );
}
}
return std::make_pair( (int)( nParts - 1 ), globalIndex - m_partElementOffset.back() );
}
//--------------------------------------------------------------------------------------------------
/// convert from global element index to part and part-local index
//--------------------------------------------------------------------------------------------------
std::pair<const RigFemPart*, size_t> RigFemPartCollection::partAndElementIndex( size_t globalIndex ) const
{
auto [partId, elementIdx] = partIdAndElementIndex( globalIndex );
return std::make_pair( part( partId ), elementIdx );
}
//--------------------------------------------------------------------------------------------------
/// convert from part and part-local index to global index
//--------------------------------------------------------------------------------------------------
size_t RigFemPartCollection::globalIndex( int partId, size_t localIndex ) const
{
return localIndex + m_partElementOffset[partId];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RigFemPartCollection::nodeIdxFromElementNodeResultIdx( size_t globalIndex ) const
{
const size_t nParts = m_partConnectivityOffset.size();
CVF_ASSERT( nParts > 0 );
int partId = (int)( nParts - 1 );
size_t partIdx = globalIndex - m_partConnectivityOffset.back();
for ( size_t i = 1; i < nParts; i++ )
{
if ( globalIndex < m_partConnectivityOffset[i] )
{
partId = (int)( i - 1 );
partIdx = globalIndex - m_partConnectivityOffset[i - 1];
break;
}
}
const RigFemPart* part = this->part( partId );
return (int)m_partNodeOffset[partId] + part->nodeIdxFromElementNodeResultIdx( partIdx );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigFemPartCollection::globalElementNodeResultIdx( int partId, int elementIdx, int elmLocalNodeIdx ) const
{
return m_partElementOffset[partId] * 8 + part( partId )->elementNodeResultIdx( elementIdx, elmLocalNodeIdx );
}

View File

@ -38,6 +38,19 @@ public:
float characteristicElementSize() const;
cvf::BoundingBox boundingBox() const;
std::pair<int, size_t> partIdAndElementIndex( size_t globalIndex ) const;
std::pair<const RigFemPart*, size_t> partAndElementIndex( size_t globalIndex ) const;
size_t globalIndex( int partId, size_t localIndex ) const;
std::pair<int, size_t> partIdAndNodeIndex( size_t globalNodeIndex ) const;
int nodeIdxFromElementNodeResultIdx( size_t globalResultIdx ) const;
size_t globalElementNodeResultIdx( int part, int elementIdx, int elmLocalNodeIdx ) const;
private:
cvf::Collection<RigFemPart> m_femParts;
std::vector<size_t> m_partElementOffset;
std::vector<size_t> m_partNodeOffset;
std::vector<size_t> m_partConnectivityOffset;
};

View File

@ -146,6 +146,8 @@ RigFemScalarResultFrames*
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
{
const std::vector<float>& s11 = s11Frames->frameData( fIdx );
if ( s11.empty() ) continue;
const std::vector<float>& s22 = s22Frames->frameData( fIdx );
const std::vector<float>& s33 = s33Frames->frameData( fIdx );
const std::vector<float>& s12 = s12Frames->frameData( fIdx );

View File

@ -1043,6 +1043,54 @@ const std::vector<float>&
return scalarResults->frameData( frameIndex );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemPartResultsCollection::globalResultValues( const RigFemResultAddress& resVarAddr,
int timeStepIndex,
std::vector<float>& resultValues )
{
CVF_ASSERT( resVarAddr.isValid() );
for ( int i = 0; i < partCount(); i++ )
{
const std::vector<float>& partResults = this->resultValues( resVarAddr, i, (int)timeStepIndex );
if ( partResults.empty() )
{
size_t expectedSize = 0;
switch ( resVarAddr.resultPosType )
{
case RIG_NODAL:
expectedSize = m_femParts->part( i )->nodes().nodeIds.size();
break;
case RIG_ELEMENT_NODAL:
case RIG_INTEGRATION_POINT:
expectedSize = m_femParts->part( i )->elementNodeResultCount();
break;
case RIG_ELEMENT_NODAL_FACE:
expectedSize = m_femParts->part( i )->elementCount() * 6;
break;
case RIG_ELEMENT:
expectedSize = m_femParts->part( i )->elementCount();
break;
default:
break;
}
resultValues.resize( resultValues.size() + expectedSize, NAN );
}
else
{
resultValues.insert( resultValues.end(), partResults.begin(), partResults.end() );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -125,6 +125,8 @@ public:
std::vector<RigFemResultAddress> loadedResults() const;
const std::vector<float>& resultValues( const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex );
void globalResultValues( const RigFemResultAddress& resVarAddr, int timeStepIndex, std::vector<float>& resultValues );
std::vector<caf::Ten3f> tensors( const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex );
const RigFemPartCollection* parts() const;

View File

@ -8,6 +8,9 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/RivSectionFlattener.h
${CMAKE_CURRENT_LIST_DIR}/RivEclipseIntersectionGrid.h
${CMAKE_CURRENT_LIST_DIR}/RivFemIntersectionGrid.h
${CMAKE_CURRENT_LIST_DIR}/RivIntersectionGeometryGeneratorInterface.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -15,11 +18,12 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RivExtrudedCurveIntersectionPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivExtrudedCurveIntersectionSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RivIntersectionResultsColoringTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RivHexGridIntersectionTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionGeometryGenerator.cpp
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivBoxIntersectionSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RivSectionFlattener.cpp
${CMAKE_CURRENT_LIST_DIR}/RivEclipseIntersectionGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RivFemIntersectionGrid.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -18,6 +18,8 @@
#include "RivBoxIntersectionGeometryGenerator.h"
#include "RivIntersectionHexGridInterface.h"
#include "RimBoxIntersection.h"
#include "RimCase.h"
#include "RimGridView.h"

View File

@ -18,7 +18,7 @@
#pragma once
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include "cafPdmPointer.h"
@ -30,6 +30,7 @@
#include <vector>
class RimBoxIntersection;
class RivIntersectionHexGridInterface;
namespace cvf
{
@ -37,7 +38,7 @@ class ScalarMapper;
class DrawableGeo;
} // namespace cvf
class RivBoxIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorIF
class RivBoxIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorInterface
{
public:
RivBoxIntersectionGeometryGenerator( RimBoxIntersection* intersectionBox, const RivIntersectionHexGridInterface* grid );

View File

@ -36,6 +36,8 @@
#include "RivBoxIntersectionSourceInfo.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include "RivIntersectionHexGridInterface.h"
#include "RivIntersectionResultsColoringTools.h"
#include "RivMeshLinesSourceInfo.h"
#include "RivPartPriority.h"
@ -219,7 +221,7 @@ void RivBoxIntersectionPartMgr::appendMeshLinePartsToModel( cvf::ModelBasicList*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RivIntersectionGeometryGeneratorIF* RivBoxIntersectionPartMgr::intersectionGeometryGenerator() const
const RivIntersectionGeometryGeneratorInterface* RivBoxIntersectionPartMgr::intersectionGeometryGenerator() const
{
if ( m_intersectionBoxGenerator.notNull() ) return m_intersectionBoxGenerator.p();

View File

@ -34,6 +34,7 @@ class RigMainGrid;
class RigResultAccessor;
class RivTernaryScalarMapper;
class RivIntersectionGeometryGeneratorInterface;
class RimCellEdgeColors;
class RimEclipseCellColors;
@ -60,7 +61,7 @@ public:
void appendNativeIntersectionFacesToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
void appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const;
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const;
private:
void updatePartEffect();

View File

@ -0,0 +1,102 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivEclipseIntersectionGrid.h"
#include "RigActiveCellInfo.h"
#include "RigFemPart.h"
#include "RigMainGrid.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivEclipseIntersectionGrid::RivEclipseIntersectionGrid( const RigMainGrid* mainGrid,
const RigActiveCellInfo* activeCellInfo,
bool showInactiveCells )
: m_mainGrid( mainGrid )
, m_activeCellInfo( activeCellInfo )
, m_showInactiveCells( showInactiveCells )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RivEclipseIntersectionGrid::displayOffset() const
{
return m_mainGrid->displayModelOffset();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RivEclipseIntersectionGrid::boundingBox() const
{
return m_mainGrid->boundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const
{
m_mainGrid->findIntersectingCells( intersectingBB, intersectedCells );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivEclipseIntersectionGrid::useCell( size_t cellIndex ) const
{
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
if ( m_showInactiveCells )
return !( cell.isInvalid() || ( cell.subGrid() != nullptr ) );
else
return m_activeCellInfo->isActive( cellIndex ) && ( cell.subGrid() == nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const
{
m_mainGrid->cellCornerVertices( cellIndex, cellCorners );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const
{
const std::array<size_t, 8>& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices();
for ( size_t i = 0; i < 8; i++ )
{
cornerIndices[i] = cornerIndicesSource[i];
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFault* RivEclipseIntersectionGrid::findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const
{
return m_mainGrid->findFaultFromCellIndexAndCellFace( reservoirCellIndex, face );
}

View File

@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RivIntersectionHexGridInterface.h"
#include "cvfBoundingBox.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cvfStructGrid.h"
#include <array>
#include <vector>
class RigActiveCellInfo;
class RigMainGrid;
class RigFault;
class RivEclipseIntersectionGrid : public RivIntersectionHexGridInterface
{
public:
RivEclipseIntersectionGrid( const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo, bool showInactiveCells );
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
void findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const override;
private:
cvf::cref<RigMainGrid> m_mainGrid;
cvf::cref<RigActiveCellInfo> m_activeCellInfo;
bool m_showInactiveCells;
};

View File

@ -34,7 +34,7 @@
#include "RimSurfaceIntersectionCurve.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionHexGridInterface.h"
#include "RivPolylineGenerator.h"
#include "RivSectionFlattener.h"

View File

@ -21,7 +21,7 @@
#include "cafPdmPointer.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include "cvfArray.h"
@ -47,7 +47,7 @@ class ScalarMapper;
class DrawableGeo;
} // namespace cvf
class RivExtrudedCurveIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorIF
class RivExtrudedCurveIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorInterface
{
public:
RivExtrudedCurveIntersectionGeometryGenerator( RimExtrudedCurveIntersection* intersection,

View File

@ -53,7 +53,7 @@
#include "RivExtrudedCurveIntersectionGeometryGenerator.h"
#include "RivExtrudedCurveIntersectionSourceInfo.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionHexGridInterface.h"
#include "RivIntersectionResultsColoringTools.h"
#include "RivMeshLinesSourceInfo.h"
#include "RivObjectSourceInfo.h"
@ -176,7 +176,7 @@ void RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMech
const std::vector<RivIntersectionVertexWeights>& vertexWeights,
const std::vector<float>& resultValues,
bool isElementNodalResult,
const RigFemPart* femPart,
const RigFemPartCollection* femParts,
const cvf::ScalarMapper* mapper )
{
textureCoords->resize( vertexWeights.size() );
@ -210,7 +210,7 @@ void RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMech
}
else
{
resIdx = femPart->nodeIdxFromElementNodeResultIdx( vertexWeights[triangleVxIdx].vxId( wIdx ) );
resIdx = femParts->nodeIdxFromElementNodeResultIdx( vertexWeights[triangleVxIdx].vxId( wIdx ) );
}
resValue += resultValues[resIdx] * vertexWeights[triangleVxIdx].weight( wIdx );
@ -895,7 +895,7 @@ cvf::Mat4d RivExtrudedCurveIntersectionPartMgr::unflattenTransformMatrix( const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RivIntersectionGeometryGeneratorIF* RivExtrudedCurveIntersectionPartMgr::intersectionGeometryGenerator() const
const RivIntersectionGeometryGeneratorInterface* RivExtrudedCurveIntersectionPartMgr::intersectionGeometryGenerator() const
{
if ( m_intersectionGenerator.notNull() ) return m_intersectionGenerator.p();

View File

@ -56,7 +56,7 @@ class RivExtrudedCurveIntersectionGeometryGenerator;
class RivIntersectionHexGridInterface;
class RivIntersectionVertexWeights;
class RivPipeGeometryGenerator;
class RivIntersectionGeometryGeneratorIF;
class RivIntersectionGeometryGeneratorInterface;
//==================================================================================================
///
@ -79,7 +79,7 @@ public:
cvf::Mat4d unflattenTransformMatrix( const cvf::Vec3d& intersectionPointFlat ) const;
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const;
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const;
private:
void generatePartGeometry();

View File

@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivFemIntersectionGrid.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivFemIntersectionGrid::RivFemIntersectionGrid( const RigFemPartCollection* femParts )
: m_femParts( femParts )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RivFemIntersectionGrid::displayOffset() const
{
return m_femParts->boundingBox().min();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RivFemIntersectionGrid::boundingBox() const
{
return m_femParts->boundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const
{
for ( int i = 0; i < m_femParts->partCount(); i++ )
{
const RigFemPart* part = m_femParts->part( i );
std::vector<size_t> foundElements;
part->findIntersectingCells( intersectingBB, &foundElements );
for ( size_t t = 0; t < foundElements.size(); t++ )
{
size_t globalIdx = m_femParts->globalIndex( i, foundElements[t] );
intersectedCells->push_back( globalIdx );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivFemIntersectionGrid::useCell( size_t globalCellIndex ) const
{
auto [part, elementIdx] = m_femParts->partAndElementIndex( globalCellIndex );
return ( ( part->elementType( elementIdx ) == RigElementType::HEX8 ) ||
( part->elementType( elementIdx ) == RigElementType::HEX8P ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::cellCornerVertices( size_t globalCellIndex, cvf::Vec3d cellCorners[8] ) const
{
auto [part, elementIdx] = m_femParts->partAndElementIndex( globalCellIndex );
const std::vector<cvf::Vec3f>& nodeCoords = part->nodes().coordinates;
const int* cornerIndices = part->connectivities( elementIdx );
for ( int i = 0; i < 8; i++ )
{
cellCorners[i] = cvf::Vec3d( nodeCoords[cornerIndices[i]] );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::cellCornerIndices( size_t globalCellIndex, size_t cornerIndices[8] ) const
{
auto [part, elementIdx] = m_femParts->partAndElementIndex( globalCellIndex );
RigElementType elmType = part->elementType( elementIdx );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) return;
int elmIdx = static_cast<int>( elementIdx );
const int partId = part->elementPartId();
for ( int i = 0; i < 8; i++ )
{
cornerIndices[i] = m_femParts->globalElementNodeResultIdx( partId, elmIdx, i );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFault* RivFemIntersectionGrid::findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const
{
return nullptr;
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RivIntersectionHexGridInterface.h"
#include "cvfBoundingBox.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cvfStructGrid.h"
#include <vector>
class RigFemPart;
class RigFemPartCollection;
class RigFault;
class RivFemIntersectionGrid : public RivIntersectionHexGridInterface
{
public:
explicit RivFemIntersectionGrid( const RigFemPartCollection* femParts );
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
void findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const override;
private:
cvf::cref<RigFemPartCollection> m_femParts;
};

View File

@ -1,195 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivHexGridIntersectionTools.h"
#include "RigActiveCellInfo.h"
#include "RigFemPart.h"
#include "RigMainGrid.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivEclipseIntersectionGrid::RivEclipseIntersectionGrid( const RigMainGrid* mainGrid,
const RigActiveCellInfo* activeCellInfo,
bool showInactiveCells )
: m_mainGrid( mainGrid )
, m_activeCellInfo( activeCellInfo )
, m_showInactiveCells( showInactiveCells )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RivEclipseIntersectionGrid::displayOffset() const
{
return m_mainGrid->displayModelOffset();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RivEclipseIntersectionGrid::boundingBox() const
{
return m_mainGrid->boundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const
{
m_mainGrid->findIntersectingCells( intersectingBB, intersectedCells );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivEclipseIntersectionGrid::useCell( size_t cellIndex ) const
{
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
if ( m_showInactiveCells )
return !( cell.isInvalid() || ( cell.subGrid() != nullptr ) );
else
return m_activeCellInfo->isActive( cellIndex ) && ( cell.subGrid() == nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const
{
m_mainGrid->cellCornerVertices( cellIndex, cellCorners );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const
{
const std::array<size_t, 8>& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices();
for ( size_t i = 0; i < 8; i++ )
{
cornerIndices[i] = cornerIndicesSource[i];
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFault* RivEclipseIntersectionGrid::findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const
{
return m_mainGrid->findFaultFromCellIndexAndCellFace( reservoirCellIndex, face );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivFemIntersectionGrid::RivFemIntersectionGrid( const RigFemPart* femPart )
: m_femPart( femPart )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RivFemIntersectionGrid::displayOffset() const
{
return m_femPart->boundingBox().min();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RivFemIntersectionGrid::boundingBox() const
{
return m_femPart->boundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const
{
m_femPart->findIntersectingCells( intersectingBB, intersectedCells );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivFemIntersectionGrid::useCell( size_t cellIndex ) const
{
RigElementType elmType = m_femPart->elementType( cellIndex );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) return false;
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const
{
RigElementType elmType = m_femPart->elementType( cellIndex );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) return;
const std::vector<cvf::Vec3f>& nodeCoords = m_femPart->nodes().coordinates;
const int* cornerIndices = m_femPart->connectivities( cellIndex );
cellCorners[0] = cvf::Vec3d( nodeCoords[cornerIndices[0]] );
cellCorners[1] = cvf::Vec3d( nodeCoords[cornerIndices[1]] );
cellCorners[2] = cvf::Vec3d( nodeCoords[cornerIndices[2]] );
cellCorners[3] = cvf::Vec3d( nodeCoords[cornerIndices[3]] );
cellCorners[4] = cvf::Vec3d( nodeCoords[cornerIndices[4]] );
cellCorners[5] = cvf::Vec3d( nodeCoords[cornerIndices[5]] );
cellCorners[6] = cvf::Vec3d( nodeCoords[cornerIndices[6]] );
cellCorners[7] = cvf::Vec3d( nodeCoords[cornerIndices[7]] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const
{
RigElementType elmType = m_femPart->elementType( cellIndex );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) return;
int elmIdx = static_cast<int>( cellIndex );
cornerIndices[0] = m_femPart->elementNodeResultIdx( elmIdx, 0 );
cornerIndices[1] = m_femPart->elementNodeResultIdx( elmIdx, 1 );
cornerIndices[2] = m_femPart->elementNodeResultIdx( elmIdx, 2 );
cornerIndices[3] = m_femPart->elementNodeResultIdx( elmIdx, 3 );
cornerIndices[4] = m_femPart->elementNodeResultIdx( elmIdx, 4 );
cornerIndices[5] = m_femPart->elementNodeResultIdx( elmIdx, 5 );
cornerIndices[6] = m_femPart->elementNodeResultIdx( elmIdx, 6 );
cornerIndices[7] = m_femPart->elementNodeResultIdx( elmIdx, 7 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFault* RivFemIntersectionGrid::findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const
{
return nullptr;
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RivIntersectionVertexWeights.h"
#include "cvfArray.h"
#include <vector>
class RivIntersectionGeometryGeneratorInterface
{
public:
virtual bool isAnyGeometryPresent() const = 0;
virtual const std::vector<size_t>& triangleToCellIndex() const = 0;
virtual const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const = 0;
virtual const cvf::Vec3fArray* triangleVxes() const = 0;
};

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBoundingBox.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cvfStructGrid.h"
#include <vector>
class RigFault;
//--------------------------------------------------------------------------------------------------
/// Interface definition used to compute the geometry for planes intersecting a grid
//--------------------------------------------------------------------------------------------------
class RivIntersectionHexGridInterface : public cvf::Object
{
public:
virtual cvf::Vec3d displayOffset() const = 0;
virtual cvf::BoundingBox boundingBox() const = 0;
virtual void findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const = 0;
virtual bool useCell( size_t cellIndex ) const = 0;
virtual void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const = 0;
virtual void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const = 0;
virtual const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const = 0;
};

View File

@ -37,6 +37,8 @@
#include "RigGeoMechCaseData.h"
#include "RigResultAccessorFactory.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include "RivIntersectionVertexWeights.h"
#include "RivScalarMapperUtils.h"
#include "RivTernaryTextureCoordsCreator.h"
@ -52,7 +54,7 @@ void RivIntersectionResultsColoringTools::calculateIntersectionResultColors(
size_t timeStepIndex,
bool useSeparateIntersectionResDefTimeStep,
RimIntersection* rimIntersectionHandle,
const RivIntersectionGeometryGeneratorIF* intersectionGeomGenIF,
const RivIntersectionGeometryGeneratorInterface* intersectionGeomGenIF,
const cvf::ScalarMapper* explicitScalarColorMapper,
const RivTernaryScalarMapper* explicitTernaryColorMapper,
cvf::Part* intersectionFacesPart,
@ -223,11 +225,12 @@ void RivIntersectionResultsColoringTools::updateEclipseTernaryCellResultColors(
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const RimGeoMechResultDefinition* geomResultDef,
void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors(
const RimGeoMechResultDefinition* geomResultDef,
size_t timeStepIndex,
const cvf::ScalarMapper* scalarColorMapper,
bool isLightingDisabled,
const RivIntersectionGeometryGeneratorIF* geomGenerator,
const RivIntersectionGeometryGeneratorInterface* geomGenerator,
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords )
{
@ -246,6 +249,8 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
geomGenerator->triangleVxToCellCornerInterpolationWeights();
if ( resVarAddress.resultPosType == RIG_ELEMENT )
{
if ( caseData->femPartResults()->partCount() == 1 )
{
const std::vector<float>& resultValues =
caseData->femPartResults()->resultValues( resVarAddress, 0, (int)timeStepIndex );
@ -255,10 +260,23 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
triangleToCellIdx,
scalarColorMapper );
}
else
{
std::vector<float> resultValues;
caseData->femPartResults()->globalResultValues( resVarAddress, (int)timeStepIndex, resultValues );
RivIntersectionResultsColoringTools::calculateElementBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
resultValues,
triangleToCellIdx,
scalarColorMapper );
}
}
else if ( resVarAddress.resultPosType == RIG_ELEMENT_NODAL_FACE )
{
// Special direction sensitive result calculation
if ( caseData->femPartResults()->partCount() == 1 ) // only supported for single-part geomech cases
{
if ( resVarAddress.componentName == "Pazi" || resVarAddress.componentName == "Pinc" )
{
RivIntersectionResultsColoringTools::calculatePlaneAngleTextureCoords( intersectionFacesTextureCoords,
@ -277,6 +295,9 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
scalarColorMapper );
}
}
else
return;
}
else
{
// Do a "Hack" to show elm nodal and not nodal POR results
@ -285,20 +306,32 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
{
resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
}
bool isElementNodalResult = !( resVarAddress.resultPosType == RIG_NODAL );
if ( caseData->femPartResults()->partCount() == 1 )
{
const std::vector<float>& resultValues =
caseData->femPartResults()->resultValues( resVarAddress, 0, (int)timeStepIndex );
RigFemPart* femPart = caseData->femParts()->part( 0 );
bool isElementNodalResult = !( resVarAddress.resultPosType == RIG_NODAL );
RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
vertexWeights,
resultValues,
isElementNodalResult,
caseData->femParts(),
scalarColorMapper );
}
else
{
std::vector<float> resultValues;
caseData->femPartResults()->globalResultValues( resVarAddress, (int)timeStepIndex, resultValues );
RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
vertexWeights,
resultValues,
isElementNodalResult,
femPart,
caseData->femParts(),
scalarColorMapper );
}
}
RivScalarMapperUtils::applyTextureResultsToPart( intersectionFacesPart,
intersectionFacesTextureCoords,

View File

@ -20,17 +20,16 @@
#include "cvfArray.h"
#include "RivHexGridIntersectionTools.h"
class RimEclipseResultDefinition;
class RimGeoMechResultDefinition;
class RimIntersection;
class RivIntersectionGeometryGeneratorIF;
class RivIntersectionGeometryGeneratorInterface;
class RivIntersectionVertexWeights;
class RivTernaryScalarMapper;
class RigResultAccessor;
class RigFemPart;
class RigFemPartCollection;
class RigGeoMechCaseData;
class RigFemResultAddress;
@ -46,7 +45,7 @@ public:
static void calculateIntersectionResultColors( size_t timeStepIndex,
bool useSeparateIntersectionResDefTimeStep,
RimIntersection* rimIntersectionHandle,
const RivIntersectionGeometryGeneratorIF* intersectionGeomGenIF,
const RivIntersectionGeometryGeneratorInterface* intersectionGeomGenIF,
const cvf::ScalarMapper* explicitScalarColorMapper,
const RivTernaryScalarMapper* explicitTernaryColorMapper,
cvf::Part* intersectionFacesPart,
@ -73,7 +72,7 @@ private:
size_t timeStepIndex,
const cvf::ScalarMapper* scalarColorMapper,
bool isLightingDisabled,
const RivIntersectionGeometryGeneratorIF* geomGenerator,
const RivIntersectionGeometryGeneratorInterface* geomGenerator,
cvf::Part* m_intersectionBoxFaces,
cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords );
@ -87,7 +86,7 @@ private:
const std::vector<RivIntersectionVertexWeights>& vertexWeights,
const std::vector<float>& resultValues,
bool isElementNodalResult,
const RigFemPart* femPart,
const RigFemPartCollection* femParts,
const cvf::ScalarMapper* mapper );
static void calculateElementBasedGeoMechTextureCoords( cvf::Vec2fArray* textureCoords,

View File

@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) 2021 - Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -18,82 +18,8 @@
#pragma once
#include "cvfBoundingBox.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cvfStructGrid.h"
#include <array>
#include <vector>
class RigActiveCellInfo;
class RigFemPart;
class RigMainGrid;
class RigFault;
//--------------------------------------------------------------------------------------------------
/// Interface definition used to compute the geometry for planes intersecting a grid
//--------------------------------------------------------------------------------------------------
class RivIntersectionHexGridInterface : public cvf::Object
{
public:
virtual cvf::Vec3d displayOffset() const = 0;
virtual cvf::BoundingBox boundingBox() const = 0;
virtual void findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const = 0;
virtual bool useCell( size_t cellIndex ) const = 0;
virtual void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const = 0;
virtual void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const = 0;
virtual const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const = 0;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RivEclipseIntersectionGrid : public RivIntersectionHexGridInterface
{
public:
RivEclipseIntersectionGrid( const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo, bool showInactiveCells );
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
void findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const override;
private:
cvf::cref<RigMainGrid> m_mainGrid;
cvf::cref<RigActiveCellInfo> m_activeCellInfo;
bool m_showInactiveCells;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RivFemIntersectionGrid : public RivIntersectionHexGridInterface
{
public:
explicit RivFemIntersectionGrid( const RigFemPart* femPart );
cvf::Vec3d displayOffset() const override;
cvf::BoundingBox boundingBox() const override;
void findIntersectingCells( const cvf::BoundingBox& intersectingBB,
std::vector<size_t>* intersectedCells ) const override;
bool useCell( size_t cellIndex ) const override;
void cellCornerVertices( size_t cellIndex, cvf::Vec3d cellCorners[8] ) const override;
void cellCornerIndices( size_t cellIndex, size_t cornerIndices[8] ) const override;
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
cvf::StructGridInterface::FaceType face ) const override;
private:
cvf::cref<RigFemPart> m_femPart;
};
#include <cstddef>
//--------------------------------------------------------------------------------------------------
///
@ -222,12 +148,3 @@ private:
std::array<float, 8> m_weights;
int m_count;
};
class RivIntersectionGeometryGeneratorIF
{
public:
virtual bool isAnyGeometryPresent() const = 0;
virtual const std::vector<size_t>& triangleToCellIndex() const = 0;
virtual const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const = 0;
virtual const cvf::Vec3fArray* triangleVxes() const = 0;
};

View File

@ -39,7 +39,7 @@ size_t RivSectionFlattener::indexToNextValidPoint( const std::vector<cvf::Vec3d>
cvf::Vec3d p2 = polyLine[lIdx];
cvf::Vec3d p1p2 = p2 - p1;
if ( ( p1p2 - ( p1p2 * extrDir ) * extrDir ).length() > 0.1 )
if ( ( p1p2 - ( p1p2 * extrDir ) * extrDir ).length() > 0.001 )
{
return lIdx;
}

View File

@ -32,7 +32,8 @@
#include "RimSurfaceInView.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionHexGridInterface.h"
#include "RivIntersectionVertexWeights.h"
#include "RivPolylineGenerator.h"
#include "RivSectionFlattener.h"

View File

@ -21,7 +21,7 @@
#include "cafPdmPointer.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include "cvfArray.h"
#include "cvfBoundingBox.h"
@ -47,7 +47,7 @@ class ScalarMapper;
class DrawableGeo;
} // namespace cvf
class RivSurfaceIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorIF
class RivSurfaceIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorInterface
{
public:
RivSurfaceIntersectionGeometryGenerator( RimSurfaceInView* surfInView, const RivIntersectionHexGridInterface* grid );

View File

@ -28,6 +28,8 @@
#include "RimSurfaceInView.h"
#include "RimSurfaceResultDefinition.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include "RivIntersectionHexGridInterface.h"
#include "RivIntersectionResultsColoringTools.h"
#include "RivMeshLinesSourceInfo.h"
#include "RivPartPriority.h"
@ -271,7 +273,7 @@ QString RivSurfacePartMgr::resultInfoText( Rim3dView* view, uint hitPart, cvf::V
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RivIntersectionGeometryGeneratorIF* RivSurfacePartMgr::intersectionGeometryGenerator() const
const RivIntersectionGeometryGeneratorInterface* RivSurfacePartMgr::intersectionGeometryGenerator() const
{
if ( m_intersectionGenerator.notNull() ) return m_intersectionGenerator.p();

View File

@ -36,7 +36,7 @@ class RigResultAccessor;
class Rim3dView;
class RivSurfaceIntersectionGeometryGenerator;
class RivIntersectionGeometryGeneratorIF;
class RivIntersectionGeometryGeneratorInterface;
class RivSurfacePartMgr : public cvf::Object
{
@ -51,7 +51,7 @@ public:
QString resultInfoText( Rim3dView* view, uint hitPart, cvf::Vec3d hitPoint );
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const;
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const;
private:
void generatePartGeometry();

View File

@ -51,7 +51,7 @@ CAF_PDM_SOURCE_INIT( RimBoxIntersection, "IntersectionBox" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RivIntersectionGeometryGeneratorIF* RimBoxIntersection::intersectionGeometryGenerator() const
const RivIntersectionGeometryGeneratorInterface* RimBoxIntersection::intersectionGeometryGenerator() const
{
if ( m_intersectionBoxPartMgr.notNull() ) return m_intersectionBoxPartMgr->intersectionGeometryGenerator();

View File

@ -78,7 +78,7 @@ public:
void setToDefaultSizeBox();
void setToDefaultSizeSlice( SinglePlaneState plane, const cvf::Vec3d& position );
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const override;
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const override;
protected:
caf::PdmFieldHandle* userDescriptionField() final;

View File

@ -86,7 +86,7 @@ CAF_PDM_SOURCE_INIT( RimExtrudedCurveIntersection, "CrossSection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RivIntersectionGeometryGeneratorIF* RimExtrudedCurveIntersection::intersectionGeometryGenerator() const
const RivIntersectionGeometryGeneratorInterface* RimExtrudedCurveIntersection::intersectionGeometryGenerator() const
{
if ( m_crossSectionPartMgr.notNull() ) return m_crossSectionPartMgr->intersectionGeometryGenerator();

View File

@ -94,7 +94,7 @@ public:
Rim2dIntersectionView* correspondingIntersectionView() const;
RivExtrudedCurveIntersectionPartMgr* intersectionPartMgr();
void rebuildGeometry();
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const override;
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const override;
std::vector<cvf::Vec3d> polyLinesForExtrusionDirection() const;
void appendPointToExtrusionDirection( const cvf::Vec3d& point );

View File

@ -29,7 +29,9 @@
#include "RimGridView.h"
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RivHexGridIntersectionTools.h"
#include "RivEclipseIntersectionGrid.h"
#include "RivFemIntersectionGrid.h"
CAF_PDM_ABSTRACT_SOURCE_INIT( RimIntersection, "RimIntersectionHandle" );
@ -203,8 +205,7 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() )
{
RigFemPart* femPart = geomCase->geoMechData()->femParts()->part( 0 );
return new RivFemIntersectionGrid( femPart );
return new RivFemIntersectionGrid( geomCase->geoMechData()->femParts() );
}
}
@ -219,11 +220,9 @@ cvf::ref<RivIntersectionHexGridInterface> RimIntersection::createHexGridInterfac
RimGeoMechView* geoView;
this->firstAncestorOrThisOfType( geoView );
if ( geoView && geoView->femParts() && geoView->femParts()->partCount() )
if ( geoView && geoView->femParts() )
{
RigFemPart* femPart = geoView->femParts()->part( 0 );
return new RivFemIntersectionGrid( femPart );
return new RivFemIntersectionGrid( geoView->femParts() );
}
return nullptr;

View File

@ -27,7 +27,7 @@
class RimIntersectionResultDefinition;
class RivIntersectionHexGridInterface;
class RimIntersectionResultsDefinitionCollection;
class RivIntersectionGeometryGeneratorIF;
class RivIntersectionGeometryGeneratorInterface;
class RimIntersection : public caf::PdmObject
{
@ -46,7 +46,7 @@ public:
RimIntersectionResultDefinition* activeSeparateResultDefinition();
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
virtual const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const = 0;
virtual const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const = 0;
protected:
virtual RimIntersectionResultsDefinitionCollection* findSeparateResultsCollection();

View File

@ -30,7 +30,6 @@
#include "RiuViewer.h"
#include "RivHexGridIntersectionTools.h"
#include "RivSurfacePartMgr.h"
#include "cafPdmUiDoubleSliderEditor.h"
@ -144,7 +143,7 @@ RivSurfacePartMgr* RimSurfaceInView::surfacePartMgr()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RivIntersectionGeometryGeneratorIF* RimSurfaceInView::intersectionGeometryGenerator() const
const RivIntersectionGeometryGeneratorInterface* RimSurfaceInView::intersectionGeometryGenerator() const
{
if ( m_surfacePartMgr.notNull() ) return m_surfacePartMgr->intersectionGeometryGenerator();

View File

@ -53,7 +53,7 @@ public:
void clearGeometry();
RivSurfacePartMgr* surfacePartMgr();
const RivIntersectionGeometryGeneratorIF* intersectionGeometryGenerator() const override;
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const override;
void loadDataAndUpdate();

View File

@ -516,9 +516,9 @@ std::vector<RimRegularLegendConfig*> RimSurfaceInViewCollection::legendConfigs()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<const RivIntersectionGeometryGeneratorIF*> RimSurfaceInViewCollection::intersectionGeometryGenerators() const
std::vector<const RivIntersectionGeometryGeneratorInterface*> RimSurfaceInViewCollection::intersectionGeometryGenerators() const
{
std::vector<const RivIntersectionGeometryGeneratorIF*> generators;
std::vector<const RivIntersectionGeometryGeneratorInterface*> generators;
for ( auto surf : m_surfacesInView )
{

View File

@ -38,7 +38,7 @@ class RimSurfaceCollection;
class RimEnsembleSurface;
class RimRegularLegendConfig;
class RiuViewer;
class RivIntersectionGeometryGeneratorIF;
class RivIntersectionGeometryGeneratorInterface;
class RimSurfaceInViewCollection : public RimCheckableNamedObject
{
@ -66,14 +66,13 @@ public:
std::vector<RimRegularLegendConfig*> legendConfigs();
std::vector<const RivIntersectionGeometryGeneratorIF*> intersectionGeometryGenerators() const;
std::vector<const RivIntersectionGeometryGeneratorInterface*> intersectionGeometryGenerators() const;
protected:
void initAfterRead() override;
caf::PdmFieldHandle* userDescriptionField() override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;

View File

@ -45,7 +45,7 @@
#include "RimSurfaceInView.h"
#include "RimSurfaceInViewCollection.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionGeometryGeneratorInterface.h"
#include <cmath>
@ -199,7 +199,7 @@ void RigVisibleCategoriesCalculator::appendVisibleFaultCells( RimEclipseView* ec
void RigVisibleCategoriesCalculator::appendVisibleIntersectionCells( RimEclipseView* eclView, std::set<size_t>& visibleCells )
{
// Intersections
std::vector<const RivIntersectionGeometryGeneratorIF*> intersectionGeoGenerators;
std::vector<const RivIntersectionGeometryGeneratorInterface*> intersectionGeoGenerators;
if ( !eclView->separateIntersectionResultsCollection()->isActive() )
{

View File

@ -18,7 +18,7 @@
#include "RiuGeoMechXfTensorResultAccessor.h"
#include "RigFemPartResultsCollection.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionVertexWeights.h"
#include "cvfAssert.h"
#include "cvfGeometryTools.h"

View File

@ -1077,6 +1077,7 @@ void RiuViewerCommands::findCellAndGridIndex( Rim3dView* m
{
CVF_ASSERT( cellIndex && gridIndex );
RimEclipseCase* eclipseCase = nullptr;
RimGeoMechCase* geomechCase = dynamic_cast<RimGeoMechCase*>( mainOrComparisonView->ownerCase() );
if ( sepInterResDef )
{
@ -1096,6 +1097,13 @@ void RiuViewerCommands::findCellAndGridIndex( Rim3dView* m
*cellIndex = cell.gridLocalCellIndex();
*gridIndex = cell.hostGrid()->gridIndex();
}
else if ( geomechCase )
{
RigFemPartCollection* parts = geomechCase->geoMechData()->femParts();
auto [partId, elementIdx] = parts->partIdAndElementIndex( globalCellIndex );
*cellIndex = elementIdx;
*gridIndex = (size_t)partId;
}
else
{
*cellIndex = globalCellIndex;