mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-06 06:03:23 -06:00
Add multiple selected cell edge results
This commit is contained in:
parent
f82c530966
commit
c31bc3e50e
@ -190,33 +190,40 @@ bool RicCreateEnsembleWellLogUi::autoCreateEnsembleWellLogs() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<QString, RiaDefines::ResultCatType>> RicCreateEnsembleWellLogUi::properties() const
|
||||
std::vector<std::pair<QString, RiaDefines::ResultCatType>>
|
||||
RicCreateEnsembleWellLogUi::properties( const std::vector<QString>& resultNames,
|
||||
const std::vector<RiaDefines::ResultCatType>& resultCategories,
|
||||
const RigEclipseCaseData* caseData )
|
||||
{
|
||||
std::vector<QString> selectedKeyWords = m_selectedKeywords();
|
||||
|
||||
auto findResultCategory = []( const QString& keyword,
|
||||
const std::vector<RiaDefines::ResultCatType>& categories,
|
||||
RigEclipseCaseData* caseData ) {
|
||||
const RigEclipseCaseData* caseData ) {
|
||||
// Find the result category for a given keyword
|
||||
RigCaseCellResultsData* resultData = caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
auto resultData = caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
for ( auto category : categories )
|
||||
if ( resultData->hasResultEntry( RigEclipseResultAddress( category, keyword ) ) ) return category;
|
||||
|
||||
return RiaDefines::ResultCatType::UNDEFINED;
|
||||
};
|
||||
|
||||
std::vector<RiaDefines::ResultCatType> resultCategories = validResultCategories();
|
||||
|
||||
std::vector<std::pair<QString, RiaDefines::ResultCatType>> props;
|
||||
for ( auto keyword : selectedKeyWords )
|
||||
for ( auto keyword : resultNames )
|
||||
{
|
||||
auto resultCategory = findResultCategory( keyword, resultCategories, m_caseData );
|
||||
auto resultCategory = findResultCategory( keyword, resultCategories, caseData );
|
||||
props.push_back( std::make_pair( keyword, resultCategory ) );
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<QString, RiaDefines::ResultCatType>> RicCreateEnsembleWellLogUi::properties() const
|
||||
{
|
||||
return properties( m_selectedKeywords.value(), validResultCategories(), m_caseData );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,6 +61,11 @@ public:
|
||||
|
||||
std::vector<std::pair<QString, RiaDefines::ResultCatType>> properties() const;
|
||||
|
||||
static std::vector<std::pair<QString, RiaDefines::ResultCatType>>
|
||||
properties( const std::vector<QString>& resultNames,
|
||||
const std::vector<RiaDefines::ResultCatType>& resultCategories,
|
||||
const RigEclipseCaseData* caseData );
|
||||
|
||||
void setCaseData( RigEclipseCaseData* caseData );
|
||||
|
||||
protected:
|
||||
|
@ -316,47 +316,29 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
|
||||
{
|
||||
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
|
||||
|
||||
if ( cellEdgeResultColors->propertyType() == RimCellEdgeColors::ANY_SINGLE_PROPERTY )
|
||||
auto resultAddresses = cellEdgeResultColors->resultAddresses();
|
||||
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
cellEdgeResultColors->cellEdgeMetaData( &metaData );
|
||||
|
||||
size_t cubeFaceIdx;
|
||||
for ( cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++ )
|
||||
{
|
||||
cvf::ref<RigResultAccessor> daObj =
|
||||
RivCellEdgeGeometryUtils::createCellCenterResultAccessor( cellEdgeResultColors->singleVarEdgeResultColors(),
|
||||
timeStepIndex,
|
||||
eclipseCase,
|
||||
grid );
|
||||
|
||||
for ( size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++ )
|
||||
size_t adjustedTimeStep = timeStepIndex;
|
||||
if ( metaData[cubeFaceIdx].m_isStatic )
|
||||
{
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace( static_cast<cvf::StructGridInterface::FaceType>( cubeFaceIdx ),
|
||||
daObj.p() );
|
||||
adjustedTimeStep = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RigEclipseResultAddress resultAddresses[6];
|
||||
cellEdgeResultColors->gridScalarIndices( resultAddresses );
|
||||
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
cellEdgeResultColors->cellEdgeMetaData( &metaData );
|
||||
|
||||
size_t cubeFaceIdx;
|
||||
for ( cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++ )
|
||||
{
|
||||
size_t adjustedTimeStep = timeStepIndex;
|
||||
if ( metaData[cubeFaceIdx].m_isStatic )
|
||||
{
|
||||
adjustedTimeStep = 0;
|
||||
}
|
||||
|
||||
RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel();
|
||||
cvf::ref<RigResultAccessor> daObj =
|
||||
RigResultAccessorFactory::createFromResultAddress( eclipseCase,
|
||||
grid->gridIndex(),
|
||||
porosityModel,
|
||||
adjustedTimeStep,
|
||||
resultAddresses[cubeFaceIdx] );
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace( static_cast<cvf::StructGridInterface::FaceType>( cubeFaceIdx ),
|
||||
daObj.p() );
|
||||
}
|
||||
RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel();
|
||||
cvf::ref<RigResultAccessor> daObj =
|
||||
RigResultAccessorFactory::createFromResultAddress( eclipseCase,
|
||||
grid->gridIndex(),
|
||||
porosityModel,
|
||||
adjustedTimeStep,
|
||||
resultAddresses[cubeFaceIdx] );
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace( static_cast<cvf::StructGridInterface::FaceType>( cubeFaceIdx ),
|
||||
daObj.p() );
|
||||
}
|
||||
|
||||
return cellEdgeResultAccessor;
|
||||
|
@ -20,9 +20,12 @@
|
||||
|
||||
#include "RimCellEdgeColors.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RicCreateEnsembleWellLogUi.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
@ -30,8 +33,11 @@
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include <array>
|
||||
|
||||
namespace caf
|
||||
@ -40,7 +46,8 @@ template <>
|
||||
void AppEnum<RimCellEdgeColors::PropertyType>::setUp()
|
||||
{
|
||||
addItem( RimCellEdgeColors::MULTI_AXIS_STATIC_PROPERTY, "MULTI_AXIS_STATIC_PROPERTY", "Multi Axis Static Property" );
|
||||
addItem( RimCellEdgeColors::ANY_SINGLE_PROPERTY, "ANY_SINGLE_PROPERTY", "Any Single Property" );
|
||||
QStringList aliasList = { "ANY_SINGLE_PROPERTY" };
|
||||
addItem( RimCellEdgeColors::CUSTOM_PROPERTIES, "CUSTOM_PROPERTIES", "Selected Properties", aliasList );
|
||||
setDefault( RimCellEdgeColors::MULTI_AXIS_STATIC_PROPERTY );
|
||||
}
|
||||
} // namespace caf
|
||||
@ -65,13 +72,28 @@ RimCellEdgeColors::RimCellEdgeColors()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", ":/Legend.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_singleVarEdgeResultColors, "SingleVarEdgeResult", "Result Property", ":/CellResult.png" );
|
||||
m_singleVarEdgeResultColors = new RimEclipseCellColors();
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedKeywords, "SelectedProperties", "Selected Properties" );
|
||||
m_selectedKeywords.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_showTextValuesIfItemIsUnchecked,
|
||||
"ShowTextValuesIfItemIsUnchecked",
|
||||
false,
|
||||
"Always Show Values in Result Info Window",
|
||||
"",
|
||||
"Allow display of result values in Result Info window if the Cell Edge object is unchecked in "
|
||||
"Property Editor." );
|
||||
|
||||
m_resultVariable.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
|
||||
m_legendConfig = new RimRegularLegendConfig();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_singleVarEdgeResultColors_OBSOLETE,
|
||||
"SingleVarEdgeResult",
|
||||
"Result Property",
|
||||
":/CellResult.png" );
|
||||
m_singleVarEdgeResultColors_OBSOLETE = new RimEclipseCellColors();
|
||||
m_singleVarEdgeResultColors_OBSOLETE.uiCapability()->setUiHidden( true );
|
||||
|
||||
m_ignoredResultScalar = cvf::UNDEFINED_DOUBLE;
|
||||
resetResultAddresses();
|
||||
}
|
||||
@ -89,7 +111,6 @@ RimCellEdgeColors::~RimCellEdgeColors()
|
||||
void RimCellEdgeColors::setReservoirView( RimEclipseView* ownerReservoirView )
|
||||
{
|
||||
m_reservoirView = ownerReservoirView;
|
||||
m_singleVarEdgeResultColors->setReservoirView( ownerReservoirView );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -97,24 +118,47 @@ void RimCellEdgeColors::setReservoirView( RimEclipseView* ownerReservoirView )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::loadResult()
|
||||
{
|
||||
if ( !m_enableCellEdgeColors ) return;
|
||||
if ( !m_reservoirView->currentGridCellResults() ) return;
|
||||
|
||||
if ( isUsingSingleVariable() )
|
||||
{
|
||||
m_singleVarEdgeResultColors->loadResult();
|
||||
;
|
||||
resetResultAddresses();
|
||||
|
||||
RigEclipseResultAddress resultAddr = m_singleVarEdgeResultColors->eclipseResultAddress();
|
||||
for ( int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx )
|
||||
if ( isUserDefinedPropertiesActive() )
|
||||
{
|
||||
std::vector<RiaDefines::ResultCatType> categories = { RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaDefines::ResultCatType::INPUT_PROPERTY };
|
||||
|
||||
std::vector<QString> resultNames = m_selectedKeywords();
|
||||
if ( resultNames.size() > 6 )
|
||||
{
|
||||
m_resultNameToAddressPairs[cubeFaceIdx] =
|
||||
std::make_pair( m_singleVarEdgeResultColors->resultVariable(), resultAddr );
|
||||
QString title = "Cell Edge Results";
|
||||
|
||||
QString text =
|
||||
QString( "Selected Cell Edge result property count is %1. Up to 6 results are supported, no "
|
||||
"data will be loaded.\n\nPlease select equal to or less than 6 properties to show data." )
|
||||
.arg( resultNames.size() );
|
||||
|
||||
RiaLogging::errorInMessageBox( nullptr, title, text );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
auto properties = RicCreateEnsembleWellLogUi::properties( resultNames,
|
||||
categories,
|
||||
m_reservoirView->eclipseCase()->eclipseCaseData() );
|
||||
|
||||
for ( size_t i = 0; i < properties.size(); i++ )
|
||||
{
|
||||
auto [name, category] = properties[i];
|
||||
RigEclipseResultAddress adr = RigEclipseResultAddress( category, name );
|
||||
|
||||
m_reservoirView->currentGridCellResults()->ensureKnownResultLoaded( adr );
|
||||
|
||||
m_resultNameToAddressPairs[i] = std::make_pair( name, adr );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resetResultAddresses();
|
||||
QStringList vars = findResultVariableNames();
|
||||
updateIgnoredScalarValue();
|
||||
|
||||
@ -151,8 +195,12 @@ void RimCellEdgeColors::loadResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::initAfterRead()
|
||||
{
|
||||
m_singleVarEdgeResultColors->initAfterRead();
|
||||
this->updateUiIconFromToggleField();
|
||||
|
||||
if ( m_singleVarEdgeResultColors_OBSOLETE->resultVariableUiName() != RiaResultNames::undefinedResultName() )
|
||||
{
|
||||
m_selectedKeywords.v().push_back( m_singleVarEdgeResultColors_OBSOLETE->resultVariableUiName() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -192,6 +240,8 @@ void RimCellEdgeColors::EdgeFaceEnum::setUp()
|
||||
|
||||
QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_resultVariable )
|
||||
{
|
||||
if ( m_reservoirView && m_reservoirView->currentGridCellResults() )
|
||||
@ -202,8 +252,6 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions( const ca
|
||||
// TODO: Must also handle input properties
|
||||
// varList += m_reservoirView->gridCellResults()->resultNames(RiaDefines::INPUT_PROPERTY);
|
||||
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
std::map<QString, std::array<QString, 6>> varBaseNameToVarsMap;
|
||||
|
||||
int i;
|
||||
@ -258,6 +306,41 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions( const ca
|
||||
}
|
||||
}
|
||||
|
||||
if ( fieldNeedingOptions == &m_selectedKeywords )
|
||||
{
|
||||
RigCaseCellResultsData* resultData = m_reservoirView->currentGridCellResults();
|
||||
|
||||
std::vector<RiaDefines::ResultCatType> resultCategories = { RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaDefines::ResultCatType::INPUT_PROPERTY };
|
||||
|
||||
for ( auto catType : resultCategories )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> allOptions =
|
||||
RimEclipseResultDefinition::calcOptionsForVariableUiFieldStandard( catType, resultData );
|
||||
|
||||
bool isFirstOfCategory = true;
|
||||
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
||||
{
|
||||
if ( resultData->hasResultEntry( RigEclipseResultAddress( catType, option.optionUiText() ) ) )
|
||||
{
|
||||
if ( isFirstOfCategory )
|
||||
{
|
||||
// Add the category title only when there is at least one valid result
|
||||
options.push_back(
|
||||
caf::PdmOptionItemInfo::createHeader( caf::AppEnum<RiaDefines::ResultCatType>::uiText( catType ),
|
||||
true ) );
|
||||
isFirstOfCategory = false;
|
||||
}
|
||||
|
||||
options.push_back( option );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
return QList<caf::PdmOptionItemInfo>();
|
||||
}
|
||||
|
||||
@ -266,11 +349,12 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions( const ca
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_showTextValuesIfItemIsUnchecked );
|
||||
uiOrdering.add( &m_propertyType );
|
||||
|
||||
if ( isUsingSingleVariable() )
|
||||
if ( isUserDefinedPropertiesActive() )
|
||||
{
|
||||
m_singleVarEdgeResultColors->uiOrdering( uiConfigName, uiOrdering );
|
||||
uiOrdering.add( &m_selectedKeywords );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -323,13 +407,15 @@ QStringList RimCellEdgeColors::findResultVariableNames()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::gridScalarIndices( RigEclipseResultAddress resultIndices[6] )
|
||||
std::array<RigEclipseResultAddress, 6> RimCellEdgeColors::resultAddresses() const
|
||||
{
|
||||
int cubeFaceIndex;
|
||||
for ( cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex )
|
||||
std::array<RigEclipseResultAddress, 6> adr;
|
||||
for ( int cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex )
|
||||
{
|
||||
resultIndices[cubeFaceIndex] = RigEclipseResultAddress( m_resultNameToAddressPairs[cubeFaceIndex].second );
|
||||
adr[cubeFaceIndex] = RigEclipseResultAddress( m_resultNameToAddressPairs[cubeFaceIndex].second );
|
||||
}
|
||||
|
||||
return adr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -349,9 +435,9 @@ void RimCellEdgeColors::gridScalarResultNames( std::vector<QString>* resultNames
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellEdgeColors::isUsingSingleVariable() const
|
||||
bool RimCellEdgeColors::isUserDefinedPropertiesActive() const
|
||||
{
|
||||
return ( m_propertyType == ANY_SINGLE_PROPERTY );
|
||||
return ( m_propertyType == CUSTOM_PROPERTIES );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -361,22 +447,22 @@ void RimCellEdgeColors::cellEdgeMetaData( std::vector<RimCellEdgeMetaData>* meta
|
||||
{
|
||||
CVF_ASSERT( metaDataVector );
|
||||
|
||||
RigEclipseResultAddress resultIndices[6];
|
||||
this->gridScalarIndices( resultIndices );
|
||||
auto addresses = this->resultAddresses();
|
||||
|
||||
std::vector<QString> resultNames;
|
||||
this->gridScalarResultNames( &resultNames );
|
||||
|
||||
bool isStatic = true;
|
||||
if ( isUsingSingleVariable() )
|
||||
{
|
||||
isStatic = m_singleVarEdgeResultColors->resultType() == RiaDefines::ResultCatType::STATIC_NATIVE;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < 6; i++ )
|
||||
{
|
||||
if ( isUserDefinedPropertiesActive() )
|
||||
{
|
||||
isStatic = addresses[i].resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE;
|
||||
}
|
||||
|
||||
RimCellEdgeMetaData metaData;
|
||||
metaData.m_eclipseResultAddress = resultIndices[i];
|
||||
metaData.m_eclipseResultAddress = addresses[i];
|
||||
metaData.m_resultVariable = resultNames[i];
|
||||
metaData.m_isStatic = isStatic;
|
||||
|
||||
@ -403,7 +489,17 @@ bool RimCellEdgeColors::hasResult() const
|
||||
{
|
||||
if ( !m_enableCellEdgeColors() ) return false;
|
||||
|
||||
if ( isUsingSingleVariable() && m_singleVarEdgeResultColors->isFlowDiagOrInjectionFlooding() )
|
||||
return showTextResult();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellEdgeColors::showTextResult() const
|
||||
{
|
||||
if ( !m_enableCellEdgeColors && !m_showTextValuesIfItemIsUnchecked ) return false;
|
||||
|
||||
if ( isUserDefinedPropertiesActive() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -444,32 +540,19 @@ void RimCellEdgeColors::minMaxCellEdgeValues( double& min, double& max )
|
||||
|
||||
if ( m_reservoirView->currentGridCellResults() )
|
||||
{
|
||||
if ( isUsingSingleVariable() && singleVarEdgeResultColors()->isFlowDiagOrInjectionFlooding() )
|
||||
auto resultAddresses = this->resultAddresses();
|
||||
|
||||
size_t faceIdx;
|
||||
for ( faceIdx = 0; faceIdx < 6; faceIdx++ )
|
||||
{
|
||||
int currentTimeStep = m_reservoirView->currentTimeStep();
|
||||
if ( !resultAddresses[faceIdx].isValid() ) continue;
|
||||
|
||||
RigFlowDiagResults* fldResults = singleVarEdgeResultColors()->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = singleVarEdgeResultColors()->flowDiagResAddress();
|
||||
|
||||
fldResults->minMaxScalarValues( resAddr, currentTimeStep, &globalMin, &globalMax );
|
||||
}
|
||||
else
|
||||
{
|
||||
RigEclipseResultAddress resultAddresses[6];
|
||||
this->gridScalarIndices( resultAddresses );
|
||||
|
||||
size_t faceIdx;
|
||||
for ( faceIdx = 0; faceIdx < 6; faceIdx++ )
|
||||
{
|
||||
if ( !resultAddresses[faceIdx].isValid() ) continue;
|
||||
double cMin, cMax;
|
||||
m_reservoirView->currentGridCellResults()->minMaxCellScalarValues( resultAddresses[faceIdx], cMin, cMax );
|
||||
|
||||
{
|
||||
double cMin, cMax;
|
||||
m_reservoirView->currentGridCellResults()->minMaxCellScalarValues( resultAddresses[faceIdx], cMin, cMax );
|
||||
|
||||
globalMin = std::min( globalMin, cMin );
|
||||
globalMax = std::max( globalMax, cMax );
|
||||
}
|
||||
globalMin = std::min( globalMin, cMin );
|
||||
globalMax = std::max( globalMax, cMax );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -486,8 +569,7 @@ void RimCellEdgeColors::posNegClosestToZero( double& pos, double& neg )
|
||||
pos = HUGE_VAL;
|
||||
neg = -HUGE_VAL;
|
||||
|
||||
RigEclipseResultAddress resultAddresses[6];
|
||||
this->gridScalarIndices( resultAddresses );
|
||||
auto resultAddresses = this->resultAddresses();
|
||||
|
||||
size_t faceIdx;
|
||||
for ( faceIdx = 0; faceIdx < 6; faceIdx++ )
|
||||
@ -504,22 +586,6 @@ void RimCellEdgeColors::posNegClosestToZero( double& pos, double& neg )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::updateUiFieldsFromActiveResult()
|
||||
{
|
||||
m_singleVarEdgeResultColors->updateUiFieldsFromActiveResult();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::setEclipseCase( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
m_singleVarEdgeResultColors->setEclipseCase( eclipseCase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -528,49 +594,21 @@ void RimCellEdgeColors::setResultVariable( const QString& variableName )
|
||||
m_resultVariable = variableName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellEdgeColors::resultVariable() const
|
||||
{
|
||||
if ( isUsingSingleVariable() )
|
||||
{
|
||||
return m_singleVarEdgeResultColors->resultVariable();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_resultVariable;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellEdgeColors::resultVariableUiName() const
|
||||
{
|
||||
if ( isUsingSingleVariable() )
|
||||
{
|
||||
return m_singleVarEdgeResultColors->resultVariableUiName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_resultVariable;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellEdgeColors::resultVariableUiShortName() const
|
||||
{
|
||||
if ( isUsingSingleVariable() )
|
||||
if ( isUserDefinedPropertiesActive() )
|
||||
{
|
||||
return m_singleVarEdgeResultColors->resultVariableUiShortName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_resultVariable;
|
||||
if ( m_selectedKeywords().empty() ) return "";
|
||||
|
||||
if ( m_selectedKeywords().size() == 1 ) return m_selectedKeywords().front();
|
||||
|
||||
return "Multiple Properties";
|
||||
}
|
||||
|
||||
return m_resultVariable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -589,35 +627,12 @@ caf::PdmFieldHandle* RimCellEdgeColors::objectToggleField()
|
||||
return &m_enableCellEdgeColors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellEdgeColors::hasCategoryResult() const
|
||||
{
|
||||
return isUsingSingleVariable() && m_singleVarEdgeResultColors->hasCategoryResult();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCellColors* RimCellEdgeColors::singleVarEdgeResultColors()
|
||||
{
|
||||
return m_singleVarEdgeResultColors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimRegularLegendConfig* RimCellEdgeColors::legendConfig()
|
||||
{
|
||||
if ( isUsingSingleVariable() )
|
||||
{
|
||||
return m_singleVarEdgeResultColors->legendConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_legendConfig;
|
||||
}
|
||||
return m_legendConfig();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -68,39 +68,33 @@ public:
|
||||
enum PropertyType
|
||||
{
|
||||
MULTI_AXIS_STATIC_PROPERTY,
|
||||
ANY_SINGLE_PROPERTY
|
||||
CUSTOM_PROPERTIES
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<RimCellEdgeColors::EdgeFaceType> EdgeFaceEnum;
|
||||
|
||||
void setReservoirView( RimEclipseView* ownerReservoirView );
|
||||
void setEclipseCase( RimEclipseCase* eclipseCase );
|
||||
|
||||
void setResultVariable( const QString& variableName );
|
||||
QString resultVariable() const;
|
||||
QString resultVariableUiName() const;
|
||||
QString resultVariableUiShortName() const;
|
||||
|
||||
void setActive( bool active );
|
||||
|
||||
double ignoredScalarValue() { return m_ignoredResultScalar; }
|
||||
void gridScalarIndices( RigEclipseResultAddress resultIndices[6] );
|
||||
void cellEdgeMetaData( std::vector<RimCellEdgeMetaData>* metaData );
|
||||
double ignoredScalarValue() { return m_ignoredResultScalar; }
|
||||
std::array<RigEclipseResultAddress, 6> resultAddresses() const;
|
||||
void cellEdgeMetaData( std::vector<RimCellEdgeMetaData>* metaData );
|
||||
|
||||
void loadResult();
|
||||
bool hasResult() const;
|
||||
bool hasCategoryResult() const;
|
||||
bool isUsingSingleVariable() const;
|
||||
bool showTextResult() const;
|
||||
bool isUserDefinedPropertiesActive() const;
|
||||
|
||||
RimEclipseCellColors* singleVarEdgeResultColors();
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
PropertyType propertyType() const;
|
||||
|
||||
void minMaxCellEdgeValues( double& min, double& max );
|
||||
void posNegClosestToZero( double& pos, double& neg );
|
||||
|
||||
void updateUiFieldsFromActiveResult();
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
@ -130,5 +124,9 @@ private:
|
||||
|
||||
caf::PdmField<caf::AppEnum<PropertyType>> m_propertyType;
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
||||
caf::PdmChildField<RimEclipseCellColors*> m_singleVarEdgeResultColors;
|
||||
caf::PdmField<std::vector<QString>> m_selectedKeywords;
|
||||
caf::PdmField<bool> m_showTextValuesIfItemIsUnchecked;
|
||||
|
||||
// Obsolete fields
|
||||
caf::PdmChildField<RimEclipseCellColors*> m_singleVarEdgeResultColors_OBSOLETE;
|
||||
};
|
||||
|
@ -609,7 +609,6 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
|
||||
this->firstAncestorOrThisOfType( cellEdgeColors );
|
||||
if ( cellEdgeColors )
|
||||
{
|
||||
cellEdgeColors->singleVarEdgeResultColors()->updateLegendCategorySettings();
|
||||
cellEdgeColors->loadResult();
|
||||
|
||||
if ( view )
|
||||
|
@ -1400,11 +1400,6 @@ void RimEclipseView::onUpdateLegends()
|
||||
{
|
||||
if ( this->cellEdgeResult()->hasResult() )
|
||||
{
|
||||
if ( this->cellEdgeResult()->isUsingSingleVariable() )
|
||||
{
|
||||
this->cellEdgeResult()->singleVarEdgeResultColors()->updateRangesForEmbeddedLegends( m_currentTimeStep );
|
||||
}
|
||||
else
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
@ -1416,21 +1411,6 @@ void RimEclipseView::onUpdateLegends()
|
||||
globalPosClosestToZero,
|
||||
globalNegClosestToZero );
|
||||
this->cellEdgeResult()->legendConfig()->setAutomaticRanges( globalMin, globalMax, globalMin, globalMax );
|
||||
|
||||
if ( this->cellEdgeResult()->hasCategoryResult() )
|
||||
{
|
||||
if ( cellEdgeResult()->singleVarEdgeResultColors()->resultType() !=
|
||||
RiaDefines::ResultCatType::FORMATION_NAMES )
|
||||
{
|
||||
cellEdgeResult()->legendConfig()->setIntegerCategories( results->uniqueCellScalarValues(
|
||||
cellEdgeResult()->singleVarEdgeResultColors()->eclipseResultAddress() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString> fnVector = eclipseCase->formationNames();
|
||||
cellEdgeResult()->legendConfig()->setNamedCategories( fnVector );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->cellEdgeResult()->legendConfig()->setTitle( QString( "Edge Results: \n" ) +
|
||||
@ -1557,7 +1537,6 @@ void RimEclipseView::setEclipseCase( RimEclipseCase* reservoir )
|
||||
faultResultSettings()->customFaultResult()->setEclipseCase( reservoir );
|
||||
cellFilterCollection()->setCase( reservoir );
|
||||
m_streamlineCollection->setEclipseCase( reservoir );
|
||||
cellEdgeResult()->setEclipseCase( reservoir );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -1703,13 +1703,6 @@ void RiuMainWindow::updateUiFieldsFromActiveResult( caf::PdmObjectHandle* object
|
||||
{
|
||||
eclFaultColors->updateUiFieldsFromActiveResult();
|
||||
}
|
||||
|
||||
RimCellEdgeColors* cellEdgeColors = nullptr;
|
||||
cellEdgeColors = dynamic_cast<RimCellEdgeColors*>( objectToUpdate );
|
||||
if ( cellEdgeColors )
|
||||
{
|
||||
cellEdgeColors->updateUiFieldsFromActiveResult();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -732,49 +732,43 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
|
||||
{
|
||||
QString text;
|
||||
|
||||
if ( m_viewWithFaultsSettings && m_viewWithFaultsSettings->cellEdgeResult()->hasResult() )
|
||||
if ( m_viewWithFaultsSettings && m_viewWithFaultsSettings->cellEdgeResult()->showTextResult() )
|
||||
{
|
||||
m_viewWithFaultsSettings->cellEdgeResult()->loadResult();
|
||||
|
||||
text += "-- Cell edge result data --\n";
|
||||
|
||||
if ( m_viewWithFaultsSettings->cellEdgeResult()->isUsingSingleVariable() )
|
||||
{
|
||||
text += cellResultText( m_viewWithFaultsSettings->cellEdgeResult()->singleVarEdgeResultColors() );
|
||||
text += "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
m_viewWithFaultsSettings->cellEdgeResult()->cellEdgeMetaData( &metaData );
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
m_viewWithFaultsSettings->cellEdgeResult()->cellEdgeMetaData( &metaData );
|
||||
|
||||
std::set<RigEclipseResultAddress> uniqueResultIndices;
|
||||
std::set<RigEclipseResultAddress> uniqueResultAddresses;
|
||||
|
||||
for ( int idx = 0; idx < 6; idx++ )
|
||||
for ( int idx = 0; idx < 6; idx++ )
|
||||
{
|
||||
RigEclipseResultAddress resultAddr = metaData[idx].m_eclipseResultAddress;
|
||||
if ( !resultAddr.isValid() ) continue;
|
||||
|
||||
if ( uniqueResultAddresses.find( resultAddr ) != uniqueResultAddresses.end() ) continue;
|
||||
|
||||
size_t adjustedTimeStep = m_timeStepIndex;
|
||||
if ( metaData[idx].m_isStatic )
|
||||
{
|
||||
RigEclipseResultAddress resultAddr = metaData[idx].m_eclipseResultAddress;
|
||||
if ( !resultAddr.isValid() ) continue;
|
||||
adjustedTimeStep = 0;
|
||||
}
|
||||
|
||||
if ( uniqueResultIndices.find( resultAddr ) != uniqueResultIndices.end() ) continue;
|
||||
RiaDefines::PorosityModelType porosityModel = m_eclResDef->porosityModel();
|
||||
cvf::ref<RigResultAccessor> resultAccessor =
|
||||
RigResultAccessorFactory::createFromResultAddress( m_eclResDef->eclipseCase()->eclipseCaseData(),
|
||||
m_gridIndex,
|
||||
porosityModel,
|
||||
adjustedTimeStep,
|
||||
resultAddr );
|
||||
if ( resultAccessor.notNull() )
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar( m_cellIndex );
|
||||
text.append( QString( "%1 : %2\n" ).arg( metaData[idx].m_resultVariable ).arg( scalarValue ) );
|
||||
|
||||
size_t adjustedTimeStep = m_timeStepIndex;
|
||||
if ( metaData[idx].m_isStatic )
|
||||
{
|
||||
adjustedTimeStep = 0;
|
||||
}
|
||||
|
||||
RiaDefines::PorosityModelType porosityModel = m_eclResDef->porosityModel();
|
||||
cvf::ref<RigResultAccessor> resultAccessor =
|
||||
RigResultAccessorFactory::createFromResultAddress( m_eclResDef->eclipseCase()->eclipseCaseData(),
|
||||
m_gridIndex,
|
||||
porosityModel,
|
||||
adjustedTimeStep,
|
||||
resultAddr );
|
||||
if ( resultAccessor.notNull() )
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar( m_cellIndex );
|
||||
text.append( QString( "%1 : %2\n" ).arg( metaData[idx].m_resultVariable ).arg( scalarValue ) );
|
||||
|
||||
uniqueResultIndices.insert( resultAddr );
|
||||
}
|
||||
uniqueResultAddresses.insert( resultAddr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user