Fix T36769: fluid sim modifier can crash blender
authorDaniel Genrich <daniel.genrich@gmx.net>
Wed, 5 Feb 2014 14:30:10 +0000 (15:30 +0100)
committerDaniel Genrich <daniel.genrich@gmx.net>
Wed, 5 Feb 2014 14:37:38 +0000 (15:37 +0100)
Crash only happened when the number of openmp threads were greater than the resolution.

intern/elbeem/intern/solver_init.cpp

index 4c398ab9cb4d65af64a0f5adf79e2b366398a0b3..fcb9cbf937c351971e2980f72b422bb4a4902556 100644 (file)
@@ -799,6 +799,15 @@ bool LbmFsgrSolver::initializeSolverMemory()
                mLevel[i].avgOmegaCnt = 0.0;
        }
 
+       /*
+       // DG: this would be the correct sanity check, not the "hack below" */
+       // if(( mSizey / mNumOMPThreads) * mNumOMPThreads != mSizey) {
+               // setNumOMPThreads();
+       //}
+       if( mSizey < mNumOMPThreads ) {
+               setNumOMPThreads(mSizey);
+       }
+
        // init sizes
        mLevel[mMaxRefine].lSizex = mSizex;
        mLevel[mMaxRefine].lSizey = mSizey;