aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhaas <rhaas@b2a53a04-0f4f-0410-87ed-f9f25ced00cf>2010-05-25 19:18:18 +0000
committerrhaas <rhaas@b2a53a04-0f4f-0410-87ed-f9f25ced00cf>2010-05-25 19:18:18 +0000
commit997fb4bb26ecfd7883f59d44064cda094faa41a7 (patch)
tree2c01fff9a078743225b2a211db30afac330bb5a0
parent506b980364008642a64dea93dd3ad55c7caca9c5 (diff)
TwoPunctures: fix bug in d3tensor
Had hard coded the lower bound to be zero and forgotten to initialize the first column of pointers git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinInitialData/TwoPunctures/trunk@108 b2a53a04-0f4f-0410-87ed-f9f25ced00cf
-rw-r--r--src/TP_utilities.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/TP_utilities.c b/src/TP_utilities.c
index 35a0c22..f883a78 100644
--- a/src/TP_utilities.c
+++ b/src/TP_utilities.c
@@ -124,16 +124,20 @@ d3tensor (long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
/* 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;
}