diff options
Diffstat (limited to 'src/GetHyperslab.c')
-rw-r--r-- | src/GetHyperslab.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/GetHyperslab.c b/src/GetHyperslab.c index aaebbf2..adfd7d3 100644 --- a/src/GetHyperslab.c +++ b/src/GetHyperslab.c @@ -592,7 +592,7 @@ static int GetDiagonalFromFrom3D (const cGH *GH, t_hslabConversionFn conversion_fn, void *hdata) { - int i, j, k, npoints, myproc, linear_idx; + int i, j, k, myproc, linear_idx; int vdatatype, hdata_size, vdata_size; const char *vdata; const pGExtras *extras; @@ -608,22 +608,28 @@ static int GetDiagonalFromFrom3D (const cGH *GH, myproc = CCTK_MyProc (GH); - i = extras->ownership[0][0][0]; - j = extras->ownership[0][0][1]; - k = extras->ownership[0][0][2]; - for (npoints = 0; npoints < mapping->global_hsize[0]; npoints++) + i = mapping->global_startpoint[0] - extras->lb[myproc][0]; + j = mapping->global_startpoint[1] - extras->lb[myproc][1]; + k = mapping->global_startpoint[2] - extras->lb[myproc][2]; + while (i < extras->ownership[0][1][0] && + j < extras->ownership[0][1][1] && + k < extras->ownership[0][1][2]) { - linear_idx = i + j*extras->hyper_volume[1] + k*extras->hyper_volume[2]; - if (conversion_fn) + if (i >= extras->ownership[0][0][0] && + j >= extras->ownership[0][0][1] && + k >= extras->ownership[0][0][2]) { - conversion_fn (vdata + linear_idx*vdata_size, hdata, 1, 1, 1); - } - else - { - memcpy (hdata, vdata + linear_idx*vdata_size, hdata_size); + linear_idx = i + j*extras->hyper_volume[1] + k*extras->hyper_volume[2]; + if (conversion_fn) + { + conversion_fn (vdata + linear_idx*vdata_size, hdata, 1, 1, 1); + } + else + { + memcpy (hdata, vdata + linear_idx*vdata_size, hdata_size); + } + hdata = (char *) hdata + hdata_size; } - - hdata = (char *) hdata + hdata_size; i += mapping->downsample[0]; j += mapping->downsample[1]; k += mapping->downsample[2]; |