[cig-commits] commit: added backwards compatibility for swarmvariable dataset names.

Mercurial hg at geodynamics.org
Tue Mar 23 10:35:19 PDT 2010


changeset:   595:e2ca66bdc7dd
branch:      1.4.x
user:        JohnMansour <john.mansour at maths.monash.edu.au>
date:        Tue Feb 23 18:16:14 2010 +1100
files:       Swarm/src/FileParticleLayout.c
description:
added backwards compatibility for swarmvariable dataset names.
also improved error reporting.


diff -r 70e08e4261af -r e2ca66bdc7dd Swarm/src/FileParticleLayout.c
--- a/Swarm/src/FileParticleLayout.c	Mon Feb 22 17:07:19 2010 +1100
+++ b/Swarm/src/FileParticleLayout.c	Tue Feb 23 18:16:14 2010 +1100
@@ -400,7 +400,29 @@ void _FileParticleLayout_InitialiseParti
                #else
                   self->fileData[swarmVar_I][ii-1]  = H5Dopen( file[ii-1], dataSpaceName, H5P_DEFAULT );
                #endif
-                  self->fileSpace[swarmVar_I][ii-1] = H5Dget_space( self->fileData[swarmVar_I][ii-1] );
+               /* if we cannot find the specified dataSpace, try again using the old naming convention */
+               if(self->fileData[swarmVar_I][ii-1] < 0){
+                  sprintf( dataSpaceName, "/%s", swarmVar->name );
+                  
+                  #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
+                     self->fileData[swarmVar_I][ii-1]  = H5Dopen( file[ii-1], dataSpaceName );
+                  #else
+                     self->fileData[swarmVar_I][ii-1]  = H5Dopen( file[ii-1], dataSpaceName, H5P_DEFAULT );
+                  #endif
+               }
+               /* if we still cannot find the specified dataSpace, there is a problem */
+               if(self->fileData[swarmVar_I][ii-1] < 0)
+                     Journal_Firewall( 
+                        NULL, 
+                        self->errorStream,
+                        "\n\nError in %s for %s '%s' \n Cannot open dataSpace for checkpointed swarmvariable (%s) that requries reloading.\n  Checkpoint files may be invalid.\n\n", 
+                        __func__, 
+                        self->type, 
+                        self->name,
+                        swarmVar->name );
+
+               
+               self->fileSpace[swarmVar_I][ii-1] = H5Dget_space( self->fileData[swarmVar_I][ii-1] );
                
                Variable_Update( swarmVar->variable );
             }



More information about the CIG-COMMITS mailing list