mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Reduce memory use for summary address object
* Use one common variable for object name, use three ints * Move enums to separate file * Refactor use of enums * Move implementation to cpp * Refactor includes
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
|
||||
|
||||
@@ -419,9 +419,9 @@ bool RifCsvUserDataParser::parseColumnInfo( QTextStream*
|
||||
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( colName.toStdString() );
|
||||
|
||||
// Create address of a give category if provided
|
||||
if ( parseOptions.defaultCategory == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL )
|
||||
if ( parseOptions.defaultCategory == RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL )
|
||||
addr = RifEclipseSummaryAddress::wellAddress( colName.toStdString(), nameFromData.toStdString() );
|
||||
else if ( parseOptions.defaultCategory == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_FIELD )
|
||||
else if ( parseOptions.defaultCategory == RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_FIELD )
|
||||
addr = RifEclipseSummaryAddress::fieldAddress( colName.toStdString() );
|
||||
|
||||
double scaleFactor = 1.0;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifEclipseUserDataParserTools.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
class RimDerivedSummaryCase;
|
||||
class RimSummaryCase;
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
|
||||
@@ -107,21 +107,21 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
|
||||
return RifEclipseSummaryAddress();
|
||||
}
|
||||
|
||||
RifEclipseSummaryAddress::SummaryVarCategory sumCategory( RifEclipseSummaryAddress::SUMMARY_INVALID );
|
||||
std::string quantityName;
|
||||
int regionNumber( -1 );
|
||||
int regionNumber2( -1 );
|
||||
std::string groupName;
|
||||
std::string networkName;
|
||||
std::string wellName;
|
||||
int wellSegmentNumber( -1 );
|
||||
std::string lgrName;
|
||||
int cellI( -1 );
|
||||
int cellJ( -1 );
|
||||
int cellK( -1 );
|
||||
int aquiferNumber( -1 );
|
||||
bool isErrorResult( false );
|
||||
int id( -1 );
|
||||
RifEclipseSummaryAddressDefines::SummaryVarCategory sumCategory( RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_INVALID );
|
||||
std::string quantityName;
|
||||
int regionNumber( -1 );
|
||||
int regionNumber2( -1 );
|
||||
std::string groupName;
|
||||
std::string networkName;
|
||||
std::string wellName;
|
||||
int wellSegmentNumber( -1 );
|
||||
std::string lgrName;
|
||||
int cellI( -1 );
|
||||
int cellJ( -1 );
|
||||
int cellK( -1 );
|
||||
int aquiferNumber( -1 );
|
||||
bool isErrorResult( false );
|
||||
int id( -1 );
|
||||
|
||||
quantityName = stringFromPointer( ertSumVarNode.get_keyword() );
|
||||
|
||||
@@ -129,36 +129,36 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
|
||||
{
|
||||
case ECL_SMSPEC_AQUIFER_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_AQUIFER;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_AQUIFER;
|
||||
aquiferNumber = ertSumVarNode.get_num();
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_WELL_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL;
|
||||
wellName = stringFromPointer( ertSumVarNode.get_wgname() );
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_REGION_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_REGION;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_REGION;
|
||||
regionNumber = ertSumVarNode.get_num();
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_FIELD_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_FIELD;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_FIELD;
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_GROUP_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_GROUP;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_GROUP;
|
||||
groupName = stringFromPointer( ertSumVarNode.get_wgname() );
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_BLOCK_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_BLOCK;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_BLOCK;
|
||||
|
||||
auto ijk = ertSumVarNode.get_ijk();
|
||||
cellI = ijk[0];
|
||||
@@ -168,7 +168,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
|
||||
break;
|
||||
case ECL_SMSPEC_COMPLETION_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_COMPLETION;
|
||||
wellName = stringFromPointer( ertSumVarNode.get_wgname() );
|
||||
|
||||
auto ijk = ertSumVarNode.get_ijk();
|
||||
@@ -179,7 +179,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
|
||||
break;
|
||||
case ECL_SMSPEC_LOCAL_BLOCK_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_BLOCK_LGR;
|
||||
lgrName = stringFromPointer( ertSumVarNode.get_lgr_name() );
|
||||
|
||||
auto ijk = ertSumVarNode.get_lgr_ijk();
|
||||
@@ -190,7 +190,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
|
||||
break;
|
||||
case ECL_SMSPEC_LOCAL_COMPLETION_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_COMPLETION_LGR;
|
||||
wellName = stringFromPointer( ertSumVarNode.get_wgname() );
|
||||
lgrName = stringFromPointer( ertSumVarNode.get_lgr_name() );
|
||||
|
||||
@@ -202,33 +202,33 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
|
||||
break;
|
||||
case ECL_SMSPEC_LOCAL_WELL_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_LGR;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_LGR;
|
||||
wellName = stringFromPointer( ertSumVarNode.get_wgname() );
|
||||
lgrName = stringFromPointer( ertSumVarNode.get_lgr_name() );
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_NETWORK_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_NETWORK;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_NETWORK;
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_REGION_2_REGION_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_REGION_2_REGION;
|
||||
regionNumber = ertSumVarNode.get_R1();
|
||||
regionNumber2 = ertSumVarNode.get_R2();
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_SEGMENT_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_SEGMENT;
|
||||
wellName = stringFromPointer( ertSumVarNode.get_wgname() );
|
||||
wellSegmentNumber = ertSumVarNode.get_num();
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_MISC_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_MISC;
|
||||
sumCategory = RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_MISC;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,76 +22,36 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "RifEclipseSummaryAddressDefines.h"
|
||||
using namespace RifEclipseSummaryAddressDefines;
|
||||
|
||||
class QTextStream;
|
||||
class QString;
|
||||
|
||||
#define ENSEMBLE_STAT_P10_QUANTITY_NAME "P10"
|
||||
#define ENSEMBLE_STAT_P50_QUANTITY_NAME "P50"
|
||||
#define ENSEMBLE_STAT_P90_QUANTITY_NAME "P90"
|
||||
#define ENSEMBLE_STAT_MEAN_QUANTITY_NAME "MEAN"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifEclipseSummaryAddress
|
||||
{
|
||||
public:
|
||||
// Based on list in ecl_smspec.c and list of types taken from Eclipse Reference Manual ecl_rm_2011.1.pdf
|
||||
enum SummaryVarCategory : int8_t
|
||||
{
|
||||
SUMMARY_INVALID,
|
||||
SUMMARY_FIELD,
|
||||
SUMMARY_AQUIFER,
|
||||
SUMMARY_NETWORK,
|
||||
SUMMARY_MISC,
|
||||
SUMMARY_REGION,
|
||||
SUMMARY_REGION_2_REGION,
|
||||
SUMMARY_GROUP,
|
||||
SUMMARY_WELL,
|
||||
SUMMARY_WELL_COMPLETION,
|
||||
SUMMARY_WELL_LGR,
|
||||
SUMMARY_WELL_COMPLETION_LGR,
|
||||
SUMMARY_WELL_SEGMENT,
|
||||
SUMMARY_BLOCK,
|
||||
SUMMARY_BLOCK_LGR,
|
||||
SUMMARY_IMPORTED,
|
||||
SUMMARY_ENSEMBLE_STATISTICS
|
||||
};
|
||||
|
||||
enum SummaryIdentifierType
|
||||
{
|
||||
INPUT_REGION_NUMBER,
|
||||
INPUT_REGION_2_REGION,
|
||||
INPUT_WELL_NAME,
|
||||
INPUT_GROUP_NAME,
|
||||
INPUT_NETWORK_NAME,
|
||||
INPUT_CELL_IJK,
|
||||
INPUT_LGR_NAME,
|
||||
INPUT_SEGMENT_NUMBER,
|
||||
INPUT_AQUIFER_NUMBER,
|
||||
INPUT_VECTOR_NAME,
|
||||
INPUT_ID
|
||||
};
|
||||
|
||||
public:
|
||||
RifEclipseSummaryAddress();
|
||||
|
||||
RifEclipseSummaryAddress( SummaryVarCategory category,
|
||||
const std::string& vectorName,
|
||||
int16_t regionNumber,
|
||||
int16_t regionNumber2,
|
||||
int regionNumber,
|
||||
int regionNumber2,
|
||||
const std::string& groupName,
|
||||
const std::string& networkName,
|
||||
const std::string& wellName,
|
||||
int16_t wellSegmentNumber,
|
||||
int wellSegmentNumber,
|
||||
const std::string& lgrName,
|
||||
int32_t cellI,
|
||||
int32_t cellJ,
|
||||
int32_t cellK,
|
||||
int16_t aquiferNumber,
|
||||
int cellI,
|
||||
int cellJ,
|
||||
int cellK,
|
||||
int aquiferNumber,
|
||||
bool isErrorResult,
|
||||
int32_t id );
|
||||
int id );
|
||||
|
||||
RifEclipseSummaryAddress( SummaryVarCategory category, std::map<SummaryIdentifierType, std::string>& identifiers );
|
||||
|
||||
@@ -132,53 +92,53 @@ public:
|
||||
static std::string generateStringFromAddresses( const std::vector<RifEclipseSummaryAddress>& addressVector,
|
||||
const std::string jointString = "; " );
|
||||
|
||||
static bool isDependentOnWellName( SummaryVarCategory category );
|
||||
static bool isDependentOnWellName( RifEclipseSummaryAddressDefines::SummaryVarCategory category );
|
||||
|
||||
// Access methods
|
||||
|
||||
SummaryVarCategory category() const { return m_variableCategory; }
|
||||
const std::string& vectorName() const { return m_vectorName; }
|
||||
SummaryVarCategory category() const;
|
||||
std::string vectorName() const;
|
||||
bool isHistoryVector() const;
|
||||
|
||||
int regionNumber() const { return m_regionNumber; }
|
||||
int regionNumber2() const { return m_regionNumber2; }
|
||||
int regionNumber() const;
|
||||
int regionNumber2() const;
|
||||
|
||||
const std::string& groupName() const { return m_groupName; }
|
||||
const std::string& networkName() const { return m_networkName; }
|
||||
const std::string& wellName() const { return m_wellName; }
|
||||
int wellSegmentNumber() const { return m_wellSegmentNumber; }
|
||||
const std::string& lgrName() const { return m_lgrName; }
|
||||
int cellI() const { return m_cellI; }
|
||||
int cellJ() const { return m_cellJ; }
|
||||
int cellK() const { return m_cellK; }
|
||||
int aquiferNumber() const { return m_aquiferNumber; }
|
||||
int id() const { return m_id; }
|
||||
std::string blockAsString() const;
|
||||
std::string groupName() const;
|
||||
std::string networkName() const;
|
||||
std::string wellName() const;
|
||||
int wellSegmentNumber() const;
|
||||
std::string lgrName() const;
|
||||
int cellI() const;
|
||||
int cellJ() const;
|
||||
int cellK() const;
|
||||
int aquiferNumber() const;
|
||||
int id() const;
|
||||
std::string blockAsString() const;
|
||||
|
||||
const std::string ensembleStatisticsVectorName() const;
|
||||
std::string ensembleStatisticsVectorName() const;
|
||||
|
||||
// Derived properties
|
||||
|
||||
std::string uiText() const;
|
||||
std::string itemUiText() const;
|
||||
std::string addressComponentUiText( RifEclipseSummaryAddress::SummaryIdentifierType itemTypeInput ) const;
|
||||
std::string addressComponentUiText( SummaryIdentifierType itemTypeInput ) const;
|
||||
bool isUiTextMatchingFilterText( const QString& filterString ) const;
|
||||
|
||||
bool isValid() const;
|
||||
void setVectorName( const std::string& vectorName ) { m_vectorName = vectorName; }
|
||||
void setWellName( const std::string& wellName ) { m_wellName = wellName; }
|
||||
void setGroupName( const std::string& groupName ) { m_groupName = groupName; }
|
||||
void setNetworkName( const std::string& networkName ) { m_networkName = networkName; }
|
||||
void setRegion( int region ) { m_regionNumber = (int16_t)region; }
|
||||
void setRegion2( int region2 ) { m_regionNumber2 = (int16_t)region2; }
|
||||
void setAquiferNumber( int aquiferNumber ) { m_aquiferNumber = (int16_t)aquiferNumber; }
|
||||
void setVectorName( const std::string& vectorName );
|
||||
void setWellName( const std::string& wellName );
|
||||
void setGroupName( const std::string& groupName );
|
||||
void setNetworkName( const std::string& networkName );
|
||||
void setRegion( int region );
|
||||
void setRegion2( int region2 );
|
||||
void setAquiferNumber( int aquiferNumber );
|
||||
void setCellIjk( const std::string& uiText );
|
||||
void setWellSegmentNumber( int segment ) { m_wellSegmentNumber = (int16_t)segment; }
|
||||
void setWellSegmentNumber( int segment );
|
||||
|
||||
void setAsErrorResult() { m_isErrorResult = true; }
|
||||
bool isErrorResult() const { return m_isErrorResult; }
|
||||
void setAsErrorResult();
|
||||
bool isErrorResult() const;
|
||||
|
||||
void setId( int id ) { m_id = id; }
|
||||
void setId( int id );
|
||||
|
||||
bool hasAccumulatedData() const;
|
||||
|
||||
@@ -188,14 +148,16 @@ public:
|
||||
|
||||
bool isCalculated() const;
|
||||
|
||||
std::string formatUiTextRegionToRegion() const;
|
||||
static std::pair<int16_t, int16_t> regionToRegionPairFromUiText( const std::string& s );
|
||||
std::string formatUiTextRegionToRegion() const;
|
||||
static std::pair<int, int> regionToRegionPairFromUiText( const std::string& s );
|
||||
|
||||
private:
|
||||
static RifEclipseSummaryAddress fromTokens( const std::vector<std::string>& tokens );
|
||||
|
||||
bool isValidEclipseCategory() const;
|
||||
static std::tuple<int32_t, int32_t, int32_t> ijkTupleFromUiText( const std::string& s );
|
||||
bool isValidEclipseCategory() const;
|
||||
static std::tuple<int, int, int> ijkTupleFromUiText( const std::string& s );
|
||||
void setCellIjk( std::tuple<int, int, int> ijk );
|
||||
void setCellIjk( int i, int j, int k );
|
||||
|
||||
private:
|
||||
// The ordering the variables are defined in defines how the objects get sorted. Members defined first will be
|
||||
@@ -203,21 +165,14 @@ private:
|
||||
|
||||
SummaryVarCategory m_variableCategory;
|
||||
std::string m_vectorName;
|
||||
std::string m_wellName;
|
||||
std::string m_groupName;
|
||||
std::string m_networkName;
|
||||
std::string m_name;
|
||||
std::string m_lgrName;
|
||||
int32_t m_cellK;
|
||||
int32_t m_cellJ;
|
||||
int32_t m_cellI;
|
||||
int16_t m_regionNumber;
|
||||
int16_t m_regionNumber2;
|
||||
int16_t m_wellSegmentNumber;
|
||||
int16_t m_aquiferNumber;
|
||||
int m_number0;
|
||||
int m_number1;
|
||||
int m_number2;
|
||||
bool m_isErrorResult;
|
||||
int32_t m_id;
|
||||
int m_id;
|
||||
};
|
||||
|
||||
QTextStream& operator<<( QTextStream& str, const RifEclipseSummaryAddress& sobj );
|
||||
|
||||
QTextStream& operator>>( QTextStream& str, RifEclipseSummaryAddress& sobj );
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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
|
||||
|
||||
#define ENSEMBLE_STAT_P10_QUANTITY_NAME "P10"
|
||||
#define ENSEMBLE_STAT_P50_QUANTITY_NAME "P50"
|
||||
#define ENSEMBLE_STAT_P90_QUANTITY_NAME "P90"
|
||||
#define ENSEMBLE_STAT_MEAN_QUANTITY_NAME "MEAN"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
namespace RifEclipseSummaryAddressDefines
|
||||
{
|
||||
// Based on list in ecl_smspec.c and list of types taken from Eclipse Reference Manual ecl_rm_2011.1.pdf
|
||||
enum class SummaryVarCategory
|
||||
{
|
||||
SUMMARY_INVALID,
|
||||
SUMMARY_FIELD,
|
||||
SUMMARY_AQUIFER,
|
||||
SUMMARY_NETWORK,
|
||||
SUMMARY_MISC,
|
||||
SUMMARY_REGION,
|
||||
SUMMARY_REGION_2_REGION,
|
||||
SUMMARY_GROUP,
|
||||
SUMMARY_WELL,
|
||||
SUMMARY_WELL_COMPLETION,
|
||||
SUMMARY_WELL_LGR,
|
||||
SUMMARY_WELL_COMPLETION_LGR,
|
||||
SUMMARY_WELL_SEGMENT,
|
||||
SUMMARY_BLOCK,
|
||||
SUMMARY_BLOCK_LGR,
|
||||
SUMMARY_IMPORTED,
|
||||
SUMMARY_ENSEMBLE_STATISTICS
|
||||
};
|
||||
|
||||
enum class SummaryIdentifierType
|
||||
{
|
||||
INPUT_REGION_NUMBER,
|
||||
INPUT_REGION_2_REGION,
|
||||
INPUT_WELL_NAME,
|
||||
INPUT_GROUP_NAME,
|
||||
INPUT_NETWORK_NAME,
|
||||
INPUT_CELL_IJK,
|
||||
INPUT_LGR_NAME,
|
||||
INPUT_SEGMENT_NUMBER,
|
||||
INPUT_AQUIFER_NUMBER,
|
||||
INPUT_VECTOR_NAME,
|
||||
INPUT_ID
|
||||
};
|
||||
}; // namespace RifEclipseSummaryAddressDefines
|
||||
@@ -134,30 +134,17 @@ QString RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( const QSt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseSummaryTools::dumpMetaData( RifSummaryReaderInterface* readerEclipseSummary )
|
||||
{
|
||||
const std::set<RifEclipseSummaryAddress>& addresses = readerEclipseSummary->allResultAddresses();
|
||||
const auto addresses = readerEclipseSummary->allResultAddresses();
|
||||
|
||||
for ( int category = 0; category < RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR; category++ )
|
||||
for ( const auto& catAddresse : addresses )
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory categoryEnum = RifEclipseSummaryAddress::SummaryVarCategory( category );
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> catAddresses = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, categoryEnum );
|
||||
|
||||
if ( !catAddresses.empty() )
|
||||
{
|
||||
std::cout << caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::uiText( categoryEnum ).toStdString()
|
||||
<< " count : " << catAddresses.size() << std::endl;
|
||||
|
||||
for ( const auto& catAddresse : catAddresses )
|
||||
{
|
||||
std::cout << catAddresse.vectorName() << " " << catAddresse.regionNumber() << " " << catAddresse.regionNumber2() << " "
|
||||
<< catAddresse.groupName() << " " << catAddresse.wellName() << " " << catAddresse.wellSegmentNumber() << " "
|
||||
<< catAddresse.lgrName() << " " << catAddresse.cellI() << " " << catAddresse.cellJ() << " " << catAddresse.cellK()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << catAddresse.vectorName() << " " << catAddresse.regionNumber() << " " << catAddresse.regionNumber2() << " "
|
||||
<< catAddresse.groupName() << " " << catAddresse.wellName() << " " << catAddresse.wellSegmentNumber() << " "
|
||||
<< catAddresse.lgrName() << " " << catAddresse.cellI() << " " << catAddresse.cellJ() << " " << catAddresse.cellK()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "ert/ecl/ecl_sum.hpp"
|
||||
|
||||
|
||||
@@ -166,9 +166,10 @@ bool RifEclipseUserDataKeywordTools::isYearX( const std::string& identifier )
|
||||
RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( const std::string quantityName,
|
||||
const std::vector<std::string>& columnHeaderText )
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( quantityName );
|
||||
RifEclipseSummaryAddressDefines::SummaryVarCategory category =
|
||||
RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( quantityName );
|
||||
|
||||
if ( category == RifEclipseSummaryAddress::SUMMARY_INVALID )
|
||||
if ( category == RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_INVALID )
|
||||
{
|
||||
return RifEclipseSummaryAddress::importedAddress( quantityName );
|
||||
}
|
||||
@@ -189,9 +190,9 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
|
||||
switch ( category )
|
||||
{
|
||||
case RifEclipseSummaryAddress::SUMMARY_FIELD:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_FIELD:
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_AQUIFER:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_AQUIFER:
|
||||
{
|
||||
if ( columnHeaderText.size() > 0 )
|
||||
{
|
||||
@@ -199,11 +200,11 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RifEclipseSummaryAddress::SUMMARY_NETWORK:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_NETWORK:
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_MISC:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_MISC:
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_REGION:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_REGION:
|
||||
{
|
||||
if ( columnHeaderText.size() > 0 )
|
||||
{
|
||||
@@ -211,9 +212,9 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_REGION_2_REGION:
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_GROUP:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_GROUP:
|
||||
{
|
||||
if ( columnHeaderText.size() > 0 )
|
||||
{
|
||||
@@ -221,7 +222,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL:
|
||||
{
|
||||
if ( columnHeaderText.size() > 0 )
|
||||
{
|
||||
@@ -229,7 +230,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_COMPLETION:
|
||||
{
|
||||
if ( columnHeaderText.size() > 1 )
|
||||
{
|
||||
@@ -240,14 +241,14 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_LGR:
|
||||
if ( columnHeaderText.size() > 1 )
|
||||
{
|
||||
wellName = columnHeaderText[0];
|
||||
lgrName = columnHeaderText[1];
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_COMPLETION_LGR:
|
||||
if ( columnHeaderText.size() > 2 )
|
||||
{
|
||||
wellName = columnHeaderText[0];
|
||||
@@ -256,20 +257,20 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
RifEclipseUserDataKeywordTools::extractThreeInts( &cellI, &cellJ, &cellK, columnHeaderText[2] );
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_SEGMENT:
|
||||
if ( columnHeaderText.size() > 1 )
|
||||
{
|
||||
wellName = columnHeaderText[0];
|
||||
wellSegmentNumber = RiaStdStringTools::toInt( columnHeaderText[1] );
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_BLOCK:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_BLOCK:
|
||||
if ( columnHeaderText.size() > 0 )
|
||||
{
|
||||
RifEclipseUserDataKeywordTools::extractThreeInts( &cellI, &cellJ, &cellK, columnHeaderText[0] );
|
||||
}
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_BLOCK_LGR:
|
||||
if ( columnHeaderText.size() > 1 )
|
||||
{
|
||||
lgrName = columnHeaderText[0];
|
||||
|
||||
@@ -111,5 +111,6 @@ RiaDefines::EclipseUnitSystem RifEnsembleStatisticsReader::unitSystem() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEnsembleStatisticsReader::validateAddress( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
return address.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS && !address.vectorName().empty();
|
||||
return address.category() == RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_ENSEMBLE_STATISTICS &&
|
||||
!address.vectorName().empty();
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
class RimEnsembleStatisticsCase;
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
|
||||
@@ -45,9 +45,9 @@ RifReaderObservedData::~RifReaderObservedData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderObservedData::open( const QString& headerFileName,
|
||||
const QString& identifierName,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory summaryCategory )
|
||||
bool RifReaderObservedData::open( const QString& headerFileName,
|
||||
const QString& identifierName,
|
||||
RifEclipseSummaryAddressDefines::SummaryVarCategory summaryCategory )
|
||||
{
|
||||
AsciiDataParseOptions parseOptions;
|
||||
parseOptions.dateFormat = "yyyy-MM-dd";
|
||||
@@ -154,9 +154,9 @@ std::vector<time_t> RifReaderObservedData::timeSteps( const RifEclipseSummaryAdd
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifReaderObservedData::address( const QString& vectorName,
|
||||
const QString& identifierName,
|
||||
RifEclipseSummaryAddress::SummaryVarCategory summaryCategory )
|
||||
RifEclipseSummaryAddress RifReaderObservedData::address( const QString& vectorName,
|
||||
const QString& identifierName,
|
||||
RifEclipseSummaryAddressDefines::SummaryVarCategory summaryCategory )
|
||||
{
|
||||
std::string stdVectorName = vectorName.toStdString();
|
||||
int regionNumber( -1 );
|
||||
@@ -175,13 +175,13 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString&
|
||||
|
||||
switch ( summaryCategory )
|
||||
{
|
||||
case RifEclipseSummaryAddress::SUMMARY_GROUP:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_GROUP:
|
||||
groupName = identifierName.toStdString();
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL:
|
||||
wellName = identifierName.toStdString();
|
||||
break;
|
||||
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
|
||||
case RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL_LGR:
|
||||
lgrName = identifierName.toStdString();
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
RifReaderObservedData();
|
||||
~RifReaderObservedData() override;
|
||||
|
||||
bool open( const QString& headerFileName, const QString& identifierName, RifEclipseSummaryAddress::SummaryVarCategory summaryCategory );
|
||||
bool open( const QString& headerFileName, const QString& identifierName, RifEclipseSummaryAddressDefines::SummaryVarCategory summaryCategory );
|
||||
|
||||
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
|
||||
@@ -52,8 +52,9 @@ public:
|
||||
RiaDefines::EclipseUnitSystem unitSystem() const override;
|
||||
|
||||
private:
|
||||
RifEclipseSummaryAddress
|
||||
address( const QString& vectorName, const QString& identifierName, RifEclipseSummaryAddress::SummaryVarCategory summaryCategory );
|
||||
RifEclipseSummaryAddress address( const QString& vectorName,
|
||||
const QString& identifierName,
|
||||
RifEclipseSummaryAddressDefines::SummaryVarCategory summaryCategory );
|
||||
|
||||
private:
|
||||
std::unique_ptr<RifCsvUserDataParser> m_asciiParser;
|
||||
|
||||
@@ -52,7 +52,9 @@ RifRevealCsvSectionSummaryReader::~RifRevealCsvSectionSummaryReader()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifRevealCsvSectionSummaryReader::parse( const QString& text, RifEclipseSummaryAddress::SummaryVarCategory defaultCategory, QString* errorText )
|
||||
bool RifRevealCsvSectionSummaryReader::parse( const QString& text,
|
||||
RifEclipseSummaryAddressDefines::SummaryVarCategory defaultCategory,
|
||||
QString* errorText )
|
||||
{
|
||||
m_allResultAddresses.clear();
|
||||
m_mapFromAddressToResultIndex.clear();
|
||||
@@ -80,7 +82,7 @@ bool RifRevealCsvSectionSummaryReader::parse( const QString& text, RifEclipseSum
|
||||
{ "1000Sm3/d", { "SM3/DAY", 1000.0 } },
|
||||
{ "MSm3", { "SM3", 1000000.0 } } };
|
||||
|
||||
QString prefix = defaultCategory == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_FIELD ? "F" : "W";
|
||||
QString prefix = defaultCategory == RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_FIELD ? "F" : "W";
|
||||
|
||||
std::map<QString, QString> nameMapping = { { "WaterCut", prefix + "WCT" }, { "GOR", prefix + "GOR" },
|
||||
{ "BottomHolePressure", prefix + "BHP" }, { "CumLiquidInjected", prefix + "LIT" },
|
||||
|
||||
@@ -35,5 +35,5 @@ public:
|
||||
RifRevealCsvSectionSummaryReader();
|
||||
~RifRevealCsvSectionSummaryReader() override;
|
||||
|
||||
bool parse( const QString& fileName, RifEclipseSummaryAddress::SummaryVarCategory defaultCategory, QString* errorText = nullptr );
|
||||
bool parse( const QString& fileName, RifEclipseSummaryAddressDefines::SummaryVarCategory defaultCategory, QString* errorText = nullptr );
|
||||
};
|
||||
|
||||
@@ -66,8 +66,8 @@ std::pair<bool, QString> RifRevealCsvSummaryReader::parse( const QString& fileNa
|
||||
cvf::ref<RifRevealCsvSectionSummaryReader> sectionReader = new RifRevealCsvSectionSummaryReader;
|
||||
|
||||
// The first part is field data, and the rest is well data
|
||||
auto defaultCategory = isFirst ? RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_FIELD
|
||||
: RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL;
|
||||
auto defaultCategory = isFirst ? RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_FIELD
|
||||
: RifEclipseSummaryAddressDefines::SummaryVarCategory::SUMMARY_WELL;
|
||||
|
||||
QString errorMessage;
|
||||
if ( !sectionReader->parse( p, defaultCategory, &errorMessage ) )
|
||||
|
||||
Reference in New Issue
Block a user