Elbeem: Use pragma directive instead of overriding number of omp threads
[blender.git] / intern / elbeem / intern / simulation_object.cpp
index 9e98adfc734f22f4cea760662cc4bb3b9428266c..99c3b170634c5f6c9ec271a7e270d6be69caa8db 100644 (file)
 //! lbm factory functions
 LbmSolverInterface* createSolver();
 
 //! lbm factory functions
 LbmSolverInterface* createSolver();
 
-#if PARALLEL==1
-static int omp_threadcache;
-#endif
-
 /******************************************************************************
  * Constructor
  *****************************************************************************/
 /******************************************************************************
  * Constructor
  *****************************************************************************/
@@ -71,10 +67,6 @@ SimulationObject::~SimulationObject()
        if(mpParam)          delete mpParam;
        if(mpParts)          delete mpParts;
        debMsgStd("SimulationObject",DM_MSG,"El'Beem Done!\n",10);
        if(mpParam)          delete mpParam;
        if(mpParts)          delete mpParts;
        debMsgStd("SimulationObject",DM_MSG,"El'Beem Done!\n",10);
-#if (PARALLEL == 1)
-       omp_set_num_threads(omp_threadcache);
-       printf("Resetting omp_threads to cached value %d \n", omp_threadcache);
-#endif
 }
 
 
 }
 
 
@@ -185,9 +177,7 @@ int SimulationObject::initializeLbmSimulation(ntlRenderGlobals *glob)
                mpLbm->setSmoothing(1.0 * mpElbeemSettings->surfaceSmoothing, 1.0 * mpElbeemSettings->surfaceSmoothing);
                mpLbm->setIsoSubdivs(mpElbeemSettings->surfaceSubdivs);
 #if PARALLEL==1
                mpLbm->setSmoothing(1.0 * mpElbeemSettings->surfaceSmoothing, 1.0 * mpElbeemSettings->surfaceSmoothing);
                mpLbm->setIsoSubdivs(mpElbeemSettings->surfaceSubdivs);
 #if PARALLEL==1
-               omp_threadcache = omp_get_max_threads();
-               omp_set_num_threads(mpElbeemSettings->threads);
-               printf("Setting omp_threads to usersetting %d \n", mpElbeemSettings->threads);
+               mpLbm->setNumOMPThreads(mpElbeemSettings->threads);
 #endif
                mpLbm->setSizeX(mpElbeemSettings->resolutionxyz);
                mpLbm->setSizeY(mpElbeemSettings->resolutionxyz);
 #endif
                mpLbm->setSizeX(mpElbeemSettings->resolutionxyz);
                mpLbm->setSizeY(mpElbeemSettings->resolutionxyz);