mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-25 07:08:45 -06:00
The destructor called updateReferringCurveSets(), which runs loadDataAndUpdate() on every referring curve set. At that point the summary cases are already deleted, so reloading the curve data has nothing to read. The reload also syncs UI fields, reloads the curve filters, rebuilds the address list, recomputes statistics over an empty case set and updates three legends, and it calls updateAll() on the parent plot once per curve set instead of once per plot. Add clearReferringCurveSets(), which deletes the ensemble and statistics curves directly and updates each affected plot once. For an ensemble with many realizations spread over several curve sets in the same plot this removes most of the work done while deleting. Query the referring objects as RimEnsembleCurveSet instead of walking all referring objects and casting. The previous loop discarded everything that was not a curve set, so the behavior is unchanged.
185 lines
7.6 KiB
C++
185 lines
7.6 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2016- Statoil ASA
|
|
//
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include "RiaDefines.h"
|
|
#include "Summary/RiaSummaryDefines.h"
|
|
|
|
#include "RifEclipseSummaryAddress.h"
|
|
|
|
#include "RigEnsembleParameter.h"
|
|
|
|
#include "cafPdmChildArrayField.h"
|
|
#include "cafPdmChildField.h"
|
|
#include "cafPdmField.h"
|
|
#include "cafPdmObject.h"
|
|
#include "cafPdmProxyValueField.h"
|
|
|
|
#include <QString>
|
|
|
|
#include <memory>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
class RimSummaryCase;
|
|
class RimSummaryAddressCollection;
|
|
class RiaSummaryAddressAnalyzer;
|
|
class RimSummaryEnsembleParameterCollection;
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RimSummaryEnsemble : public caf::PdmObject
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
caf::Signal<> caseNameChanged;
|
|
caf::Signal<RimSummaryCase*> caseRemoved;
|
|
|
|
public:
|
|
RimSummaryEnsemble();
|
|
~RimSummaryEnsemble() override;
|
|
|
|
void removeCase( RimSummaryCase* summaryCase, bool notifyChange = true );
|
|
void addCase( RimSummaryCase* summaryCase, bool notifyChange = true );
|
|
void replaceCases( const std::vector<RimSummaryCase*>& summaryCases, bool notifyChange = true );
|
|
|
|
virtual void reloadCases();
|
|
|
|
virtual std::vector<RimSummaryCase*> allSummaryCases() const;
|
|
RimSummaryCase* firstSummaryCase() const;
|
|
|
|
QString name() const;
|
|
|
|
void setNameTemplate( const QString& name );
|
|
virtual void updateName( const std::set<QString>& existingEnsembleNames );
|
|
void setUsePathKey1( bool useKey1 );
|
|
void setUsePathKey2( bool useKey2 );
|
|
virtual std::pair<std::string, std::string> nameKeys() const;
|
|
virtual QString nameTemplateText() const;
|
|
|
|
void setGroupingMode( RiaDefines::EnsembleGroupingMode groupingMode );
|
|
RiaDefines::EnsembleGroupingMode groupingMode() const;
|
|
|
|
bool isEnsemble() const;
|
|
void setAsEnsemble( bool isEnsemble );
|
|
virtual std::set<RifEclipseSummaryAddress> ensembleSummaryAddresses() const;
|
|
virtual std::set<time_t> ensembleTimeSteps() const;
|
|
|
|
void setEnsembleId( int ensembleId );
|
|
int ensembleId() const;
|
|
bool hasEnsembleParameters() const;
|
|
|
|
std::vector<RigEnsembleParameter> variationSortedEnsembleParameters( bool excludeNoVariation = false ) const;
|
|
std::vector<std::pair<RigEnsembleParameter, double>> correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address ) const;
|
|
std::vector<std::pair<RigEnsembleParameter, double>> correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address,
|
|
time_t selectedTimeStep ) const;
|
|
std::vector<std::pair<RigEnsembleParameter, double>> parameterCorrelations( const RifEclipseSummaryAddress& address,
|
|
time_t selectedTimeStep,
|
|
const std::vector<QString>& selectedParameters = {},
|
|
const std::set<RimSummaryCase*>& selectedCases = {} ) const;
|
|
|
|
std::vector<std::pair<RigEnsembleParameter, double>>
|
|
parameterCorrelationsAllTimeSteps( const RifEclipseSummaryAddress& address, const std::vector<QString>& selectedParameters = {} ) const;
|
|
|
|
RigEnsembleParameter ensembleParameter( const QString& paramName ) const;
|
|
void calculateEnsembleParametersIntersectionHash();
|
|
|
|
void loadDataAndUpdate();
|
|
|
|
static bool validateEnsembleCases( const std::vector<RimSummaryCase*> cases );
|
|
bool operator<( const RimSummaryEnsemble& rhs ) const;
|
|
|
|
RiaDefines::EclipseUnitSystem unitSystem() const;
|
|
|
|
void onCalculationUpdated();
|
|
|
|
void updateReferringCurveSets();
|
|
void updateReferringCurveSetsZoomAll();
|
|
void clearReferringCurveSets();
|
|
|
|
RiaSummaryAddressAnalyzer* addressAnalyzer();
|
|
|
|
void computeMinMax( const RifEclipseSummaryAddress& address );
|
|
void setMinMax( const RifEclipseSummaryAddress& address, double min, double max );
|
|
std::pair<double, double> minMax( const RifEclipseSummaryAddress& address );
|
|
|
|
virtual void cleanupBeforeDelete();
|
|
|
|
bool includeInAutoReload() const;
|
|
|
|
protected:
|
|
virtual void onLoadDataAndUpdate();
|
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
void buildMetaData();
|
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
|
|
|
bool isAutoNameChecked() const;
|
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
|
void initAfterRead() override;
|
|
void buildChildNodes();
|
|
|
|
private:
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
|
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
|
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
|
|
|
QString nameAndItemCount() const;
|
|
void updateIcon();
|
|
|
|
void updateReferringCurveSets( bool doZoomAll );
|
|
|
|
void onCaseNameChanged( const SignalEmitter* emitter );
|
|
|
|
void clearChildNodes();
|
|
|
|
QString ensembleDescription() const;
|
|
|
|
protected:
|
|
caf::PdmChildArrayField<RimSummaryCase*> m_cases;
|
|
caf::PdmField<QString> m_name;
|
|
caf::PdmField<bool> m_includeInAutoReload;
|
|
|
|
private:
|
|
caf::PdmField<QString> m_nameTemplateString;
|
|
caf::PdmField<bool> m_autoName;
|
|
caf::PdmField<bool> m_useKey1;
|
|
caf::PdmField<bool> m_useKey2;
|
|
caf::PdmProxyValueField<QString> m_ensembleDescription;
|
|
|
|
caf::PdmField<caf::AppEnum<RiaDefines::EnsembleGroupingMode>> m_groupingMode;
|
|
|
|
caf::PdmProxyValueField<QString> m_nameAndItemCount;
|
|
caf::PdmField<bool> m_isEnsemble;
|
|
caf::PdmChildField<RimSummaryAddressCollection*> m_dataVectorFolders;
|
|
|
|
caf::PdmChildField<RimSummaryEnsembleParameterCollection*> m_ensembleParameters;
|
|
|
|
caf::PdmField<int> m_ensembleId;
|
|
|
|
mutable std::vector<RigEnsembleParameter> m_cachedSortedEnsembleParameters;
|
|
std::unique_ptr<RiaSummaryAddressAnalyzer> m_analyzer;
|
|
|
|
std::map<RifEclipseSummaryAddress, std::pair<double, double>> m_minMaxValues;
|
|
};
|