[cig-commits] commit: Fix compiler warnings

Mercurial hg at geodynamics.org
Sun Oct 16 05:18:45 PDT 2011


changeset:   627:b1fae62131ad
user:        Walter Landry <wlandry at caltech.edu>
date:        Sun Oct 16 05:15:16 2011 -0700
files:       Mesh/src/CartesianGenerator.cxx
description:
Fix compiler warnings


diff -r 78edc3a2ea06 -r b1fae62131ad Mesh/src/CartesianGenerator.cxx
--- a/Mesh/src/CartesianGenerator.cxx	Sun Oct 16 05:14:03 2011 -0700
+++ b/Mesh/src/CartesianGenerator.cxx	Sun Oct 16 05:15:16 2011 -0700
@@ -183,309 +183,308 @@ void _CartesianGenerator_Print( void* me
 }
 
 void _CartesianGenerator_AssignFromXML( void* meshGenerator, Stg_ComponentFactory* cf, void* data ) {
-	CartesianGenerator*		self = (CartesianGenerator*)meshGenerator;
-	Dictionary*					dict;
-	Dictionary_Entry_Value*	tmp;
-	char*							rootKey;
-	Dictionary_Entry_Value*	sizeList;
-	Dictionary_Entry_Value	*minList, *maxList;
-	unsigned						maxDecompDims;
-	unsigned						*minDecomp, *maxDecomp;
-	double						*crdMin, *crdMax;
-	unsigned*					size;
-	unsigned						shadowDepth;
-	Stream*						stream;
-	Stream*						errorStream = Journal_Register( Error_Type, (Name)self->type  );
-	unsigned						d_i;
-	unsigned						restartTimestep;
-   AbstractContext*        context;	
+  CartesianGenerator*		self = (CartesianGenerator*)meshGenerator;
+  Dictionary*					dict;
+  Dictionary_Entry_Value*	tmp;
+  char*							rootKey;
+  Dictionary_Entry_Value*	sizeList;
+  Dictionary_Entry_Value	*minList, *maxList;
+  unsigned						maxDecompDims;
+  unsigned						*minDecomp, *maxDecomp;
+  double						*crdMin, *crdMax;
+  unsigned*					size;
+  unsigned						shadowDepth;
+  Stream*						stream;
+  Stream*						errorStream = Journal_Register( Error_Type, (Name)self->type  );
+  unsigned						d_i;
+  unsigned						restartTimestep;
+  AbstractContext*        context;	
 #ifdef READ_HDF5
-	hid_t file, fileData;
+  hid_t file, fileData;
 #endif
 	
-	assert( self && Stg_CheckType( self, CartesianGenerator ) );
-	assert( cf );
+  assert( self && Stg_CheckType( self, CartesianGenerator ) );
+  assert( cf );
 
-   /* get the context which is required for filename determination */
-   context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ) ;
+  /* get the context which is required for filename determination */
+  context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ) ;
 
-	/* Call parent construct. */
-	_MeshGenerator_AssignFromXML( self, cf, data );
+  /* Call parent construct. */
+  _MeshGenerator_AssignFromXML( self, cf, data );
 
-	/* Rip out the components structure as a dictionary. */
-	dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, (Dictionary_Entry_Key)self->name )  );
+  /* Rip out the components structure as a dictionary. */
+  dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, (Dictionary_Entry_Key)self->name )  );
 
-	/* Read the sizes. */
-	sizeList = Dictionary_Get( dict, (Dictionary_Entry_Key)"size" );
-	assert( sizeList );
-	assert( Dictionary_Entry_Value_GetCount( sizeList ) >= self->nDims  );
-	size = Memory_Alloc_Array_Unnamed( unsigned, self->nDims );
-	for( d_i = 0; d_i < self->nDims; d_i++ ) {
-		tmp = Dictionary_Entry_Value_GetElement( sizeList, d_i );
-		rootKey = Dictionary_Entry_Value_AsString( tmp );
+  /* Read the sizes. */
+  sizeList = Dictionary_Get( dict, (Dictionary_Entry_Key)"size" );
+  assert( sizeList );
+  assert( Dictionary_Entry_Value_GetCount( sizeList ) >= self->nDims  );
+  size = Memory_Alloc_Array_Unnamed( unsigned, self->nDims );
+  for( d_i = 0; d_i < self->nDims; d_i++ ) {
+    tmp = Dictionary_Entry_Value_GetElement( sizeList, d_i );
+    rootKey = Dictionary_Entry_Value_AsString( tmp );
 
-		if( !Stg_StringIsNumeric( (char *)rootKey )  )
-			tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
-		size[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp  );
-	}
+    if( !Stg_StringIsNumeric( (char *)rootKey )  )
+      tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
+    size[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp  );
+  }
 
-	/* Read decomposition restrictions. */
-	maxDecompDims = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"maxDecomposedDims", 0  );
+  /* Read decomposition restrictions. */
+  maxDecompDims = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"maxDecomposedDims", 0  );
 
-	minList = Dictionary_Get( dict, (Dictionary_Entry_Key)"minDecompositions" );
-	if( minList  ) {
-		minDecomp = AllocArray( unsigned, self->nDims );
-		for( d_i = 0; d_i < self->nDims; d_i++ ) {
-			tmp = Dictionary_Entry_Value_GetElement( minList, d_i );
-			rootKey = Dictionary_Entry_Value_AsString( tmp );
+  minList = Dictionary_Get( dict, (Dictionary_Entry_Key)"minDecompositions" );
+  if( minList  ) {
+    minDecomp = AllocArray( unsigned, self->nDims );
+    for( d_i = 0; d_i < self->nDims; d_i++ ) {
+      tmp = Dictionary_Entry_Value_GetElement( minList, d_i );
+      rootKey = Dictionary_Entry_Value_AsString( tmp );
 
-			if( !Stg_StringIsNumeric( (char *)rootKey )  )
-				tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
-			minDecomp[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp  );
-		}
-	}
-	else
-		minDecomp = NULL;
+      if( !Stg_StringIsNumeric( (char *)rootKey )  )
+        tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
+      minDecomp[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp  );
+    }
+  }
+  else
+    minDecomp = NULL;
 
