2021-03-25 12:56:09 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2021- Equinor 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 "RifEclipseSummaryAddress.h"
|
|
|
|
|
#include "RifSummaryReaderInterface.h"
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <set>
|
|
|
|
|
#include <string>
|
2022-07-07 16:42:06 +02:00
|
|
|
#include <tuple>
|
2021-03-25 12:56:09 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
|
{
|
|
|
|
|
namespace EclIO
|
|
|
|
|
{
|
|
|
|
|
class ESmry;
|
2021-09-10 12:27:25 +00:00
|
|
|
class ExtESmry;
|
2021-03-25 12:56:09 +01:00
|
|
|
} // namespace EclIO
|
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
2021-04-08 15:53:38 +02:00
|
|
|
class RiaThreadSafeLogger;
|
|
|
|
|
|
|
|
|
|
class RifOpmCommonSummaryTools
|
|
|
|
|
{
|
|
|
|
|
public:
|
2023-02-26 10:48:40 +01:00
|
|
|
static std::tuple<std::set<RifEclipseSummaryAddress>, std::map<RifEclipseSummaryAddress, size_t>, std::map<RifEclipseSummaryAddress, std::string>>
|
2022-07-07 16:42:06 +02:00
|
|
|
buildAddressesSmspecAndKeywordMap( const Opm::EclIO::ESmry* summaryFile );
|
2021-09-10 11:41:29 +02:00
|
|
|
|
|
|
|
|
static std::pair<std::set<RifEclipseSummaryAddress>, std::map<RifEclipseSummaryAddress, std::string>>
|
2022-07-07 16:42:06 +02:00
|
|
|
buildAddressesAndKeywordMap( const std::vector<std::string>& keywords );
|
2021-04-08 15:53:38 +02:00
|
|
|
};
|
|
|
|
|
|
2021-03-25 12:56:09 +01:00
|
|
|
//==================================================================================================
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
class RifOpmCommonEclipseSummary : public RifSummaryReaderInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
RifOpmCommonEclipseSummary();
|
2021-04-15 02:14:51 +00:00
|
|
|
~RifOpmCommonEclipseSummary() override;
|
2021-03-25 12:56:09 +01:00
|
|
|
|
2021-09-10 16:36:25 +02:00
|
|
|
void useEnhancedSummaryFiles( bool enable );
|
|
|
|
|
void createEnhancedSummaryFiles( bool enable );
|
2021-03-26 13:52:26 +01:00
|
|
|
|
2021-09-10 16:36:25 +02:00
|
|
|
static void resetEnhancedSummaryFileCount();
|
|
|
|
|
static size_t numberOfEnhancedSummaryFileCreated();
|
2021-03-25 12:56:09 +01:00
|
|
|
|
2023-01-03 14:52:33 +01:00
|
|
|
bool open( const QString& fileName, bool includeRestartFiles, RiaThreadSafeLogger* threadSafeLogger );
|
2021-03-25 12:56:09 +01:00
|
|
|
|
2023-09-29 17:52:31 +02:00
|
|
|
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
|
|
|
|
std::pair<bool, std::vector<double>> values( const RifEclipseSummaryAddress& resultAddress ) const override;
|
|
|
|
|
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override;
|
|
|
|
|
RiaDefines::EclipseUnitSystem unitSystem() const override;
|
2021-03-25 12:56:09 +01:00
|
|
|
|
|
|
|
|
private:
|
2024-02-26 13:55:41 +01:00
|
|
|
void buildMetaData() override;
|
2023-01-03 14:52:33 +01:00
|
|
|
bool openFileReader( const QString& fileName, bool includeRestartFiles, RiaThreadSafeLogger* threadSafeLogger );
|
2021-03-25 12:56:09 +01:00
|
|
|
|
2021-09-10 16:36:25 +02:00
|
|
|
static void increaseEsmryFileCount();
|
2023-01-03 14:52:33 +01:00
|
|
|
static QString enhancedSummaryFilename( const QString& fileName );
|
|
|
|
|
static QString smspecSummaryFilename( const QString& fileName );
|
2021-03-25 12:56:09 +01:00
|
|
|
|
|
|
|
|
private:
|
2021-09-10 16:36:25 +02:00
|
|
|
std::unique_ptr<Opm::EclIO::ESmry> m_standardReader;
|
|
|
|
|
std::unique_ptr<Opm::EclIO::ExtESmry> m_enhancedReader;
|
2021-09-10 12:27:25 +00:00
|
|
|
|
2021-09-10 16:36:25 +02:00
|
|
|
std::map<RifEclipseSummaryAddress, std::string> m_summaryAddressToKeywordMap;
|
2021-09-10 11:41:29 +02:00
|
|
|
std::vector<time_t> m_timeSteps;
|
2021-03-25 12:56:09 +01:00
|
|
|
|
2021-09-10 16:36:25 +02:00
|
|
|
static size_t sm_createdEsmryFileCount;
|
2021-03-25 12:56:09 +01:00
|
|
|
|
2021-09-10 16:36:25 +02:00
|
|
|
bool m_useEsmryFiles;
|
|
|
|
|
bool m_createEsmryFiles;
|
2021-03-25 12:56:09 +01:00
|
|
|
};
|