Add support for K filter to polyline intersections (#10302)

* Add support for K filter to polyline intersections
This commit is contained in:
jonjenssen 2023-05-25 08:14:43 +02:00 committed by GitHub
parent fe5c24ef5d
commit 1063d7f3d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 181 additions and 60 deletions

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

@ -64,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 )
@ -278,6 +278,8 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
m_hexGrid->setKIntervalFilter( m_intersection->kLayerFilterEnabled(), m_intersection->kFilterText().toStdString() );
calculateLineSegementTransforms();
calculateTransformedPolyline();

View File

@ -50,12 +50,12 @@ 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;
@ -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

@ -129,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

@ -90,9 +90,10 @@ bool RimCellFilterIntervalTool::isNumberIncluded( size_t number ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimCellFilterIntervalTool::numberFromPart( QString strVal ) const
size_t RimCellFilterIntervalTool::numberFromPart( std::string strVal ) const
{
return strVal.toUInt();
QString qStrVal = QString::fromStdString( strVal );
return qStrVal.toUInt();
}
//--------------------------------------------------------------------------------------------------
@ -100,13 +101,15 @@ size_t RimCellFilterIntervalTool::numberFromPart( QString strVal ) const
// Define a range with the comma separated format A,B,C-D, etc., i.e. 1,4,5-8
// Only positive numbers are supported.
//--------------------------------------------------------------------------------------------------
void RimCellFilterIntervalTool::setInterval( bool enabled, QString intervalText )
void RimCellFilterIntervalTool::setInterval( bool enabled, std::string intervalText )
{
m_intervals.clear();
if ( !enabled ) return;
QStringList parts = RiaTextStringTools::splitSkipEmptyParts( intervalText, "," );
QString qIntervalText = QString::fromStdString( intervalText );
QStringList parts = RiaTextStringTools::splitSkipEmptyParts( qIntervalText, "," );
for ( auto& part : parts )
{
@ -114,10 +117,11 @@ void RimCellFilterIntervalTool::setInterval( bool enabled, QString intervalText
switch ( minmax.size() )
{
case 1:
m_intervals.push_back( RimCellFilterInterval( numberFromPart( minmax[0] ) ) );
m_intervals.push_back( RimCellFilterInterval( numberFromPart( minmax[0].toStdString() ) ) );
break;
case 2:
m_intervals.push_back( RimCellFilterInterval( numberFromPart( minmax[0] ), numberFromPart( minmax[1] ) ) );
m_intervals.push_back(
RimCellFilterInterval( numberFromPart( minmax[0].toStdString() ), numberFromPart( minmax[1].toStdString() ) ) );
break;
default:

View File

@ -18,8 +18,8 @@
#pragma once
#include <QString>
#include <list>
#include <string>
class RimCellFilterInterval
{
@ -42,14 +42,14 @@ public:
RimCellFilterIntervalTool( bool includeAllByDefault = true );
~RimCellFilterIntervalTool();
void setInterval( bool enabled, QString intervalText );
void setInterval( bool enabled, std::string intervalText );
bool isNumberIncluded( size_t number ) const;
private:
size_t numberFromPart( QString strVal ) const;
size_t numberFromPart( std::string strVal ) const;
bool m_includeAllByDefault;
QString m_intervalText;
bool m_includeAllByDefault;
std::string m_intervalText;
std::list<RimCellFilterInterval> m_intervals;
};

View File

@ -812,7 +812,7 @@ void RimPolygonFilter::updateCells()
initializeCellList();
// get optional k-cell filter
m_intervalTool.setInterval( m_enableKFilter, m_kFilterStr );
m_intervalTool.setInterval( m_enableKFilter, m_kFilterStr().toStdString() );
// get polyline as vector
std::vector<cvf::Vec3d> points;

View File

@ -125,16 +125,16 @@ private:
caf::PdmField<caf::AppEnum<PolygonIncludeType>> m_polyIncludeType;
caf::PdmPtrField<RimCase*> m_srcCase;
caf::PdmField<bool> m_enableFiltering;
caf::PdmField<bool> m_enableKFilter;
caf::PdmField<bool> m_showLines;
caf::PdmField<bool> m_showSpheres;
caf::PdmField<QString> m_kFilterStr;
caf::PdmField<int> m_lineThickness;
caf::PdmField<double> m_sphereRadiusFactor;
caf::PdmField<cvf::Color3f> m_lineColor;
caf::PdmField<cvf::Color3f> m_sphereColor;
caf::PdmField<double> m_polygonPlaneDepth;
caf::PdmField<bool> m_lockPolygonToPlane;
caf::PdmField<bool> m_enableKFilter;
caf::PdmField<QString> m_kFilterStr;
std::shared_ptr<RicPolylineTargetsPickEventHandler> m_pickTargetsEventHandler;

View File

@ -267,6 +267,15 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
CAF_PDM_InitFieldNoDefault( &m_collectionDepthFilterType, "CollectionDepthFilterType", "Collection Controlled Filter Type" );
m_collectionDepthFilterType.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_enableKFilter, "EnableKFilter", false, "Enable K Range Filter" );
CAF_PDM_InitFieldNoDefault( &m_kFilterText, "KRangeFilter", "K Range Filter", "", "Example: 2,4,10-20,31", "" );
CAF_PDM_InitField( &m_kFilterCollectionOverride, "KFilterCollectionOverride", false, "K Range Filter is Controlled by Intersection Collection" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_kFilterCollectionOverride );
CAF_PDM_InitFieldNoDefault( &m_kFilterCollectionText, "KRangeCollectionFilter", "Collection K Range Filter", "", "Example: 2,4,10-20,31", "" );
m_kFilterCollectionText.uiCapability()->setUiHidden( true );
setDeletable( true );
}
@ -397,6 +406,32 @@ void RimExtrudedCurveIntersection::setDepthOverrideParameters( double upperThres
m_collectionDepthFilterType = filterType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimExtrudedCurveIntersection::kLayerFilterEnabled() const
{
return m_enableKFilter() || m_kFilterCollectionOverride();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimExtrudedCurveIntersection::kFilterText() const
{
if ( m_kFilterCollectionOverride() ) return m_kFilterCollectionText();
return m_kFilterText();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::setKFilterOverride( bool collectionOverride, QString kFilterText )
{
m_kFilterCollectionOverride = collectionOverride;
m_kFilterCollectionText = kFilterText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -406,7 +441,8 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength ||
changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells ||
changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold ||
changedField == &m_depthLowerThreshold || changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType )
changedField == &m_depthLowerThreshold || changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType ||
changedField == &m_enableKFilter || changedField == &m_kFilterText || changedField == &m_kFilterCollectionOverride )
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
@ -574,6 +610,21 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf::
default:
break;
}
if ( eclipseView() != nullptr )
{
auto kgroup = uiOrdering.addNewGroup( "K Range Filter" );
if ( m_kFilterCollectionOverride() )
{
kgroup->add( &m_kFilterCollectionOverride );
}
else
{
kgroup->add( &m_enableKFilter );
kgroup->add( &m_kFilterText );
}
}
}
this->defineSeparateDataSourceUi( uiConfigName, uiOrdering );

View File

@ -26,6 +26,8 @@
#include "cafPdmChildField.h"
#include "cafPdmProxyValueField.h"
#include <QString>
class RimWellPath;
class RivExtrudedCurveIntersectionPartMgr;
class RimEclipseView;
@ -81,6 +83,10 @@ public:
double lowerFilterDepth( double lowerGridLimit ) const;
RimIntersectionFilterEnum depthFilterType() const;
bool kLayerFilterEnabled() const;
QString kFilterText() const;
void setKFilterOverride( bool collectionOverride, QString kFilterText );
void setDepthOverride( bool collectionOverride );
void setDepthOverrideParameters( double upperThreshold, double lowerThreshold, RimIntersectionFilterEnum filterType );
@ -197,4 +203,10 @@ private:
cvf::ref<RivExtrudedCurveIntersectionPartMgr> m_crossSectionPartMgr;
mutable std::vector<std::vector<cvf::Vec3d>> m_simulationWellBranchCenterlines;
caf::PdmField<bool> m_enableKFilter;
caf::PdmField<QString> m_kFilterText;
caf::PdmField<bool> m_kFilterCollectionOverride;
caf::PdmField<QString> m_kFilterCollectionText;
};

View File

@ -69,9 +69,12 @@ RimIntersectionCollection::RimIntersectionCollection()
m_depthLowerThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_depthThresholdOverridden, "DepthFilterOverride", false, "Override Intersection Depth Filters" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_depthThresholdOverridden );
CAF_PDM_InitFieldNoDefault( &m_depthFilterType, "CollectionDepthFilterType", "Depth Filter Type" );
CAF_PDM_InitField( &m_kFilterOverridden, "OverrideKFilter", false, "Override K Range Filter" );
CAF_PDM_InitFieldNoDefault( &m_kFilterStr, "KRangeFilter", "K Range Filter", "", "Example: 2,4,10-20,31", "" );
}
//--------------------------------------------------------------------------------------------------
@ -380,6 +383,16 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
rebuildView = true;
}
if ( changedField == &m_kFilterOverridden || changedField == &m_kFilterStr )
{
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
cs->setKFilterOverride( m_kFilterOverridden, m_kFilterStr );
cs->rebuildGeometryAndScheduleCreateDisplayModel();
}
rebuildView = true;
}
if ( rebuildView )
{
rebuild3dView();
@ -439,40 +452,46 @@ void RimIntersectionCollection::updateIntersectionBoxGeometry()
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "Depth Filter - Curve Intersections" );
m_depthFilterType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
m_depthUpperThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
m_depthLowerThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
filterGroup->add( &m_depthThresholdOverridden );
filterGroup->add( &m_depthFilterType );
switch ( m_depthFilterType() )
{
case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW:
m_depthUpperThreshold.uiCapability()->setUiName( "Depth" );
filterGroup->add( &m_depthUpperThreshold );
break;
case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN:
m_depthUpperThreshold.uiCapability()->setUiName( "Upper Depth" );
filterGroup->add( &m_depthUpperThreshold );
m_depthLowerThreshold.uiCapability()->setUiName( "Lower Depth" );
filterGroup->add( &m_depthLowerThreshold );
break;
case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE:
m_depthLowerThreshold.uiCapability()->setUiName( "Depth" );
filterGroup->add( &m_depthLowerThreshold );
break;
case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE:
default:
break;
}
if ( eclipseView() )
{
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "Depth Filter - Curve Intersections" );
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "K Filter - Curve Intersections" );
m_depthFilterType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
m_depthUpperThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
m_depthLowerThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
m_kFilterStr.uiCapability()->setUiReadOnly( !m_kFilterOverridden() );
filterGroup->add( &m_depthThresholdOverridden );
filterGroup->add( &m_depthFilterType );
switch ( m_depthFilterType() )
{
case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW:
m_depthUpperThreshold.uiCapability()->setUiName( "Depth" );
filterGroup->add( &m_depthUpperThreshold );
break;
case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN:
m_depthUpperThreshold.uiCapability()->setUiName( "Upper Depth" );
filterGroup->add( &m_depthUpperThreshold );
m_depthLowerThreshold.uiCapability()->setUiName( "Lower Depth" );
filterGroup->add( &m_depthLowerThreshold );
break;
case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE:
m_depthLowerThreshold.uiCapability()->setUiName( "Depth" );
filterGroup->add( &m_depthLowerThreshold );
break;
case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE:
default:
break;
}
filterGroup->add( &m_kFilterOverridden );
filterGroup->add( &m_kFilterStr );
}
uiOrdering.skipRemainingFields( true );

View File

@ -103,4 +103,7 @@ private:
caf::PdmField<double> m_depthUpperThreshold;
caf::PdmField<double> m_depthLowerThreshold;
caf::PdmField<caf::AppEnum<RimIntersectionFilterEnum>> m_depthFilterType;
caf::PdmField<bool> m_kFilterOverridden;
caf::PdmField<QString> m_kFilterStr;
};