-	maxList = Dictionary_Get( dict, (Dictionary_Entry_Key)"maxDecompositions" );
-	if( maxList  ) {
-		maxDecomp = AllocArray( unsigned, self->nDims );
-		for( d_i = 0; d_i < self->nDims; d_i++ ) {
-			tmp = Dictionary_Entry_Value_GetElement( maxList, d_i );
-			rootKey = Dictionary_Entry_Value_AsString( tmp );
+  maxList = Dictionary_Get( dict, (Dictionary_Entry_Key)"maxDecompositions" );
+  if( maxList  ) {
+    maxDecomp = AllocArray( unsigned, self->nDims );
+    for( d_i = 0; d_i < self->nDims; d_i++ ) {
+      tmp = Dictionary_Entry_Value_GetElement( maxList, d_i );
+      rootKey = Dictionary_Entry_Value_AsString( tmp );
 
-			if( !Stg_StringIsNumeric( (char *)rootKey )  )
-				tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
-			maxDecomp[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp  );
-		}
-	}
-	else
-		maxDecomp = NULL;
+      if( !Stg_StringIsNumeric( (char *)rootKey )  )
+        tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
+      maxDecomp[d_i] = Dictionary_Entry_Value_AsUnsignedInt( tmp  );
+    }
+  }
+  else
+    maxDecomp = NULL;
 
-	/* Initial setup. */
-	CartesianGenerator_SetTopologyParams( self, size, maxDecompDims, minDecomp, maxDecomp );
+  /* Initial setup. */
+  CartesianGenerator_SetTopologyParams( self, size, maxDecompDims, minDecomp, maxDecomp );
 
-        /* Contact stuff. */
-        self->contactDepth[0][0] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-left", 0  );
-        self->contactDepth[0][1] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-right", 0  );
-        self->contactDepth[1][0] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-bottom", 0  );
-        self->contactDepth[1][1] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-top", 0  );
-        self->contactDepth[2][0] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-back", 0  );
-        self->contactDepth[2][1] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-front", 0  );
-        self->contactGeom[0] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"contactGeometry-x", 0.0  );
-        self->contactGeom[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"contactGeometry-y", 0.0  );
-        self->contactGeom[2] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"contactGeometry-z", 0.0  );
+  /* Contact stuff. */
+  self->contactDepth[0][0] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-left", 0  );
+  self->contactDepth[0][1] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-right", 0  );
+  self->contactDepth[1][0] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-bottom", 0  );
+  self->contactDepth[1][1] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-top", 0  );
+  self->contactDepth[2][0] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-back", 0  );
+  self->contactDepth[2][1] = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"contactDepth-front", 0  );
+  self->contactGeom[0] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"contactGeometry-x", 0.0  );
+  self->contactGeom[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"contactGeometry-y", 0.0  );
+  self->contactGeom[2] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"contactGeometry-z", 0.0  );
 
