Skip to content

Commit

Permalink
Reintroduce weighting.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Nov 4, 2024
1 parent db8d0e9 commit bfee2dd
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ double RigContourMapCalculator::calculateSum( const RigContourMapProjection&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<std::pair<size_t, double>>> RigContourMapCalculator::generateGridMapping( RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
ResultAggregationEnum resultAggregation )
std::vector<std::vector<std::pair<size_t, double>>>
RigContourMapCalculator::generateGridMapping( RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
ResultAggregationEnum resultAggregation,
const std::vector<double>& weightingResultValues )
{
int nCells = contourMapGrid.numberOfCells();
std::vector<std::vector<std::pair<size_t, double>>> projected3dGridIndices( nCells );

std::vector<double> weightingResultValues = contourMapProjection.retrieveParameterWeights();

if ( RigContourMapCalculator::isStraightSummationResult( resultAggregation ) )
{
#pragma omp parallel for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ class RigContourMapCalculator
RESULTS_HC_COLUMN
};

static std::vector<std::vector<std::pair<size_t, double>>> generateGridMapping( RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
ResultAggregationEnum resultAggregation );
static std::vector<std::vector<std::pair<size_t, double>>> generateGridMapping( RigContourMapProjection& contourMapProjection,
const RigContourMapGrid& contourMapGrid,
ResultAggregationEnum resultAggregation,
const std::vector<double>& weightingResultValues );

static double calculateValueInMapCell( const RigContourMapProjection& contourMapProjection,
const std::vector<std::pair<size_t, double>>& matchingCells,
Expand Down
14 changes: 3 additions & 11 deletions ApplicationLibCode/ReservoirDataModel/RigContourMapProjection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ RigContourMapProjection::RigContourMapProjection( const RigContourMapGrid& conto
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<std::pair<size_t, double>>>
RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation )
RigContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation,
const std::vector<double>& weights )
{
m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, m_contourMapGrid, resultAggregation );
m_projected3dGridIndices = RigContourMapCalculator::generateGridMapping( *this, m_contourMapGrid, resultAggregation, weights );
return m_projected3dGridIndices;
}

Expand Down Expand Up @@ -472,12 +473,3 @@ std::vector<double> RigContourMapProjection::yVertexPositions() const
{
return m_contourMapGrid.yVertexPositions();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// double RigContourMapProjection::gridEdgeOffset() const
// {
// // TODO: remove???
// return m_contourMapGrid.sampleSpacing() * 2.0;
// }
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> retrieveParameterWeights() = 0;

virtual size_t kLayer( size_t globalCellIdx ) const = 0;
virtual size_t kLayers() const = 0;
virtual std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& bbox ) const = 0;
Expand All @@ -82,7 +80,8 @@ class RigContourMapProjection
void setCellVisibility( cvf::ref<cvf::UByteArray> cellVisibility ) { m_cellGridIdxVisibility = cellVisibility; }
virtual cvf::ref<cvf::UByteArray> getCellVisibility() const;

std::vector<std::vector<std::pair<size_t, double>>> generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation );
std::vector<std::vector<std::pair<size_t, double>>>
generateGridMapping( RigContourMapCalculator::ResultAggregationEnum resultAggregation, const std::vector<double>& weights );

double interpolateValue( const cvf::Vec2d& gridPosition2d ) const;
virtual std::pair<double, double> minmaxValuesAllTimeSteps( const std::vector<int>& timeSteps );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ std::vector<double> RigEclipseContourMapProjection::generateResults( const RigEc

std::vector<double> aggregatedResults = std::vector<double>( nCells, std::numeric_limits<double>::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
{
Expand Down Expand Up @@ -192,29 +190,6 @@ std::vector<double> RigEclipseContourMapProjection::calculateColumnResult( RigCo
return resultValues;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigEclipseContourMapProjection::retrieveParameterWeights()
{
std::vector<double> 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;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class RigEclipseContourMapProjection : public RigContourMapProjection
protected:
using CellIndexAndResult = RigContourMapProjection::CellIndexAndResult;

std::vector<double> retrieveParameterWeights() override;
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& bbox ) const override;
size_t kLayer( size_t globalCellIdx ) const override;
size_t kLayers() const override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,6 @@ std::vector<bool> RigGeoMechContourMapProjection::getMapCellVisibility( RigFemRe
return mapCellVisibility;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigGeoMechContourMapProjection::retrieveParameterWeights()
{
return std::vector<double>();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class RigGeoMechContourMapProjection : public RigContourMapProjection
using CellIndexAndResult = RigContourMapProjection::CellIndexAndResult;

// GeoMech implementation specific data generation methods
std::vector<double> retrieveParameterWeights() override;
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& bbox ) const override;
size_t kLayer( size_t globalCellIdx ) const override;
size_t kLayers() const override;
Expand Down

0 comments on commit bfee2dd

Please sign in to comment.