diff options
Diffstat (limited to 'src/Mapping.c')
-rw-r--r-- | src/Mapping.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/Mapping.c b/src/Mapping.c index 4434c8f..2176494 100644 --- a/src/Mapping.c +++ b/src/Mapping.c @@ -208,12 +208,12 @@ static CCTK_INT DefineMapping (const cGH *GH, } if (! retval) { - mapping = (hslab_mapping_t *) malloc (sizeof (hslab_mapping_t)); + mapping = malloc (sizeof (hslab_mapping_t)); if (mapping) { - mapping->do_dir = (int *) malloc ((6*vinfo.dim + 2*nprocs) * sizeof(int)); - mapping->global_hsize = (CCTK_INT *) malloc (((2*hdim + 1) * (nprocs+1) + - hdim) * sizeof (CCTK_INT)); + mapping->do_dir = malloc ((6*vinfo.dim + 2*nprocs) * sizeof(int)); + mapping->global_hsize = malloc (((2*hdim + 1) * (nprocs+1) + hdim) * + sizeof (CCTK_INT)); } if (! mapping || ! mapping->do_dir || ! mapping->global_hsize) { @@ -290,7 +290,7 @@ static CCTK_INT DefineMapping (const cGH *GH, } } - /* diagonals can be extracted from non-staggered 3D variables only */ + /* diagonals can be extracted from non-staggered 3D variables only */ if (mapping->is_diagonal_in_3D && vinfo.stagtype != 0) { free (mapping->do_dir); free (mapping->global_hsize); free (mapping); @@ -408,15 +408,17 @@ static CCTK_INT DefineMapping (const cGH *GH, mapping->global_startpoint[vdim] = origin[vdim]; } + mapping->totals = 0; 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]; - mapping->totals = 0; - for (npoints = 0; npoints < mapping->global_hsize[0]; npoints++) + while (i < extras->ownership[0][1][0] && + j < extras->ownership[0][1][1] && + k < extras->ownership[0][1][2]) { - 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]) + if (i >= extras->ownership[0][0][0] && + j >= extras->ownership[0][0][1] && + k >= extras->ownership[0][0][2]) { mapping->totals++; } |