[MOAB-dev] r4197 - MOAB/trunk/src/io

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Oct 6 12:06:10 CDT 2010


Author: kraftche
Date: 2010-10-06 12:06:10 -0500 (Wed, 06 Oct 2010)
New Revision: 4197

Modified:
   MOAB/trunk/src/io/ReadHDF5.cpp
   MOAB/trunk/src/io/ReadHDF5.hpp
Log:
HDF5 reader fixes:
  o Avoid reading connectivity twice for some elements when doing 
    partial/parallel read
  o When doing partial/parallel read, read explicit adjacencies
    before deciding which lower-dimension entities are adjacent.


Modified: MOAB/trunk/src/io/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/ReadHDF5.cpp	2010-10-06 17:02:54 UTC (rev 4196)
+++ MOAB/trunk/src/io/ReadHDF5.cpp	2010-10-06 17:06:10 UTC (rev 4197)
@@ -710,9 +710,34 @@
     
   dbgOut.tprint( 1, "GATHERING NODE IDS\n" );
   
-    // if input contained any polyhedra, need to get faces
+    // Figure out the maximum dimension of entity to be read
+  int max_dim = 0;
   for (int i = 0; i < fileInfo->num_elem_desc; ++i) {
     EntityType type = CN::EntityTypeFromName( fileInfo->elems[i].type );
+    if (type <= MBVERTEX || type >= MBENTITYSET) {
+      assert( false ); // for debug code die for unknown element tyoes
+      continue; // for release code, skip unknown element types
+    }
+    int dim = CN::Dimension(type);
+    if (dim > max_dim) {
+      Range subset;
+      intersect( fileInfo->elems[i].desc, file_ids, subset );
+      if (!subset.empty())
+        max_dim = dim;
+    }
+  }
+#ifdef USE_MPI
+  if (nativeParallel) {
+    int send = max_dim;
+    MPI_Allreduce( &send, &max_dim, 1, MPI_INT, MPI_MAX, *mpiComm );
+  }
+#endif
+  
+    // if input contained any polyhedra, then need to get faces
+    // of the polyhedra before the next loop because we need to 
+    // read said faces in that loop.
+  for (int i = 0; i < fileInfo->num_elem_desc; ++i) {
+    EntityType type = CN::EntityTypeFromName( fileInfo->elems[i].type );
     if (type != MBPOLYHEDRON)
       continue;
     
@@ -721,7 +746,7 @@
     
     Range polyhedra;
     intersect( fileInfo->elems[i].desc, file_ids, polyhedra );
-    rval = read_elems( i, polyhedra, file_ids );
+    rval = read_elems( i, polyhedra, &file_ids );
     if (MB_SUCCESS != rval)
       return error(rval);
   }
@@ -737,13 +762,24 @@
     }


More information about the moab-dev mailing list