Add ifdefs for OpenMP usage.

This commit is contained in:
Kristian Bendiksen committed 2020-09-14 21:46:27 +02:00
1 parent 81a93a80fd
commit 02944f4eca
4 files changed
+33 -5

No files matched your search

@@ -44,7 +44,10 @@
#include "cvfStructGridGeometryGenerator.h"
#include <algorithm>
#ifdef USE_OPENMP
#include <omp.h>
#endif
namespace caf
{
@@ -857,11 +860,20 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
}
}
}
#ifdef USE_OPENMP
std::vector<std::vector<std::vector<cvf::Vec4d>>> threadTriangles( omp_get_max_threads() );
#else
std::vector<std::vector<std::vector<cvf::Vec4d>>> threadTriangles( 1 );
#endif
#pragma omp parallel
{
#ifdef USE_OPENMP
int myThread = omp_get_thread_num();
#else
int myThread = 0;
#endif
threadTriangles[myThread].resize( std::max( (size_t)1, m_contourPolygons.size() ) );
#pragma omp for schedule( dynamic )