///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2022- 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RifRftSegment.h" #include #include //-------------------------------------------------------------------------------------------------- /// segnxt : Int ID for the next segment /// brno : Branch ID number /// brnst : Branch ID number for start of segment /// brnen : Branch ID number for end of segment /// segNo : Segment ID number /// //-------------------------------------------------------------------------------------------------- RifRftSegmentData::RifRftSegmentData( int segnxt, int brno, int brnst, int brnen, int segNo ) : m_segNext( segnxt ) , m_segbrno( brno ) , m_brnst( brnst ) , m_brnen( brnen ) , m_segmentNo( segNo ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RifRftSegmentData::segNext() const { return m_segNext; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RifRftSegmentData::segBrno() const { return m_segbrno; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RifRftSegmentData::segBrnst() const { return m_brnst; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RifRftSegmentData::segBrnen() const { return m_brnen; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RifRftSegmentData::segNo() const { return m_segmentNo; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RifRftSegment::setSegmentData( std::vector segmentData ) { m_topology = segmentData; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RifRftSegment::topology() const { return m_topology; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RifRftSegment::addResultNameAndSize( const Opm::EclIO::EclFile::EclEntry& resultNameAndSize ) { m_resultNameAndSize.push_back( resultNameAndSize ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RifRftSegment::resultNameAndSize() const { return m_resultNameAndSize; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RifRftSegment::branchIds() const { std::unordered_set s; for ( const auto& segData : m_topology ) { s.insert( segData.segBrno() ); } std::vector v; v.assign( s.begin(), s.end() ); std::sort( v.begin(), v.end() ); return v; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RifRftSegment::indicesForBranchNumber( int branchNumber ) const { std::vector v; for ( size_t i = 0; i < m_topology.size(); i++ ) { auto segment = m_topology[i]; if ( branchNumber <= 0 || segment.segBrno() == branchNumber ) { v.push_back( i ); } } return v; }