mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9624 Add alphabetical and by value sorting
This commit is contained in:
parent
28b3f16db1
commit
752363a4b8
@ -260,7 +260,7 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveFilter::calculateValueOptions( con
|
|||||||
auto curveSet = parentCurveSet();
|
auto curveSet = parentCurveSet();
|
||||||
if ( curveSet )
|
if ( curveSet )
|
||||||
{
|
{
|
||||||
auto params = curveSet->correlationSortedEnsembleParameters();
|
auto params = curveSet->ensembleParameters( RimEnsembleCurveSet::ParameterSorting::ABSOLUTE_VALUE );
|
||||||
for ( const auto& [param, corr] : params )
|
for ( const auto& [param, corr] : params )
|
||||||
{
|
{
|
||||||
options.push_back(
|
options.push_back(
|
||||||
@ -657,7 +657,7 @@ void RimEnsembleCurveFilter::updateMaxMinAndDefaultValues( bool forceDefault )
|
|||||||
{
|
{
|
||||||
if ( !selectedEnsembleParameter().isValid() )
|
if ( !selectedEnsembleParameter().isValid() )
|
||||||
{
|
{
|
||||||
auto ensParams = parentCurveSet()->correlationSortedEnsembleParameters();
|
auto ensParams = parentCurveSet()->ensembleParameters( RimEnsembleCurveSet::ParameterSorting::ABSOLUTE_VALUE );
|
||||||
if ( !ensParams.empty() )
|
if ( !ensParams.empty() )
|
||||||
{
|
{
|
||||||
m_ensembleParameterName = ensParams.front().first.name;
|
m_ensembleParameterName = ensParams.front().first.name;
|
||||||
|
@ -74,6 +74,20 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
template <>
|
||||||
|
void AppEnum<RimEnsembleCurveSet::ParameterSorting>::setUp()
|
||||||
|
{
|
||||||
|
addItem( RimEnsembleCurveSet::ParameterSorting::ABSOLUTE_VALUE, "ABSOLUTE_VALUE", "Absolute Correlation" );
|
||||||
|
addItem( RimEnsembleCurveSet::ParameterSorting::ALPHABETICALLY, "ALPHABETICALLY", "Alphabetically" );
|
||||||
|
setDefault( RimEnsembleCurveSet::ParameterSorting::ABSOLUTE_VALUE );
|
||||||
|
}
|
||||||
|
} // namespace caf
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Internal functions
|
/// Internal functions
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -123,8 +137,10 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
|
|||||||
|
|
||||||
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color" );
|
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter" );
|
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Parameter" );
|
||||||
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_ensembleParameterSorting, "EnsembleParameterSorting", "Parameter Sorting" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector" );
|
CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector" );
|
||||||
m_objectiveValuesSummaryAddressesUiField.xmlCapability()->disableIO();
|
m_objectiveValuesSummaryAddressesUiField.xmlCapability()->disableIO();
|
||||||
@ -939,6 +955,7 @@ void RimEnsembleCurveSet::appendColorGroup( caf::PdmUiOrdering& uiOrdering )
|
|||||||
else if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
else if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
||||||
{
|
{
|
||||||
m_ensembleParameter.uiCapability()->setUiReadOnly( !m_yValuesSummaryCaseCollection() );
|
m_ensembleParameter.uiCapability()->setUiReadOnly( !m_yValuesSummaryCaseCollection() );
|
||||||
|
colorsGroup->add( &m_ensembleParameterSorting );
|
||||||
colorsGroup->add( &m_ensembleParameter );
|
colorsGroup->add( &m_ensembleParameter );
|
||||||
}
|
}
|
||||||
else if ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION || m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION )
|
else if ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION || m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION )
|
||||||
@ -1107,7 +1124,7 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
|
|||||||
}
|
}
|
||||||
else if ( fieldNeedingOptions == &m_ensembleParameter )
|
else if ( fieldNeedingOptions == &m_ensembleParameter )
|
||||||
{
|
{
|
||||||
auto params = correlationSortedEnsembleParameters();
|
auto params = ensembleParameters( m_ensembleParameterSorting() );
|
||||||
for ( const auto& paramCorrPair : params )
|
for ( const auto& paramCorrPair : params )
|
||||||
{
|
{
|
||||||
QString name = paramCorrPair.first.name;
|
QString name = paramCorrPair.first.name;
|
||||||
@ -1885,19 +1902,31 @@ std::vector<RigEnsembleParameter> RimEnsembleCurveSet::variationSortedEnsemblePa
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<std::pair<RigEnsembleParameter, double>> RimEnsembleCurveSet::correlationSortedEnsembleParameters() const
|
std::vector<std::pair<RigEnsembleParameter, double>>
|
||||||
|
RimEnsembleCurveSet::ensembleParameters( ParameterSorting sortingMode ) const
|
||||||
{
|
{
|
||||||
RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
|
||||||
if ( ensemble )
|
if ( ensemble )
|
||||||
|
{
|
||||||
|
if ( sortingMode == ParameterSorting::ABSOLUTE_VALUE )
|
||||||
{
|
{
|
||||||
return ensemble->correlationSortedEnsembleParameters( summaryAddress() );
|
return ensemble->correlationSortedEnsembleParameters( summaryAddress() );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if ( sortingMode == ParameterSorting::ALPHABETICALLY )
|
||||||
{
|
{
|
||||||
return std::vector<std::pair<RigEnsembleParameter, double>>();
|
auto parameters = ensemble->parameterCorrelationsAllTimeSteps( summaryAddress() );
|
||||||
|
std::sort( parameters.begin(), parameters.end(), []( const auto& lhs, const auto& rhs ) {
|
||||||
|
return lhs.first.name < rhs.first.name;
|
||||||
|
} );
|
||||||
|
|
||||||
|
return parameters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -81,6 +81,12 @@ public:
|
|||||||
using ColorModeEnum = RimEnsembleCurveSetColorManager::ColorModeEnum;
|
using ColorModeEnum = RimEnsembleCurveSetColorManager::ColorModeEnum;
|
||||||
using TimeStepFilterEnum = caf::AppEnum<RimTimeStepFilter::TimeStepFilterTypeEnum>;
|
using TimeStepFilterEnum = caf::AppEnum<RimTimeStepFilter::TimeStepFilterTypeEnum>;
|
||||||
|
|
||||||
|
enum class ParameterSorting
|
||||||
|
{
|
||||||
|
ABSOLUTE_VALUE,
|
||||||
|
ALPHABETICALLY
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RimEnsembleCurveSet();
|
RimEnsembleCurveSet();
|
||||||
~RimEnsembleCurveSet() override;
|
~RimEnsembleCurveSet() override;
|
||||||
@ -137,7 +143,7 @@ public:
|
|||||||
void updateAllTextInPlot();
|
void updateAllTextInPlot();
|
||||||
std::vector<RigEnsembleParameter> variationSortedEnsembleParameters() const;
|
std::vector<RigEnsembleParameter> variationSortedEnsembleParameters() const;
|
||||||
|
|
||||||
std::vector<std::pair<RigEnsembleParameter, double>> correlationSortedEnsembleParameters() const;
|
std::vector<std::pair<RigEnsembleParameter, double>> ensembleParameters( ParameterSorting sortingMode ) const;
|
||||||
|
|
||||||
std::vector<RimSummaryCase*> filterEnsembleCases( const std::vector<RimSummaryCase*>& sumCases );
|
std::vector<RimSummaryCase*> filterEnsembleCases( const std::vector<RimSummaryCase*>& sumCases );
|
||||||
void disableStatisticCurves();
|
void disableStatisticCurves();
|
||||||
@ -222,6 +228,7 @@ private:
|
|||||||
caf::PdmField<ColorModeEnum> m_colorMode;
|
caf::PdmField<ColorModeEnum> m_colorMode;
|
||||||
caf::PdmField<cvf::Color3f> m_color;
|
caf::PdmField<cvf::Color3f> m_color;
|
||||||
caf::PdmField<QString> m_ensembleParameter;
|
caf::PdmField<QString> m_ensembleParameter;
|
||||||
|
caf::PdmField<caf::AppEnum<RimEnsembleCurveSet::ParameterSorting>> m_ensembleParameterSorting;
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimSummaryAddress*> m_objectiveValuesSummaryAddresses;
|
caf::PdmChildArrayField<RimSummaryAddress*> m_objectiveValuesSummaryAddresses;
|
||||||
caf::PdmField<QString> m_objectiveValuesSummaryAddressesUiField;
|
caf::PdmField<QString> m_objectiveValuesSummaryAddressesUiField;
|
||||||
|
Loading…
Reference in New Issue
Block a user