Fixed a bug. Worked correctly now for cases like: size=40, pencilsize=320 --> splitti...
authorYan Shi <yanshi@uiuc.edu>
Tue, 20 Sep 2005 03:32:33 +0000 (03:32 +0000)
committerYan Shi <yanshi@uiuc.edu>
Tue, 20 Sep 2005 03:32:33 +0000 (03:32 +0000)
40*8, not 20*16

src/libs/ck-libs/fftlib/fftlib.h

index 58d2ab245e15d19a5ccdea3a317d35db6df2f2e8..e9989c55a8056b560517598c667bae86ca5525c8 100644 (file)
@@ -133,9 +133,9 @@ class LineFFTinfo {
            CkAssert((sizeX==sizeY) && (sizeX==sizeZ));
            
            if(pblock == PencilBlock::SQUAREBLOCK){
-               getSquaresize(xPencilsPerSlab, xsquare);
-               getSquaresize(yPencilsPerSlab, ysquare);
-               getSquaresize(zPencilsPerSlab, zsquare);
+               getSquaresize(xPencilsPerSlab, sizeX, xsquare);
+               getSquaresize(yPencilsPerSlab, sizeX, ysquare);
+               getSquaresize(zPencilsPerSlab, sizeX, zsquare);
                
                CkAssert((xsquare[1]%ysquare[1]==0) || (ysquare[1]%xsquare[1]==0));
                CkAssert((zsquare[0]%ysquare[0]==0) || (ysquare[0]%zsquare[0]==0));
@@ -148,14 +148,15 @@ class LineFFTinfo {
                         || (zPencilsPerSlab%yPencilsPerSlab==0));
            }
        }
-       void getSquaresize(int size, int *square) {
-           int squaresize = (int)sqrt(size);
+       void getSquaresize(int size, int planesize, int *square) {
+           int squaresize = (int)sqrt((float)size);
            if(size==squaresize*squaresize){
                square[0]=squaresize;
                square[1]=squaresize;
            }
            else{
-               while(squaresize>1 && (size%squaresize!=0)){
+               while(squaresize>1 && ((size%squaresize!=0) || 
+                      ((size%squaresize==0)&&(planesize%squaresize!=0||planesize%(size/squaresize)!=0)))){
                    squaresize--;
                }
                square[1]=squaresize;