mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
BCPROP: add correct number of times to properties table.
Also improved defaults.
This commit is contained in:
1 parent
b7a4983009
commit
ba92dfb825
6 files changed
+100
-59
No files matched your search
@@ -36,6 +36,50 @@
|
||||
|
||||
namespace RigEclipseResultTools
|
||||
{
|
||||
namespace
|
||||
{
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Helper function to find maximum value in a result
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int findMaxResultValue( RimEclipseCase* eclipseCase, const QString& resultName, const std::vector<RiaDefines::ResultCatType>& categories )
|
||||
{
|
||||
if ( eclipseCase == nullptr ) return 0;
|
||||
|
||||
auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
if ( !resultsData ) return 0;
|
||||
|
||||
// Try to find result in the provided categories
|
||||
RigEclipseResultAddress resultAddr;
|
||||
bool hasResult = false;
|
||||
|
||||
for ( const auto& category : categories )
|
||||
{
|
||||
RigEclipseResultAddress addr( category, RiaDefines::ResultDataType::INTEGER, resultName );
|
||||
if ( resultsData->hasResultEntry( addr ) )
|
||||
{
|
||||
resultAddr = addr;
|
||||
hasResult = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !hasResult ) return 0;
|
||||
|
||||
resultsData->ensureKnownResultLoaded( resultAddr );
|
||||
auto resultValues = resultsData->cellScalarResults( resultAddr, 0 );
|
||||
if ( resultValues.empty() ) return 0;
|
||||
|
||||
// Find maximum value
|
||||
int maxValue = 0;
|
||||
for ( double value : resultValues )
|
||||
{
|
||||
maxValue = std::max( maxValue, static_cast<int>( value ) );
|
||||
}
|
||||
|
||||
return maxValue;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -194,47 +238,19 @@ int generateOperNumResult( RimEclipseCase* eclipseCase, int borderCellValue )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int findMaxOperNumValue( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
if ( eclipseCase == nullptr ) return 0;
|
||||
|
||||
auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
if ( !resultsData ) return 0;
|
||||
|
||||
// Try to find OPERNUM in both STATIC_NATIVE (from file) and GENERATED (created by us) categories
|
||||
RigEclipseResultAddress operNumAddrNative( RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaDefines::ResultDataType::INTEGER,
|
||||
RiaResultNames::opernum() );
|
||||
RigEclipseResultAddress operNumAddrGenerated( RiaDefines::ResultCatType::GENERATED,
|
||||
RiaDefines::ResultDataType::INTEGER,
|
||||
RiaResultNames::opernum() );
|
||||
return findMaxResultValue( eclipseCase,
|
||||
RiaResultNames::opernum(),
|
||||
{ RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::ResultCatType::GENERATED } );
|
||||
}
|
||||
|
||||
RigEclipseResultAddress operNumAddr;
|
||||
bool hasOperNum = false;
|
||||
|
||||
if ( resultsData->hasResultEntry( operNumAddrNative ) )
|
||||
{
|
||||
operNumAddr = operNumAddrNative;
|
||||
hasOperNum = true;
|
||||
}
|
||||
else if ( resultsData->hasResultEntry( operNumAddrGenerated ) )
|
||||
{
|
||||
operNumAddr = operNumAddrGenerated;
|
||||
hasOperNum = true;
|
||||
}
|
||||
|
||||
if ( !hasOperNum ) return 0;
|
||||
|
||||
resultsData->ensureKnownResultLoaded( operNumAddr );
|
||||
auto operNumValues = resultsData->cellScalarResults( operNumAddr, 0 );
|
||||
if ( operNumValues.empty() ) return 0;
|
||||
|
||||
// Find maximum value
|
||||
int maxValue = 0;
|
||||
for ( double value : operNumValues )
|
||||
{
|
||||
maxValue = std::max( maxValue, static_cast<int>( value ) );
|
||||
}
|
||||
|
||||
return maxValue;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int findMaxBcconValue( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
// Look for BCCON in GENERATED category
|
||||
return findMaxResultValue( eclipseCase, "BCCON", { RiaDefines::ResultCatType::GENERATED } );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -51,6 +51,8 @@ int generateOperNumResult( RimEclipseCase* eclipseCase, int borderCellValue = -1
|
||||
|
||||
int findMaxOperNumValue( RimEclipseCase* eclipseCase );
|
||||
|
||||
int findMaxBcconValue( RimEclipseCase* eclipseCase );
|
||||
|
||||
void generateBcconResult( RimEclipseCase* eclipseCase, const cvf::Vec3st& min, const cvf::Vec3st& max );
|
||||
|
||||
std::vector<BorderCellFace> generateBorderCellFaces( RimEclipseCase* eclipseCase );
|
||||
|
||||
Reference in new issue
Block a user