msvc: Use source folder structure for project file.
[blender.git] / intern / elbeem / intern / solver_init.cpp
index 63ce1570eea083fea8f7d768dcff6e488c98cce8..8b962d604cf8532dcce9057273805b96f4377928 100644 (file)
@@ -685,13 +685,16 @@ bool LbmFsgrSolver::initializeSolverMemory()
                if(firstMInit) {
                        mrSetup();
                }
+#else
+               (void)firstMInit;
 #endif // LBM_INCLUDE_TESTSOLVERS==1
                firstMInit=false;
 
                calculateMemreqEstimate( mSizex, mSizey, mSizez, 
                                mMaxRefine, mFarFieldSize, &memEstFromFunc, &memEstFine, &memreqStr );
                
-               double memLimit;
+               bool noLimit = false;
+               double memLimit = 0.;
                string memLimStr("-");
                if(sizeof(void*)==4) {
                        // 32bit system, limit to 2GB
@@ -699,8 +702,9 @@ bool LbmFsgrSolver::initializeSolverMemory()
                        memLimStr = string("2GB");
                } else {
                        // 64bit, just take 16GB as limit for now...
-                       memLimit = 16.0* 1024.0*1024.0*1024.0;
-                       memLimStr = string("16GB");
+                       // memLimit = 16.0* 1024.0*1024.0*1024.0;
+                       // memLimStr = string("16GB");
+                       noLimit = true;
                }
 
                // restrict max. chunk of 1 mem block to 1GB for windos
@@ -724,7 +728,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
                        memBlockAllocProblem = true;
                }
 
-               if(memEstFromFunc>memLimit || memBlockAllocProblem) {
+               if(!noLimit && (memEstFromFunc>memLimit || memBlockAllocProblem)) {
                        sizeReduction *= 0.9;
                        mSizex = (int)(orgSx * sizeReduction);
                        mSizey = (int)(orgSy * sizeReduction);
@@ -797,6 +801,17 @@ bool LbmFsgrSolver::initializeSolverMemory()
                mLevel[i].avgOmegaCnt = 0.0;
        }
 
+#if PARALLEL == 1
+       /*
+       // DG: this would be the correct sanity check, not the "hack below" */
+       // if(( mSizey / mNumOMPThreads) * mNumOMPThreads != mSizey) {
+               // setNumOMPThreads();
+       //}
+       if( mSizey < mNumOMPThreads ) {
+               setNumOMPThreads(mSizey);
+       }
+#endif
+
        // init sizes
        mLevel[mMaxRefine].lSizex = mSizex;
        mLevel[mMaxRefine].lSizey = mSizey;
@@ -1338,13 +1353,13 @@ bool LbmFsgrSolver::initializeSolverPostinit() {
                                } } \
                                if(ntype&(CFBndFreeslip)) { \
                                        const LbmFloat dp=dot(objvel, vec2L((*pNormals)[n]) ); \
-                                       const LbmVec oldov=objvel; /*DEBUG*/ \
+                                       /* const LbmVec oldov=objvel; */ /*DEBUG*/ \
                                        objvel = vec2L((*pNormals)[n]) *dp; \
                                        /* if((j==24)&&(n%5==2)) errMsg("FSBT","n"<<n<<" v"<<objvel<<" nn"<<(*pNormals)[n]<<" dp"<<dp<<" oldov"<<oldov ); */ \
                                } \
                                else if(ntype&(CFBndPartslip)) { \
                                        const LbmFloat dp=dot(objvel, vec2L((*pNormals)[n]) ); \
-                                       const LbmVec oldov=objvel; /*DEBUG*/ \
+                                       /* const LbmVec oldov=objvel; */ /*DEBUG*/ \
                                        /* if((j==24)&&(n%5==2)) errMsg("FSBT","n"<<n<<" v"<<objvel<<" nn"<<(*pNormals)[n]<<" dp"<<dp<<" oldov"<<oldov ); */ \
                                        const LbmFloat partv = mObjectPartslips[OId]; \
                                        /*errMsg("PARTSLIP_DEBUG","l="<<l<<" ccel="<<RAC(ccel, dfInv[l] )<<" partv="<<partv<<",id="<<(int)(mnbf>>24)<<" newval="<<newval ); / part slip debug */ \