aboutsummaryrefslogtreecommitdiff
path: root/src/DumpGH.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-03-27 13:15:27 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2000-03-27 13:15:27 +0000
commit52c82a9aefc0c96ba9d8bde98e159fc4707ed055 (patch)
tree43ec49f9595aef5ba1929bceea7af635a842f7e6 /src/DumpGH.c
parent80631ac6c5509ee69d8bf76343a703550cb5d7e8 (diff)
Output and cp/recovery for arrays of arbitrary size and dims
(although tested only for maxdim <= 3 of course). The (identical) downsampling code in IOHDF5 and IOFlexIO is hard-coded for 3D arrays only. But this will be replaced by Gerd's fantastic hyperslabbing thorn in the very next days anyways :-) git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@99 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/DumpGH.c')
-rw-r--r--src/DumpGH.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/DumpGH.c b/src/DumpGH.c
index 5f4880d..0a64c15 100644
--- a/src/DumpGH.c
+++ b/src/DumpGH.c
@@ -237,7 +237,7 @@ void IOFlexIO_DumpGH (cGH *GH, int called_from)
IOFile iof;
int index, wrotech;
int timelevel, current_timelevel;
- int old_downsample_x, old_downsample_y, old_downsample_z;
+ int *old_downsample;
int old_out_single;
ioGH *ioUtilGH;
flexioGH *myGH;
@@ -254,10 +254,11 @@ void IOFlexIO_DumpGH (cGH *GH, int called_from)
dumpfnames = (char **) calloc (checkpoint_keep, sizeof (char *));
/* disable downsampling after saving original downsampling params */
- old_downsample_x = ioUtilGH->downsample_x;
- old_downsample_y = ioUtilGH->downsample_y;
- old_downsample_z = ioUtilGH->downsample_z;
- ioUtilGH->downsample_x = ioUtilGH->downsample_y = ioUtilGH->downsample_z = 1;
+ old_downsample = (int *) malloc (CCTK_MaxDim () * sizeof (int));
+ for (index = 0; index < CCTK_MaxDim (); index++) {
+ old_downsample [index] = ioUtilGH->downsample [index];
+ ioUtilGH->downsample [index] = 1;
+ }
/* disable output in single precision */
old_out_single = ioUtilGH->out_single;
@@ -327,10 +328,16 @@ void IOFlexIO_DumpGH (cGH *GH, int called_from)
/* ... now the variables */
for (index = 0; index < CCTK_NumVars (); index++) {
+ const char *thorn, *impl = CCTK_ImpFromVarI (index);
+
+ /* find out the thorn implementing variable with index */
+ thorn = CCTK_ImplementationThorn (impl);
+ if (! thorn)
+ thorn = impl;
- /* let only variables pass which belong to an active implementation and
+ /* let only variables pass which belong to an active thorn and
have storage assigned */
- if (! CCTK_IsImplementationActive (CCTK_ImpFromVarI (index)) ||
+ if (! CCTK_IsThornActive (thorn) ||
! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index)))
continue;
@@ -382,9 +389,8 @@ void IOFlexIO_DumpGH (cGH *GH, int called_from)
ioUtilGH->out_single = old_out_single;
/* restore original downsampling params */
- ioUtilGH->downsample_x = old_downsample_x;
- ioUtilGH->downsample_y = old_downsample_y;
- ioUtilGH->downsample_z = old_downsample_z;
+ memcpy (ioUtilGH->downsample, old_downsample, CCTK_MaxDim () * sizeof (int));
+ free (old_downsample);
/* stop total checkpoint timer and print timing info */
if (print_timing_info) {