mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
RFT: Add connection data as segment results
This commit is contained in:
parent
418c4df7b3
commit
b6973a3644
@ -124,6 +124,36 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto
|
||||
auto key = std::make_pair( wellName, RftDate{ y, m, d } );
|
||||
auto segment = m_rftWellDateSegments[key];
|
||||
|
||||
if ( resultName.find( "CON" ) == 0 )
|
||||
{
|
||||
// Connection results with size equal to length of result CONSEGNO. CONSEGNO defines the segment
|
||||
// numbers the connection is connected to.
|
||||
|
||||
const std::string consegResultName = "CONSEGNO";
|
||||
auto connnectionSegmentNumbers = m_opm_rft->getRft<int>( consegResultName, wellName, y, m, d );
|
||||
if ( connnectionSegmentNumbers.empty() ) return;
|
||||
|
||||
auto segmentNumbers = segment.segmentNumbersForBranchIndex( rftAddress.segmentBranchIndex(),
|
||||
rftAddress.segmentBranchType() );
|
||||
|
||||
size_t resultDataIndex = 0;
|
||||
for ( int segmentNumber : segmentNumbers )
|
||||
{
|
||||
if ( std::find( connnectionSegmentNumbers.begin(), connnectionSegmentNumbers.end(), segmentNumber ) !=
|
||||
connnectionSegmentNumbers.end() )
|
||||
{
|
||||
values->push_back( data[resultDataIndex++] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The number of values must be equal to the number of segments, use infinity for segments
|
||||
// with no data
|
||||
values->push_back( std::numeric_limits<double>::infinity() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto indices =
|
||||
segment.indicesForBranchIndex( rftAddress.segmentBranchIndex(), rftAddress.segmentBranchType() );
|
||||
for ( const auto& i : indices )
|
||||
@ -132,6 +162,7 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto
|
||||
values->push_back( data[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
values->insert( values->end(), data.begin(), data.end() );
|
||||
@ -356,14 +387,8 @@ void RifReaderOpmRft::buildMetaData()
|
||||
|
||||
m_rftSegmentTimeSteps.insert( dt );
|
||||
|
||||
auto segmentCount = segmentData.topology().size();
|
||||
|
||||
for ( const auto& resultNameAndSize : resultNameAndSizes )
|
||||
{
|
||||
auto resultValueCount = std::get<2>( resultNameAndSize );
|
||||
|
||||
if ( static_cast<size_t>( resultValueCount ) != segmentCount ) continue;
|
||||
|
||||
auto resultName = std::get<0>( resultNameAndSize );
|
||||
auto adr = RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ),
|
||||
dt,
|
||||
@ -441,7 +466,7 @@ void RifReaderOpmRft::buildSegmentData()
|
||||
for ( const auto& rftResultMetaData : arraysAtWellDate )
|
||||
{
|
||||
auto [name, arrayType, size] = rftResultMetaData;
|
||||
if ( name.find( "SEG" ) == 0 )
|
||||
if ( ( name.find( "SEG" ) == 0 ) || ( name.find( "CON" ) == 0 ) )
|
||||
{
|
||||
segment.addResultNameAndSize( rftResultMetaData );
|
||||
}
|
||||
|
@ -285,3 +285,20 @@ std::vector<size_t> RifRftSegment::indicesForBranchIndex( int branchIndex, RiaDe
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RifRftSegment::segmentNumbersForBranchIndex( int oneBasedBranchIndex,
|
||||
RiaDefines::RftBranchType branchType ) const
|
||||
{
|
||||
std::vector<int> v;
|
||||
|
||||
auto indices = indicesForBranchIndex( oneBasedBranchIndex, branchType );
|
||||
for ( auto index : indices )
|
||||
{
|
||||
v.push_back( m_topology[index].segNo() );
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
std::vector<size_t> indicesForBranchNumber( int branchNumber ) const;
|
||||
std::vector<size_t> indicesForBranchIndex( int branchIndex, RiaDefines::RftBranchType branchType ) const;
|
||||
|
||||
std::vector<int> segmentNumbersForBranchIndex( int oneBasedBranchIndex, RiaDefines::RftBranchType branchType ) const;
|
||||
|
||||
private:
|
||||
std::vector<RifRftSegmentData> m_topology;
|
||||
std::vector<Opm::EclIO::EclFile::EclEntry> m_resultNameAndSize;
|
||||
|
Loading…
Reference in New Issue
Block a user