-	/* Read geometry. */
-	minList = Dictionary_Get( dict, (Dictionary_Entry_Key)"minCoord"  );
-	maxList = Dictionary_Get( dict, (Dictionary_Entry_Key)"maxCoord" );
-	if( minList && maxList ) {
-		assert( Dictionary_Entry_Value_GetCount( minList ) >= self->nDims );
-		assert( Dictionary_Entry_Value_GetCount( maxList ) >= self->nDims  );
-		crdMin = Memory_Alloc_Array_Unnamed( double, 3 );
-		crdMax = Memory_Alloc_Array_Unnamed( double, 3 );
-		for( d_i = 0; d_i < self->nDims; d_i++ ) {
-		   double maxVal;
-			tmp = Dictionary_Entry_Value_GetElement( minList, d_i );
-			rootKey = Dictionary_Entry_Value_AsString( tmp );
+  /* Read geometry. */
+  minList = Dictionary_Get( dict, (Dictionary_Entry_Key)"minCoord"  );
+  maxList = Dictionary_Get( dict, (Dictionary_Entry_Key)"maxCoord" );
+  if( minList && maxList ) {
+    assert( Dictionary_Entry_Value_GetCount( minList ) >= self->nDims );
+    assert( Dictionary_Entry_Value_GetCount( maxList ) >= self->nDims  );
+    crdMin = Memory_Alloc_Array_Unnamed( double, 3 );
+    crdMax = Memory_Alloc_Array_Unnamed( double, 3 );
+    for( d_i = 0; d_i < self->nDims; d_i++ ) {
+      double maxVal;
+      tmp = Dictionary_Entry_Value_GetElement( minList, d_i );
+      rootKey = Dictionary_Entry_Value_AsString( tmp );
 
-			if( !Stg_StringIsNumeric( (char *)rootKey )  )
-				tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
-			crdMin[d_i] = Dictionary_Entry_Value_AsDouble( tmp  );
+      if( !Stg_StringIsNumeric( (char *)rootKey )  )
+        tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
+      crdMin[d_i] = Dictionary_Entry_Value_AsDouble( tmp  );
 
-			tmp = Dictionary_Entry_Value_GetElement( maxList, d_i );
-			rootKey = Dictionary_Entry_Value_AsString( tmp );
+      tmp = Dictionary_Entry_Value_GetElement( maxList, d_i );
+      rootKey = Dictionary_Entry_Value_AsString( tmp );
 
-			if( !Stg_StringIsNumeric( (char *)rootKey )  )
-				tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
-			crdMax[d_i] = Dictionary_Entry_Value_AsDouble( tmp );
-			/* test to ensure provided domain is valid */
-			maxVal =  (abs(crdMax[d_i]) > abs(crdMin[d_i])) ? abs(crdMax[d_i]) : abs(crdMin[d_i]);
-			if( maxVal == 0  ) maxVal = 1;  /* if maxVal is zero, then both numbers must be zero, set to one as next test will fail */
-         Journal_Firewall( ( ( (crdMax[d_i] - crdMin[d_i])/maxVal) > 1E-10 || d_i==J_AXIS), errorStream,
-                     "\n\nError in %s for %s '%s'\n\n"
-                     "Dimension of domain (min = %f, max = %f) for component number %u is not valid.\n\n",
-                     __func__, self->type, self->name,
-                     crdMin[d_i], crdMax[d_i], d_i);
-		}
+      if( !Stg_StringIsNumeric( (char *)rootKey )  )
+        tmp = Dictionary_Get( cf->rootDict, (Dictionary_Entry_Key)rootKey );
+      crdMax[d_i] = Dictionary_Entry_Value_AsDouble( tmp );
+      /* test to ensure provided domain is valid */
+      maxVal =  (abs(crdMax[d_i]) > abs(crdMin[d_i])) ? abs(crdMax[d_i]) : abs(crdMin[d_i]);
+      if( maxVal == 0  ) maxVal = 1;  /* if maxVal is zero, then both numbers must be zero, set to one as next test will fail */
+      Journal_Firewall( ( ( (crdMax[d_i] - crdMin[d_i])/maxVal) > 1E-10 || d_i==J_AXIS), errorStream,
+                        "\n\nError in %s for %s '%s'\n\n"
+                        "Dimension of domain (min = %f, max = %f) for component number %u is not valid.\n\n",
+                        __func__, self->type, self->name,
+                        crdMin[d_i], crdMax[d_i], d_i);
+    }
 
-		restartTimestep = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"restartTimestep", 0 );	
-		if( restartTimestep  ) {
-         char*   meshReadFileName;
-         char*   meshReadFileNamePart;
-         self->readFromFile = True;
+    restartTimestep = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"restartTimestep", 0 );	
+    if( restartTimestep  ) {
+      char*   meshReadFileName;
+      char*   meshReadFileNamePart;
+      self->readFromFile = True;
 #ifdef READ_HDF5
-         hid_t   attrib_id, group_id;
-         herr_t  status;
+      hid_t   attrib_id, group_id;
 
-         meshReadFileNamePart = Context_GetCheckPointReadPrefixString( context );
+      meshReadFileNamePart = Context_GetCheckPointReadPrefixString( context );
 
-         /** assumption: that the generator only generates one mesh, or that the information in that mesh's checkpoint
-         file is valid for all meshes being generated TODO: generalise **/
-         Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.h5", meshReadFileNamePart, self->meshes[0]->name, restartTimestep );
+      /** assumption: that the generator only generates one mesh, or that the information in that mesh's checkpoint
+          file is valid for all meshes being generated TODO: generalise **/
+      Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.h5", meshReadFileNamePart, self->meshes[0]->name, restartTimestep );
 	      
-	      /** Read in minimum coord. */
-	      file = H5Fopen( meshReadFileName, H5F_ACC_RDONLY, H5P_DEFAULT );
+      /** Read in minimum coord. */
+      file = H5Fopen( meshReadFileName, H5F_ACC_RDONLY, H5P_DEFAULT );
 	      
-	      if( !file ) {
-            /** file not found, so don't load from checkpoint */
-            self->readFromFile = False;
-				Journal_Printf( errorStream, 
-					"Warning - Couldn't find checkpoint mesh file with filename \"%s\".\n", 
-					meshReadFileName );
-			}
-			else {
-         int res[self->nDims];
+      if( !file ) {
+        /** file not found, so don't load from checkpoint */
+        self->readFromFile = False;
+        Journal_Printf( errorStream, 
+                        "Warning - Couldn't find checkpoint mesh file with filename \"%s\".\n", 
+                        meshReadFileName );
+      }
+      else {
+        int res[self->nDims];
 
-         #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-	         fileData = H5Dopen( file, "/min" );
-         #else
-	         fileData = H5Dopen2( file, "/min", H5P_DEFAULT );
-         #endif
-	         H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, crdMin );
-	         H5Dclose( fileData );
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+        fileData = H5Dopen( file, "/min" );
+#else
+        fileData = H5Dopen2( file, "/min", H5P_DEFAULT );
+#endif
+        H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, crdMin );
+        H5Dclose( fileData );
 	         
-	         /** Read in maximum coord. */
-         #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-	         fileData = H5Dopen( file, "/max" );
-         #else
-	         fileData = H5Dopen2( file, "/max", H5P_DEFAULT );
-         #endif
-	         H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, crdMax );
-	         H5Dclose( fileData );
+        /** Read in maximum coord. */
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+        fileData = H5Dopen( file, "/max" );
+#else
+        fileData = H5Dopen2( file, "/max", H5P_DEFAULT );
+#endif
+        H5Dread( fileData, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, crdMax );
+        H5Dclose( fileData );
 
-            /** get the file attributes  */
-         #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-            group_id  = H5Gopen(file, "/");
-            attrib_id = H5Aopen_name(group_id, "checkpoint file version");
-         #else
-            group_id  = H5Gopen2(file, "/", H5P_DEFAULT);
-            attrib_id = H5Aopen(group_id, "checkpoint file version", H5P_DEFAULT);
-         #endif
+        /** get the file attributes  */
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+        group_id  = H5Gopen(file, "/");
+        attrib_id = H5Aopen_name(group_id, "checkpoint file version");
+#else
+        group_id  = H5Gopen2(file, "/", H5P_DEFAULT);
+        attrib_id = H5Aopen(group_id, "checkpoint file version", H5P_DEFAULT);
+#endif
 
-         /** check for correct mesh size */
+        /** check for correct mesh size */
       
-         #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-            attrib_id = H5Aopen_name(group_id, "mesh resolution");
-         #else
-            attrib_id = H5Aopen(group_id, "mesh resolution", H5P_DEFAULT);
-         #endif
-         status = H5Aread(attrib_id, H5T_NATIVE_INT, &res);
-         H5Aclose(attrib_id);
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+        attrib_id = H5Aopen_name(group_id, "mesh resolution");
+#else
+        attrib_id = H5Aopen(group_id, "mesh resolution", H5P_DEFAULT);
+#endif
+        H5Aread(attrib_id, H5T_NATIVE_INT, &res);
+        H5Aclose(attrib_id);
    
-         if(self->nDims == 2){
-           if(!((size[0]==(unsigned)(res[0])) && (size[1]==(unsigned)(res[1])))){
-               if (context->interpolateRestart)
-                  self->readFromFile = False;
-               else
-                  Journal_Firewall( 
-                     0, 
-                     errorStream,
-                     "\n\nError in %s for %s '%s'\n"
-                     "Size of mesh (%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u,%u).\n\n"
-                     "If you would like to interpolate checkpoint data to simulation mesh size\n"
-                     "    please re-launch using '--interpolateRestart=1' flag\n\n", 
-                     __func__, self->type, self->name, 
-                     (unsigned int) res[0], (unsigned int) res[1],
-                     meshReadFileName,
-                     (unsigned int) size[0], (unsigned int) size[1]);
-            }
-         } else {
-           if(!((size[0]==(unsigned)(res[0])) && (size[1]==(unsigned)(res[1]))
-                && (size[2]==(unsigned)(res[2])))){
-               if (context->interpolateRestart)
-                  self->readFromFile = False;
-               else
-                  Journal_Firewall( 
-                     0, 
-                     errorStream,
-                     "\n\nError in %s for %s '%s'\n"
-                     "Size of mesh (%u,%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u,%u,%u).\n\n"
-                     "If you would like to interpolate checkpoint data to simulation mesh size\n"
-                     "    please re-launch using '--interpolateRestart=1' flag\n\n", 
-                     __func__, self->type, self->name, 
-                     (unsigned int) res[0], (unsigned int) res[1], (unsigned int) res[2],
-                     meshReadFileName,
-                     (unsigned int) size[0], (unsigned int) size[1], (unsigned int) size[2]);
-               }
-            }
+        if(self->nDims == 2){
+          if(!((size[0]==(unsigned)(res[0])) && (size[1]==(unsigned)(res[1])))){
+            if (context->interpolateRestart)
+              self->readFromFile = False;
+            else
+              Journal_Firewall( 
+                               0, 
+                               errorStream,
+                               "\n\nError in %s for %s '%s'\n"
+                               "Size of mesh (%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u,%u).\n\n"
+                               "If you would like to interpolate checkpoint data to simulation mesh size\n"
+                               "    please re-launch using '--interpolateRestart=1' flag\n\n", 
+                               __func__, self->type, self->name, 
+                               (unsigned int) res[0], (unsigned int) res[1],
+                               meshReadFileName,
+                               (unsigned int) size[0], (unsigned int) size[1]);
+          }
+        } else {
+          if(!((size[0]==(unsigned)(res[0])) && (size[1]==(unsigned)(res[1]))
+               && (size[2]==(unsigned)(res[2])))){
+            if (context->interpolateRestart)
+              self->readFromFile = False;
+            else
+              Journal_Firewall( 
+                               0, 
+                               errorStream,
+                               "\n\nError in %s for %s '%s'\n"
+                               "Size of mesh (%u,%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u,%u,%u).\n\n"
+                               "If you would like to interpolate checkpoint data to simulation mesh size\n"
+                               "    please re-launch using '--interpolateRestart=1' flag\n\n", 
+                               __func__, self->type, self->name, 
+                               (unsigned int) res[0], (unsigned int) res[1], (unsigned int) res[2],
+                               meshReadFileName,
+                               (unsigned int) size[0], (unsigned int) size[1], (unsigned int) size[2]);
+          }
+        }
 
-         H5Gclose(group_id);
-         H5Fclose( file );
+        H5Gclose(group_id);
+        H5Fclose( file );
 
-         }
+      }
 
 #else
