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
44 changed files with 741 additions and 397 deletions

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"
@@ -49,14 +51,14 @@
///
//--------------------------------------------------------------------------------------------------
void RivIntersectionResultsColoringTools::calculateIntersectionResultColors(
size_t timeStepIndex,
bool useSeparateIntersectionResDefTimeStep,
RimIntersection* rimIntersectionHandle,
const RivIntersectionGeometryGeneratorIF* intersectionGeomGenIF,
const cvf::ScalarMapper* explicitScalarColorMapper,
const RivTernaryScalarMapper* explicitTernaryColorMapper,
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords )
size_t timeStepIndex,
bool useSeparateIntersectionResDefTimeStep,
RimIntersection* rimIntersectionHandle,
const RivIntersectionGeometryGeneratorInterface* intersectionGeomGenIF,
const cvf::ScalarMapper* explicitScalarColorMapper,
const RivTernaryScalarMapper* explicitTernaryColorMapper,
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords )
{
if ( !intersectionGeomGenIF || !intersectionGeomGenIF->isAnyGeometryPresent() ) return;
@@ -223,13 +225,14 @@ void RivIntersectionResultsColoringTools::updateEclipseTernaryCellResultColors(
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const RimGeoMechResultDefinition* geomResultDef,
size_t timeStepIndex,
const cvf::ScalarMapper* scalarColorMapper,
bool isLightingDisabled,
const RivIntersectionGeometryGeneratorIF* geomGenerator,
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords )
void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors(
const RimGeoMechResultDefinition* geomResultDef,
size_t timeStepIndex,
const cvf::ScalarMapper* scalarColorMapper,
bool isLightingDisabled,
const RivIntersectionGeometryGeneratorInterface* geomGenerator,
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords )
{
RigGeoMechCaseData* caseData = nullptr;
RigFemResultAddress resVarAddress;
@@ -247,35 +250,53 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
if ( resVarAddress.resultPosType == RIG_ELEMENT )
{
const std::vector<float>& resultValues =
caseData->femPartResults()->resultValues( resVarAddress, 0, (int)timeStepIndex );
if ( caseData->femPartResults()->partCount() == 1 )
{
const std::vector<float>& resultValues =
caseData->femPartResults()->resultValues( resVarAddress, 0, (int)timeStepIndex );
RivIntersectionResultsColoringTools::calculateElementBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
resultValues,
triangleToCellIdx,
scalarColorMapper );
RivIntersectionResultsColoringTools::calculateElementBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
resultValues,
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 ( resVarAddress.componentName == "Pazi" || resVarAddress.componentName == "Pinc" )
if ( caseData->femPartResults()->partCount() == 1 ) // only supported for single-part geomech cases
{
RivIntersectionResultsColoringTools::calculatePlaneAngleTextureCoords( intersectionFacesTextureCoords,
triangelVxes,
resVarAddress,
scalarColorMapper );
if ( resVarAddress.componentName == "Pazi" || resVarAddress.componentName == "Pinc" )
{
RivIntersectionResultsColoringTools::calculatePlaneAngleTextureCoords( intersectionFacesTextureCoords,
triangelVxes,
resVarAddress,
scalarColorMapper );
}
else
{
RivIntersectionResultsColoringTools::calculateGeoMechTensorXfTextureCoords( intersectionFacesTextureCoords,
triangelVxes,
vertexWeights,
caseData,
resVarAddress,
(int)timeStepIndex,
scalarColorMapper );
}
}
else
{
RivIntersectionResultsColoringTools::calculateGeoMechTensorXfTextureCoords( intersectionFacesTextureCoords,
triangelVxes,
vertexWeights,
caseData,
resVarAddress,
(int)timeStepIndex,
scalarColorMapper );
}
return;
}
else
{
@@ -285,19 +306,31 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
{
resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
}
bool isElementNodalResult = !( resVarAddress.resultPosType == RIG_NODAL );
const std::vector<float>& resultValues =
caseData->femPartResults()->resultValues( resVarAddress, 0, (int)timeStepIndex );
if ( caseData->femPartResults()->partCount() == 1 )
{
const std::vector<float>& resultValues =
caseData->femPartResults()->resultValues( resVarAddress, 0, (int)timeStepIndex );
RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
vertexWeights,
resultValues,
isElementNodalResult,
caseData->femParts(),
scalarColorMapper );
}
else
{
std::vector<float> resultValues;
caseData->femPartResults()->globalResultValues( resVarAddress, (int)timeStepIndex, resultValues );
RigFemPart* femPart = caseData->femParts()->part( 0 );
bool isElementNodalResult = !( resVarAddress.resultPosType == RIG_NODAL );
RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
vertexWeights,
resultValues,
isElementNodalResult,
femPart,
scalarColorMapper );
RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMechTextureCoords( intersectionFacesTextureCoords,
vertexWeights,
resultValues,
isElementNodalResult,
caseData->femParts(),
scalarColorMapper );
}
}
RivScalarMapperUtils::applyTextureResultsToPart( intersectionFacesPart,

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,11 +45,11 @@ public:
static void calculateIntersectionResultColors( size_t timeStepIndex,
bool useSeparateIntersectionResDefTimeStep,
RimIntersection* rimIntersectionHandle,
const RivIntersectionGeometryGeneratorIF* intersectionGeomGenIF,
const cvf::ScalarMapper* explicitScalarColorMapper,
const RivTernaryScalarMapper* explicitTernaryColorMapper,
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords );
const RivIntersectionGeometryGeneratorInterface* intersectionGeomGenIF,
const cvf::ScalarMapper* explicitScalarColorMapper,
const RivTernaryScalarMapper* explicitTernaryColorMapper,
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords );
private:
static void updateEclipseCellResultColors( const RimEclipseResultDefinition* eclipseResDef,
@@ -69,12 +68,12 @@ private:
cvf::Part* m_intersectionBoxFaces,
cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords );
static void updateGeoMechCellResultColors( const RimGeoMechResultDefinition* geomResultDef,
size_t timeStepIndex,
const cvf::ScalarMapper* scalarColorMapper,
bool isLightingDisabled,
const RivIntersectionGeometryGeneratorIF* geomGenerator,
cvf::Part* m_intersectionBoxFaces,
static void updateGeoMechCellResultColors( const RimGeoMechResultDefinition* geomResultDef,
size_t timeStepIndex,
const cvf::ScalarMapper* scalarColorMapper,
bool isLightingDisabled,
const RivIntersectionGeometryGeneratorInterface* geomGenerator,
cvf::Part* m_intersectionBoxFaces,
cvf::Vec2fArray* m_intersectionBoxFacesTextureCoords );
static void calculateEclipseTextureCoordinates( cvf::Vec2fArray* textureCoords,
@@ -85,10 +84,10 @@ private:
static void
calculateNodeOrElementNodeBasedGeoMechTextureCoords( cvf::Vec2fArray* textureCoords,
const std::vector<RivIntersectionVertexWeights>& vertexWeights,
const std::vector<float>& resultValues,
bool isElementNodalResult,
const RigFemPart* femPart,
const cvf::ScalarMapper* mapper );
const std::vector<float>& resultValues,
bool isElementNodalResult,
const RigFemPartCollection* femParts,
const cvf::ScalarMapper* mapper );
static void calculateElementBasedGeoMechTextureCoords( cvf::Vec2fArray* textureCoords,
const std::vector<float>& resultValues,

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();