Release 2023.06

This commit is contained in:
Magne Sjaastad
2023-06-19 13:48:44 +02:00
committed by GitHub
parent a7108f0a09
commit 77bf792b1a
1390 changed files with 66974 additions and 11511 deletions

View File

@@ -70,9 +70,9 @@ bool RivBoxIntersectionGeometryGenerator::isAnyGeometryPresent() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivBoxIntersectionGeometryGenerator::generateSurface()
cvf::ref<cvf::DrawableGeo> RivBoxIntersectionGeometryGenerator::generateSurface( cvf::UByteArray* visibleCells )
{
calculateArrays();
calculateArrays( visibleCells );
CVF_ASSERT( m_triangleVxes.notNull() );
@@ -244,7 +244,7 @@ RimBoxIntersection* RivBoxIntersectionGeometryGenerator::intersectionBox() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionGeometryGenerator::calculateArrays()
void RivBoxIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray* visibleCells )
{
if ( m_triangleVxes->size() ) return;
@@ -253,8 +253,7 @@ void RivBoxIntersectionGeometryGenerator::calculateArrays()
cvf::Vec3d displayOffset( 0, 0, 0 );
{
RimGridView* gridView = nullptr;
m_intersectionBoxDefinition->firstAncestorOrThisOfType( gridView );
auto gridView = m_intersectionBoxDefinition->firstAncestorOrThisOfType<RimGridView>();
if ( gridView && gridView->ownerCase() )
{
displayOffset = gridView->ownerCase()->displayModelOffset();
@@ -311,6 +310,7 @@ void RivBoxIntersectionGeometryGenerator::calculateArrays()
{
size_t globalCellIdx = columnCellCandidates[cccIdx];
if ( ( visibleCells != nullptr ) && ( ( *visibleCells )[globalCellIdx] == 0 ) ) continue;
if ( !m_hexGrid->useCell( globalCellIdx ) ) continue;
hexPlaneCutTriangleVxes.clear();

View File

@@ -46,7 +46,7 @@ public:
~RivBoxIntersectionGeometryGenerator() override;
// Generate geometry
cvf::ref<cvf::DrawableGeo> generateSurface();
cvf::ref<cvf::DrawableGeo> generateSurface( cvf::UByteArray* visibleCells );
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
RimBoxIntersection* intersectionBox() const;
@@ -60,7 +60,7 @@ public:
const cvf::Vec3fArray* triangleVxes() const override;
private:
void calculateArrays();
void calculateArrays( cvf::UByteArray* visibleCells );
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;

View File

@@ -96,12 +96,12 @@ void RivBoxIntersectionPartMgr::updateCellResultColor( int timeStepIndex )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionPartMgr::generatePartGeometry()
void RivBoxIntersectionPartMgr::generatePartGeometry( cvf::UByteArray* visibleCells )
{
bool useBufferObjects = true;
// Surface geometry
{
cvf::ref<cvf::DrawableGeo> geo = m_intersectionBoxGenerator->generateSurface();
cvf::ref<cvf::DrawableGeo> geo = m_intersectionBoxGenerator->generateSurface( visibleCells );
if ( geo.notNull() )
{
geo->computeNormals();
@@ -187,11 +187,6 @@ void RivBoxIntersectionPartMgr::updatePartEffect()
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionPartMgr::appendNativeIntersectionFacesToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionBoxFaces.isNull() && m_intersectionBoxGridLines.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionBoxFaces.notNull() )
{
m_intersectionBoxFaces->setTransform( scaleTransform );
@@ -204,11 +199,6 @@ void RivBoxIntersectionPartMgr::appendNativeIntersectionFacesToModel( cvf::Model
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionPartMgr::appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionBoxFaces.isNull() && m_intersectionBoxGridLines.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionBoxGridLines.notNull() )
{
m_intersectionBoxGridLines->setTransform( scaleTransform );

View File

@@ -63,9 +63,10 @@ public:
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const;
void generatePartGeometry( cvf::UByteArray* visibleCells );
private:
void updatePartEffect();
void generatePartGeometry();
private:
RimBoxIntersection* m_rimIntersectionBox;

View File

@@ -61,11 +61,18 @@ void RivEclipseIntersectionGrid::findIntersectingCells( const cvf::BoundingBox&
//--------------------------------------------------------------------------------------------------
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 );
size_t i, j, k;
m_mainGrid->ijkFromCellIndexUnguarded( cellIndex, &i, &j, &k );
if ( m_intervalTool.isNumberIncluded( k ) )
{
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 );
}
return false;
}
//--------------------------------------------------------------------------------------------------
@@ -97,3 +104,11 @@ const RigFault* RivEclipseIntersectionGrid::findFaultFromCellIndexAndCellFace( s
{
return m_mainGrid->findFaultFromCellIndexAndCellFace( reservoirCellIndex, face );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivEclipseIntersectionGrid::setKIntervalFilter( bool enabled, std::string kIntervalStr )
{
m_intervalTool.setInterval( enabled, kIntervalStr );
}

View File

@@ -20,6 +20,8 @@
#include "RivIntersectionHexGridInterface.h"
#include "RimCellFilterIntervalTool.h"
#include "cvfBoundingBox.h"
#include "cvfObject.h"
#include "cvfVector3.h"
@@ -45,9 +47,11 @@ public:
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;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
private:
cvf::cref<RigMainGrid> m_mainGrid;
cvf::cref<RigActiveCellInfo> m_activeCellInfo;
bool m_showInactiveCells;
RimCellFilterIntervalTool m_intervalTool;
};

View File

@@ -51,9 +51,7 @@
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform( const RimExtrudedCurveIntersection* intersection )
{
Rim3dView* rimView = nullptr;
intersection->firstAncestorOrThisOfType( rimView );
CVF_ASSERT( rimView );
auto rimView = intersection->firstAncestorOrThisOfTypeAsserted<Rim3dView>();
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
return transForm;
@@ -66,8 +64,8 @@ cvf::ref<caf::DisplayCoordTransform> displayCoordTransform( const RimExtrudedCur
RivExtrudedCurveIntersectionGeometryGenerator::RivExtrudedCurveIntersectionGeometryGenerator( RimExtrudedCurveIntersection* crossSection,
std::vector<std::vector<cvf::Vec3d>>& polylines,
const cvf::Vec3d& extrusionDirection,
const RivIntersectionHexGridInterface* grid,
bool isFlattened,
RivIntersectionHexGridInterface* grid,
bool isFlattened,
const cvf::Vec3d& flattenedPolylineStartPoint )
: m_intersection( crossSection )
, m_polylines( polylines )
@@ -114,8 +112,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateLineSegementTransfo
cvf::Vec3d displayOffset( 0, 0, 0 );
{
RimGridView* gridView = nullptr;
m_intersection->firstAncestorOrThisOfType( gridView );
auto gridView = m_intersection->firstAncestorOrThisOfType<RimGridView>();
if ( gridView && gridView->ownerCase() )
{
displayOffset = gridView->ownerCase()->displayModelOffset();
@@ -268,7 +265,7 @@ private:
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray* visibleCells )
{
if ( m_triangleVxes->size() ) return;
@@ -281,6 +278,8 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
m_hexGrid->setKIntervalFilter( m_intersection->kLayerFilterEnabled(), m_intersection->kFilterText().toStdString() );
calculateLineSegementTransforms();
calculateTransformedPolyline();
@@ -387,6 +386,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
for ( auto globalCellIdx : columnCellCandidates )
{
if ( ( visibleCells != nullptr ) && ( ( *visibleCells )[globalCellIdx] == 0 ) ) continue;
if ( !m_hexGrid->useCell( globalCellIdx ) ) continue;
hexPlaneCutTriangleVxes.clear();
@@ -619,9 +619,9 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
/// Generate surface drawable geo from the specified region
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::generateSurface()
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::generateSurface( cvf::UByteArray* visibleCells )
{
calculateArrays();
calculateArrays( visibleCells );
CVF_ASSERT( m_triangleVxes.notNull() );
@@ -782,7 +782,7 @@ const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::faultMeshV
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionGeometryGenerator::ensureGeometryIsCalculated()
{
calculateArrays();
calculateArrays( nullptr );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -50,17 +50,17 @@ class DrawableGeo;
class RivExtrudedCurveIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorInterface
{
public:
RivExtrudedCurveIntersectionGeometryGenerator( RimExtrudedCurveIntersection* intersection,
std::vector<std::vector<cvf::Vec3d>>& polylines,
const cvf::Vec3d& extrusionDirection,
const RivIntersectionHexGridInterface* grid,
bool isFlattened,
const cvf::Vec3d& flattenedPolylineStartPoint );
RivExtrudedCurveIntersectionGeometryGenerator( RimExtrudedCurveIntersection* intersection,
std::vector<std::vector<cvf::Vec3d>>& polylines,
const cvf::Vec3d& extrusionDirection,
RivIntersectionHexGridInterface* grid,
bool isFlattened,
const cvf::Vec3d& flattenedPolylineStartPoint );
~RivExtrudedCurveIntersectionGeometryGenerator() override;
// Generate geometry
cvf::ref<cvf::DrawableGeo> generateSurface();
cvf::ref<cvf::DrawableGeo> generateSurface( cvf::UByteArray* visibleCells );
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
cvf::ref<cvf::DrawableGeo> createFaultMeshDrawable();
@@ -87,7 +87,7 @@ public:
void ensureGeometryIsCalculated();
private:
void calculateArrays();
void calculateArrays( cvf::UByteArray* visibleCells );
void calculateLineSegementTransforms();
void calculateTransformedPolyline();
void calculateSurfaceIntersectionPoints();
@@ -102,7 +102,7 @@ private:
private:
RimExtrudedCurveIntersection* m_intersection;
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;
cvf::ref<RivIntersectionHexGridInterface> m_hexGrid;
const std::vector<std::vector<cvf::Vec3d>> m_polylines;
cvf::Vec3d m_extrusionDirection;
bool m_isFlattened;

View File

@@ -231,7 +231,7 @@ void RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMech
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry()
void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry( cvf::UByteArray* visibleCells )
{
if ( m_intersectionGenerator.isNull() ) return;
@@ -242,7 +242,7 @@ void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry()
bool useBufferObjects = true;
// Surface geometry
{
cvf::ref<cvf::DrawableGeo> geo = m_intersectionGenerator->generateSurface();
cvf::ref<cvf::DrawableGeo> geo = m_intersectionGenerator->generateSurface( visibleCells );
if ( geo.notNull() )
{
geo->computeNormals();
@@ -341,8 +341,7 @@ void RivExtrudedCurveIntersectionPartMgr::createFaultLabelParts( const std::vect
if ( !m_rimIntersection->activeSeparateResultDefinition() )
{
RimEclipseView* eclipseView = nullptr;
m_rimIntersection->firstAncestorOrThisOfType( eclipseView );
auto eclipseView = m_rimIntersection->firstAncestorOrThisOfType<RimEclipseView>();
if ( eclipseView )
{
faultInViewColl = eclipseView->faultCollection();
@@ -773,11 +772,6 @@ cvf::ref<cvf::Part> RivExtrudedCurveIntersectionPartMgr::createCurvePart( const
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionPartMgr::appendIntersectionFacesToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionFaces.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionFaces.notNull() )
{
m_intersectionFaces->setTransform( scaleTransform );
@@ -790,11 +784,6 @@ void RivExtrudedCurveIntersectionPartMgr::appendIntersectionFacesToModel( cvf::M
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionPartMgr::appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionGridLines.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionGridLines.notNull() )
{
m_intersectionGridLines->setTransform( scaleTransform );
@@ -874,7 +863,7 @@ void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView&
for ( size_t i = 0; i < m_annotationParts.size(); i++ )
{
auto part = m_annotationParts[i];
auto& part = m_annotationParts[i];
if ( part.notNull() )
{
part->setTransform( scaleTransform );

View File

@@ -20,13 +20,13 @@
#pragma once
#include "cvfArray.h"
#include "cvfCollection.h"
#include "cvfColor4.h"
#include "cvfMatrix4.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cafPdmPointer.h"
#include "cvfCollection.h"
#include <QString>
@@ -81,8 +81,9 @@ public:
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const;
void generatePartGeometry( cvf::UByteArray* visibleCells );
private:
void generatePartGeometry();
void createFaultLabelParts( const std::vector<std::pair<QString, cvf::Vec3d>>& labelAndAnchors );
void createPolyLineParts( bool useBufferObjects );
void createExtrusionDirParts( bool useBufferObjects );

View File

@@ -53,18 +53,12 @@ cvf::BoundingBox RivFemIntersectionGrid::boundingBox() const
//--------------------------------------------------------------------------------------------------
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 FEM models the term element is used instead of cell.
// Each FEM part has a local element index which is transformed into global index for a FEM part collection.
std::vector<size_t> intersectedGlobalElementIndices;
m_femParts->findIntersectingGlobalElementIndices( intersectingBB, &intersectedGlobalElementIndices );
for ( size_t t = 0; t < foundElements.size(); t++ )
{
size_t globalIdx = m_femParts->globalIndex( i, foundElements[t] );
intersectedCells->push_back( globalIdx );
}
}
*intersectedCells = intersectedGlobalElementIndices;
}
//--------------------------------------------------------------------------------------------------
@@ -135,3 +129,11 @@ const RigFault* RivFemIntersectionGrid::findFaultFromCellIndexAndCellFace( size_
{
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemIntersectionGrid::setKIntervalFilter( bool enabled, std::string kIntervalStr )
{
// not supported for geomech grids
}

View File

@@ -45,6 +45,7 @@ public:
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;
void setKIntervalFilter( bool enabled, std::string kIntervalStr ) override;
private:
cvf::cref<RigFemPartCollection> m_femParts;

View File

@@ -24,6 +24,7 @@
#include "cvfStructGrid.h"
#include <string>
#include <vector>
class RigFault;
@@ -41,4 +42,5 @@ public:
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;
virtual void setKIntervalFilter( bool enabled, std::string kIntervalStr ) = 0;
};

View File

@@ -18,7 +18,8 @@
#include "RivIntersectionResultsColoringTools.h"
#include "RiuGeoMechXfTensorResultAccessor.h"
#include "RiaOffshoreSphericalCoords.h"
#include "RiaResultNames.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
@@ -42,7 +43,7 @@
#include "RivScalarMapperUtils.h"
#include "RivTernaryTextureCoordsCreator.h"
#include "RiaOffshoreSphericalCoords.h"
#include "RiuGeoMechXfTensorResultAccessor.h"
#include "cvfGeometryTools.h"
#include "cvfStructGridGeometryGenerator.h"
@@ -61,9 +62,7 @@ void RivIntersectionResultsColoringTools::calculateIntersectionResultColors( int
{
if ( !intersectionGeomGenIF || !intersectionGeomGenIF->isAnyGeometryPresent() ) return;
RimGridView* gridView = nullptr;
rimIntersectionHandle->firstAncestorOrThisOfType( gridView );
auto gridView = rimIntersectionHandle->firstAncestorOrThisOfType<RimGridView>();
if ( !gridView ) return;
bool isLightingDisabled = gridView->isLightingDisabled();
@@ -99,9 +98,7 @@ void RivIntersectionResultsColoringTools::calculateIntersectionResultColors( int
if ( !eclipseResDef && !geomResultDef )
{
RimEclipseView* eclipseView = nullptr;
rimIntersectionHandle->firstAncestorOrThisOfType( eclipseView );
auto eclipseView = rimIntersectionHandle->firstAncestorOrThisOfType<RimEclipseView>();
if ( eclipseView )
{
eclipseResDef = eclipseView->cellResult();
@@ -109,9 +106,7 @@ void RivIntersectionResultsColoringTools::calculateIntersectionResultColors( int
if ( !ternaryColorMapper ) ternaryColorMapper = eclipseView->cellResult()->ternaryLegendConfig()->scalarMapper();
}
RimGeoMechView* geoView;
rimIntersectionHandle->firstAncestorOrThisOfType( geoView );
auto geoView = rimIntersectionHandle->firstAncestorOrThisOfType<RimGeoMechView>();
if ( geoView )
{
geomResultDef = geoView->cellResult();
@@ -419,7 +414,7 @@ void RivIntersectionResultsColoringTools::calculateElementBasedGeoMechTextureCoo
void RivIntersectionResultsColoringTools::calculateGeoMechTensorXfTextureCoords( cvf::Vec2fArray* textureCoords,
const cvf::Vec3fArray* triangelVertices,
const std::vector<RivIntersectionVertexWeights>& vertexWeights,
RigGeoMechCaseData* caseData,
RigGeoMechCaseData* caseData,
const RigFemResultAddress& resVarAddress,
int partIdx,
int timeStepIdx,
@@ -486,9 +481,9 @@ void RivIntersectionResultsColoringTools::calculatePlaneAngleTextureCoords( cvf:
// as plane
// normal
float angle = cvf::Math::toDegrees( operation( sphCoord ) );
cvf::Vec2f texCoord = ( angle != std::numeric_limits<float>::infinity() ) ? mapper->mapToTextureCoord( angle )
: cvf::Vec2f( 0.0f, 1.0f );
float angle = cvf::Math::toDegrees( operation( sphCoord ) );
cvf::Vec2f texCoord = ( angle != std::numeric_limits<float>::infinity() ) ? mapper->mapToTextureCoord( angle )
: cvf::Vec2f( 0.0f, 1.0f );
rawPtr[triangleVxStartIdx + 0] = texCoord;
rawPtr[triangleVxStartIdx + 1] = texCoord;
rawPtr[triangleVxStartIdx + 2] = texCoord;