Contour Maps: Use different data structures for kLayer-cell sorting

This commit is contained in:
Gaute Lindkvist 2020-12-04 08:40:25 +01:00
parent 307f9e94b1
commit 931c66ff2e
6 changed files with 30 additions and 4 deletions

View File

@ -1346,19 +1346,20 @@ std::vector<RimContourMapProjection::CellIndexAndResult>
std::vector<size_t> allCellIndices = findIntersectingCells( bbox2dElement );
std::map<size_t, std::vector<size_t>> kLayerIndexMap;
std::vector<std::vector<size_t>> kLayerCellIndexVector;
kLayerCellIndexVector.resize( kLayers() );
for ( size_t globalCellIdx : allCellIndices )
{
if ( ( *m_cellGridIdxVisibility )[globalCellIdx] )
{
kLayerIndexMap[kLayer( globalCellIdx )].push_back( globalCellIdx );
kLayerCellIndexVector[kLayer( globalCellIdx )].push_back( globalCellIdx );
}
}
for ( const auto& kLayerIndexPair : kLayerIndexMap )
for ( const auto& kLayerIndices : kLayerCellIndexVector )
{
for ( size_t globalCellIdx : kLayerIndexPair.second )
for ( size_t globalCellIdx : kLayerIndices )
{
double overlapVolume = calculateOverlapVolume( globalCellIdx, bbox2dElement );
if ( overlapVolume > 0.0 )

View File

@ -134,6 +134,7 @@ protected:
virtual void clearResultVariable() = 0;
virtual RimGridView* baseView() const = 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;
virtual double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const = 0;
virtual double calculateRayLengthInCell( size_t globalCellIdx,

View File

@ -60,6 +60,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseContourMapProjection, "RimEclipseContourMapProjec
//--------------------------------------------------------------------------------------------------
RimEclipseContourMapProjection::RimEclipseContourMapProjection()
: RimContourMapProjection()
, m_kLayers( 0u )
{
CAF_PDM_InitObject( "RimEclipseContourMapProjection", ":/2DMapProjection16x16.png", "", "" );
@ -339,6 +340,7 @@ void RimEclipseContourMapProjection::updateGridInformation()
auto eclipseCase = this->eclipseCase();
m_mainGrid = eclipseCase->eclipseCaseData()->mainGrid();
m_activeCellInfo = eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
m_kLayers = m_mainGrid->cellCountK();
m_gridBoundingBox = eclipseCase->activeCellsBoundingBox();
cvf::Vec3d minExpandedPoint = m_gridBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 );
@ -418,6 +420,14 @@ size_t RimEclipseContourMapProjection::kLayer( size_t globalCellIdx ) const
return k;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimEclipseContourMapProjection::kLayers() const
{
return m_kLayers;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -72,6 +72,7 @@ protected:
RimGridView* baseView() const 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;
double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const override;
double calculateRayLengthInCell( size_t globalCellIdx,
const cvf::Vec3d& highestPoint,
@ -97,6 +98,7 @@ protected:
cvf::ref<RigMainGrid> m_mainGrid;
cvf::ref<RigActiveCellInfo> m_activeCellInfo;
size_t m_kLayers;
QString m_currentResultName;
};

View File

@ -57,6 +57,7 @@ CAF_PDM_SOURCE_INIT( RimGeoMechContourMapProjection, "RimGeoMechContourMapProjec
///
//--------------------------------------------------------------------------------------------------
RimGeoMechContourMapProjection::RimGeoMechContourMapProjection()
: m_kLayers( 0u )
{
CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png", "", "" );
CAF_PDM_InitField( &m_limitToPorePressureRegions, "LimitToPorRegion", true, "Limit to Pore Pressure regions", "", "", "" );
@ -218,6 +219,7 @@ void RimGeoMechContourMapProjection::updateGridInformation()
RimGeoMechCase* geoMechCase = this->geoMechCase();
m_femPart = geoMechCase->geoMechData()->femParts()->part( 0 );
m_femPartGrid = m_femPart->getOrCreateStructGrid();
m_kLayers = m_femPartGrid->cellCountK();
m_femPart->ensureIntersectionSearchTreeIsBuilt();
m_gridBoundingBox = geoMechCase->activeCellsBoundingBox();
@ -445,6 +447,14 @@ size_t RimGeoMechContourMapProjection::kLayer( size_t globalCellIdx ) const
return k;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimGeoMechContourMapProjection::kLayers() const
{
return m_kLayers;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -76,6 +76,7 @@ protected:
RimGridView* baseView() const 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;
double calculateOverlapVolume( size_t globalCellIdx, const cvf::BoundingBox& bbox ) const override;
double calculateRayLengthInCell( size_t globalCellIdx,
const cvf::Vec3d& highestPoint,
@ -102,4 +103,5 @@ protected:
cvf::ref<RigFemPart> m_femPart;
cvf::cref<RigFemPartGrid> m_femPartGrid;
RigFemResultAddress m_currentResultAddr;
size_t m_kLayers;
};