diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 4f616bda428cf3944118d6fbd7879d211eb916f6..8daad2869e3af1e2e96c738ad8919949fd8ffbb5 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -619,7 +619,7 @@ bool MakeMeshConformal(GModel *gm, int howto) } } // HEX IS ONLY SURROUNED BY COMPATIBLE ELEMENTS - if (faces.size() == e->getNumFaces()){ + if ((int)faces.size() == e->getNumFaces()){ remainingHexes.push_back(e); } else { diff --git a/Mesh/delaunay3d.cpp b/Mesh/delaunay3d.cpp index 95b97a75213851da3567d8cc95e4bebea49c136b..a89dfef0995a6251ffca179a16bda7e69777c206 100644 --- a/Mesh/delaunay3d.cpp +++ b/Mesh/delaunay3d.cpp @@ -3,7 +3,7 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to the public mailing list <gmsh@onelab.info>. -#ifdef _OPENMP +#if defined(_OPENMP) #include <omp.h> #endif @@ -25,7 +25,7 @@ #include "MTetrahedron.h" #include "meshGRegionLocalMeshMod.h" -#ifdef _HAVE_NUMA +#if defined(_HAVE_NUMA) #include <numa.h> #endif @@ -914,7 +914,7 @@ void delaunayTrgl (const unsigned int numThreads, tetContainer &allocator, double threshold) { -#ifdef _VERBOSE +#if defined(_VERBOSE) double totSearchGlob=0; double totCavityGlob=0; #endif @@ -932,10 +932,12 @@ void delaunayTrgl (const unsigned int numThreads, maxLocSizeK = std::max(maxLocSizeK, s); } +#if defined(_OPENMP) #pragma omp parallel num_threads(numThreads) +#endif { -#ifdef _OPENMP +#if defined(_OPENMP) int myThread = omp_get_thread_num(); #else int myThread = 0; @@ -959,7 +961,7 @@ void delaunayTrgl (const unsigned int numThreads, for (unsigned int K=0;K<NPTS_AT_ONCE;K++){ locSizeK[K] = assignTo[K+myThread*NPTS_AT_ONCE].size(); locSize += locSizeK[K]; -#ifdef _HAVE_NUMA +#if defined(_HAVE_NUMA) allocatedVerts [K] = (Vertex*)numa_alloc_local (locSizeK[K]*sizeof(Vertex)); #else // allocatedVerts [K] = (Vertex*)calloc (locSizeK[K],sizeof(Vertex)); @@ -973,13 +975,18 @@ void delaunayTrgl (const unsigned int numThreads, std::vector<Vertex*> vToAdd(NPTS_AT_ONCE); +#if defined(_OPENMP) #pragma omp barrier +#endif + //////////////////////////////////////////////////////////////////////////////////// ////////////////////////// M A I N L O O P /////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// for (unsigned int iPGlob=0 ; iPGlob < maxLocSizeK; iPGlob++){ +#if defined(_OPENMP) #pragma omp barrier +#endif std::vector<Tet*> t(NPTS_AT_ONCE); // double c1 = Cpu(); // FIND SEEDS @@ -1020,8 +1027,9 @@ void delaunayTrgl (const unsigned int numThreads, // t3 += Cpu() - t1; +#if defined(_OPENMP) #pragma omp barrier - +#endif for (unsigned int K=0; K< NPTS_AT_ONCE; K++) { if (!vToAdd[K])ok[K]=false; else ok[K] = canWeProcessCavity (cavity[K], myThread, K); @@ -1063,14 +1071,18 @@ void delaunayTrgl (const unsigned int numThreads, } // t4 += Cpu() - t1; } -#ifdef _VERBOSE +#if defined(_VERBOSE) +#if defined(_OPENMP) #pragma omp critical +#endif { totCavityGlob+= totCavity; totSearchGlob+= totSearch; } #endif +#if defined(_OPENMP) #pragma omp barrier +#endif // clear last cavity for (unsigned int K=0; K< NPTS_AT_ONCE; K++) { for (unsigned int i=0; i<cavity[K].size(); i++)cavity[K][i]->unset(myThread,K); @@ -1085,7 +1097,7 @@ void delaunayTrgl (const unsigned int numThreads, // printf(" %12.5E %12.5E %12.5E tot %12.5E \n",t2,t3,t4,t2+t3+t4); -#ifdef _VERBOSE +#if defined(_VERBOSE) printf("average searches per point %12.5E\n",totSearchGlob/Npts); printf("average size for del cavity %12.5E\n",totCavityGlob/Npts); printf("cache misses: "); diff --git a/Mesh/delaunay3d_private.h b/Mesh/delaunay3d_private.h index 27a5785122daff9469ace364fff431175cdde0c5..077b66be8492f3e9d53fdf901965068939122ce1 100644 --- a/Mesh/delaunay3d_private.h +++ b/Mesh/delaunay3d_private.h @@ -3,14 +3,15 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to the public mailing list <gmsh@onelab.info>. -#ifndef _DELAUNAY3D_H_ -#define _DELAUNAY3D_H_ +#ifndef _DELAUNAY3D_PRIVATE_H_ +#define _DELAUNAY3D_PRIVATE_H_ + #include <vector> #include "SPoint3.h" #include <math.h> #include "robustPredicates.h" #include <stdio.h> -#ifdef _OPENMP +#if defined(_OPENMP) #include <omp.h> #endif @@ -293,9 +294,11 @@ class tetContainer { // FIXME !!! if (nbThreads != 1) throw; _perThread.resize(nbThreads); +#if defined(_OPENMP) #pragma omp parallel num_threads(nbThreads) +#endif { -#ifdef _OPENMP +#if defined(_OPENMP) int myThread = omp_get_thread_num(); #else int myThread = 0; @@ -317,9 +320,9 @@ typedef std::vector<conn> connContainer; void SortHilbert (std::vector<Vertex*>& v, std::vector<int> &indices); void computeAdjacencies (Tet *t, int iFace, connContainer &faceToTet); void __print (const char *name, int thread, tetContainer &T, Vertex *v = 0); -void delaunayTrgl (const unsigned int numThreads, - const unsigned int NPTS_AT_ONCE, - unsigned int Npts, +void delaunayTrgl (const unsigned int numThreads, + const unsigned int NPTS_AT_ONCE, + unsigned int Npts, std::vector<Vertex*> assignTo[], tetContainer &allocator, double threshold = 0.0); bool edgeSwap(Tet *tet, int iLocalEdge, tetContainer &T, int myThread);