mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Show branch ID range in addition to branch index
This commit is contained in:
@@ -67,14 +67,6 @@ QString RiaDefines::segmentBranchNumberResultName()
|
|||||||
return "SegmentBranchNumber";
|
return "SegmentBranchNumber";
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RiaDefines::segmentOneBasedBranchIndexResultName()
|
|
||||||
{
|
|
||||||
return "SegmentOneBasedBranchIndex";
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
|
@@ -29,7 +29,6 @@ QString segmentNumberResultName();
|
|||||||
|
|
||||||
QString allBranches();
|
QString allBranches();
|
||||||
QString segmentBranchNumberResultName();
|
QString segmentBranchNumberResultName();
|
||||||
QString segmentOneBasedBranchIndexResultName();
|
|
||||||
|
|
||||||
enum class RftBranchType
|
enum class RftBranchType
|
||||||
{
|
{
|
||||||
|
@@ -98,15 +98,6 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ( rftAddress.segmentResultName() == RiaDefines::segmentOneBasedBranchIndexResultName() )
|
|
||||||
{
|
|
||||||
auto branchIndices = segment.oneBasedBranchIndices();
|
|
||||||
for ( const auto& branchNumber : branchIndices )
|
|
||||||
{
|
|
||||||
values->push_back( branchNumber );
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( resultName.empty() )
|
if ( resultName.empty() )
|
||||||
@@ -295,6 +286,25 @@ void RifReaderOpmRft::cellIndices( const RifEclipseRftAddress& rftAddress, std::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::map<int, int> RifReaderOpmRft::branchIdsAndOneBasedIndices( const QString& wellName, const QDateTime& timeStep )
|
||||||
|
{
|
||||||
|
int y = timeStep.date().year();
|
||||||
|
int m = timeStep.date().month();
|
||||||
|
int d = timeStep.date().day();
|
||||||
|
|
||||||
|
auto key = std::make_pair( wellName.toStdString(), RftDate{ y, m, d } );
|
||||||
|
if ( m_rftWellDateSegments.count( key ) > 0 )
|
||||||
|
{
|
||||||
|
auto segment = m_rftWellDateSegments[key];
|
||||||
|
return segment.branchIdsAndOneBasedBranchIndices();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -538,7 +548,8 @@ void RifReaderOpmRft::buildSegmentBranchTypes( const RftSegmentKey& segmentKey )
|
|||||||
// The device segment is connected to a segment on the tubing branch
|
// The device segment is connected to a segment on the tubing branch
|
||||||
//
|
//
|
||||||
// Annulus branch
|
// Annulus branch
|
||||||
// Layer between device branch and reservoir. The segment connection data is imported from WSEGLINK in the data deck
|
// Layer between device branch and reservoir. The segment connection data is imported from WSEGLINK in the data
|
||||||
|
// deck
|
||||||
|
|
||||||
auto wellName = segmentKey.first;
|
auto wellName = segmentKey.first;
|
||||||
auto date = segmentKey.second;
|
auto date = segmentKey.second;
|
||||||
|
@@ -53,6 +53,8 @@ public:
|
|||||||
|
|
||||||
void cellIndices( const RifEclipseRftAddress& rftAddress, std::vector<caf::VecIjk>* indices ) override;
|
void cellIndices( const RifEclipseRftAddress& rftAddress, std::vector<caf::VecIjk>* indices ) override;
|
||||||
|
|
||||||
|
std::map<int, int> branchIdsAndOneBasedIndices( const QString& wellName, const QDateTime& timeStep );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Segment data
|
// Segment data
|
||||||
// RftDate must be synced with definition in Opm::EclIO::ERft::RftDate
|
// RftDate must be synced with definition in Opm::EclIO::ERft::RftDate
|
||||||
|
@@ -149,21 +149,6 @@ std::vector<int> RifRftSegment::branchIds() const
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::set<int> RifRftSegment::oneBasedBranchIndices() const
|
|
||||||
{
|
|
||||||
std::set<int> indices;
|
|
||||||
|
|
||||||
for ( auto b : m_oneBasedBranchIndexMap )
|
|
||||||
{
|
|
||||||
indices.insert( b.second );
|
|
||||||
}
|
|
||||||
|
|
||||||
return indices;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -174,6 +159,14 @@ int RifRftSegment::oneBasedBranchIndexForBranchId( int branchId ) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::map<int, int> RifRftSegment::branchIdsAndOneBasedBranchIndices() const
|
||||||
|
{
|
||||||
|
return m_oneBasedBranchIndexMap;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@@ -55,10 +55,11 @@ public:
|
|||||||
void addResultNameAndSize( const Opm::EclIO::EclFile::EclEntry& resultNameAndSize );
|
void addResultNameAndSize( const Opm::EclIO::EclFile::EclEntry& resultNameAndSize );
|
||||||
std::vector<Opm::EclIO::EclFile::EclEntry> resultNameAndSize() const;
|
std::vector<Opm::EclIO::EclFile::EclEntry> resultNameAndSize() const;
|
||||||
|
|
||||||
std::vector<int> tubingBranchIds() const;
|
std::vector<int> tubingBranchIds() const;
|
||||||
std::vector<int> branchIds() const;
|
std::vector<int> branchIds() const;
|
||||||
std::set<int> oneBasedBranchIndices() const;
|
int oneBasedBranchIndexForBranchId( int branchId ) const;
|
||||||
int oneBasedBranchIndexForBranchId( int branchId ) const;
|
std::map<int, int> branchIdsAndOneBasedBranchIndices() const;
|
||||||
|
|
||||||
const RifRftSegmentData* segmentData( int segmentNumber ) const;
|
const RifRftSegmentData* segmentData( int segmentNumber ) const;
|
||||||
|
|
||||||
void createDeviceBranch( int deviceBranchFirstSegmentNumber, int oneBasedBranchIndex );
|
void createDeviceBranch( int deviceBranchFirstSegmentNumber, int oneBasedBranchIndex );
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "RifReaderRftInterface.h"
|
#include "RifReaderRftInterface.h"
|
||||||
|
|
||||||
|
#include "RifReaderOpmRft.h"
|
||||||
#include "cafPdmUiItem.h"
|
#include "cafPdmUiItem.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -144,26 +145,36 @@ QList<caf::PdmOptionItemInfo> RimRftTools::segmentBranchIndexOptions( RifReaderR
|
|||||||
const QString& wellName,
|
const QString& wellName,
|
||||||
const QDateTime& timeStep )
|
const QDateTime& timeStep )
|
||||||
{
|
{
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
auto opmReader = dynamic_cast<RifReaderOpmRft*>( readerRft );
|
||||||
|
if ( opmReader )
|
||||||
options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), -1 ) );
|
|
||||||
|
|
||||||
if ( readerRft )
|
|
||||||
{
|
{
|
||||||
std::vector<double> values;
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), -1 ) );
|
||||||
|
|
||||||
auto adr = RifEclipseRftAddress::createSegmentAddress( wellName,
|
auto branchIdIndex = opmReader->branchIdsAndOneBasedIndices( wellName, timeStep );
|
||||||
timeStep,
|
|
||||||
RiaDefines::segmentOneBasedBranchIndexResultName() );
|
|
||||||
|
|
||||||
readerRft->values( adr, &values );
|
std::set<int> indices;
|
||||||
for ( const auto& v : values )
|
for ( auto b : branchIdIndex )
|
||||||
{
|
{
|
||||||
int intValue = v;
|
indices.insert( b.second );
|
||||||
auto txt = QString::number( intValue );
|
|
||||||
options.push_back( caf::PdmOptionItemInfo( txt, intValue ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for ( auto i : indices )
|
||||||
|
{
|
||||||
|
std::vector<int> branchIds;
|
||||||
|
for ( auto b : branchIdIndex )
|
||||||
|
{
|
||||||
|
if ( b.second == i ) branchIds.push_back( b.first );
|
||||||
|
}
|
||||||
|
|
||||||
|
auto minMax = std::minmax_element( branchIds.begin(), branchIds.end() );
|
||||||
|
|
||||||
|
auto txt = QString( "%1 (%2-%3)" ).arg( i ).arg( *minMax.first ).arg( *minMax.second );
|
||||||
|
options.push_back( caf::PdmOptionItemInfo( txt, i ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
return options;
|
return {};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user