aboutsummaryrefslogtreecommitdiff
path: root/CarpetAttic
diff options
context:
space:
mode:
authorcott <>2003-12-10 13:49:00 +0000
committercott <>2003-12-10 13:49:00 +0000
commitcc69118d5dca78409888934cb9296ac57f3dd859 (patch)
tree4a0631a63e8f96586367513e42649d43626ba760 /CarpetAttic
parenta142fa9154d6fb0cb32f442eb6b39df001c49898 (diff)
Fixed problems with zero sized arrays/scalars.
darcs-hash:20031210134930-19929-df9164b8596f45f23adc51296e744f1e74e7c720.gz
Diffstat (limited to 'CarpetAttic')
-rw-r--r--CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
index 6940a0a12..f832b399a 100644
--- a/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
+++ b/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc
@@ -48,7 +48,7 @@
#include "ioflexio.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc,v 1.13 2003/12/03 16:02:51 cott Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIOCheckpoint/src/checkpointrestart.cc,v 1.14 2003/12/10 14:49:30 cott Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOFlexIO_checkpointrestart_cc);
}
@@ -477,6 +477,27 @@ int CarpetIOFlexIO_Recover (cGH* cgh, const char *basefilename, int called_from)
if ( (grouptype != CCTK_GF) && (reflevel != 0) )
continue;
+ /* now check if there is any memory allocated
+ for GFs and GAs. GSs should always have
+ memory allocated and there is at this point
+ no CCTK function to check this :/
+ */
+
+ if ( (grouptype == CCTK_GF) || (grouptype == CCTK_ARRAY)){
+ const int gpdim = CCTK_GroupDimI(group);
+ int gtotalsize=1;
+ for(int d=0;d<gpdim;d++){
+ const int* gpsize= CCTK_ArrayGroupSizeI(cgh,d,group);
+ assert(gpsize != NULL);
+ gtotalsize*=gpsize[d];
+ }
+ if(gtotalsize == 0){
+ if (verbose) CCTK_VInfo(CCTK_THORNSTRING, "Group %s is zero-sized. No checkpoint info written",CCTK_GroupName(group));
+ continue;
+ }
+ }
+
+
/* get the number of allocated timelevels */
CCTK_GroupData (gindex, &gdata);
gdata.numtimelevels = 0;