2017-09-07 05:01:40 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016- Statoil ASA
|
2018-04-27 06:30:51 -05:00
|
|
|
//
|
2017-09-07 05:01:40 -05: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.
|
2018-04-27 06:30:51 -05:00
|
|
|
//
|
2017-09-07 05:01:40 -05: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.
|
2018-04-27 06:30:51 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-09-07 05:01:40 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2018-04-27 06:30:51 -05:00
|
|
|
|
2017-09-07 05:01:40 -05:00
|
|
|
#pragma once
|
|
|
|
|
2019-07-25 00:38:46 -05:00
|
|
|
#include "RiaEclipseUnitTools.h"
|
|
|
|
#include "RifEclipseRftAddress.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RifEclipseSummaryAddress.h"
|
2019-07-25 00:38:46 -05:00
|
|
|
#include "RifReaderEnsembleStatisticsRft.h"
|
2018-05-10 14:29:55 -05:00
|
|
|
|
2017-09-07 05:01:40 -05:00
|
|
|
#include "cafPdmChildArrayField.h"
|
2017-09-07 09:08:13 -05:00
|
|
|
#include "cafPdmField.h"
|
2017-09-07 05:01:40 -05:00
|
|
|
#include "cafPdmObject.h"
|
2018-05-04 00:18:25 -05:00
|
|
|
#include "cafPdmProxyValueField.h"
|
2017-09-07 05:01:40 -05:00
|
|
|
|
2019-01-29 09:42:04 -06:00
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include <utility>
|
2017-09-07 06:00:53 -05:00
|
|
|
#include <vector>
|
|
|
|
|
2019-07-25 00:38:46 -05:00
|
|
|
class RifReaderRftInterface;
|
|
|
|
class RifReaderEnsembleStatisticsRft;
|
2017-09-07 05:01:40 -05:00
|
|
|
class RimSummaryCase;
|
|
|
|
|
2018-05-31 03:23:51 -05:00
|
|
|
//==================================================================================================
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-31 03:23:51 -05:00
|
|
|
//==================================================================================================
|
|
|
|
class EnsembleParameter
|
|
|
|
{
|
|
|
|
public:
|
2019-01-29 09:42:04 -06:00
|
|
|
typedef std::pair<QString, EnsembleParameter> NameParameterPair;
|
2018-05-31 03:23:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
TYPE_NONE,
|
|
|
|
TYPE_NUMERIC,
|
|
|
|
TYPE_TEXT
|
|
|
|
};
|
|
|
|
enum Bins
|
|
|
|
{
|
|
|
|
LOW_VARIATION,
|
|
|
|
MEDIUM_VARIATION,
|
|
|
|
HIGH_VARIATION,
|
|
|
|
NR_OF_VARIATION_BINS
|
|
|
|
};
|
|
|
|
QString name;
|
|
|
|
Type type;
|
|
|
|
std::vector<QVariant> values;
|
|
|
|
double minValue;
|
|
|
|
double maxValue;
|
|
|
|
int variationBin;
|
|
|
|
|
|
|
|
EnsembleParameter()
|
|
|
|
: type( TYPE_NONE )
|
|
|
|
, minValue( std::numeric_limits<double>::infinity() )
|
|
|
|
, maxValue( -std::numeric_limits<double>::infinity() )
|
|
|
|
, variationBin( static_cast<int>( MEDIUM_VARIATION ) )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isValid() const
|
|
|
|
{
|
|
|
|
return !name.isEmpty() && type != TYPE_NONE;
|
|
|
|
}
|
|
|
|
bool isNumeric() const
|
|
|
|
{
|
|
|
|
return type == TYPE_NUMERIC;
|
|
|
|
}
|
|
|
|
bool isText() const
|
|
|
|
{
|
|
|
|
return type == TYPE_TEXT;
|
|
|
|
}
|
2019-01-29 09:42:04 -06:00
|
|
|
double normalizedStdDeviation() const;
|
2019-01-29 08:04:04 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static void sortByBinnedVariation( std::vector<NameParameterPair>& parameterVector );
|
2019-01-29 08:04:04 -06:00
|
|
|
|
2019-12-02 07:05:41 -06:00
|
|
|
static QString uiName( const NameParameterPair& paramPair );
|
|
|
|
|
2019-01-29 08:04:04 -06:00
|
|
|
private:
|
2019-01-29 09:42:04 -06:00
|
|
|
double stdDeviation() const;
|
2018-05-31 03:23:51 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
//==================================================================================================
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-05-31 03:23:51 -05:00
|
|
|
//==================================================================================================
|
2017-09-07 05:01:40 -05:00
|
|
|
class RimSummaryCaseCollection : public caf::PdmObject
|
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2018-04-27 06:30:51 -05:00
|
|
|
|
2017-09-07 05:01:40 -05:00
|
|
|
public:
|
|
|
|
RimSummaryCaseCollection();
|
2018-10-18 12:45:57 -05:00
|
|
|
~RimSummaryCaseCollection() override;
|
2017-09-08 08:26:13 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void removeCase( RimSummaryCase* summaryCase );
|
|
|
|
void addCase( RimSummaryCase* summaryCase, bool updateCurveSets = true );
|
|
|
|
virtual std::vector<RimSummaryCase*> allSummaryCases() const;
|
|
|
|
void setName( const QString& name );
|
|
|
|
QString name() const;
|
|
|
|
bool isEnsemble() const;
|
|
|
|
void setAsEnsemble( bool isEnsemble );
|
2018-09-24 06:59:55 -05:00
|
|
|
virtual std::set<RifEclipseSummaryAddress> ensembleSummaryAddresses() const;
|
2019-09-06 03:40:57 -05:00
|
|
|
std::set<QString> wellsWithRftData() const;
|
|
|
|
std::set<QDateTime> rftTimeStepsForWell( const QString& wellName ) const;
|
|
|
|
RifReaderRftInterface* rftStatisticsReader();
|
2019-07-25 00:38:46 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
EnsembleParameter ensembleParameter( const QString& paramName ) const;
|
|
|
|
void calculateEnsembleParametersIntersectionHash();
|
|
|
|
void clearEnsembleParametersHashes();
|
2018-05-31 03:23:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void loadDataAndUpdate();
|
2018-06-25 08:14:47 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static bool validateEnsembleCases( const std::vector<RimSummaryCase*> cases );
|
|
|
|
bool operator<( const RimSummaryCaseCollection& rhs ) const;
|
2019-07-25 00:38:46 -05:00
|
|
|
|
|
|
|
RiaEclipseUnitTools::UnitSystem unitSystem() const;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2017-09-07 05:01:40 -05:00
|
|
|
private:
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
QString nameAndItemCount() const;
|
|
|
|
void updateIcon();
|
2018-05-08 08:22:38 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void initAfterRead() override;
|
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue ) override;
|
2017-09-07 05:01:40 -05:00
|
|
|
|
2018-06-25 08:14:47 -05:00
|
|
|
protected:
|
2019-09-06 03:40:57 -05:00
|
|
|
virtual void onLoadDataAndUpdate();
|
|
|
|
void updateReferringCurveSets();
|
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
void setNameAsReadOnly();
|
2018-06-25 08:14:47 -05:00
|
|
|
|
2017-09-07 05:01:40 -05:00
|
|
|
caf::PdmChildArrayField<RimSummaryCase*> m_cases;
|
2018-06-25 08:14:47 -05:00
|
|
|
|
|
|
|
private:
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmField<QString> m_name;
|
|
|
|
caf::PdmProxyValueField<QString> m_nameAndItemCount;
|
|
|
|
caf::PdmField<bool> m_isEnsemble;
|
|
|
|
cvf::ref<RifReaderEnsembleStatisticsRft> m_statisticsEclipseRftReader;
|
2018-09-13 05:38:17 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
size_t m_commonAddressCount; // if different address count among cases, set to 0
|
2017-09-07 05:01:40 -05:00
|
|
|
};
|