mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
deleteSummaryCaseCollection() looped over every case in the ensemble, and for each case scanned every summary plot and called updateConnectedEditors() on every multi plot. For an ensemble with many realizations this scanned each plot once per realization, and updated the connected editors once per realization and multi plot. This showed up as a hot spot in the profiler. Replace deleteCurvesAssosiatedWithCase() with deleteCurvesAssosiatedWithCases(), which takes a set of cases and returns whether anything was deleted. Each plot is now scanned once, and the connected editors of a multi plot are updated only when that multi plot actually lost a curve. RicCloseSummaryCaseFeature and RicCloseObservedDataFeature are updated to the new signature. RicCloseSummaryCaseFeature also scans each plot once instead of once per case.
113 lines
3.9 KiB
C++
113 lines
3.9 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2017- 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 "RimSummaryPlotSourceStepping.h"
|
|
#include "Summary/RiaSummaryDefines.h"
|
|
|
|
#include "cafPdmChildArrayField.h"
|
|
#include "cafPdmChildField.h"
|
|
#include "cafPdmField.h"
|
|
#include "cafPdmObject.h"
|
|
|
|
#include <set>
|
|
|
|
class RimSummaryCase;
|
|
class RimSummaryCurve;
|
|
class RimSummaryPlot;
|
|
class RiuPlotWidget;
|
|
class RiuPlotCurve;
|
|
class QKeyEvent;
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RimSummaryCurveCollection : public caf::PdmObject
|
|
{
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
private:
|
|
caf::Signal<> curvesChanged;
|
|
|
|
public:
|
|
RimSummaryCurveCollection();
|
|
|
|
bool isCurvesVisible();
|
|
|
|
void setCurveForSourceStepping( RimSummaryCurve* curve );
|
|
RimSummaryCurve* curveForSourceStepping() const;
|
|
|
|
RimSummaryPlotSourceStepping* sourceSteppingObject() const;
|
|
|
|
std::set<RiaDefines::HorizontalAxisType> horizontalAxisTypes() const;
|
|
std::vector<RimSummaryCurve*> curves() const;
|
|
|
|
void setCurveAsTopZWithinCategory( RimSummaryCurve* curve );
|
|
|
|
void loadDataAndUpdate( bool updateParentPlot );
|
|
|
|
void updateCurveOrder();
|
|
|
|
private:
|
|
void setParentPlotAndReplot( RiuPlotWidget* plot );
|
|
void setParentPlotNoReplot( RiuPlotWidget* plot );
|
|
void detachPlotCurves();
|
|
void reattachPlotCurves();
|
|
|
|
RimSummaryCurve* findRimCurveFromPlotCurve( const RiuPlotCurve* curve ) const;
|
|
|
|
void addCurve( RimSummaryCurve* curve );
|
|
void insertCurve( RimSummaryCurve* curve, size_t index );
|
|
void deleteCurve( RimSummaryCurve* curve );
|
|
void removeCurve( RimSummaryCurve* curve );
|
|
|
|
/// Delete the curves associated with any of the given cases. Returns true if any curve was deleted.
|
|
bool deleteCurvesAssosiatedWithCases( const std::set<RimSummaryCase*>& summaryCases );
|
|
void deleteAllCurves();
|
|
void updateCaseNameHasChanged();
|
|
|
|
void setCurrentSummaryCurve( RimSummaryCurve* curve );
|
|
|
|
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
|
|
|
private:
|
|
caf::PdmFieldHandle* objectToggleField() override;
|
|
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
|
|
|
void onCurvesReordered( const SignalEmitter* emitter );
|
|
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
|
|
|
void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& updatedObjects ) override;
|
|
|
|
private:
|
|
friend class RimSummaryPlot;
|
|
|
|
caf::PdmField<bool> m_showCurves;
|
|
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
|
|
|
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_ySourceStepping;
|
|
|
|
caf::PdmPointer<RimSummaryCurve> m_currentSummaryCurve;
|
|
caf::PdmPointer<RimSummaryCurve> m_curveForSourceStepping;
|
|
};
|