diff options
Diffstat (limited to 'src/Reduction.c')
-rw-r--r-- | src/Reduction.c | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/src/Reduction.c b/src/Reduction.c index a088414..30ddfd5 100644 --- a/src/Reduction.c +++ b/src/Reduction.c @@ -176,27 +176,15 @@ int PUGH_ReductionArrays (const cGH *GH, buffer = malloc (num_outvals * sizeof (CCTK_REAL)); /* do the reduction on the input arrays */ - retval = reduction_fn (GH, - proc, - num_dims, - from, - to, - iterator, - points_per_dim, - num_points, - num_inarrays, - intypes, - inarrays, - num_outvals, - buffer); + retval = reduction_fn (GH, proc, num_dims, from, to, iterator, points_per_dim, + num_points, 1, num_inarrays, intypes, inarrays, + num_outvals, buffer); if (retval == 0 && (proc < 0 || proc == CCTK_MyProc (GH))) { /* type-cast the result to the requested datatype */ retval = copy_real_to_outtype (num_inarrays * num_outvals, - buffer, - outtype, - outvals); + buffer, outtype, outvals); } free (intypes); @@ -305,12 +293,12 @@ int PUGH_ReductionGVs (const cGH *GH, case CCTK_GF: case CCTK_ARRAY: this_retval = ReductionGA (GH, invars[i], proc, &result, - reduction_fn); + reduction_fn); break; case CCTK_SCALAR: this_retval = ReductionScalar (GH, invars[i], proc, &result, - reduction_fn); + reduction_fn); break; default: @@ -381,7 +369,6 @@ static int ReductionGA (const cGH *GH, int vindex, int proc, CCTK_REAL *outval, int i, stagger_index, num_points, dir_points, retval; pGA *GA; const void *data; - char *fullname; int *from, *to, *iterator, *points_per_dim; @@ -389,17 +376,6 @@ static int ReductionGA (const cGH *GH, int vindex, int proc, CCTK_REAL *outval, GA = ((pGA ***) PUGH_pGH (GH)->variables)[vindex][0]; data = GA->data; - /* check for zero-sized arrays */ - if (GA->extras->npoints <= 0) - { - fullname = CCTK_FullName (vindex); - CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "ReductionGA: Cannot reduce zero-sized grid array '%s'", - fullname); - free (fullname); - return (-1); - } - /* allocate temporary vectors */ from = malloc (4 * GA->connectivity->dim * sizeof (int)); to = from + 1*GA->connectivity->dim; @@ -441,8 +417,8 @@ static int ReductionGA (const cGH *GH, int vindex, int proc, CCTK_REAL *outval, /* now do the reduction */ retval = reduction_fn (GH, proc, GA->connectivity->dim, from, to, iterator, - points_per_dim, num_points, 1, &GA->vtype, &data, - 1, outval); + points_per_dim, num_points, GA->extras->npoints > 0, 1, + &GA->vtype, &data, 1, outval); /* free temporary vectors */ free (from); @@ -515,7 +491,7 @@ static int ReductionScalar (const cGH *GH, /* now do the reduction */ retval = reduction_fn (GH, proc, 1, &from, &to, &iterator, - &points_per_dim, num_points, 1, &type, &data, + &points_per_dim, num_points, 1, 1, &type, &data, 1, outval); return retval; |