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

luis at geodynamics.org luis at geodynamics.org
Wed Aug 23 19:47:01 PDT 2006


Author: luis
Date: 2006-08-23 19:47:01 -0700 (Wed, 23 Aug 2006)
New Revision: 4410

Modified:
   mc/3D/CitcomS/trunk/lib/Output_h5.c
   mc/3D/CitcomS/trunk/lib/hdf5_related.h
Log:
Added /cap/average/coord dataset


Modified: mc/3D/CitcomS/trunk/lib/Output_h5.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Output_h5.c	2006-08-23 23:27:13 UTC (rev 4409)
+++ mc/3D/CitcomS/trunk/lib/Output_h5.c	2006-08-24 02:47:01 UTC (rev 4410)
@@ -52,6 +52,7 @@
 void h5output_meta(struct All_variables *);
 void h5output_coord(struct All_variables *);
 void h5output_surf_botm_coord(struct All_variables *E);
+void h5output_have_coord(struct All_variables *);
 void h5output_material(struct All_variables *);
 
 /* time-varying data */
@@ -84,6 +85,7 @@
 static herr_t h5create_surf_velocity(hid_t loc_id, field_t *field);
 static herr_t h5create_surf_heatflux(hid_t loc_id, field_t *field);
 static herr_t h5create_surf_topography(hid_t loc_id, field_t *field);
+static herr_t h5create_have_coord(hid_t loc_id, field_t *field);
 static herr_t h5create_have_temperature(hid_t loc_id, field_t *field);
 static herr_t h5create_have_vxy_rms(hid_t loc_id, field_t *field);
 static herr_t h5create_have_vz_rms(hid_t loc_id, field_t *field);
@@ -122,6 +124,7 @@
         h5output_meta(E);
         h5output_coord(E);
         h5output_surf_botm_coord(E);
+        h5output_have_coord(E);
         h5output_material(E);
     }
 
@@ -227,6 +230,8 @@
 
     E->hdf5.const_vector3d = NULL;
     E->hdf5.const_vector2d = NULL;
+    E->hdf5.const_scalar1d = NULL;
+
     E->hdf5.tensor3d = NULL;
     E->hdf5.vector3d = NULL;
     E->hdf5.vector2d = NULL;
@@ -238,6 +243,7 @@
 
     h5allocate_field(E, VECTOR_FIELD, 3, 0, dtype, &(E->hdf5.const_vector3d));
     h5allocate_field(E, VECTOR_FIELD, 2, 0, dtype, &(E->hdf5.const_vector2d));
+    h5allocate_field(E, SCALAR_FIELD, 1, 0, dtype, &(E->hdf5.const_scalar1d));
 
     h5allocate_field(E, TENSOR_FIELD, 3, 1, dtype, &(E->hdf5.tensor3d));
         
@@ -311,6 +317,7 @@
         if(E->output.average == 1)
         {
             avg_group = h5create_group(cap_group, "average", (size_t)0);
+            h5create_have_coord(avg_group, E->hdf5.const_scalar1d);
             h5create_have_temperature(avg_group, E->hdf5.scalar1d);
             h5create_have_vxy_rms(avg_group, E->hdf5.scalar1d);
             h5create_have_vz_rms(avg_group, E->hdf5.scalar1d);
@@ -326,7 +333,6 @@
 
     E->hdf5.count = 0; // TODO: for restart, initialize to last value
 
-
     /* Determine current cap and remember it */
 
     nprocx = E->parallel.nprocx;
@@ -337,6 +343,7 @@
     E->hdf5.capid = cap;
     E->hdf5.cap_group = E->hdf5.cap_groups[cap];
 
+
 #endif
 }
 
