added some OpenMP for loops for the generation of samples

refs #1005

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@680 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Isaak Lim
2012-09-18 12:24:42 +00:00
parent 60774dbdfa
commit cddb183af5

View File

@@ -60,6 +60,10 @@
# include <cfloat>
#endif
#ifdef USE_OPENMP
#include <omp.h>
#endif
//== NAMESPACE ===============================================================
namespace OpenMesh {
@@ -110,6 +114,9 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
double bestEnergy = FLT_MAX;
// Generate random samples for collapses
#ifdef USE_OPENMP
#pragma omp parallel for shared(bestEnergy, bestHandle)
#endif
for ( unsigned int i = 0; i < randomSamples_; ++i) {
// Random halfedge handle
@@ -201,6 +208,9 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
// Generate random samples for collapses
unsigned int legalCollapses = 0;
#ifdef USE_OPENMP
#pragma omp parallel for shared(bestEnergy, bestHandle, legalCollapses)
#endif
for ( unsigned int i = 0; i < randomSamples_; ++i) {
// Random halfedge handle