aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.c')
-rw-r--r--src/Utils.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Utils.c b/src/Utils.c
index 33f0ec2..f18ad1d 100644
--- a/src/Utils.c
+++ b/src/Utils.c
@@ -422,10 +422,12 @@ int IOUtil_1DLines (const cGH *GH,
'x' + dim, (double) origin_phys[dir][dim],
'x' + dir, num_dims,
(double) lower[dim], (double) upper[dim]);
+
+ slice_center[dir][dim] = origin_index[dir][dim] == -1 ?
+ 0 : ceil ((upper[dim] - lower[dim]) / (2*delta[dim]) - 1e-6);
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "IOUtil_1DLines: slice center will default to %c-index 0",
- 'x' + dir);
- slice_center[dir][dim] = 0;
+ "IOUtil_1DLines: slice center will default to %c-index %d",
+ 'x' + dir, slice_center[dir][dim]);
}
else
{
@@ -582,10 +584,13 @@ int IOUtil_2DPlanes (const cGH *GH,
"planes (%f) is out of grid coordinates range (%f, %f)",
'x' + (num_dims - dir - 1), (double) origin_phys[dir],
(double) lower[num_dims-1-dir], (double) upper[num_dims-1-dir]);
+
+ slice_center[dir] = origin_index[dir] == -1 ?
+ 0 : ceil ((upper[num_dims-1-dir] - lower[num_dims-1-dir]) /
+ (2*delta[num_dims-1-dir]) - 1e-6);
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "IOUtil_2DPlanes: slice center will default to %c-index 0",
- 'x' + (num_dims - dir - 1));
- slice_center[dir] = 0;
+ "IOUtil_2DPlanes: slice center will default to %c-index %d",
+ 'x' + dir, slice_center[dir]);
}
else
{