← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3922: Fix compilation with clang, when openmp is switched off.

 

------------------------------------------------------------
revno: 3922
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Tue 2014-04-15 16:45:52 +0200
message:
  Fix compilation with clang, when openmp is switched off.
modified:
  py/wrapper/yadeWrapper.cpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'py/wrapper/yadeWrapper.cpp'
--- py/wrapper/yadeWrapper.cpp	2014-03-31 16:18:51 +0000
+++ py/wrapper/yadeWrapper.cpp	2014-04-15 14:45:52 +0000
@@ -315,8 +315,8 @@
 			}
 			
 			//adapt position- and radii-informations and replace spheres from bpListTmp by clumps:
+			#ifdef YADE_OPENMP
 			omp_lock_t locker;
-			#ifdef YADE_OPENMP
 			omp_init_lock(&locker);//since bodies are created and deleted in following sections, it is neccessary to lock critical parts of the code (avoid seg fault)
 			#pragma omp parallel for schedule(dynamic) shared(locker)
 			for(int i=0; i<numReplaceTmp; i++) {
@@ -370,7 +370,9 @@
 					idsTmp[jj] = newSphere->id;
 				}
 				//cout << "thread " << omp_get_thread_num() << " unsets locker" << endl;
+			  #ifdef YADE_OPENMP
 				omp_unset_lock(&locker);//end of critical section
+        #endif
 				Body::id_t newClumpId = clump(idsTmp, discretization);
 				ret.append(python::make_tuple(newClumpId,idsTmp));
 				erase(b->id);