aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--param.ccl47
-rw-r--r--src/Utils.c17
2 files changed, 39 insertions, 25 deletions
diff --git a/param.ccl b/param.ccl
index 53a4fdc..7b332de 100644
--- a/param.ccl
+++ b/param.ccl
@@ -236,33 +236,39 @@ REAL out_zline_y "y-coord for 1D lines in z-direction" STEERABLE = RECOVER
INT out_xline_yi "y-index (from 0) for 1D lines in x-direction, overrides IO::out_xline_y" STEERABLE = RECOVER
{
0:* :: "An index between [0, ny)"
- -1: :: "Default to physical coordinate IO::out_xline_y"
-} -1
+ -1: :: "Default to physical coordinate IO::out_xline_y if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_xline_y if it is within grid bounds, otherwise revert to using the y-center of the box"
+} -2
INT out_xline_zi "z-index (from 0) for 1D lines in x-direction, overrides IO::out_xline_z" STEERABLE = RECOVER
{
0:* :: "An index between [0, nz)"
- -1: :: "Default to physical coordinate IO::out_xline_z"
-} -1
+ -1: :: "Default to physical coordinate IO::out_xline_z if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_xline_z if it is within grid bounds, otherwise revert to using the z-center of the box"
+} -2
INT out_yline_xi "x-index (from 0) for 1D lines in y-direction, overrides IO::out_yline_x" STEERABLE = RECOVER
{
0:* :: "An index between [0, nx)"
- -1: :: "Default to physical coordinate IO::out_yline_x"
-} -1
+ -1: :: "Default to physical coordinate IO::out_yline_x if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_yline_x if it is within grid bounds, otherwise revert to using the x-center of the box"
+} -2
INT out_yline_zi "z-index (from 0) for 1D lines in y-direction, overrides IO::out_yline_z" STEERABLE = RECOVER
{
0:* :: "An index between [0, nz)"
- -1: :: "Default to physical coordinate IO::out_yline_z"
-} -1
+ -1: :: "Default to physical coordinate IO::out_yline_z if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_yline_z if it is within grid bounds, otherwise revert to using the z-center of the box"
+} -2
INT out_zline_xi "x-index (from 0) for 1D lines in z-direction, overrides IO::out_zline_x" STEERABLE = RECOVER
{
0:* :: "An index between [0, nx)"
- -1: :: "Default to physical coordinate IO::out_zline_x"
-} -1
+ -1: :: "Default to physical coordinate IO::out_zline_x if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_zline_x if it is within grid bounds, otherwise revert to using the x-center of the box"
+} -2
INT out_zline_yi "y-index (from 0) for 1D lines in z-direction, overrides IO::out_zline_y" STEERABLE = RECOVER
{
0:* :: "An index between [0, ny)"
- -1: :: "Default to physical coordinate IO::out_zline_y"
-} -1
+ -1: :: "Default to physical coordinate IO::out_zline_y if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_zline_y if it is within grid bounds, otherwise revert to using the y-center of the box"
+} -2
##################################
@@ -283,19 +289,22 @@ REAL out_xyplane_z "z-coord for 2D planes in xy" STEERABLE = RECOVER
INT out_yzplane_xi "x-index (from 0) for 2D planes in yz, overrrides IO::out_yzplane_x" STEERABLE = RECOVER
{
- 0:* :: "An index between [0, nx)"
- -1: :: "Default to physical coordinate IO::out_yzplane_x"
-} -1
+ 0:* :: "An index between [0, nx)"
+ -1: :: "Default to physical coordinate IO::out_yzplane_x if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_yzplane_x if it is within grid bounds, otherwise revert to using the x-center of the box"
+} -2
INT out_xzplane_yi "y-index (from 0) for 2D planes in xz, overrrides IO::out_xzplane_y" STEERABLE = RECOVER
{
0:* :: "An index between [0, ny)"
- -1: :: "Default to physical coordinate IO::out_xzplane_y"
-} -1
+ -1: :: "Default to physical coordinate IO::out_xzplane_y if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_xzplane_y if it is within grid bounds, otherwise revert to using the y-center of the box"
+} -2
INT out_xyplane_zi "z-index (from 0) for 2D planes in xy, overrrides IO::out_xyplane_z" STEERABLE = RECOVER
{
0:* :: "An index between [0, nz)"
- -1: :: "Default to physical coordinate IO::out_xyplane_z"
-} -1
+ -1: :: "Default to physical coordinate IO::out_xyplane_z if it is within grid bounds, otherwise revert to using 0"
+ -2: :: "Default to physical coordinate IO::out_xyplane_z if it is within grid bounds, otherwise revert to using the z-center of the box"
+} -2
private:
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
{