#14710 Support ensemble data filters in ensemble contour maps

Replace the built-in formation filter with ensemble data filters. Load ensemble data filters after project read, and parent new views before assigning the case so the ensemble filter collection is resolved correctly.
This commit is contained in:
Magne Sjaastad committed 2026-09-28 10:30:12 +02:00
1 parent 2bdc35ef68
commit 9911c49d2b
20 files changed
+442 -190

No files matched your search

@@ -309,7 +309,6 @@ std::vector<std::vector<std::pair<size_t, double>>>
const RigContourMapGrid& contourMapGrid,
ResultAggregationType resultAggregation,
const std::vector<double>& weightingResultValues,
const std::set<int>& kLayers,
const std::vector<std::vector<cvf::Vec3d>>& limitToPolygons )
{
int nCells = contourMapGrid.numberOfCells();
@@ -337,12 +336,12 @@ std::vector<std::vector<std::pair<size_t, double>>>
if ( isSummationResult )
{
projected3dGridIndices[index] =
cellRayIntersectionAndResults( contourMapProjection, contourMapGrid, globalPos, weightingResultValues, kLayers );
cellRayIntersectionAndResults( contourMapProjection, contourMapGrid, globalPos, weightingResultValues );
}
else
{
projected3dGridIndices[index] =
cellOverlapVolumesAndResults( contourMapProjection, contourMapGrid, globalPos, weightingResultValues, kLayers );
cellOverlapVolumesAndResults( contourMapProjection, contourMapGrid, globalPos, weightingResultValues );
}
}
return projected3dGridIndices;
@@ -355,8 +354,7 @@ std::vector<RigContourMapCalculator::CellIndexAndResult>
RigContourMapCalculator::cellOverlapVolumesAndResults( const RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
const cvf::Vec2d& globalPos2d,
const std::vector<double>& weightingResultValues,
const std::set<int>& kLayers )
const std::vector<double>& weightingResultValues )
{
const cvf::BoundingBox& expandedBoundingBox = contourMapGrid.expandedBoundingBox();
cvf::Vec3d top2dElementCentroid( globalPos2d, expandedBoundingBox.max().z() );
@@ -390,11 +388,6 @@ std::vector<RigContourMapCalculator::CellIndexAndResult>
{
if ( cellGridIdxVisibility.isNull() || ( *cellGridIdxVisibility )[globalCellIdx] )
{
auto k = contourMapProjection.kLayer( globalCellIdx );
if ( !kLayers.empty() )
{
if ( !kLayers.contains( (int)k ) ) continue;
}
kLayerCellIndexVector[contourMapProjection.kLayer( globalCellIdx )].push_back( globalCellIdx );
}
}
@@ -427,8 +420,7 @@ std::vector<RigContourMapCalculator::CellIndexAndResult>
RigContourMapCalculator::cellRayIntersectionAndResults( const RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
const cvf::Vec2d& globalPos2d,
const std::vector<double>& weightingResultValues,
const std::set<int>& kLayers )
const std::vector<double>& weightingResultValues )
{
std::vector<std::pair<size_t, double>> matchingVisibleCellsAndWeight;
@@ -458,12 +450,7 @@ std::vector<RigContourMapCalculator::CellIndexAndResult>
if ( cellGridIdxVisibility.isNull() || ( *cellGridIdxVisibility )[globalCellIdx] )
{
auto k = contourMapProjection.kLayer( globalCellIdx );
if ( !kLayers.empty() )
{
if ( !kLayers.contains( (int)k ) ) continue;
}
kLayerIndexMap[k].push_back( globalCellIdx );
kLayerIndexMap[contourMapProjection.kLayer( globalCellIdx )].push_back( globalCellIdx );
}
}
@@ -60,7 +60,6 @@ public:
const RigContourMapGrid& contourMapGrid,
ResultAggregationType resultAggregation,
const std::vector<double>& weightingResultValues,
const std::set<int>& kLayers,
const std::vector<std::vector<cvf::Vec3d>>& limitToPolygons );
static double calculateValueInMapCell( const RigContourMapProjection& contourMapProjection,
@@ -71,14 +70,12 @@ public:
static std::vector<CellIndexAndResult> cellOverlapVolumesAndResults( const RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
const cvf::Vec2d& globalPos2d,
const std::vector<double>& weightingResultValues,
const std::set<int>& kLayers );
const std::vector<double>& weightingResultValues );
static std::vector<CellIndexAndResult> cellRayIntersectionAndResults( const RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
const cvf::Vec2d& globalPos2d,
const std::vector<double>& weightingResultValues,
const std::set<int>& kLayers );
const std::vector<double>& weightingResultValues );
static bool isColumnResult( ResultAggregationType aggregationType );
static bool isMeanResult( ResultAggregationType aggregationType );
@@ -48,11 +48,10 @@ RigContourMapProjection::RigContourMapProjection( const RigContourMapGrid* conto
std::vector<std::vector<std::pair<size_t, double>>>
RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation,
const std::vector<double>& weights,
const std::set<int>& kLayers,
const std::vector<std::vector<cvf::Vec3d>>& limitToPolygons )
{
m_projected3dGridIndices =
RigContourMapCalculator::generateGridMapping( *this, *m_contourMapGrid, resultAggregation, weights, kLayers, limitToPolygons );
RigContourMapCalculator::generateGridMapping( *this, *m_contourMapGrid, resultAggregation, weights, limitToPolygons );
return m_projected3dGridIndices;
}
@@ -92,7 +92,6 @@ public:
virtual std::vector<std::vector<std::pair<size_t, double>>>
generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation,
const std::vector<double>& weights,
const std::set<int>& kLayers,
const std::vector<std::vector<cvf::Vec3d>>& limitToPolygons );
double interpolateValue( const cvf::Vec2d& gridPosition2d ) const;
@@ -44,7 +44,6 @@ RigStatisticsContourMapProjection::~RigStatisticsContourMapProjection()
std::vector<std::vector<std::pair<size_t, double>>>
RigStatisticsContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation,
const std::vector<double>& weights,
const std::set<int>& kLayers,
const std::vector<std::vector<cvf::Vec3d>>& limitToPolygons )
{
// The grid mapping is usually necessary to produce the data. For the statistics projection
@@ -42,7 +42,6 @@ public:
std::vector<std::vector<std::pair<size_t, double>>>
generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation,
const std::vector<double>& weights,
const std::set<int>& kLayers,
const std::vector<std::vector<cvf::Vec3d>>& limitToPolygons ) override;
std::vector<bool> getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationType resultAggregation ) override;
@@ -167,22 +167,3 @@ void RigFormationNames::appendFormationRangeWithColor( const QString& name, cvf:
m_formationColors.push_back( color );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RigFormationNames::findKLayers( std::vector<QString> formationNames ) const
{
std::set<int> foundK;
for ( int k = 1; k < (int)m_nameIndexPrKLayer.size(); k++ )
{
auto layerName = formationNameFromKLayerIdx( k );
if ( std::find( formationNames.begin(), formationNames.end(), layerName ) != formationNames.end() )
{
foundK.insert( k );
}
}
return foundK;
}
@@ -20,7 +20,6 @@
#include <QString>
#include <set>
#include <vector>
#include "cvfColor3.h"
@@ -44,8 +43,6 @@ public:
void appendFormationRange( const QString& name, cvf::Color3f color, int kStartIdx, int kEndIdx );
void appendFormationRangeHeight( const QString& name, cvf::Color3f color, int kLayerCount );
std::set<int> findKLayers( std::vector<QString> formationNames ) const;
private:
static cvf::Color3f undefinedColor();
void appendFormationRangeWithColor( const QString& name, cvf::Color3f color, int kStartIdx, int kEndIdx );