Revision: 55567
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55567
Author:   genscher
Date:     2013-03-25 11:11:49 +0000 (Mon, 25 Mar 2013)
Log Message:
-----------
Bugfix [#34749] Fluid domain > 10GB crashes Blender - out of memory

I am unsure if I did catch all problematic code but I ran out of memorybefore 
the sim started ;)

Modified Paths:
--------------
    trunk/blender/intern/elbeem/intern/solver_class.h
    trunk/blender/intern/elbeem/intern/solver_init.cpp

Modified: trunk/blender/intern/elbeem/intern/solver_class.h
===================================================================
--- trunk/blender/intern/elbeem/intern/solver_class.h   2013-03-25 11:08:14 UTC 
(rev 55566)
+++ trunk/blender/intern/elbeem/intern/solver_class.h   2013-03-25 11:11:49 UTC 
(rev 55567)
@@ -765,19 +765,19 @@
 
 // lbm testsolver get index define, note - ignores is (set) as flag
 // array is only a single entry
-#define _LBMGI(level, ii,ij,ik, is) ( (mLevel[level].lOffsy*(ik)) + 
(mLevel[level].lOffsx*(ij)) + (ii) )
+#define _LBMGI(level, ii,ij,ik, is) ( 
(LONGINT)((LONGINT)mLevel[level].lOffsy*(LONGINT)(ik)) + 
((LONGINT)mLevel[level].lOffsx*(LONGINT)(ij)) + (LONGINT)(ii) )
 
 //! flag array acces macro
-#define _RFLAG(level,xx,yy,zz,set) mLevel[level].mprsFlags[set][ 
LBMGI((level),(xx),(yy),(zz),(set)) ]
-#define _RFLAG_NB(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ 
LBMGI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set)
 ]
-#define _RFLAG_NBINV(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ 
LBMGI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set)
 ]
+#define _RFLAG(level,xx,yy,zz,set) mLevel[level].mprsFlags[set][ 
(LONGINT)LBMGI((level),(xx),(yy),(zz),(set)) ]
+#define _RFLAG_NB(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ 
(LONGINT)LBMGI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set)
 ]
+#define _RFLAG_NBINV(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ 
(LONGINT)LBMGI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set)
 ]
 
 // array handling  
-----------------------------------------------------------------------------------------------
 
-#define _LBMQI(level, ii,ij,ik, is, lunused) ( (mLevel[level].lOffsy*(ik)) + 
(mLevel[level].lOffsx*(ij)) + (ii) )
-#define _QCELL(level,xx,yy,zz,set,l) (mLevel[level].mprsCells[(set)][ 
LBMQI((level),(xx),(yy),(zz),(set), l)*dTotalNum +(l)])
-#define _QCELL_NB(level,xx,yy,zz,set, dir,l) (mLevel[level].mprsCells[(set)][ 
LBMQI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set,
 l)*dTotalNum +(l)])
-#define _QCELL_NBINV(level,xx,yy,zz,set, dir,l) 
(mLevel[level].mprsCells[(set)][ 
LBMQI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set,
 l)*dTotalNum +(l)])
+#define _LBMQI(level, ii,ij,ik, is, lunused) ( 
(LONGINT)((LONGINT)mLevel[level].lOffsy*(LONGINT)(ik)) + 
(LONGINT)((LONGINT)mLevel[level].lOffsx*(LONGINT)(ij)) + (LONGINT)(ii) )
+#define _QCELL(level,xx,yy,zz,set,l) (mLevel[level].mprsCells[(set)][ 
(LONGINT)LBMQI((level),(xx),(yy),(zz),(set), l)*(LONGINT)dTotalNum 
+(LONGINT)(l)])
+#define _QCELL_NB(level,xx,yy,zz,set, dir,l) (mLevel[level].mprsCells[(set)][ 
(LONGINT)LBMQI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set,
 l)*dTotalNum +(l)])
+#define _QCELL_NBINV(level,xx,yy,zz,set, dir,l) 
(mLevel[level].mprsCells[(set)][ 
(LONGINT)LBMQI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set,
 l)*dTotalNum +(l)])
 
 #define QCELLSTEP dTotalNum
 #define _RACPNT(level, ii,ij,ik, is )  &QCELL(level,ii,ij,ik,is,0)

Modified: trunk/blender/intern/elbeem/intern/solver_init.cpp
===================================================================
--- trunk/blender/intern/elbeem/intern/solver_init.cpp  2013-03-25 11:08:14 UTC 
(rev 55566)
+++ trunk/blender/intern/elbeem/intern/solver_init.cpp  2013-03-25 11:11:49 UTC 
(rev 55567)
@@ -817,16 +817,16 @@
        mLevel[ mMaxRefine ].nodeSize = ((mvGeoEnd[0]-mvGeoStart[0]) / 
(LbmFloat)(mSizex));
        mLevel[ mMaxRefine ].simCellSize = mpParam->getCellSize();
        mLevel[ mMaxRefine ].lcellfactor = 1.0;
-       LONGINT rcellSize = 
((mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*mLevel[mMaxRefine].lSizez)
 *dTotalNum);
+       LONGINT rcellSize = 
(LONGINT)((LONGINT)((LONGINT)mLevel[mMaxRefine].lSizex*(LONGINT)mLevel[mMaxRefine].lSizey*(LONGINT)mLevel[mMaxRefine].lSizez)
 * (LONGINT)dTotalNum);
 
 #if COMPRESSGRIDS==0
        mLevel[ mMaxRefine ].mprsCells[0] = new LbmFloat[ rcellSize +4 ];
        mLevel[ mMaxRefine ].mprsCells[1] = new LbmFloat[ rcellSize +4 ];
        ownMemCheck += 2 * sizeof(LbmFloat) * (rcellSize+4);
 #else // COMPRESSGRIDS==0
-       LONGINT compressOffset = 
(mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*dTotalNum*2);
-       // D int tmp = ( (rcellSize +compressOffset +4)/(1024*1024) )*4;
-       // D printf("Debug MEMMMM excee: %d\n", tmp);
+       LONGINT compressOffset = (LONGINT)((LONGINT)mLevel[mMaxRefine].lSizex * 
(LONGINT)mLevel[mMaxRefine].lSizey * (LONGINT)dTotalNum * 2);
+       // LONGINT tmp = ( (rcellSize +compressOffset +4)/(1024*1024) 
)*sizeof(LbmFloat);
+       // printf("Debug MEMMMM excee: %I64d, %I64d, %I64d, %d, %d\n", tmp, 
compressOffset, rcellSize, mLevel[mMaxRefine].lSizex, mLevel[mMaxRefine].lSizey 
);
        mLevel[ mMaxRefine ].mprsCells[1] = new LbmFloat[ rcellSize 
+compressOffset +4 ];
        mLevel[ mMaxRefine ].mprsCells[0] = mLevel[ mMaxRefine 
].mprsCells[1]+compressOffset;
        ownMemCheck += sizeof(LbmFloat) * (rcellSize +compressOffset +4);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to