-         Journal_Firewall(!context->interpolateRestart,  
-                     errorStream,"\n\n Interpolation restart not supported for ASCII checkpoint files \n\n");
+      Journal_Firewall(!context->interpolateRestart,  
+                       errorStream,"\n\n Interpolation restart not supported for ASCII checkpoint files \n\n");
 
-         meshReadFileNamePart = Context_GetCheckPointReadPrefixString( context );
+      meshReadFileNamePart = Context_GetCheckPointReadPrefixString( context );
 
-         Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.dat", meshReadFileNamePart, self->meshes[0]->name, restartTimestep );
+      Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.dat", meshReadFileNamePart, self->meshes[0]->name, restartTimestep );
 	        
-			FILE* meshFile = fopen( meshReadFileName, "r" );	
-			/*Journal_Firewall( 
-				meshFile != 0, 
-				errorStream, 
-				"Error in %s - Couldn't find checkpoint mesh file with filename \"%s\" - aborting.\n", 
-				__func__,  
-				meshReadFileName );*/
+      FILE* meshFile = fopen( meshReadFileName, "r" );	
+      /*Journal_Firewall( 
+        meshFile != 0, 
+        errorStream, 
+        "Error in %s - Couldn't find checkpoint mesh file with filename \"%s\" - aborting.\n", 
+        __func__,  
+        meshReadFileName );*/
 
-			if( meshFile == 0 ) {
-            /* file not found, so don't load from checkpoint */
-            self->readFromFile = False;            
-				Journal_Printf( errorStream, 
-					"Warning - Couldn't find checkpoint mesh file with filename \"%s\".\n", 
-					meshReadFileName );
-			}
-			else {
-				/* Read min and max coords from file */
-		      if(self->nDims==2)
-                  fscanf( meshFile, "Min: %lg %lg 0\n", &crdMin[0], &crdMin[1] );
-            else
-                  fscanf( meshFile, "Min: %lg %lg %lg\n", &crdMin[0], &crdMin[1], &crdMin[2] );
-		      if(self->nDims==2)
-                  fscanf( meshFile, "Max: %lg %lg 0\n", &crdMax[0], &crdMax[1] );
-            else
-                  fscanf( meshFile, "Max: %lg %lg %lg\n", &crdMax[0], &crdMax[1], &crdMax[2] );
+      if( meshFile == 0 ) {
+        /* file not found, so don't load from checkpoint */
+        self->readFromFile = False;            
+        Journal_Printf( errorStream, 
+                        "Warning - Couldn't find checkpoint mesh file with filename \"%s\".\n", 
+                        meshReadFileName );
+      }
+      else {
+        /* Read min and max coords from file */
+        if(self->nDims==2)
+          fscanf( meshFile, "Min: %lg %lg 0\n", &crdMin[0], &crdMin[1] );
+        else
+          fscanf( meshFile, "Min: %lg %lg %lg\n", &crdMin[0], &crdMin[1], &crdMin[2] );
+        if(self->nDims==2)
+          fscanf( meshFile, "Max: %lg %lg 0\n", &crdMax[0], &crdMax[1] );
+        else
+          fscanf( meshFile, "Max: %lg %lg %lg\n", &crdMax[0], &crdMax[1], &crdMax[2] );
             
-				fclose( meshFile );
-			}
+        fclose( meshFile );
+      }
 #endif
 				
