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
|
|
|
|
|
|
2021-01-21 12:58:46 +01:00
|
|
|
#include "RiaDefines.h"
|
2024-10-22 16:24:11 +02:00
|
|
|
|
|
|
|
|
#include "RiaHashTools.h"
|
|
|
|
|
|
2018-03-26 13:11:36 +02:00
|
|
|
#include "RigCaseRealizationParameters.h"
|
|
|
|
|
|
2020-11-18 14:37:43 +01:00
|
|
|
#include "RimCaseDisplayNameTools.h"
|
|
|
|
|
|
2019-12-10 16:12:21 +01:00
|
|
|
#include "cafFilePath.h"
|
2022-01-13 09:02:07 +01:00
|
|
|
#include "cafPdmChildField.h"
|
2016-05-31 13:42:27 +02:00
|
|
|
#include "cafPdmField.h"
|
2017-09-22 09:21:12 +02:00
|
|
|
#include "cafPdmObject.h"
|
2016-05-31 13:42:27 +02:00
|
|
|
|
2018-05-03 09:53:25 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2019-07-25 07:38:46 +02:00
|
|
|
class RifReaderRftInterface;
|
2017-09-22 08:23:50 +02:00
|
|
|
class RifSummaryReaderInterface;
|
2024-07-29 15:38:17 +02:00
|
|
|
class RimSummaryEnsemble;
|
2022-01-13 09:02:07 +01:00
|
|
|
class RimSummaryAddressCollection;
|
2016-05-31 13:42:27 +02:00
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
//
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2016-05-31 13:42:27 +02:00
|
|
|
//
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
|
|
class RimSummaryCase : public caf::PdmObject
|
|
|
|
|
{
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2020-09-02 15:04:48 +02:00
|
|
|
public:
|
|
|
|
|
caf::Signal<> nameChanged;
|
|
|
|
|
|
2020-11-18 14:37:43 +01:00
|
|
|
using DisplayNameEnum = caf::AppEnum<RimCaseDisplayNameTools::DisplayName>;
|
2020-09-02 15:04:48 +02:00
|
|
|
|
2016-05-31 13:42:27 +02:00
|
|
|
public:
|
|
|
|
|
RimSummaryCase();
|
2018-10-18 19:45:57 +02:00
|
|
|
~RimSummaryCase() override;
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
virtual QString summaryHeaderFilename() const;
|
|
|
|
|
QString displayCaseName() const;
|
|
|
|
|
QString nativeCaseName() const;
|
|
|
|
|
void setCustomCaseName( const QString& caseName );
|
|
|
|
|
void updateAutoShortName();
|
|
|
|
|
RimCaseDisplayNameTools::DisplayName displayNameType() const;
|
|
|
|
|
void setDisplayNameOption( RimCaseDisplayNameTools::DisplayName displayNameOption );
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
void setCaseId( int caseId );
|
|
|
|
|
int caseId() const;
|
2022-08-17 22:12:23 -07:00
|
|
|
|
2022-01-13 09:02:07 +01:00
|
|
|
void refreshMetaData();
|
2024-02-26 13:55:41 +01:00
|
|
|
void onCalculationUpdated();
|
2022-01-13 09:02:07 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
virtual void createSummaryReaderInterface() = 0;
|
|
|
|
|
virtual void createRftReaderInterface() {}
|
2017-09-22 09:11:39 +02:00
|
|
|
virtual RifSummaryReaderInterface* summaryReader() = 0;
|
2019-09-06 10:40:57 +02:00
|
|
|
virtual RifReaderRftInterface* rftReader();
|
2020-01-30 14:23:33 +01:00
|
|
|
virtual QString errorMessagesFromReader();
|
2016-05-31 13:42:27 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void setSummaryHeaderFileName( const QString& fileName );
|
2017-09-25 14:37:41 +02:00
|
|
|
|
2022-12-08 07:08:22 +01:00
|
|
|
caf::AppEnum<RiaDefines::EclipseUnitSystem> unitsSystem();
|
|
|
|
|
|
2020-09-02 15:04:48 +02:00
|
|
|
bool isObservedData() const;
|
2017-09-15 14:30:09 +02:00
|
|
|
|
2024-07-05 09:06:16 +02:00
|
|
|
bool showVectorItemsInProjectTree() const;
|
|
|
|
|
void setShowVectorItemsInProjectTree( bool enable );
|
2022-05-23 14:25:53 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void setCaseRealizationParameters( const std::shared_ptr<RigCaseRealizationParameters>& crlParameters );
|
2018-05-03 09:53:25 +02:00
|
|
|
std::shared_ptr<RigCaseRealizationParameters> caseRealizationParameters() const;
|
2019-09-06 10:40:57 +02:00
|
|
|
bool hasCaseRealizationParameters() const;
|
2024-07-29 15:38:17 +02:00
|
|
|
RimSummaryEnsemble* ensemble() const;
|
2019-09-06 10:40:57 +02:00
|
|
|
void copyFrom( const RimSummaryCase& rhs );
|
|
|
|
|
bool operator<( const RimSummaryCase& rhs ) const;
|
2018-03-26 13:11:36 +02:00
|
|
|
|
2016-07-06 13:35:24 +02:00
|
|
|
protected:
|
2022-04-27 01:51:55 +02:00
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
2020-02-12 11:43:15 +01:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
2020-01-13 15:21:15 +01:00
|
|
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
2023-05-30 15:56:19 +02:00
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
void updateTreeItemName();
|
|
|
|
|
|
2020-01-30 14:23:33 +01:00
|
|
|
virtual QString caseName() const = 0;
|
|
|
|
|
|
2020-04-08 14:30:38 +02:00
|
|
|
void initAfterRead() override;
|
2024-10-16 11:00:50 +02:00
|
|
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
|
|
|
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder, bool showCurveCalculator ) const;
|
2020-04-08 14:30:38 +02:00
|
|
|
|
2020-01-30 14:23:33 +01:00
|
|
|
private:
|
2022-01-13 09:02:07 +01:00
|
|
|
void buildChildNodes();
|
2024-10-22 16:24:11 +02:00
|
|
|
int serialNumber();
|
2022-01-13 09:02:07 +01:00
|
|
|
|
2020-01-30 14:23:33 +01:00
|
|
|
protected:
|
2020-09-02 15:04:48 +02:00
|
|
|
caf::PdmField<QString> m_displayName;
|
|
|
|
|
caf::PdmField<DisplayNameEnum> m_displayNameOption;
|
|
|
|
|
caf::PdmField<caf::FilePath> m_summaryHeaderFilename;
|
|
|
|
|
|
2022-04-27 01:51:55 +02:00
|
|
|
caf::PdmField<bool> m_showSubNodesInTree;
|
|
|
|
|
|
2022-01-13 09:02:07 +01:00
|
|
|
caf::PdmChildField<RimSummaryAddressCollection*> m_dataVectorFolders;
|
|
|
|
|
|
2020-09-02 15:04:48 +02:00
|
|
|
bool m_isObservedData;
|
|
|
|
|
caf::PdmField<int> m_caseId;
|
2019-09-06 10:40:57 +02:00
|
|
|
|
2018-05-03 09:53:25 +02:00
|
|
|
std::shared_ptr<RigCaseRealizationParameters> m_crlParameters;
|
2016-07-06 13:35:24 +02:00
|
|
|
|
2020-09-02 15:04:48 +02:00
|
|
|
caf::PdmField<bool> m_useAutoShortName_OBSOLETE;
|
|
|
|
|
|
2019-11-05 15:55:35 +01:00
|
|
|
static const QString DEFAULT_DISPLAY_NAME;
|
2024-10-22 16:24:11 +02:00
|
|
|
|
|
|
|
|
friend struct std::hash<RimSummaryCase*>;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Custom specialization of std::hash injected in namespace std
|
|
|
|
|
// NB! Note that this is a specialization of std::hash for a pointer type
|
|
|
|
|
template <>
|
|
|
|
|
struct std::hash<RimSummaryCase*>
|
|
|
|
|
{
|
|
|
|
|
std::size_t operator()( RimSummaryCase* s ) const noexcept
|
|
|
|
|
{
|
|
|
|
|
if ( !s ) return 0;
|
|
|
|
|
|
|
|
|
|
auto serialNumber = s->serialNumber();
|
|
|
|
|
if ( serialNumber != -1 )
|
|
|
|
|
{
|
|
|
|
|
return RiaHashTools::hash( serialNumber );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return RiaHashTools::hash( s->summaryHeaderFilename().toStdString() );
|
|
|
|
|
}
|
2016-05-31 13:42:27 +02:00
|
|
|
};
|