[cig-commits] r4217 - mc/3D/CitcomS/trunk/lib

luis at geodynamics.org luis at geodynamics.org
Thu Aug 3 07:03:24 PDT 2006


Author: luis
Date: 2006-08-03 07:03:24 -0700 (Thu, 03 Aug 2006)
New Revision: 4217

Modified:
   mc/3D/CitcomS/trunk/lib/Output_h5.c
   mc/3D/CitcomS/trunk/lib/hdf5_info.h
Log:
Fix bug in behavior for values of monitoringFrequency > 1 by keeping an
internal count of steps (Python does not pass monitoringFrequency to C code).


Modified: mc/3D/CitcomS/trunk/lib/Output_h5.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Output_h5.c	2006-08-03 11:17:02 UTC (rev 4216)
+++ mc/3D/CitcomS/trunk/lib/Output_h5.c	2006-08-03 14:03:24 UTC (rev 4217)
@@ -170,6 +170,9 @@
     /* disable horizontal average h5output   by Tan2 */
     /* h5output_ave_r(E, cycles); */
 
+    /* prepare for next step */
+    E->hdf5.step += 1;
+
     return;
 }
 
@@ -284,7 +287,6 @@
 
     type_id = E->hdf5.type_id;
 
-    
     /* Create necessary groups and arrays */
     for(cap = 0; cap < caps; cap++)
     {
@@ -340,6 +342,9 @@
     E->hdf5.scalar2d = (double *)malloc((nx*ny)*sizeof(double));
     E->hdf5.scalar1d = (double *)malloc((nz)*sizeof(double));
 
+    /* step about to be executed */
+    E->hdf5.step = 0;
+
 #endif
 }
 
@@ -1054,7 +1059,7 @@
     cap = h5open_cap(E);
     dataset = H5Dopen(cap, "velocity");
     h5write_field(dataset, H5T_NATIVE_DOUBLE, E->hdf5.vector3d,
-                  cycles+1, nodex, nodey, nodez, 3, E);
+                  E->hdf5.step+1, nodex, nodey, nodez, 3, E);
 
     /* release resources */
     status = H5Dclose(dataset);
@@ -1114,7 +1119,7 @@
     cap = h5open_cap(E);
     dataset = H5Dopen(cap, "temperature");
     h5write_field(dataset, H5T_NATIVE_DOUBLE, E->hdf5.scalar3d,
-                  cycles+1, nodex, nodey, nodez, 0, E);
+                  E->hdf5.step+1, nodex, nodey, nodez, 0, E);
 
     /* release resources */
     status = H5Dclose(dataset);

Modified: mc/3D/CitcomS/trunk/lib/hdf5_info.h
===================================================================
--- mc/3D/CitcomS/trunk/lib/hdf5_info.h	2006-08-03 11:17:02 UTC (rev 4216)
+++ mc/3D/CitcomS/trunk/lib/hdf5_info.h	2006-08-03 14:03:24 UTC (rev 4217)
@@ -41,6 +41,9 @@
     /* Default type used is H5T_NATIVE_FLOAT */
     hid_t type_id;
 
+    /* Keep track of step (instead of cycle) that is about to be executed */
+    int step;
+
     /* Group names under which to store the appropriate data,
      * represented by an array of strings. For a regional
      * model, only cap_groups[0] should be used.



More information about the cig-commits mailing list