aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2001-12-16 21:54:38 +0000
committertradke <tradke@94b1c47f-dcfd-45ef-a468-0854c0e9e350>2001-12-16 21:54:38 +0000
commiteeee2a8963fbaef507c311ff75112e42f97e6e2a (patch)
tree8bc9df7537ae9c8a8776dc8572663d555459cd79 /src
parent1491a798b3dcb98d40faf62d39f9d517eb32f138 (diff)
Removed restriction for diagonal output on cubic grids. Now PUGHSlab can do
non-cubic grids as well, but still only for non-staggered 3D variables. Note that IOASCII will always start the diagonal at (0,0,0) and increase by 1 in every direction. Closes PR BetaThorns-380 (??) and CactusBase/IOASCII-517. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@90 94b1c47f-dcfd-45ef-a468-0854c0e9e350
Diffstat (limited to 'src')
-rw-r--r--src/Write1D.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/Write1D.c b/src/Write1D.c
index 3701d1b..2ba8fe8 100644
--- a/src/Write1D.c
+++ b/src/Write1D.c
@@ -107,7 +107,6 @@ void IOASCII_Write1D (const cGH *GH, int vindex, const char *alias)
asciiioGH *myGH; /* IOASCII extension handle */
int Do_it[4]; /* flags indicating actual work */
int coord_index[3]; /* x,y,z coordinate variable indices */
- int is_cubic; /* true if variable lives on cubic grid */
int myproc; /* identify processor */
int i, dir; /* Loopers */
int groupindex; /* variable's group index */
@@ -161,23 +160,17 @@ void IOASCII_Write1D (const cGH *GH, int vindex, const char *alias)
Do_it[0] = out1D_x && group_static_data.dim >= 1;
Do_it[1] = out1D_y && group_static_data.dim >= 2;
Do_it[2] = out1D_z && group_static_data.dim >= 3;
- /* diagonal slice is done only if grid is cubic and non-staggered. */
- is_cubic = 1;
- for (i = 1; i < group_dynamic_data.dim; i++)
- {
- is_cubic &= group_dynamic_data.gsh[i] == group_dynamic_data.gsh[0];
- }
- if (out1D_d && ! is_cubic && myGH->out1D_last[vindex] < 0)
+ /* diagonal slice is done only if variable is non-staggered and 3D */
+ Do_it[3] = out1D_d &&
+ group_static_data.dim == 3 &&
+ group_static_data.stagtype == 0;
+ if (out1D_d && ! Do_it[3] && myGH->out1D_last[vindex] < 0)
{
CCTK_VWarn (3, __LINE__, __FILE__, CCTK_THORNSTRING,
"IOASCII_Write1D: No IOASCII_1D diagonal output for '%s' "
- "(only implemented for cubic grids)",
+ "(only implemented for non-staggered 3D variables)",
fullname);
}
- Do_it[3] = out1D_d &&
- group_static_data.dim == 3 &&
- is_cubic &&
- group_static_data.stagtype == 0;
/* return if nothing to do */
if (! (Do_it[0] || Do_it[1] || Do_it[2] || Do_it[3]))
@@ -467,7 +460,8 @@ void IOASCII_Write1D (const cGH *GH, int vindex, const char *alias)
/* OK so actually do the I/O in each direction */
for (dir = 0; dir < 4; dir++)
{
- const int length = -1;
+ int length = -1;
+ int gsh[3];
const int downsample = 1;
const int *origin;
const int zero_point[3] = {0, 0, 0};
@@ -483,6 +477,25 @@ void IOASCII_Write1D (const cGH *GH, int vindex, const char *alias)
continue;
}
+ /* need to pass the extent for diagonals */
+ if (dir < 3)
+ {
+ length = -1;
+ }
+ else
+ {
+ CCTK_GroupgshVI (GH, 3, gsh, vindex);
+ length = group_dynamic_data.gsh[0];
+ if (length > group_dynamic_data.gsh[1])
+ {
+ length = group_dynamic_data.gsh[1];
+ }
+ if (length > group_dynamic_data.gsh[2])
+ {
+ length = group_dynamic_data.gsh[2];
+ }
+ }
+
if (group_static_data.grouptype == CCTK_GF)
{
/* for GFs: get the coordinate's 1D data (in xyz direction only) */