@@ -464,6 +471,7 @@
     herr_t status;
 
     /* DEBUG
+    if (strcmp(name, "coord") == 0)
     if (chunkdims != NULL)
         printf("\t\th5create_dataset()\n"
                "\t\t\tname=\"%s\"\n"
@@ -499,7 +507,7 @@
                "\t\t\tchunkdims=NULL\n",
                name, rank,
                (int)dims[0], (int)dims[1],
-               (int)dims[2], (int)dims[3], (int)dims[4])
+               (int)dims[2], (int)dims[3], (int)dims[4]);
     // */
 
     /* create the dataspace for the dataset */
@@ -830,6 +838,14 @@
     return 0;
 }
 
+static herr_t h5create_have_coord(hid_t loc_id, field_t *field)
+{
+    h5create_dataset(loc_id, "coord", "radial coordinates",
+                     field->dtype, field->rank, field->dims, field->maxdims,
+                     NULL);
+    return 0;
+}
+
 static herr_t h5create_have_temperature(hid_t loc_id, field_t *field)
 {
     h5create_dataset(loc_id, "temperature", "temperature horizontal average",
@@ -1670,6 +1686,37 @@
  * 1D Fields                                                                *
  ****************************************************************************/
 
+void h5output_have_coord(struct All_variables *E)
+{
+    hid_t cap_group;
+    hid_t dataset;
+    herr_t status;
+
+    field_t *field;
+
+    int k;
+    int mz;
+
+    int px = E->parallel.me_loc[1];
+    int py = E->parallel.me_loc[2];
+
+    field = E->hdf5.const_scalar1d;
+
+    mz = field->block[0];
+
+    if (px == 0 && py == 0 && E->output.average == 1)
+    {
+        for(k = 0; k < mz; k++)
+            field->data[k] = E->sx[1][3][k+1];
+
+        cap_group = E->hdf5.cap_groups[E->hdf5.capid];
+        dataset   = H5Dopen(cap_group, "average/coord");
+        status    = h5write_field(dataset, field);
+        status    = H5Dclose(dataset);
+    }
+
+}
+
 void h5output_average(struct All_variables *E, int cycles)
 {
     /* horizontal average output of temperature and rms velocity */

Modified: mc/3D/CitcomS/trunk/lib/hdf5_related.h
===================================================================
--- mc/3D/CitcomS/trunk/lib/hdf5_related.h	2006-08-23 23:27:13 UTC (rev 4409)
+++ mc/3D/CitcomS/trunk/lib/hdf5_related.h	2006-08-24 02:47:01 UTC (rev 4410)
@@ -122,15 +122,16 @@
      *
      */
     
-    field_t *const_vector3d;     /* shape (xdim,ydim,zdim,3) */
-    field_t *const_vector2d;     /* shape (xdim,ydim,2) */
+    field_t *const_vector3d;    /* shape (xdim,ydim,zdim,3) */
+    field_t *const_vector2d;    /* shape (xdim,ydim,2) */
+    field_t *const_scalar1d;    /* shape (zdim,) */
     
-    field_t *tensor3d;           /* shape (tdim,xdim,ydim,zdim,6) */
-    field_t *vector3d;           /* shape (tdim,xdim,ydim,zdim,3) */
-    field_t *vector2d;           /* shape (tdim,xdim,ydim,2) */
+    field_t *tensor3d;          /* shape (tdim,xdim,ydim,zdim,6) */
+    field_t *vector3d;          /* shape (tdim,xdim,ydim,zdim,3) */
+    field_t *vector2d;          /* shape (tdim,xdim,ydim,2) */
 
-    field_t *scalar3d;           /* shape (tdim,xdim,ydim,zdim) */
-    field_t *scalar2d;           /* shape (tdim,xdim,ydim) */
-    field_t *scalar1d;           /* shape (tdim,zdim) */
+    field_t *scalar3d;          /* shape (tdim,xdim,ydim,zdim) */
+    field_t *scalar2d;          /* shape (tdim,xdim,ydim) */
+    field_t *scalar1d;          /* shape (tdim,zdim) */
 
 };



More information about the cig-commits mailing list