mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-01 08:38:00 -06:00
Refactor: improve interface for finding intersecting cells.
This commit is contained in:
1 parent
ffa117e736
commit
544e6974e7
29 files changed
+75
-105
No files matched your search
@@ -169,19 +169,20 @@ size_t RigFemPartCollection::globalElementIndex( int partId, size_t localIndex )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Find intersecting global element indexes for a given bounding box
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartCollection::findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB,
|
||||
std::vector<size_t>* intersectedGlobalElementIndices ) const
|
||||
std::vector<size_t> RigFemPartCollection::findIntersectingGlobalElementIndices( const cvf::BoundingBox& intersectingBB ) const
|
||||
{
|
||||
std::vector<size_t> intersectedGlobalElementIndices;
|
||||
for ( const auto& part : m_femParts )
|
||||
{
|
||||
std::vector<size_t> foundElements;
|
||||
part->findIntersectingElementIndices( intersectingBB, &foundElements );
|
||||
std::vector<size_t> foundElements = part->findIntersectingElementIndices( intersectingBB );
|
||||
for ( const auto& foundElement : foundElements )
|
||||
{
|
||||
const size_t globalIdx = globalElementIndex( part->elementPartId(), foundElement );
|
||||
intersectedGlobalElementIndices->push_back( globalIdx );
|
||||
intersectedGlobalElementIndices.push_back( globalIdx );
|
||||
}
|
||||
}
|
||||
|
||||
return intersectedGlobalElementIndices;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -193,8 +194,7 @@ int RigFemPartCollection::getPartIndexFromPoint( const cvf::Vec3d& point ) const
|
||||
|
||||
// Find candidates for intersected global elements
|
||||
const cvf::BoundingBox intersectingBb( point, point );
|
||||
std::vector<size_t> intersectedGlobalElementIndexCandidates;
|
||||
findIntersectingGlobalElementIndices( intersectingBb, &intersectedGlobalElementIndexCandidates );
|
||||
std::vector<size_t> intersectedGlobalElementIndexCandidates = findIntersectingGlobalElementIndices( intersectingBb );
|
||||
|
||||
if ( intersectedGlobalElementIndexCandidates.empty() ) return idx;
|
||||
|
||||
|
||||
Reference in new issue
Block a user