mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#10523 Export sector model: Support more result categories
Allow export of GENERATED and INPUT_PROPERTY in addition to STATIC.
This commit is contained in:
parent
96b3bef878
commit
b1157436fe
@ -409,39 +409,35 @@ QList<caf::PdmOptionItemInfo> RicExportEclipseSectorModelUi::calculateValueOptio
|
||||
if ( fieldNeedingOptions == &selectedKeywords )
|
||||
{
|
||||
RigCaseCellResultsData* resultData = m_caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
QList<caf::PdmOptionItemInfo> allOptions =
|
||||
RimEclipseResultDefinition::calcOptionsForVariableUiFieldStandard( RiaDefines::ResultCatType::STATIC_NATIVE, resultData );
|
||||
|
||||
std::vector<RiaDefines::ResultCatType> exportTypes = { RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaDefines::ResultCatType::GENERATED,
|
||||
RiaDefines::ResultCatType::INPUT_PROPERTY };
|
||||
|
||||
QList<caf::PdmOptionItemInfo> allOptions;
|
||||
|
||||
for ( const auto resultCategory : exportTypes )
|
||||
{
|
||||
auto options = RimEclipseResultDefinition::calcOptionsForVariableUiFieldStandard( resultCategory, resultData );
|
||||
allOptions.append( options );
|
||||
}
|
||||
|
||||
std::set<QString> mainKeywords = RicExportEclipseSectorModelUi::mainKeywords();
|
||||
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
||||
{
|
||||
if ( mainKeywords.count( option.optionUiText() ) )
|
||||
{
|
||||
if ( resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, option.optionUiText() ) ) )
|
||||
{
|
||||
options.push_back( option );
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
||||
{
|
||||
if ( !mainKeywords.count( option.optionUiText() ) && option.optionUiText() != "None" )
|
||||
{
|
||||
if ( resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, option.optionUiText() ) ) )
|
||||
{
|
||||
if ( option.optionUiText() == "ACTNUM" && exportGrid() )
|
||||
{
|
||||
if ( exportParameters() != EXPORT_TO_GRID_FILE )
|
||||
options.push_back( caf::PdmOptionItemInfo( "ACTNUM (included in Grid File)", "ACTNUM" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
options.push_back( option );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &exportFaults )
|
||||
{
|
||||
std::set<ResultExportOptions> validFaultOptions = { EXPORT_NO_RESULTS, EXPORT_TO_GRID_FILE, EXPORT_TO_SINGLE_SEPARATE_FILE };
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigFault.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
@ -411,19 +412,30 @@ bool RifEclipseInputFileTools::exportKeywords( const QString& resul
|
||||
|
||||
caf::ProgressInfo progress( keywords.size(), "Saving Keywords" );
|
||||
|
||||
auto allResultAddresses = cellResultsData->existingResults();
|
||||
|
||||
auto findResultAddress = [&allResultAddresses]( const QString& keyword ) -> RigEclipseResultAddress
|
||||
{
|
||||
for ( const auto& adr : allResultAddresses )
|
||||
{
|
||||
if ( adr.resultName() == keyword )
|
||||
{
|
||||
return adr;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
for ( const QString& keyword : keywords )
|
||||
{
|
||||
std::vector<double> resultValues;
|
||||
|
||||
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::STATIC_NATIVE, keyword );
|
||||
RigEclipseResultAddress resAddr = findResultAddress( keyword );
|
||||
if ( !cellResultsData->hasResultEntry( resAddr ) ) continue;
|
||||
|
||||
cellResultsData->ensureKnownResultLoaded( resAddr );
|
||||
|
||||
CVF_ASSERT( !cellResultsData->cellScalarResults( resAddr ).empty() );
|
||||
|
||||
resultValues = cellResultsData->cellScalarResults( resAddr )[0];
|
||||
CVF_ASSERT( !resultValues.empty() );
|
||||
std::vector<double> resultValues = cellResultsData->cellScalarResults( resAddr )[0];
|
||||
if ( resultValues.empty() ) continue;
|
||||
|
||||
double defaultExportValue = 0.0;
|
||||
@ -432,6 +444,11 @@ bool RifEclipseInputFileTools::exportKeywords( const QString& resul
|
||||
defaultExportValue = 1.0;
|
||||
}
|
||||
|
||||
RiaDefines::PorosityModelType porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL;
|
||||
|
||||
// Create result accessor object for main grid at time step zero (static result date is always at first time step
|
||||
auto resultAcc = RigResultAccessorFactory::createFromResultAddress( eclipseCase, 0, porosityModel, 0, resAddr );
|
||||
|
||||
std::vector<double> filteredResults;
|
||||
filteredResults.reserve( resultValues.size() );
|
||||
|
||||
@ -445,12 +462,13 @@ bool RifEclipseInputFileTools::exportKeywords( const QString& resul
|
||||
{
|
||||
size_t mainI = i / refinement.x();
|
||||
|
||||
size_t mainIndex = mainGrid->cellIndexFromIJK( mainI, mainJ, mainK );
|
||||
size_t reservoirCellIndex = mainGrid->cellIndexFromIJK( mainI, mainJ, mainK );
|
||||
|
||||
size_t resIndex = activeCells->cellResultIndex( mainIndex );
|
||||
size_t resIndex = activeCells->cellResultIndex( reservoirCellIndex );
|
||||
if ( resIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
filteredResults.push_back( resultValues[resIndex] );
|
||||
auto value = resultAcc->cellScalarGlobIdx( reservoirCellIndex );
|
||||
filteredResults.push_back( value );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user