-			Memory_Free( meshReadFileName );
-			Memory_Free( meshReadFileNamePart );
+      Memory_Free( meshReadFileName );
+      Memory_Free( meshReadFileNamePart );
 
-		}	
+    }	
 		   
-		/* Initial setup. */
-		CartesianGenerator_SetGeometryParams( self, crdMin, crdMax );
+    /* Initial setup. */
+    CartesianGenerator_SetGeometryParams( self, crdMin, crdMax );
 
-		/* Free coordinate arrays. */
-		FreeArray( crdMin );
-		FreeArray( crdMax );
-	}
+    /* Free coordinate arrays. */
+    FreeArray( crdMin );
+    FreeArray( crdMax );
+  }
 
-	/* Read and set shadow depth. */
-	shadowDepth = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"shadowDepth", 1  );
-	CartesianGenerator_SetShadowDepth( self, shadowDepth );
+  /* Read and set shadow depth. */
+  shadowDepth = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"shadowDepth", 1  );
+  CartesianGenerator_SetShadowDepth( self, shadowDepth );
 
-	/* Read regular flag. */
-	self->regular = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"regular", True  );
+  /* Read regular flag. */
+  self->regular = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"regular", True  );
 
-	/* Read periodic flags. */
-	self->periodic[0] = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"periodic_x", False  );
-	self->periodic[1] = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"periodic_y", False  );
-	self->periodic[2] = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"periodic_z", False  );
+  /* Read periodic flags. */
+  self->periodic[0] = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"periodic_x", False  );
+  self->periodic[1] = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"periodic_y", False  );
+  self->periodic[2] = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"periodic_z", False  );
 
-	/* Read a general dictionary flag for which processor to watch. */
-	stream = Journal_Register( Info_Type, (Name)self->type  );
-	Stream_SetPrintingRank( stream, Dictionary_GetUnsignedInt_WithDefault( cf->rootDict, "rankToWatch", 0 ) );
+  /* Read a general dictionary flag for which processor to watch. */
+  stream = Journal_Register( Info_Type, (Name)self->type  );
+  Stream_SetPrintingRank( stream, Dictionary_GetUnsignedInt_WithDefault( cf->rootDict, "rankToWatch", 0 ) );
 
