mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add Statistics Contour Map for eclipse grid ensembles.
This commit is contained in:
@@ -88,6 +88,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigContourMapTrianglesGenerator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseContourMapProjection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigGeoMechContourMapProjection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigStatisticsContourMapProjection.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -178,6 +179,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigContourMapTrianglesGenerator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseContourMapProjection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigGeoMechContourMapProjection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigStatisticsContourMapProjection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -33,6 +33,15 @@ public:
|
||||
RigContourMapGrid( const cvf::BoundingBox& originalBoundingBox, double sampleSpacing );
|
||||
RigContourMapGrid( const cvf::BoundingBox& originalBoundingBox, const cvf::BoundingBox& expandedBoundingBox, double sampleSpacing );
|
||||
|
||||
// Copy constructor
|
||||
RigContourMapGrid( const RigContourMapGrid& other )
|
||||
: m_sampleSpacing( other.m_sampleSpacing )
|
||||
, m_mapSize( other.m_mapSize )
|
||||
, m_expandedBoundingBox( other.m_expandedBoundingBox )
|
||||
, m_originalBoundingBox( other.m_originalBoundingBox )
|
||||
{
|
||||
}
|
||||
|
||||
double sampleSpacing() const;
|
||||
|
||||
cvf::Vec2ui numberOfElementsIJ() const;
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
void setCellVisibility( cvf::ref<cvf::UByteArray> cellVisibility );
|
||||
cvf::ref<cvf::UByteArray> getCellVisibility() const;
|
||||
|
||||
std::vector<std::vector<std::pair<size_t, double>>>
|
||||
virtual std::vector<std::vector<std::pair<size_t, double>>>
|
||||
generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation, const std::vector<double>& weights );
|
||||
|
||||
double interpolateValue( const cvf::Vec2d& gridPosition2d ) const;
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
const std::vector<std::vector<std::pair<size_t, double>>>& projected3dGridIndices() const;
|
||||
|
||||
// Cell index and position conversion
|
||||
std::vector<CellIndexAndResult> cellsAtIJ( unsigned int i, unsigned int j ) const;
|
||||
virtual std::vector<CellIndexAndResult> cellsAtIJ( unsigned int i, unsigned int j ) const;
|
||||
|
||||
static double maxValue( const std::vector<double>& aggregatedResults );
|
||||
static double minValue( const std::vector<double>& aggregatedResults );
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigStatisticsContourMapProjection.h"
|
||||
|
||||
#include "RigContourMapCalculator.h"
|
||||
#include "RigContourMapGrid.h"
|
||||
|
||||
#include "cafAssert.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigStatisticsContourMapProjection::RigStatisticsContourMapProjection( const RigContourMapGrid& contourMapGrid )
|
||||
: RigContourMapProjection( contourMapGrid )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigStatisticsContourMapProjection::~RigStatisticsContourMapProjection()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::vector<std::pair<size_t, double>>>
|
||||
RigStatisticsContourMapProjection::generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation,
|
||||
const std::vector<double>& weights )
|
||||
{
|
||||
// The grid mapping is usually necessary to produce the data. For the statistics projection
|
||||
// the data is already available, so we can just ignore it.
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsContourMapProjection::generateAndSaveResults( const std::vector<double>& result )
|
||||
{
|
||||
m_aggregatedResults = result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RigStatisticsContourMapProjection::findIntersectingCells( const cvf::BoundingBox& bbox ) const
|
||||
{
|
||||
CAF_ASSERT( false );
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigStatisticsContourMapProjection::kLayer( size_t globalCellIdx ) const
|
||||
{
|
||||
CAF_ASSERT( false );
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigStatisticsContourMapProjection::kLayers() const
|
||||
{
|
||||
CAF_ASSERT( false );
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigStatisticsContourMapProjection::calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const
|
||||
{
|
||||
CAF_ASSERT( false );
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigStatisticsContourMapProjection::calculateRayLengthInCell( size_t globalCellIdx,
|
||||
const cvf::Vec3d& highestPoint,
|
||||
const cvf::Vec3d& lowestPoint ) const
|
||||
{
|
||||
CAF_ASSERT( false );
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigStatisticsContourMapProjection::getParameterWeightForCell( size_t cellResultIdx, const std::vector<double>& cellWeights ) const
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<bool> RigStatisticsContourMapProjection::getMapCellVisibility( int viewStepIndex,
|
||||
RigContourMapCalculator::ResultAggregationType resultAggregation )
|
||||
|
||||
{
|
||||
return std::vector<bool>( numberOfCells(), true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<size_t, double>> RigStatisticsContourMapProjection::cellsAtIJ( unsigned int i, unsigned int j ) const
|
||||
{
|
||||
size_t cellIndex = m_contourMapGrid.cellIndexFromIJ( i, j );
|
||||
if ( cellIndex < m_aggregatedResults.size() && !std::isinf( m_aggregatedResults[cellIndex] ) &&
|
||||
!std::isnan( m_aggregatedResults[cellIndex] ) )
|
||||
{
|
||||
return { std::make_pair( cellIndex, m_aggregatedResults[cellIndex] ) };
|
||||
}
|
||||
|
||||
return std::vector<std::pair<size_t, double>>();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigContourMapCalculator.h"
|
||||
#include "RigContourMapProjection.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
class RigContourMapGrid;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigStatisticsContourMapProjection : public RigContourMapProjection
|
||||
{
|
||||
public:
|
||||
RigStatisticsContourMapProjection( const RigContourMapGrid& contourMapGrid );
|
||||
virtual ~RigStatisticsContourMapProjection();
|
||||
|
||||
std::vector<std::pair<size_t, double>> cellsAtIJ( unsigned int i, unsigned int j ) const override;
|
||||
|
||||
void generateAndSaveResults( const std::vector<double>& results );
|
||||
|
||||
std::vector<std::vector<std::pair<size_t, double>>>
|
||||
generateGridMapping( RigContourMapCalculator::ResultAggregationType resultAggregation, const std::vector<double>& weights ) override;
|
||||
|
||||
std::vector<bool> getMapCellVisibility( int viewStepIndex, RigContourMapCalculator::ResultAggregationType resultAggregation ) override;
|
||||
|
||||
protected:
|
||||
using CellIndexAndResult = RigContourMapProjection::CellIndexAndResult;
|
||||
|
||||
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& bbox ) const override;
|
||||
size_t kLayer( size_t globalCellIdx ) const override;
|
||||
size_t kLayers() const override;
|
||||
double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const override;
|
||||
double calculateRayLengthInCell( size_t globalCellIdx, const cvf::Vec3d& highestPoint, const cvf::Vec3d& lowestPoint ) const override;
|
||||
double getParameterWeightForCell( size_t cellResultIdx, const std::vector<double>& parameterWeights ) const override;
|
||||
};
|
||||
Reference in New Issue
Block a user