2016-05-31 13:42:27 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2016- Statoil ASA
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2016-05-31 13:42:27 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2016-05-31 13:42:27 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2016-05-31 13:42:27 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "cafPdmChildArrayField.h"
|
|
|
|
|
#include "cafPdmObject.h"
|
2021-12-23 09:30:36 +01:00
|
|
|
#include "cafSignal.h"
|
2016-05-31 13:42:27 +02:00
|
|
|
|
2018-06-25 15:14:47 +02:00
|
|
|
#include <functional>
|
2019-09-06 10:40:57 +02:00
|
|
|
#include <vector>
|
2017-09-07 12:01:40 +02:00
|
|
|
|
2016-05-31 13:42:27 +02:00
|
|
|
class RimSummaryCase;
|
2019-11-08 15:40:53 +01:00
|
|
|
class RimFileSummaryCase;
|
2016-05-31 13:42:27 +02:00
|
|
|
class RimEclipseResultCase;
|
2024-07-29 15:38:17 +02:00
|
|
|
class RimSummaryEnsemble;
|
2026-09-17 14:03:54 +02:00
|
|
|
class RimSummaryFileSetEnsemble;
|
2018-04-25 08:57:00 +02:00
|
|
|
class RifSummaryCaseFileResultInfo;
|
2016-05-31 13:42:27 +02:00
|
|
|
|
2017-09-11 10:44:55 +02:00
|
|
|
//==================================================================================================
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2017-09-11 10:44:55 +02:00
|
|
|
//==================================================================================================
|
2017-09-06 16:32:46 +02:00
|
|
|
class RimSummaryCaseMainCollection : public caf::PdmObject
|
2016-05-31 13:42:27 +02:00
|
|
|
{
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2021-12-23 09:30:36 +01:00
|
|
|
public:
|
|
|
|
|
caf::Signal<> dataSourceHasChanged;
|
|
|
|
|
|
2016-05-31 13:42:27 +02:00
|
|
|
public:
|
2017-09-06 16:32:46 +02:00
|
|
|
RimSummaryCaseMainCollection();
|
2018-10-18 19:45:57 +02:00
|
|
|
~RimSummaryCaseMainCollection() override;
|
2016-05-31 13:42:27 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
RimSummaryCase* summaryCase( size_t idx );
|
|
|
|
|
size_t summaryCaseCount() const;
|
|
|
|
|
|
2026-09-17 14:03:54 +02:00
|
|
|
std::vector<RimSummaryCase*> allSummaryCases() const;
|
|
|
|
|
std::vector<RimSummaryCase*> topLevelSummaryCases() const;
|
|
|
|
|
std::vector<RimSummaryEnsemble*> summaryEnsembles() const;
|
|
|
|
|
std::vector<RimSummaryFileSetEnsemble*> summaryFileSetEnsembles() const;
|
2017-09-07 12:01:40 +02:00
|
|
|
|
2023-02-26 10:48:40 +01:00
|
|
|
std::vector<RimSummaryCase*> createSummaryCasesFromFileInfos( const std::vector<RifSummaryCaseFileResultInfo>& summaryHeaderFileInfos,
|
2025-07-23 15:05:35 +02:00
|
|
|
bool readStateFromFirstFile,
|
2023-02-26 10:48:40 +01:00
|
|
|
bool showProgress = false );
|
2017-09-18 14:49:31 +02:00
|
|
|
|
2023-03-06 10:45:49 +01:00
|
|
|
RimSummaryCase* findTopLevelSummaryCaseFromFileName( const QString& fileName ) const;
|
2018-04-13 11:11:05 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void addCases( const std::vector<RimSummaryCase*> cases );
|
|
|
|
|
void addCase( RimSummaryCase* summaryCase );
|
2022-05-12 22:51:15 +02:00
|
|
|
void removeCase( RimSummaryCase* summaryCase, bool notifyChange = true );
|
2026-08-13 09:21:16 +02:00
|
|
|
// Open a RimSummaryCaseUpdateBatch around this call if the case list is used afterwards, see removeCases()
|
|
|
|
|
void removeCases( const std::vector<RimSummaryCase*>& cases );
|
2025-03-11 10:53:30 +01:00
|
|
|
void moveCase( RimSummaryCase* summaryCase, int destinationIndex );
|
2016-11-07 15:57:21 +01:00
|
|
|
|
2024-07-29 15:38:17 +02:00
|
|
|
RimSummaryEnsemble* addEnsemble( const std::vector<RimSummaryCase*>& summaryCases,
|
|
|
|
|
const QString& coolectionName,
|
|
|
|
|
bool isEnsemble,
|
|
|
|
|
std::function<RimSummaryEnsemble*()> allocator = defaultAllocator );
|
2025-03-25 06:45:39 +01:00
|
|
|
void removeEnsemble( RimSummaryEnsemble* ensemble );
|
2024-07-29 15:38:17 +02:00
|
|
|
void addEnsemble( RimSummaryEnsemble* ensemble );
|
2025-07-23 10:05:34 +02:00
|
|
|
void moveEnsemble( RimSummaryEnsemble* ensemble, int destinationIndex );
|
2016-05-31 13:42:27 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void loadAllSummaryCaseData();
|
2016-05-31 13:42:27 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
QString uniqueShortNameForCase( RimSummaryCase* summaryCase );
|
2016-07-06 13:35:24 +02:00
|
|
|
|
2021-06-10 15:44:00 +02:00
|
|
|
void updateAutoShortName();
|
2021-12-14 11:10:19 +01:00
|
|
|
void onProjectBeingSaved();
|
2021-06-10 15:44:00 +02:00
|
|
|
|
2025-03-25 06:45:39 +01:00
|
|
|
void updateEnsembleNames();
|
|
|
|
|
|
2018-05-07 13:14:43 +02:00
|
|
|
private:
|
2026-05-28 16:06:39 +02:00
|
|
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
|
|
|
|
|
2022-12-09 08:46:36 +01:00
|
|
|
void initAfterRead() override;
|
|
|
|
|
|
2025-07-23 15:05:35 +02:00
|
|
|
static void loadSummaryCaseData( const std::vector<RimSummaryCase*>& summaryCases, bool extractStateFromFirstCase );
|
|
|
|
|
static void loadFileSummaryCaseData( const std::vector<RimFileSummaryCase*>& fileSummaryCases, bool extractStateFromFirstCase );
|
2024-07-29 15:38:17 +02:00
|
|
|
static RimSummaryEnsemble* defaultAllocator();
|
2018-05-07 13:14:43 +02:00
|
|
|
|
2020-09-02 15:04:48 +02:00
|
|
|
void onCaseNameChanged( const SignalEmitter* emitter );
|
|
|
|
|
|
2016-05-31 13:42:27 +02:00
|
|
|
private:
|
2024-07-29 15:38:17 +02:00
|
|
|
caf::PdmChildArrayField<RimSummaryCase*> m_cases;
|
2025-03-25 06:45:39 +01:00
|
|
|
caf::PdmChildArrayField<RimSummaryEnsemble*> m_ensembles;
|
2016-05-31 13:42:27 +02:00
|
|
|
};
|