aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035>2003-03-11 10:48:42 +0000
committertradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035>2003-03-11 10:48:42 +0000
commitd9496ca2999409058ed1cd2005547e58b31d0480 (patch)
tree4782c7c8a3f4a07272100defc8b2ec635fb8cc87
parente6729353c2e6c0af1d345aeb450d6e9e06048e93 (diff)
Fixed a bug for extracting 3D diagonal hyperslabs.
This closes PR CactusIO/1421. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@100 10716dce-81a3-4424-a2c8-48026a0d3035
-rw-r--r--src/GetHyperslab.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/GetHyperslab.c b/src/GetHyperslab.c
index e7b8e3c..aaebbf2 100644
--- a/src/GetHyperslab.c
+++ b/src/GetHyperslab.c
@@ -435,11 +435,11 @@ static int GetLocalHyperslab (const cGH *GH,
}
/* allocate the temporary arrays */
- point = (int *) malloc (5 * vinfo.dim * sizeof (int));
- startpoint = point + 1*vinfo.dim;
- endpoint = point + 2*vinfo.dim;
- downsample = point + 3*vinfo.dim;
- points_per_dim = point + 4*vinfo.dim;
+ point = malloc (5 * vinfo.dim * sizeof (int));
+ startpoint = point + 1*vinfo.dim;
+ endpoint = point + 2*vinfo.dim;
+ downsample = point + 3*vinfo.dim;
+ points_per_dim = point + 4*vinfo.dim;
memcpy (startpoint, mapping->local_startpoint, vinfo.dim * sizeof (int));
memcpy (endpoint, mapping->local_endpoint, vinfo.dim * sizeof (int));
@@ -604,30 +604,26 @@ static int GetDiagonalFromFrom3D (const cGH *GH,
vdatatype = CCTK_VarTypeI (vindex);
hdata_size = CCTK_VarTypeSize (hdatatype);
vdata_size = CCTK_VarTypeSize (vdatatype);
- vdata = (const char *) CCTK_VarDataPtrI (GH, timelevel, vindex);
+ vdata = CCTK_VarDataPtrI (GH, timelevel, vindex);
myproc = CCTK_MyProc (GH);
- 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];
+ 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++)
{
- if (i >= extras->ownership[0][0][0] && i < extras->ownership[0][1][0] &&
- j >= extras->ownership[0][0][1] && j < extras->ownership[0][1][1] &&
- k >= extras->ownership[0][0][2] && k < extras->ownership[0][1][2])
+ linear_idx = i + j*extras->hyper_volume[1] + k*extras->hyper_volume[2];
+ if (conversion_fn)
{
- 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;
+ 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;
i += mapping->downsample[0];
j += mapping->downsample[1];
k += mapping->downsample[2];
@@ -651,7 +647,7 @@ static void SortIntoUnchunkedHyperslab (const hslab_mapping_t *mapping,
/* allocate temporary vectors */
- point = (int *) malloc (2 * mapping->hdim * sizeof (int));
+ point = malloc (2 * mapping->hdim * sizeof (int));
points_per_hdim = point + mapping->hdim;
points_per_hdim[0] = 1;