-	/* Free stuff. */
-	FreeArray( size );
-	FreeArray( minDecomp );
-	FreeArray( maxDecomp );
+  /* Free stuff. */
+  FreeArray( size );
+  FreeArray( minDecomp );
+  FreeArray( maxDecomp );
 }
 
 void _CartesianGenerator_Build( void* meshGenerator, void* data ) {
@@ -2115,66 +2114,66 @@ void CartesianGenerator_MapToDomain( Car
 
 #define MAX_LINE_LENGTH 1024
 void CartesianGenerator_GenGeom( CartesianGenerator* self, Mesh* mesh, void* data ) {
-	Stream*			   stream = Journal_Register( Info_Type, (Name)self->type );
-	Sync*			      sync;
-	AbstractContext* 	context = (AbstractContext*)data;
+  Stream*			   stream = Journal_Register( Info_Type, (Name)self->type );
+  Sync*			      sync;
+  AbstractContext* 	context = (AbstractContext*)data;
 	
-	assert( self );
-	assert( mesh  );
+  assert( self );
+  assert( mesh  );
 
-	Journal_Printf( stream, "Generating geometry...\n" );
-	Stream_Indent( stream );
+  Journal_Printf( stream, "Generating geometry...\n" );
+  Stream_Indent( stream );
 
-	/* Allocate for coordinates. */
-	sync = (Sync*)IGraph_GetDomain( (IGraph*)mesh->topo, 0 );
-	mesh->verts = AllocNamedArray2D( double, Sync_GetNumDomains( sync ), 
-					 mesh->topo->nDims, 
-					 "Mesh::verts" );
+  /* Allocate for coordinates. */
+  sync = (Sync*)IGraph_GetDomain( (IGraph*)mesh->topo, 0 );
+  mesh->verts = AllocNamedArray2D( double, Sync_GetNumDomains( sync ), 
+                                   mesh->topo->nDims, 
+                                   "Mesh::verts" );
 
-	if( context && context->restartTimestep && context->timeStep == context->restartTimestep && self->readFromFile) {
-      char*  meshReadFileName;
-      char*  meshReadFileNamePart;   
+  if( context && context->restartTimestep && context->timeStep == context->restartTimestep && self->readFromFile) {
+    char*  meshReadFileName;
+    char*  meshReadFileNamePart;   
 
-      meshReadFileNamePart = Context_GetCheckPointReadPrefixString( context );
+    meshReadFileNamePart = Context_GetCheckPointReadPrefixString( context );
 #ifdef READ_HDF5
-      Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.h5", meshReadFileNamePart, self->meshes[0]->name, context->restartTimestep );
-      Journal_Printf( stream, "... loading from file %s.\n", meshReadFileName );
-      CartesianGenerator_ReadFromHDF5( self, mesh, meshReadFileName );
+    Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.h5", meshReadFileNamePart, self->meshes[0]->name, context->restartTimestep );
+    Journal_Printf( stream, "... loading from file %s.\n", meshReadFileName );
+    CartesianGenerator_ReadFromHDF5( self, mesh, meshReadFileName );
 #else
-      Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.dat", meshReadFileNamePart, self->meshes[0]->name, context->restartTimestep );
-      Journal_Printf( stream, "... loading from file %s.\n", meshReadFileName );
-      CartesianGenerator_ReadFromASCII( self, mesh, meshReadFileName);      
+    Stg_asprintf( &meshReadFileName, "%sMesh.%s.%.5u.dat", meshReadFileNamePart, self->meshes[0]->name, context->restartTimestep );
+    Journal_Printf( stream, "... loading from file %s.\n", meshReadFileName );
+    CartesianGenerator_ReadFromASCII( self, mesh, meshReadFileName);      
 #endif
-      Memory_Free( meshReadFileName );
-      Memory_Free( meshReadFileNamePart );
-      Mesh_Sync( mesh );
+    Memory_Free( meshReadFileName );
+    Memory_Free( meshReadFileNamePart );
+    Mesh_Sync( mesh );
       
-	} else { 
-      Grid*			      grid;
-      unsigned*		   inds;
-      double*			   steps;
-      int          d_i;
+  } else { 
+    Grid*			      grid;
+    unsigned*		   inds;
+    double*			   steps;
+    int          d_i;
 
-      /* Build grid and space for indices. */
-      grid = self->vertGrid;
-      inds = Memory_Alloc_Array_Unnamed( unsigned, mesh->topo->nDims );
+    /* Build grid and space for indices. */
+    grid = self->vertGrid;
+    inds = Memory_Alloc_Array_Unnamed( unsigned, mesh->topo->nDims );
 
-      /* Calculate steps. */
-      steps = Memory_Alloc_Array_Unnamed( double, mesh->topo->nDims );
-      for( d_i = 0; d_i < mesh->topo->nDims; d_i++ )
-         steps[d_i] = self->crdMax[d_i] - self->crdMin[d_i];
+    /* Calculate steps. */
+    steps = Memory_Alloc_Array_Unnamed( double, mesh->topo->nDims );
+    for( d_i = 0; d_i < mesh->topo->nDims; d_i++ )
+      steps[d_i] = self->crdMax[d_i] - self->crdMin[d_i];
    
-      CartesianGenerator_CalcGeom( self, mesh, sync, grid, inds, steps );
+    CartesianGenerator_CalcGeom( self, mesh, sync, grid, inds, steps );
       
-      /* Free resources. */
-      FreeArray( inds );
-      FreeArray( steps );
-	}
+    /* Free resources. */
+    FreeArray( inds );
+    FreeArray( steps );
+  }
 
 
-	MPI_Barrier( self->mpiComm );
-	Journal_Printf( stream, "... done.\n" );
-	Stream_UnIndent( stream );
+  MPI_Barrier( self->mpiComm );
+  Journal_Printf( stream, "... done.\n" );
+  Stream_UnIndent( stream );
 }
 
 void CartesianGenerator_CalcGeom( CartesianGenerator* self, Mesh* mesh, Sync* sync, Grid* grid, unsigned* inds, double* steps ) {	
@@ -2251,184 +2250,183 @@ void CartesianGenerator_DestructGeometry
 
 #ifdef READ_HDF5
 void CartesianGenerator_ReadFromHDF5(  CartesianGenerator* self, Mesh* mesh, Name filename ){
-	hid_t             file, fileSpace, fileData;
-	hsize_t           start[2], count[2], size[2], maxSize[2];   
-	hid_t             memSpace, error;
-	double            buf[4];
-   Node_LocalIndex   lNode_I = 0;
-	Node_GlobalIndex  gNode_I = 0;
-   int               totalVerts, ii;
-   unsigned int		noffset;
-   MeshCheckpointFileVersion ver;
-   hid_t					attrib_id, group_id;
-   herr_t				status;
-   char*					verticeName;
-	Stream*			   errorStream = Journal_Register( Error_Type, (Name)self->type  );   
+  hid_t             file, fileSpace, fileData;
+  hsize_t           start[2], count[2], size[2], maxSize[2];   
+  hid_t             memSpace, error;
+  double            buf[4];
+  Node_LocalIndex   lNode_I = 0;
+  Node_GlobalIndex  gNode_I = 0;
+  int               totalVerts, ii;
+  unsigned int		noffset;
+  MeshCheckpointFileVersion ver;
+  hid_t					attrib_id, group_id;
+  char*					verticeName;
+  Stream*			   errorStream = Journal_Register( Error_Type, (Name)self->type  );   
 
-   /* Open the file and data set. */
-   file = H5Fopen( filename, H5F_ACC_RDONLY, H5P_DEFAULT );
+  /* Open the file and data set. */
+  file = H5Fopen( filename, H5F_ACC_RDONLY, H5P_DEFAULT );
 
-   /** get the file attributes to sanity and version checks */
-   #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-      group_id  = H5Gopen(file, "/");
-      attrib_id = H5Aopen_name(group_id, "checkpoint file version");
-   #else
-      group_id  = H5Gopen2(file, "/", H5P_DEFAULT);
-      attrib_id = H5Aopen(group_id, "checkpoint file version", H5P_DEFAULT);
-   #endif
-   /** if this attribute does not exist (attrib_id < 0) then we assume MeshCHECKPOINT_V1 and continue without checking attributes */
-   if(attrib_id < 0)
-      ver = MeshCHECKPOINT_V1;
-   else {
-      int checkVer;
-      int ndims;
-      int res[self->nDims];
-      unsigned*  sizes;
+  /** get the file attributes to sanity and version checks */
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+  group_id  = H5Gopen(file, "/");
+  attrib_id = H5Aopen_name(group_id, "checkpoint file version");
+#else
+  group_id  = H5Gopen2(file, "/", H5P_DEFAULT);
+  attrib_id = H5Aopen(group_id, "checkpoint file version", H5P_DEFAULT);
+#endif
+  /** if this attribute does not exist (attrib_id < 0) then we assume MeshCHECKPOINT_V1 and continue without checking attributes */
+  if(attrib_id < 0)
+    ver = MeshCHECKPOINT_V1;
+  else {
+    int checkVer;
+    int ndims;
+    int res[self->nDims];
+    unsigned*  sizes;
 
-      /** check for known checkpointing version type */
+    /** check for known checkpointing version type */
 
-      status = H5Aread(attrib_id, H5T_NATIVE_INT, &checkVer);
-      H5Aclose(attrib_id);
-      if(checkVer == 2)
-         ver = MeshCHECKPOINT_V2;
-      else
-         Journal_Firewall( (0), errorStream,
-            "\n\nError in %s for %s '%s'\n"
-            "Unknown checkpoint version (%u) for checkpoint file (%s).\n", 
-            __func__, self->type, self->name, (unsigned int) checkVer, filename);
+    H5Aread(attrib_id, H5T_NATIVE_INT, &checkVer);
+    H5Aclose(attrib_id);
+    if(checkVer == 2)
+      ver = MeshCHECKPOINT_V2;
+    else
+      Journal_Firewall( (0), errorStream,
+                        "\n\nError in %s for %s '%s'\n"
+                        "Unknown checkpoint version (%u) for checkpoint file (%s).\n", 
+                        __func__, self->type, self->name, (unsigned int) checkVer, filename);
 
-      /** check for correct number of dimensions */
+    /** check for correct number of dimensions */
 
-      #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-         attrib_id = H5Aopen_name(group_id, "dimensions");
-      #else
-         attrib_id = H5Aopen(group_id, "dimensions", H5P_DEFAULT);
-      #endif
-      status = H5Aread(attrib_id, H5T_NATIVE_INT, &ndims);
-      H5Aclose(attrib_id);      
-      Journal_Firewall( (ndims == (int)(self->nDims)), errorStream,
-         "\n\nError in %s for %s '%s'\n"
-         "Number of dimensions (%u) for checkpoint file (%s) does not correspond to simulation dimensions (%u).\n", 
-         __func__, self->type, self->name, (unsigned int) ndims, filename,
-         self->nDims);
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+    attrib_id = H5Aopen_name(group_id, "dimensions");
+#else
+    attrib_id = H5Aopen(group_id, "dimensions", H5P_DEFAULT);
+#endif
+    H5Aread(attrib_id, H5T_NATIVE_INT, &ndims);
+    H5Aclose(attrib_id);      
+    Journal_Firewall( (ndims == (int)(self->nDims)), errorStream,
+                      "\n\nError in %s for %s '%s'\n"
+                      "Number of dimensions (%u) for checkpoint file (%s) does not correspond to simulation dimensions (%u).\n", 
+                      __func__, self->type, self->name, (unsigned int) ndims, filename,
+                      self->nDims);
 
-      /** check for correct mesh size */
+    /** check for correct mesh size */
       
-      #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-         attrib_id = H5Aopen_name(group_id, "mesh resolution");
-      #else
-         attrib_id = H5Aopen(group_id, "mesh resolution", H5P_DEFAULT);
-      #endif
-      status = H5Aread(attrib_id, H5T_NATIVE_INT, &res);
-      H5Aclose(attrib_id);
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+    attrib_id = H5Aopen_name(group_id, "mesh resolution");
+#else
+    attrib_id = H5Aopen(group_id, "mesh resolution", H5P_DEFAULT);
+#endif
+    H5Aread(attrib_id, H5T_NATIVE_INT, &res);
+    H5Aclose(attrib_id);
 
-      sizes = Grid_GetSizes( self->elGrid ); /** global no. of elements in each dim */
-      if(self->nDims == 2)
-         Journal_Firewall(((sizes[0] == (unsigned)(res[0]))
-                           && (sizes[1] == (unsigned)(res[1])) ), 
-            errorStream,
-            "\n\nError in %s for %s '%s'\n"
-            "Size of mesh (%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u, %u).\n", 
-            __func__, self->type, self->name, 
-            (unsigned int) res[0], (unsigned int) res[1],
-            filename,
-            (unsigned int) sizes[0], (unsigned int) sizes[1]);
-      else
-         Journal_Firewall( 
-                          ( (sizes[0] == (unsigned)(res[0]))
-                            && (sizes[1] == (unsigned)(res[1]))
-                            && (sizes[2] == (unsigned)(res[2])) ), 
-            errorStream,
-            "\n\nError in %s for %s '%s'\n"
-            "Size of mesh (%u,%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u,%u,%u).\n", 
-            __func__, self->type, self->name, 
-            (unsigned int) res[0], (unsigned int) res[1], (unsigned int) res[2],
-            filename,
-            (unsigned int) sizes[0], (unsigned int) sizes[1], (unsigned int) sizes[2]);
-   }
-   H5Gclose(group_id);
+    sizes = Grid_GetSizes( self->elGrid ); /** global no. of elements in each dim */
+    if(self->nDims == 2)
+      Journal_Firewall(((sizes[0] == (unsigned)(res[0]))
+                        && (sizes[1] == (unsigned)(res[1])) ), 
+                       errorStream,
+                       "\n\nError in %s for %s '%s'\n"
+                       "Size of mesh (%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u, %u).\n", 
+                       __func__, self->type, self->name, 
+                       (unsigned int) res[0], (unsigned int) res[1],
+                       filename,
+                       (unsigned int) sizes[0], (unsigned int) sizes[1]);
+    else
+      Journal_Firewall( 
+                       ( (sizes[0] == (unsigned)(res[0]))
+                         && (sizes[1] == (unsigned)(res[1]))
+                         && (sizes[2] == (unsigned)(res[2])) ), 
+                       errorStream,
+                       "\n\nError in %s for %s '%s'\n"
+                       "Size of mesh (%u,%u,%u) for checkpoint file (%s) does not correspond to simulation mesh size (%u,%u,%u).\n", 
+                       __func__, self->type, self->name, 
+                       (unsigned int) res[0], (unsigned int) res[1], (unsigned int) res[2],
+                       filename,
+                       (unsigned int) sizes[0], (unsigned int) sizes[1], (unsigned int) sizes[2]);
+  }
+  H5Gclose(group_id);
    
-   /** account for different versions of checkpointing */
-   switch ( ver ) {
-      case MeshCHECKPOINT_V1:
-         noffset = 1;
-         Stg_asprintf( &verticeName, "/data" );
-         break;
-      case MeshCHECKPOINT_V2:
-         noffset = 0;
-         Stg_asprintf( &verticeName, "/vertices" );
-         break;
-      default:
-         Journal_Firewall( 0, errorStream,
-            "Error: in %s: unknown checkpoint file version.\n",
-            __func__ ); 
-   }
+  /** account for different versions of checkpointing */
+  switch ( ver ) {
+  case MeshCHECKPOINT_V1:
+    noffset = 1;
+    Stg_asprintf( &verticeName, "/data" );
+    break;
+  case MeshCHECKPOINT_V2:
+    noffset = 0;
+    Stg_asprintf( &verticeName, "/vertices" );
+    break;
+  default:
+    Journal_Firewall( 0, errorStream,
+                      "Error: in %s: unknown checkpoint file version.\n",
+                      __func__ ); 
+  }
    
-   /* Prepare to read vertices from file */		
-   #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
-   fileData = H5Dopen( file, verticeName );
-   #else
-   fileData = H5Dopen2( file, verticeName, H5P_DEFAULT );
-   #endif
-   fileSpace = H5Dget_space( fileData );
-   Memory_Free( verticeName );
-   start[1] = 0;
-   count[0] = 1;
-   count[1] = mesh->topo->nDims + noffset;
-   memSpace = H5Screate_simple( 2, count, NULL );
-   totalVerts = Mesh_GetGlobalSize( mesh, (MeshTopology_Dim)0 );
+  /* Prepare to read vertices from file */		
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+  fileData = H5Dopen( file, verticeName );
+#else
+  fileData = H5Dopen2( file, verticeName, H5P_DEFAULT );
+#endif
+  fileSpace = H5Dget_space( fileData );
+  Memory_Free( verticeName );
+  start[1] = 0;
+  count[0] = 1;
+  count[1] = mesh->topo->nDims + noffset;
+  memSpace = H5Screate_simple( 2, count, NULL );
+  totalVerts = Mesh_GetGlobalSize( mesh, (MeshTopology_Dim)0 );
 
-   /* Get size of dataspace to check consistency */
-   H5Sget_simple_extent_dims( fileSpace, size, maxSize ); 
+  /* Get size of dataspace to check consistency */
+  H5Sget_simple_extent_dims( fileSpace, size, maxSize ); 
 
-   Journal_Firewall( 
-                    (maxSize[0] == (unsigned)totalVerts), 
-      errorStream,
-      "\n\nError in %s for %s '%s'\n"
-      "Number of mesh vertices (%u) stored in %s does not correspond to total number of requested mesh vertices (%u).\n", 
-      __func__, 
-      self->type, 
-      self->name, 
-      (unsigned int)maxSize[0],
-      filename,
-      totalVerts);
+  Journal_Firewall( 
+                   (maxSize[0] == (unsigned)totalVerts), 
+                   errorStream,
+                   "\n\nError in %s for %s '%s'\n"
+                   "Number of mesh vertices (%u) stored in %s does not correspond to total number of requested mesh vertices (%u).\n", 
+                   __func__, 
+                   self->type, 
+                   self->name, 
+                   (unsigned int)maxSize[0],
+                   filename,
+                   totalVerts);
 
-   for( ii=0; ii<totalVerts; ii++ ) {   
-      start[0] = ii;
+  for( ii=0; ii<totalVerts; ii++ ) {   
+    start[0] = ii;
             
-      H5Sselect_hyperslab( fileSpace, H5S_SELECT_SET, start, NULL, count, NULL );
-      H5Sselect_all( memSpace );
+    H5Sselect_hyperslab( fileSpace, H5S_SELECT_SET, start, NULL, count, NULL );
+    H5Sselect_all( memSpace );
       
-      error = H5Dread( fileData, H5T_NATIVE_DOUBLE, memSpace, fileSpace, H5P_DEFAULT, buf );
-      gNode_I = ii;
+    error = H5Dread( fileData, H5T_NATIVE_DOUBLE, memSpace, fileSpace, H5P_DEFAULT, buf );
+    gNode_I = ii;
 
-      Journal_Firewall( 
-         error >= 0, 
-         errorStream,
-         "\n\nError in %s for %s '%s' - Cannot read data in %s.\n", 
-         __func__, 
-         self->type, 
-         self->name, 
-         filename );
+    Journal_Firewall( 
+                     error >= 0, 
+                     errorStream,
+                     "\n\nError in %s for %s '%s' - Cannot read data in %s.\n", 
+                     __func__, 
+                     self->type, 
+                     self->name, 
+                     filename );
       
-      if( Mesh_GlobalToDomain( mesh, MT_VERTEX, gNode_I, &lNode_I ) && 
-          lNode_I < Mesh_GetLocalSize( mesh, MT_VERTEX ) )
+    if( Mesh_GlobalToDomain( mesh, MT_VERTEX, gNode_I, &lNode_I ) && 
+        lNode_I < Mesh_GetLocalSize( mesh, MT_VERTEX ) )
       {
-         double *vert;
+        double *vert;
 
-         vert = Mesh_GetVertex( mesh, lNode_I );
-         vert[0] = buf[0 + noffset];
-         vert[1] = buf[1 + noffset];
-         if( mesh->topo->nDims ==3 )
-            vert[2] = buf[2 + noffset];
+        vert = Mesh_GetVertex( mesh, lNode_I );
+        vert[0] = buf[0 + noffset];
+        vert[1] = buf[1 + noffset];
+        if( mesh->topo->nDims ==3 )
+          vert[2] = buf[2 + noffset];
       }
-   }
+  }
          
-   /* Close handles */
-   H5Sclose( memSpace );
-   H5Sclose( fileSpace );
-   H5Dclose( fileData );
-   H5Fclose( file );
+  /* Close handles */
+  H5Sclose( memSpace );
+  H5Sclose( fileSpace );
+  H5Dclose( fileData );
+  H5Fclose( file );
    
 }
 #endif



More information about the CIG-COMMITS mailing list