aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2005-06-16 15:52:47 +0000
committertradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2005-06-16 15:52:47 +0000
commit685ea1efaf54fdfee1ab920cb5fc2299e251d5f5 (patch)
tree9cf1fff2e6dc6f42397f13726b00051a3d20496f /src
parent2bf64b5fcd41a1de645d19d60b4b7b24dcdf8987 (diff)
Set the default slice centre for 1D/2D output to be the centre of the box
if the user specified invalid values in the parfile. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@226 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a
Diffstat (limited to 'src')
-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
{