[Commits] [svn:einsteintoolkit] TwoPunctures/trunk/src/ (Rev. 108)

roland.haas at physics.gatech.edu roland.haas at physics.gatech.edu
Tue May 25 14:18:19 CDT 2010


User: rhaas
Date: 2010/05/25 02:18 PM

Modified:
 /trunk/src/
  TP_utilities.c

Log:
 TwoPunctures: fix bug in d3tensor
 
 Had hard coded the lower bound to be zero and forgotten to initialize the first
 column of pointers

File Changes:

Directory: /trunk/src/
======================

File [modified]: TP_utilities.c
Delta lines: +7 -3
===================================================================
--- trunk/src/TP_utilities.c	2010-05-24 21:47:05 UTC (rev 107)
+++ trunk/src/TP_utilities.c	2010-05-25 19:18:18 UTC (rev 108)
@@ -124,16 +124,20 @@
   /* slice chunk into rows and columns */
   long width = (nch-ncl+1);
   long depth = (ndh-ndl+1);
+  for(long j = ncl+1 ; j <= nch ; j++) { /* first row of columns */
+    retval[nrl][j] = retval[nrl][j-1] + depth;
+  }
+  assert(retval[nrl][nch]-retval[nrl][ncl] == (nch-ncl)*depth);
   for(long i = nrl+1 ; i <= nrh ; i++) {
     retval[i] = retval[i-1] + width;
-    retval[i][0] = retval[i-1][0] + width*depth;
+    retval[i][ncl] = retval[i-1][ncl] + width*depth; /* first cell in column */
     for(long j = ncl+1 ; j <= nch ; j++) {
       retval[i][j] = retval[i][j-1] + depth;
     }
-    assert(retval[i][nch]-retval[i][ncl] == (ndh-ndl)*depth);
+    assert(retval[i][nch]-retval[i][ncl] == (nch-ncl)*depth);
   }
   assert(retval[nrh]-retval[nrl] == (nrh-nrl)*width);
-  assert(retval[nrh][nch]-retval[nrl][ncl] == (nrh-nrl)*(nch-ncl)*depth);
+  assert(&retval[nrh][nch][ndh]-&retval[nrl][ncl][ndl] == (nrh-nrl+1)*(nch-ncl+1)*(ndh-ndl+1)-1);
 
   return retval;
 }



More information about the Commits mailing list