From bfee2dd00b5868d91704f6c5f88b4920b481bd82 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 4 Nov 2024 11:11:18 +0100 Subject: [PATCH] Reintroduce weighting. --- .../RimContourMapProjection.cpp | 2 +- .../RigContourMapCalculator.cpp | 10 +++---- .../RigContourMapCalculator.h | 7 +++-- .../RigContourMapProjection.cpp | 14 ++------- .../RigContourMapProjection.h | 5 ++-- .../RigEclipseContourMapProjection.cpp | 29 ++----------------- .../RigEclipseContourMapProjection.h | 1 - .../RigGeoMechContourMapProjection.cpp | 8 ----- .../RigGeoMechContourMapProjection.h | 1 - 9 files changed, 17 insertions(+), 60 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index c203545c42b..f7b24c9077f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -119,7 +119,7 @@ void RimContourMapProjection::generateResultsIfNecessary( int timeStep ) if ( gridMappingNeedsUpdating() ) { - m_contourMapProjection->generateGridMapping( m_resultAggregation() ); + m_contourMapProjection->generateGridMapping( m_resultAggregation(), retrieveParameterWeights() ); } progress.setProgress( 20 ); m_mapCellVisibility = m_contourMapProjection->getMapCellVisibility( timeStep, m_resultAggregation() ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp index 0f36ca55a50..a3d91e202ff 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.cpp @@ -221,15 +221,15 @@ double RigContourMapCalculator::calculateSum( const RigContourMapProjection& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector>> RigContourMapCalculator::generateGridMapping( RigContourMapProjection& contourMapProjection, - const RigContourMapGrid& contourMapGrid, - ResultAggregationEnum resultAggregation ) +std::vector>> + RigContourMapCalculator::generateGridMapping( RigContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + ResultAggregationEnum resultAggregation, + const std::vector& weightingResultValues ) { int nCells = contourMapGrid.numberOfCells(); std::vector>> projected3dGridIndices( nCells ); - std::vector weightingResultValues = contourMapProjection.retrieveParameterWeights(); - if ( RigContourMapCalculator::isStraightSummationResult( resultAggregation ) ) { #pragma omp parallel for diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h index 368b106a33b..199f578ea78 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapCalculator.h @@ -50,9 +50,10 @@ class RigContourMapCalculator RESULTS_HC_COLUMN }; - static std::vector>> generateGridMapping( RigContourMapProjection& contourMapProjection, - const RigContourMapGrid& contourMapGrid, - ResultAggregationEnum resultAggregation ); + static std::vector>> generateGridMapping( RigContourMapProjection& contourMapProjection, + const RigContourMapGrid& contourMapGrid, + ResultAggregationEnum resultAggregation, + const std::vector& weightingResultValues ); static double calculateValueInMapCell( const RigContourMapProjection& contourMapProjection, const std::vector>& matchingCells, diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp index 939fd7f08f6..de35bb1a002 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp @@ -44,9 +44,10 @@ RigContourMapProjection::RigContourMapProjection( const RigContourMapGrid& conto /// //-------------------------------------------------------------------------------------------------- std::vector>> - RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation ) + RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation, + const std::vector& weights ) { - m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, m_contourMapGrid, resultAggregation ); + m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, m_contourMapGrid, resultAggregation, weights ); return m_projected3dGridIndices; } @@ -472,12 +473,3 @@ std::vector RigContourMapProjection::yVertexPositions() const { return m_contourMapGrid.yVertexPositions(); } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -// double RigContourMapProjection::gridEdgeOffset() const -// { -// // TODO: remove??? -// return m_contourMapGrid.sampleSpacing() * 2.0; -// } diff --git a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h index 4de83304a71..b81345eb1d2 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h +++ b/ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.h @@ -70,8 +70,6 @@ class RigContourMapProjection // Use this function to get the result index into grid cell results. The index will differ if we have active cells virtual size_t gridResultIndex( size_t globalCellIdx ) const; - virtual std::vector retrieveParameterWeights() = 0; - virtual size_t kLayer( size_t globalCellIdx ) const = 0; virtual size_t kLayers() const = 0; virtual std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const = 0; @@ -82,7 +80,8 @@ class RigContourMapProjection void setCellVisibility( cvf::ref cellVisibility ) { m_cellGridIdxVisibility = cellVisibility; } virtual cvf::ref getCellVisibility() const; - std::vector>> generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation ); + std::vector>> + generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation, const std::vector& weights ); double interpolateValue( const cvf::Vec2d& gridPosition2d ) const; virtual std::pair minmaxValuesAllTimeSteps( const std::vector& timeSteps ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp index 5ae29ec798c..51f1bde475e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.cpp @@ -69,10 +69,8 @@ std::vector RigEclipseContourMapProjection::generateResults( const RigEc std::vector aggregatedResults = std::vector( nCells, std::numeric_limits::infinity() ); - { - if ( resultAddress.isValid() && m_resultData.hasResultEntry( resultAddress ) ) - m_useActiveCellInfo = m_resultData.isUsingGlobalActiveIndex( resultAddress ); - } + m_useActiveCellInfo = resultAddress.isValid() && m_resultData.hasResultEntry( resultAddress ) && + m_resultData.isUsingGlobalActiveIndex( resultAddress ); auto isTernaryResult = []( const RigEclipseResultAddress& address ) -> bool { @@ -192,29 +190,6 @@ std::vector RigEclipseContourMapProjection::calculateColumnResult( RigCo return resultValues; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RigEclipseContourMapProjection::retrieveParameterWeights() -{ - std::vector weights; - // if ( m_weightByParameter() ) - // { - // RigEclipseResultAddress gridScalarResultIdx = m_weightingResult->eclipseResultAddress(); - // if ( gridScalarResultIdx.isValid() ) - // { - // m_weightingResult->loadResult(); - // int timeStep = 0; - // if ( m_weightingResult->hasDynamicResult() ) - // { - // timeStep = view()->currentTimeStep(); - // } - // weights = m_weightingResult->currentGridCellResults()->cellScalarResults( gridScalarResultIdx, timeStep ); - // } - // } - return weights; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h index d9e435b9b87..211b382300c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseContourMapProjection.h @@ -52,7 +52,6 @@ class RigEclipseContourMapProjection : public RigContourMapProjection protected: using CellIndexAndResult = RigContourMapProjection::CellIndexAndResult; - std::vector retrieveParameterWeights() override; std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const override; size_t kLayer( size_t globalCellIdx ) const override; size_t kLayers() const override; diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp index 2e0b99b47bf..f8ce6da32cb 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.cpp @@ -179,14 +179,6 @@ std::vector RigGeoMechContourMapProjection::getMapCellVisibility( RigFemRe return mapCellVisibility; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RigGeoMechContourMapProjection::retrieveParameterWeights() -{ - return std::vector(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h index 198a3f60c99..568b2b615f4 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h +++ b/ApplicationLibCode/ReservoirDataModel/RigGeoMechContourMapProjection.h @@ -64,7 +64,6 @@ class RigGeoMechContourMapProjection : public RigContourMapProjection using CellIndexAndResult = RigContourMapProjection::CellIndexAndResult; // GeoMech implementation specific data generation methods - std::vector retrieveParameterWeights() override; std::vector findIntersectingCells( const cvf::BoundingBox& bbox ) const override; size_t kLayer( size_t globalCellIdx ) const override; size_t kLayers() const override;