mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Always compute bounding box of main grid and use OpenMP
This commit is contained in:
parent
5151717743
commit
661840f425
@ -288,6 +288,8 @@ void RigMainGrid::computeCachedData( std::string* aabbTreeInfo )
|
||||
*aabbTreeInfo += "Cells per bounding box : " + std::to_string( cellsPerBoundingBox ) + "\n";
|
||||
*aabbTreeInfo += m_cellSearchTree->info();
|
||||
}
|
||||
|
||||
computeBoundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -433,6 +435,35 @@ bool RigMainGrid::hasFaultWithName( const QString& name ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigMainGrid::computeBoundingBox()
|
||||
{
|
||||
m_boundingBox.reset();
|
||||
|
||||
const int numberOfThreads = RiaOpenMPTools::availableThreadCount();
|
||||
|
||||
std::vector<cvf::BoundingBox> threadBoundingBoxes( numberOfThreads );
|
||||
|
||||
#pragma omp parallel
|
||||
{
|
||||
int myThread = RiaOpenMPTools::currentThreadIndex();
|
||||
|
||||
// NB! We are inside a parallel section, do not use "parallel for" here
|
||||
#pragma omp for
|
||||
for ( long i = 0; i < static_cast<long>( m_nodes.size() ); i++ )
|
||||
{
|
||||
threadBoundingBoxes[myThread].add( m_nodes[i] );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < numberOfThreads; i++ )
|
||||
{
|
||||
m_boundingBox.add( threadBoundingBoxes[i] );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -943,13 +974,6 @@ void RigMainGrid::buildCellSearchTreeOptimized( size_t cellsPerBoundingBox )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RigMainGrid::boundingBox() const
|
||||
{
|
||||
if ( m_boundingBox.isValid() ) return m_boundingBox;
|
||||
|
||||
for ( const auto& node : m_nodes )
|
||||
{
|
||||
m_boundingBox.add( node );
|
||||
}
|
||||
|
||||
return m_boundingBox;
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,7 @@ private:
|
||||
void buildCellSearchTree();
|
||||
void buildCellSearchTreeOptimized( size_t cellsPerBoundingBox );
|
||||
bool hasFaultWithName( const QString& name ) const;
|
||||
void computeBoundingBox();
|
||||
|
||||
static std::array<double, 6> defaultMapAxes();
|
||||
|
||||
@ -133,7 +134,7 @@ private:
|
||||
|
||||
cvf::Vec3d m_displayModelOffset;
|
||||
cvf::ref<cvf::BoundingBoxTree> m_cellSearchTree;
|
||||
mutable cvf::BoundingBox m_boundingBox;
|
||||
cvf::BoundingBox m_boundingBox;
|
||||
|
||||
bool m_flipXAxis;
|
||||
bool m_flipYAxis;
|
||||
|
Loading…
Reference in New Issue
Block a user