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
@ -408,37 +408,33 @@ QList<caf::PdmOptionItemInfo> RicExportEclipseSectorModelUi::calculateValueOptio
|
|||||||
QList<caf::PdmOptionItemInfo> options;
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
if ( fieldNeedingOptions == &selectedKeywords )
|
if ( fieldNeedingOptions == &selectedKeywords )
|
||||||
{
|
{
|
||||||
RigCaseCellResultsData* resultData = m_caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
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();
|
std::set<QString> mainKeywords = RicExportEclipseSectorModelUi::mainKeywords();
|
||||||
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
||||||
{
|
{
|
||||||
if ( mainKeywords.count( option.optionUiText() ) )
|
if ( mainKeywords.count( option.optionUiText() ) )
|
||||||
{
|
{
|
||||||
if ( resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, option.optionUiText() ) ) )
|
options.push_back( option );
|
||||||
{
|
|
||||||
options.push_back( option );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
||||||
{
|
{
|
||||||
if ( !mainKeywords.count( option.optionUiText() ) && option.optionUiText() != "None" )
|
if ( !mainKeywords.count( option.optionUiText() ) && option.optionUiText() != "None" )
|
||||||
{
|
{
|
||||||
if ( resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, option.optionUiText() ) ) )
|
options.push_back( option );
|
||||||
{
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "RigEclipseResultAddress.h"
|
#include "RigEclipseResultAddress.h"
|
||||||
#include "RigFault.h"
|
#include "RigFault.h"
|
||||||
#include "RigMainGrid.h"
|
#include "RigMainGrid.h"
|
||||||
|
#include "RigResultAccessorFactory.h"
|
||||||
|
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
|
|
||||||
@ -411,19 +412,30 @@ bool RifEclipseInputFileTools::exportKeywords( const QString& resul
|
|||||||
|
|
||||||
caf::ProgressInfo progress( keywords.size(), "Saving Keywords" );
|
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 )
|
for ( const QString& keyword : keywords )
|
||||||
{
|
{
|
||||||
std::vector<double> resultValues;
|
RigEclipseResultAddress resAddr = findResultAddress( keyword );
|
||||||
|
|
||||||
RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::STATIC_NATIVE, keyword );
|
|
||||||
if ( !cellResultsData->hasResultEntry( resAddr ) ) continue;
|
if ( !cellResultsData->hasResultEntry( resAddr ) ) continue;
|
||||||
|
|
||||||
cellResultsData->ensureKnownResultLoaded( resAddr );
|
cellResultsData->ensureKnownResultLoaded( resAddr );
|
||||||
|
|
||||||
CVF_ASSERT( !cellResultsData->cellScalarResults( resAddr ).empty() );
|
CVF_ASSERT( !cellResultsData->cellScalarResults( resAddr ).empty() );
|
||||||
|
|
||||||
resultValues = cellResultsData->cellScalarResults( resAddr )[0];
|
std::vector<double> resultValues = cellResultsData->cellScalarResults( resAddr )[0];
|
||||||
CVF_ASSERT( !resultValues.empty() );
|
|
||||||
if ( resultValues.empty() ) continue;
|
if ( resultValues.empty() ) continue;
|
||||||
|
|
||||||
double defaultExportValue = 0.0;
|
double defaultExportValue = 0.0;
|
||||||
@ -432,6 +444,11 @@ bool RifEclipseInputFileTools::exportKeywords( const QString& resul
|
|||||||
defaultExportValue = 1.0;
|
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;
|
std::vector<double> filteredResults;
|
||||||
filteredResults.reserve( resultValues.size() );
|
filteredResults.reserve( resultValues.size() );
|
||||||
|
|
||||||
@ -445,12 +462,13 @@ bool RifEclipseInputFileTools::exportKeywords( const QString& resul
|
|||||||
{
|
{
|
||||||
size_t mainI = i / refinement.x();
|
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 )
|
if ( resIndex != cvf::UNDEFINED_SIZE_T )
|
||||||
{
|
{
|
||||||
filteredResults.push_back( resultValues[resIndex] );
|
auto value = resultAcc->cellScalarGlobIdx( reservoirCellIndex );
|
||||||
|
filteredResults.push_back( value );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user