mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix performance issue with filtered values
This commit is contained in:
@@ -168,12 +168,14 @@ std::vector<std::vector<int>> RicCreateContourMapPolygonTools::convertToBinaryIm
|
||||
|
||||
std::vector<std::vector<int>> image( vertexSizeIJ.x(), std::vector<int>( vertexSizeIJ.y(), 0 ) );
|
||||
|
||||
auto filteredValues = rigContourMapProjection->aggregatedVertexResultsFiltered();
|
||||
|
||||
for ( cvf::uint i = 0; i < vertexSizeIJ.x(); i++ )
|
||||
{
|
||||
for ( cvf::uint j = 0; j < vertexSizeIJ.y(); j++ )
|
||||
{
|
||||
double valueAtVertex = rigContourMapProjection->filteredValueAtVertex( i, j );
|
||||
|
||||
auto vertexIndex = rigContourMapProjection->vertexIndex( i, j );
|
||||
double valueAtVertex = vertexIndex < filteredValues.size() ? filteredValues[vertexIndex] : std::numeric_limits<double>::infinity();
|
||||
if ( !std::isinf( valueAtVertex ) )
|
||||
{
|
||||
image[i][j] = 1;
|
||||
|
||||
@@ -111,6 +111,14 @@ cvf::Vec2ui RigContourMapProjection::numberOfVerticesIJ() const
|
||||
return m_contourMapGrid.numberOfVerticesIJ();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigContourMapProjection::vertexIndex( unsigned int i, unsigned int j ) const
|
||||
{
|
||||
return m_contourMapGrid.vertexIndexFromIJ( i, j );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -124,20 +132,6 @@ double RigContourMapProjection::valueAtVertex( unsigned int i, unsigned int j )
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigContourMapProjection::filteredValueAtVertex( unsigned int i, unsigned int j ) const
|
||||
{
|
||||
size_t index = m_contourMapGrid.vertexIndexFromIJ( i, j );
|
||||
if ( index < numberOfVertices() )
|
||||
{
|
||||
auto values = aggregatedVertexResultsFiltered();
|
||||
return values.at( index );
|
||||
}
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -60,8 +60,8 @@ public:
|
||||
cvf::Vec2ui numberOfElementsIJ() const;
|
||||
cvf::Vec2ui numberOfVerticesIJ() const;
|
||||
|
||||
size_t vertexIndex( unsigned int i, unsigned int j ) const;
|
||||
double valueAtVertex( unsigned int i, unsigned int j ) const;
|
||||
double filteredValueAtVertex( unsigned int i, unsigned int j ) const;
|
||||
|
||||
unsigned int numberOfCells() const;
|
||||
unsigned int numberOfValidCells() const;
|
||||
|
||||
Reference in New Issue
Block a user