[MOAB-dev] r2812 - in MOAB/trunk/mhdf: example include src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Apr 10 16:26:47 CDT 2009


Author: kraftche
Date: 2009-04-10 16:26:46 -0500 (Fri, 10 Apr 2009)
New Revision: 2812

Modified:
   MOAB/trunk/mhdf/example/info.c
   MOAB/trunk/mhdf/include/mhdf.h
   MOAB/trunk/mhdf/src/file-desc.c
Log:
include the presense of adjacency data in file summary

Modified: MOAB/trunk/mhdf/example/info.c
===================================================================
--- MOAB/trunk/mhdf/example/info.c	2009-04-10 18:58:17 UTC (rev 2811)
+++ MOAB/trunk/mhdf/example/info.c	2009-04-10 21:26:46 UTC (rev 2812)
@@ -44,12 +44,15 @@
                             const char* subname,
                             struct mhdf_EntDesc* data,
                             const char* vals_label,
+                            const char* extra_label,
                             struct mhdf_FileDesc* all )
 {
   int i, len = 10;
   
   if (vals_label && strlen(vals_label) > len)
     len = strlen(vals_label);
+  if (extra_label && strlen(extra_label) > len)
+    len = strlen(extra_label);
   
   if (subname) 
     printf( "    %s (%s):\n", name, subname );
@@ -58,8 +61,12 @@
   
   if (vals_label)
     printf( "      %-*s: %d\n", len, vals_label, data->vals_per_ent );
-  
+ 
   printf( "      %-*s: %ld [%ld - %ld]\n", len, "entities", data->count, data->start_id, data->start_id + data->count - 1 );
+   
+  if (extra_label)
+    printf( "      %-*s\n", len, extra_label );
+
   if (!data->num_dense_tags)
     return;
   
@@ -71,7 +78,8 @@
 
 static void print_elem_desc( struct mhdf_ElemDesc* data, struct mhdf_FileDesc* all )
 {
-  print_ent_desc( data->handle, data->type, &data->desc, "nodes per element", all );
+  const char* adj = data->have_adj ? "adjacencies" : "no adjencies";
+  print_ent_desc( data->handle, data->type, &data->desc, "nodes per element", adj, all );
 }
 
 static const char* tag_type_name( enum mhdf_TagDataType type )
@@ -232,10 +240,10 @@
   int i;
   
   printf( "  Entities:\n" );
-  print_ent_desc( "Nodes", NULL, &data->nodes, "dimension", data );
+  print_ent_desc( "Nodes", NULL, &data->nodes, "dimension", NULL, data );
   for (i = 0; i < data->num_elem_desc; ++i)
     print_elem_desc( data->elems + i, data );
-  print_ent_desc( "Sets", NULL, &data->sets, NULL, data );
+  print_ent_desc( "Sets", NULL, &data->sets, NULL, NULL, data );
   
   printf( "  Tags:\n" );
   for (i = 0; i < data->num_tag_desc; ++i)

Modified: MOAB/trunk/mhdf/include/mhdf.h
===================================================================
--- MOAB/trunk/mhdf/include/mhdf.h	2009-04-10 18:58:17 UTC (rev 2811)
+++ MOAB/trunk/mhdf/include/mhdf.h	2009-04-10 21:26:46 UTC (rev 2812)
@@ -236,6 +236,7 @@
 struct mhdf_ElemDesc {
   const char* handle;       /**< String table identifier */
   const char* type;         /**< String type designator */
+  int have_adj;             /**< File contains adjacency data for this element group */
   struct mhdf_EntDesc desc;
 };
 struct mhdf_FileDesc {

Modified: MOAB/trunk/mhdf/src/file-desc.c
===================================================================
--- MOAB/trunk/mhdf/src/file-desc.c	2009-04-10 18:58:17 UTC (rev 2811)
+++ MOAB/trunk/mhdf/src/file-desc.c	2009-04-10 21:26:46 UTC (rev 2812)
@@ -147,6 +147,14 @@
 
   result->elems[index].desc.dense_tag_indices = NULL;
   result->elems[index].desc.num_dense_tags = 0;
+  result->elems[index].have_adj = mhdf_haveAdjacency( file_handle, 
+                                      result->elems[index].handle,
+                                      status );
+  if (mhdf_isError(status)) {
+    free( result );
+    return 0;
+  }
+  
   return result;
 }
                    



More information about the moab-dev mailing list