mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-02 20:30:46 -06:00
Generate OPERNUM for entire result vector.
This commit is contained in:
1 parent
5373484615
commit
fd56ae3e4d
2 files changed
+23
-23
No files matched your search
@@ -67,8 +67,9 @@ void generateBorderResult( RimEclipseCase* eclipseCase, cvf::ref<cvf::UByteArray
|
|||||||
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->activeReservoirCellIndices();
|
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->activeReservoirCellIndices();
|
||||||
int numActiveCells = static_cast<int>( activeReservoirCellIdxs.size() );
|
int numActiveCells = static_cast<int>( activeReservoirCellIdxs.size() );
|
||||||
|
|
||||||
std::vector<int> result;
|
size_t reservoirCellCount =
|
||||||
result.resize( numActiveCells, BorderType::INVISIBLE_CELL );
|
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->reservoirCellCount();
|
||||||
|
std::vector<int> result( reservoirCellCount, BorderType::INVISIBLE_CELL );
|
||||||
|
|
||||||
auto grid = eclipseCase->eclipseCaseData()->mainGrid();
|
auto grid = eclipseCase->eclipseCaseData()->mainGrid();
|
||||||
|
|
||||||
@@ -89,11 +90,11 @@ void generateBorderResult( RimEclipseCase* eclipseCase, cvf::ref<cvf::UByteArray
|
|||||||
|
|
||||||
if ( nVisibleNeighbors == 6 )
|
if ( nVisibleNeighbors == 6 )
|
||||||
{
|
{
|
||||||
result[i] = BorderType::INTERIOR_CELL;
|
result[cellIdx] = BorderType::INTERIOR_CELL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result[i] = BorderType::BORDER_CELL;
|
result[cellIdx] = BorderType::BORDER_CELL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,10 +120,6 @@ void generateOperNumResult( RimEclipseCase* eclipseCase, int borderCellValue )
|
|||||||
|
|
||||||
auto activeReservoirCellIdxs =
|
auto activeReservoirCellIdxs =
|
||||||
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->activeReservoirCellIndices();
|
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->activeReservoirCellIndices();
|
||||||
int numActiveCells = static_cast<int>( activeReservoirCellIdxs.size() );
|
|
||||||
|
|
||||||
std::vector<int> result;
|
|
||||||
result.resize( numActiveCells, 0 );
|
|
||||||
|
|
||||||
// Check if OPERNUM already exists - if so, keep existing values.
|
// Check if OPERNUM already exists - if so, keep existing values.
|
||||||
RigEclipseResultAddress operNumAddrNative( RiaDefines::ResultCatType::STATIC_NATIVE,
|
RigEclipseResultAddress operNumAddrNative( RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||||
@@ -147,16 +144,17 @@ void generateOperNumResult( RimEclipseCase* eclipseCase, int borderCellValue )
|
|||||||
hasExistingOperNum = true;
|
hasExistingOperNum = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<int> result;
|
||||||
|
|
||||||
if ( hasExistingOperNum )
|
if ( hasExistingOperNum )
|
||||||
{
|
{
|
||||||
resultsData->ensureKnownResultLoaded( operNumAddr );
|
resultsData->ensureKnownResultLoaded( operNumAddr );
|
||||||
auto existingValues = resultsData->cellScalarResults( operNumAddr );
|
auto existingValues = resultsData->cellScalarResults( operNumAddr, 0 );
|
||||||
if ( !existingValues.empty() )
|
result.resize( existingValues.size() );
|
||||||
|
|
||||||
|
for ( size_t i = 0; i < existingValues.size(); i++ )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < numActiveCells; i++ )
|
result[i] = static_cast<int>( existingValues[i] );
|
||||||
{
|
|
||||||
result[i] = static_cast<int>( existingValues[0][i] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,15 +163,16 @@ void generateOperNumResult( RimEclipseCase* eclipseCase, int borderCellValue )
|
|||||||
if ( resultsData->hasResultEntry( bordNumAddr ) )
|
if ( resultsData->hasResultEntry( bordNumAddr ) )
|
||||||
{
|
{
|
||||||
resultsData->ensureKnownResultLoaded( bordNumAddr );
|
resultsData->ensureKnownResultLoaded( bordNumAddr );
|
||||||
auto bordNumValues = resultsData->cellScalarResults( bordNumAddr );
|
auto bordNumValues = resultsData->cellScalarResults( bordNumAddr, 0 );
|
||||||
if ( !bordNumValues.empty() )
|
if ( !bordNumValues.empty() )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < numActiveCells; i++ )
|
if ( result.empty() ) result.resize( bordNumValues.size(), 0 );
|
||||||
|
for ( size_t activeCellIdx : activeReservoirCellIdxs )
|
||||||
{
|
{
|
||||||
// If BORDNUM = 1 (BORDER_CELL), assign the border cell value
|
// If BORDNUM = 1 (BORDER_CELL), assign the border cell value
|
||||||
if ( static_cast<int>( bordNumValues[0][i] ) == BorderType::BORDER_CELL )
|
if ( static_cast<int>( bordNumValues[activeCellIdx] ) == BorderType::BORDER_CELL )
|
||||||
{
|
{
|
||||||
result[i] = borderCellValue;
|
result[activeCellIdx] = borderCellValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,15 +218,14 @@ int findMaxOperNumValue( RimEclipseCase* eclipseCase )
|
|||||||
if ( !hasOperNum ) return 0;
|
if ( !hasOperNum ) return 0;
|
||||||
|
|
||||||
resultsData->ensureKnownResultLoaded( operNumAddr );
|
resultsData->ensureKnownResultLoaded( operNumAddr );
|
||||||
auto operNumValues = resultsData->cellScalarResults( operNumAddr );
|
auto operNumValues = resultsData->cellScalarResults( operNumAddr, 0 );
|
||||||
if ( operNumValues.empty() ) return 0;
|
if ( operNumValues.empty() ) return 0;
|
||||||
|
|
||||||
// Find maximum value
|
// Find maximum value
|
||||||
int maxValue = 0;
|
int maxValue = 0;
|
||||||
for ( double value : operNumValues[0] )
|
for ( double value : operNumValues )
|
||||||
{
|
{
|
||||||
int intValue = static_cast<int>( value );
|
maxValue = std::max( maxValue, static_cast<int>( value ) );
|
||||||
maxValue = std::max( maxValue, intValue );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return maxValue;
|
return maxValue;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#include "RiaPorosityModel.h"
|
||||||
#include "RiaResultNames.h"
|
#include "RiaResultNames.h"
|
||||||
#include "RiaTestDataDirectory.h"
|
#include "RiaTestDataDirectory.h"
|
||||||
|
|
||||||
@@ -592,7 +593,8 @@ TEST( RigEclipseCaseDataToolsTest, GenerateOperNumResultFromBorderResult )
|
|||||||
int numActiveCells = static_cast<int>( activeReservoirCellIdxs.size() );
|
int numActiveCells = static_cast<int>( activeReservoirCellIdxs.size() );
|
||||||
|
|
||||||
std::vector<int> customOperValues;
|
std::vector<int> customOperValues;
|
||||||
customOperValues.resize( numActiveCells, 5 ); // Set all to 5 initially
|
customOperValues.resize( eclipseCase->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL )->reservoirCellCount(),
|
||||||
|
5 ); // Set all to 5 initially
|
||||||
// Add some higher values to test max detection
|
// Add some higher values to test max detection
|
||||||
if ( numActiveCells > 10 )
|
if ( numActiveCells > 10 )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user