lib_LTLIBRARIES=libTKMesh.la
+libTKMesh_la_CXXFLAGS = $(OPENMP_CXXFLAGS)
+
libTKMesh_la_LIBADD = \
../TKMath/libTKMath.la \
../TKernel/libTKernel.la \
../TKTopAlgo/libTKTopAlgo.la \
$(STLPort_LIB) $(CSF_TBB_LIB)
+# Work around an annoying bug in libtool, it removes -fopenmp flag when linking.
+# The downside is that --enable-openmp can be used only with GNU gcc
+if ENABLE_OPENMP
+libTKMesh_la_LIBADD += -lgomp
+endif
+
libTKMesh_la_SOURCES = \
@top_srcdir@/drv/BRepMesh/BRepMesh_Array1OfBiPoint_0.cxx \
@top_srcdir@/drv/BRepMesh/BRepMesh_Array1OfVertexOfDelaun_0.cxx \
fi
+: ${enable_openmp=no}
+AC_OPENMP
+AM_CONDITIONAL( ENABLE_OPENMP, [test "xyes" = "x$enable_openmp"] )
+
#---------------------------------------------------------------------
#
# Check for TBB Libraries
}
// mesh faces in parallel threads using TBB
-#ifdef HAVE_TBB
if (Standard::IsReentrant())
+ {
+#ifdef HAVE_TBB
tbb::parallel_for_each (aFaces.begin(), aFaces.end(), *this);
- else
+#else
+ int i, n = aFaces.size();
+#pragma omp parallel for private(i)
+ for (i = 0; i < n; ++i)
+ Process (aFaces[i]);
#endif
- for (std::vector<TopoDS_Face>::iterator it(aFaces.begin()); it != aFaces.end(); it++)
- Process (*it);
+ }
+ else
+ for (std::vector<TopoDS_Face>::iterator it(aFaces.begin()); it != aFaces.end(); it++)
+ Process (*it);
}
}
// mesh faces in parallel threads using TBB
-#ifdef HAVE_TBB
if (Standard::IsReentrant())
+ {
+#ifdef HAVE_TBB
tbb::parallel_for_each (aFaces.begin(), aFaces.end(), *myMesh.operator->());
- else
+#else
+ int i, n = aFaces.size();
+#pragma omp parallel for private(i)
+ for (i = 0; i < n; ++i)
+ myMesh->Process (aFaces[i]);
#endif
- for (std::vector<TopoDS_Face>::iterator it(aFaces.begin()); it != aFaces.end(); it++)
- myMesh->Process (*it);
+ }
+ else
+ for (std::vector<TopoDS_Face>::iterator it(aFaces.begin()); it != aFaces.end(); it++)
+ myMesh->Process (*it);
// maillage des edges non contenues dans les faces :
Standard_Real f, l, defedge;