mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5915 improve performance of NNC computation and limit to active cells
This commit is contained in:
@@ -25,11 +25,48 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigConnection::RigConnection()
|
||||
: m_c1GlobIdx( cvf::UNDEFINED_SIZE_T )
|
||||
, m_c1Face( cvf::StructGridInterface::NO_FACE )
|
||||
, m_c2GlobIdx( cvf::UNDEFINED_SIZE_T )
|
||||
, m_c1Face( cvf::StructGridInterface::NO_FACE )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigConnection::RigConnection( size_t c1GlobIdx,
|
||||
size_t c2GlobIdx,
|
||||
cvf::StructGridInterface::FaceType c1Face,
|
||||
const std::vector<cvf::Vec3d>& polygon )
|
||||
: m_c1GlobIdx( c1GlobIdx )
|
||||
, m_c2GlobIdx( c2GlobIdx )
|
||||
, m_c1Face( c1Face )
|
||||
, m_polygon( polygon )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigConnection::RigConnection( const RigConnection& rhs )
|
||||
: m_c1GlobIdx( rhs.m_c1GlobIdx )
|
||||
, m_c2GlobIdx( rhs.m_c2GlobIdx )
|
||||
, m_c1Face( rhs.m_c1Face )
|
||||
, m_polygon( rhs.m_polygon )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigConnection& RigConnection::operator=( RigConnection& rhs )
|
||||
{
|
||||
m_c1GlobIdx = rhs.m_c1GlobIdx;
|
||||
m_c2GlobIdx = rhs.m_c2GlobIdx;
|
||||
m_c1Face = rhs.m_c1Face;
|
||||
m_polygon = rhs.m_polygon;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -37,3 +74,95 @@ bool RigConnection::hasCommonArea() const
|
||||
{
|
||||
return m_polygon.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigConnection::operator<( const RigConnection& other ) const
|
||||
{
|
||||
if ( m_c1GlobIdx != other.m_c1GlobIdx )
|
||||
{
|
||||
return m_c1GlobIdx < other.m_c1GlobIdx;
|
||||
}
|
||||
|
||||
return ( m_c2GlobIdx < other.m_c2GlobIdx );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigConnection RigConnectionContainer::operator[]( size_t i ) const
|
||||
{
|
||||
const auto& globIndices = m_globalIndices[i];
|
||||
return RigConnection( globIndices.first, globIndices.second, m_faces[i], m_polygons[i] );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<size_t, size_t>& RigConnectionContainer::indexPair( size_t i )
|
||||
{
|
||||
return m_globalIndices[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::StructGridInterface::FaceType& RigConnectionContainer::face( size_t i )
|
||||
{
|
||||
return m_faces[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3d>& RigConnectionContainer::polygon( size_t i )
|
||||
{
|
||||
return m_polygons[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigConnectionContainer::push_back( const RigConnection& connection )
|
||||
{
|
||||
m_globalIndices.push_back( std::make_pair( connection.m_c1GlobIdx, connection.m_c2GlobIdx ) );
|
||||
m_faces.push_back( connection.m_c1Face );
|
||||
m_polygons.push_back( connection.m_polygon );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigConnectionContainer::insert( const RigConnectionContainer& other )
|
||||
{
|
||||
m_globalIndices.insert( m_globalIndices.end(), other.m_globalIndices.begin(), other.m_globalIndices.end() );
|
||||
m_faces.insert( m_faces.end(), other.m_faces.begin(), other.m_faces.end() );
|
||||
m_polygons.insert( m_polygons.end(), other.m_polygons.begin(), other.m_polygons.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigConnectionContainer::size() const
|
||||
{
|
||||
return m_globalIndices.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigConnectionContainer::clear()
|
||||
{
|
||||
m_globalIndices.clear();
|
||||
m_faces.clear();
|
||||
m_polygons.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigConnectionContainer::empty() const
|
||||
{
|
||||
return m_globalIndices.empty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user