[MOAB-dev] r1378 - in MOAB/trunk: . parallel

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Mon Nov 12 08:30:53 CST 2007


Author: kraftche
Date: 2007-11-12 08:30:53 -0600 (Mon, 12 Nov 2007)
New Revision: 1378

Modified:
   MOAB/trunk/WriteHDF5.cpp
   MOAB/trunk/WriteHDF5.hpp
   MOAB/trunk/parallel/MBParallelComm.cpp
   MOAB/trunk/parallel/MBParallelComm.hpp
   MOAB/trunk/parallel/WriteHDF5Parallel.cpp
Log:
update parallel code for changes to poly(gon|hedron) representation

Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp	2007-11-12 13:43:19 UTC (rev 1377)
+++ MOAB/trunk/WriteHDF5.cpp	2007-11-12 14:30:53 UTC (rev 1378)
@@ -401,14 +401,6 @@
   for (ex_itor = exportList.begin(); ex_itor != exportList.end(); ++ex_itor)
     if (MB_SUCCESS != write_elems( *ex_itor ))
       goto write_fail;
-//  {
-//    if (ex_itor->type == MBPOLYGON || ex_itor->type == MBPOLYHEDRON)
-//      result = write_poly( *ex_itor );
-//    else
-//      result = write_elems( *ex_itor );
-//    if (MB_SUCCESS != result)
-//      goto write_fail;
-//  }
 
 DEBUGOUT("Writing sets.\n");
   
@@ -1730,7 +1722,6 @@
     writeUtil->assign_ids( ex_itor->range, idTag, (id_t)first_id );
     ex_itor->first_id = (id_t)first_id;
     ex_itor->offset = 0;
-    ex_itor->poly_offset = 0;
   }
 
     // create node adjacency table

Modified: MOAB/trunk/WriteHDF5.hpp
===================================================================
--- MOAB/trunk/WriteHDF5.hpp	2007-11-12 13:43:19 UTC (rev 1377)
+++ MOAB/trunk/WriteHDF5.hpp	2007-11-12 14:30:53 UTC (rev 1378)
@@ -164,9 +164,6 @@
     //! The offset at which to begin writting this processor's data.
     //! Always zero except for parallel IO.
     id_t offset;
-    //! Offset for poly connectivity.  Unused for non-poly elements.
-    //! Always zero except for parallel IO.
-    id_t poly_offset;
     //! Offset for adjacency data.  Always zero except for parallel IO
     id_t adj_offset;
     

Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp	2007-11-12 13:43:19 UTC (rev 1377)
+++ MOAB/trunk/parallel/MBParallelComm.cpp	2007-11-12 14:30:53 UTC (rev 1378)
@@ -2,7 +2,7 @@
 #include "MBParallelComm.hpp"
 #include "MBWriteUtilIface.hpp"
 #include "MBReadUtilIface.hpp"
-#include "EntitySequenceManager.hpp"
+#include "SequenceManager.hpp"
 #include "EntitySequence.hpp"
 #include "TagServer.hpp"
 #include "MBTagConventions.hpp"
@@ -10,6 +10,8 @@
 #include "MBParallelConventions.h"
 #include "MBCore.hpp"
 #include "MBError.hpp"
+#include "ElementSequence.hpp"
+#include "MBCN.hpp"
 
 #include <iostream>
 
@@ -429,27 +431,28 @@
     while (end_rit != entities.end() && TYPE_FROM_HANDLE(*start_rit) != MBENTITYSET) {
 
         // get the sequence holding this entity
-      MBEntitySequence *seq;
-      ElementEntitySequence *eseq;
+      EntitySequence *seq;
+      ElementSequence *eseq;
       result = sequenceManager->find(*start_rit, seq);
       RR("Couldn't find entity sequence.");
 
       if (NULL == seq) return MB_FAILURE;
-      eseq = dynamic_cast<ElementEntitySequence*>(seq);
+      eseq = dynamic_cast<ElementSequence*>(seq);
 
         // if type and nodes per element change, start a new range
-      if (eseq->get_type() != *entTypes.rbegin() || (int) eseq->nodes_per_element() != *vertsPerEntity.rbegin()) {
-        entTypes.push_back(eseq->get_type());
+      if (eseq->type() != *entTypes.rbegin() || (int) eseq->nodes_per_element() != *vertsPerEntity.rbegin()) {
+        entTypes.push_back(eseq->type());
         vertsPerEntity.push_back(eseq->nodes_per_element());
         allRanges.push_back(MBRange());
         allr_it++;
       }
     
         // get position in entities list one past end of this sequence
-      end_rit = entities.lower_bound(start_rit, entities.end(), eseq->get_end_handle()+1);
+      end_rit = entities.lower_bound(start_rit, entities.end(), eseq->end_handle()+1);
 
         // put these entities in the last range
-      eseq->get_entities(*allRanges.rbegin());
+      (*allRanges.rbegin()).insert( eseq->start_handle(), eseq->end_handle() );
+      //eseq->get_entities(*allRanges.rbegin());
       whole_range.merge(*allRanges.rbegin());
       
         // now start where we last left off
@@ -472,11 +475,12 @@
       count += 2*sizeof(MBEntityHandle)*num_subranges(*vit);
         // connectivity of subrange
       if (iit != vertsPerEntity.begin()) {
-        if (*eit != MBPOLYGON && *eit != MBPOLYHEDRON) 
+        //if (*eit != MBPOLYGON && *eit != MBPOLYHEDRON) 
             // for non-poly's: #verts/ent * #ents * sizeof handle
-          count += *iit * (*vit).size() * sizeof(MBEntityHandle);
+        //  count += *iit * (*vit).size() * sizeof(MBEntityHandle);
           // for poly's:  length of conn list * handle size + #ents * int size (for offsets)
-        else count += *iit * sizeof(MBEntityHandle) + (*vit).size() * sizeof(int);
+        //else 
+        count += *iit * sizeof(MBEntityHandle) + (*vit).size() * sizeof(int);
       }
     }
       //                                num_verts per subrange    ent type in subrange
@@ -505,24 +509,24 @@
         // pack the connectivity
       const MBEntityHandle *connect;
       int num_connect;
-      if (*et_it == MBPOLYGON || *et_it == MBPOLYHEDRON) {
-        std::vector<int> num_connects;
+      //if (*et_it == MBPOLYGON || *et_it == MBPOLYHEDRON) {
+      //  std::vector<int> num_connects;
+      //  for (MBRange::const_iterator rit = allr_it->begin(); rit != allr_it->end(); rit++) {
+      //    result = mbImpl->get_connectivity(*rit, connect, num_connect);
+      //    RR("Failed to get connectivity.");
+      //    num_connects.push_back(num_connect);
+      //    PACK_EH(buff_ptr, &connect[0], num_connect);
+      //  }
+      //  PACK_INTS(buff_ptr, &num_connects[0], num_connects.size());
+      //}
+      //else {
         for (MBRange::const_iterator rit = allr_it->begin(); rit != allr_it->end(); rit++) {
           result = mbImpl->get_connectivity(*rit, connect, num_connect);
           RR("Failed to get connectivity.");
-          num_connects.push_back(num_connect);
-          PACK_EH(buff_ptr, &connect[0], num_connect);
-        }
-        PACK_INTS(buff_ptr, &num_connects[0], num_connects.size());
-      }
-      else {
-        for (MBRange::const_iterator rit = allr_it->begin(); rit != allr_it->end(); rit++) {
-          result = mbImpl->get_connectivity(*rit, connect, num_connect);
-          RR("Failed to get connectivity.");
           assert(num_connect == *nv_it);
           PACK_EH(buff_ptr, &connect[0], num_connect);
         }
-      }
+      //}
 
       whole_range.merge(*allr_it);
     }
@@ -609,30 +613,30 @@
         int num_elems = (*pit).second - (*pit).first + 1;
         MBEntityHandle *connect;
         int *connect_offsets;
-        if (this_type == MBPOLYGON || this_type == MBPOLYHEDRON) {
-          result = ru->get_poly_element_array(num_elems, verts_per_entity, this_type,
-                                              start_id, start_proc, actual_start,
-                                              connect_offsets, connect);
-          RR("Failed to allocate poly element arrays.");
-        }
+        //if (this_type == MBPOLYGON || this_type == MBPOLYHEDRON) {
+        //  result = ru->get_poly_element_array(num_elems, verts_per_entity, this_type,
+        //                                      start_id, start_proc, actual_start,
+        //                                      connect_offsets, connect);
+        //  RR("Failed to allocate poly element arrays.");
+        //}
 
-        else {
+        //else {
           result = ru->get_element_array(num_elems, verts_per_entity, this_type,
                                          start_id, start_proc, actual_start,
                                          connect);
           RR("Failed to allocate element arrays.");
-        }
+        //}
 
           // copy connect arrays
-        if (this_type != MBPOLYGON && this_type != MBPOLYHEDRON) {
-          UNPACK_EH(buff_ptr, connect, num_elems * verts_per_entity);
-        }
-        else {
+        //if (this_type != MBPOLYGON && this_type != MBPOLYHEDRON) {
+        //  UNPACK_EH(buff_ptr, connect, num_elems * verts_per_entity);
+        //}
+        //else {
           UNPACK_EH(buff_ptr, connect, verts_per_entity);
           assert(NULL != connect_offsets);
             // and the offsets
           UNPACK_INTS(buff_ptr, connect_offsets, num_elems);
-        }
+        //}
 
         entities.insert((*pit).first, (*pit).second);
       }

Modified: MOAB/trunk/parallel/MBParallelComm.hpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.hpp	2007-11-12 13:43:19 UTC (rev 1377)
+++ MOAB/trunk/parallel/MBParallelComm.hpp	2007-11-12 14:30:53 UTC (rev 1378)
@@ -30,7 +30,7 @@
 #include "MBProcConfig.hpp"
 
 class TagServer;
-class EntitySequenceManager;
+class SequenceManager;
 
 class MBParallelComm 
 {
@@ -192,7 +192,7 @@
   TagServer *tagServer;
   
     //! Sequence manager, to get more efficient access to entities
-  EntitySequenceManager *sequenceManager;
+  SequenceManager *sequenceManager;
   
     //! data buffer used to communicate
   std::vector<unsigned char> myBuffer;

Modified: MOAB/trunk/parallel/WriteHDF5Parallel.cpp
===================================================================
--- MOAB/trunk/parallel/WriteHDF5Parallel.cpp	2007-11-12 13:43:19 UTC (rev 1377)
+++ MOAB/trunk/parallel/WriteHDF5Parallel.cpp	2007-11-12 14:30:53 UTC (rev 1378)
@@ -671,9 +671,7 @@
   bool operator==( const elemtype& other ) const
   {
     return mbtype == other.mbtype &&
-            (mbtype == MBPOLYGON ||
-             mbtype == MBPOLYHEDRON ||
-             mbtype == MBENTITYSET ||
+            (mbtype == MBENTITYSET ||
              numnode == other.numnode);
   }
   bool operator<( const elemtype& other ) const
@@ -682,9 +680,7 @@
       return false;
    
     return mbtype < other.mbtype ||
-           (mbtype != MBPOLYGON &&
-            mbtype != MBPOLYHEDRON &&
-            mbtype != MBENTITYSET &&
+           (mbtype != MBENTITYSET &&
             numnode < other.numnode);
   }
   bool operator!=( const elemtype& other ) const
@@ -798,7 +794,7 @@
       ++ex_iter;
     
     bool equal = ex_iter != exportList.end() && ex_iter->type == mbtype;
-    if (equal && mbtype != MBPOLYGON && mbtype != MBPOLYHEDRON)
+    if (equal)
     {
       while (ex_iter != exportList.end() && ex_iter->num_nodes < numnode)
         ++ex_iter;
@@ -813,7 +809,6 @@
       insert.num_nodes = numnode;
       insert.first_id = 0;
       insert.offset = 0;
-      insert.poly_offset = 0;
       insert.adj_offset = 0;
       ex_iter = exportList.insert( ex_iter, insert );
     }
@@ -864,51 +859,6 @@
   for (ex_iter = exportList.begin(); ex_iter != exportList.end(); ++ex_iter)
     ex_iter->offset = (id_t)*(viter++);
   
-    // If polygons or polyhedra, send calculate offsets for each
-  std::vector<int> perproc(numProc+1);
-  ExportSet *poly[] = {0,0};
-  int polycount[2];
-  for (ex_iter = exportList.begin(); ex_iter != exportList.end(); ++ex_iter)
-  {
-    if (ex_iter->type == MBPOLYGON)
-    {
-      assert(!poly[0]);
-      poly[0] = &*ex_iter;
-    }
-    else if(ex_iter->type == MBPOLYHEDRON)
-    {
-      assert(!poly[1]);
-      poly[1] = &*ex_iter;
-    }
-  }
-  for (int i = 0; i < 2; i++)
-  {
-    ExportSet* ppoly = poly[i];
-    if (!ppoly)
-      continue;
-  
-    int count;
-    rval = writeUtil->get_poly_array_size( ppoly->range.begin(),
-                                           ppoly->range.end(),
-                                           count );
-    assert(MB_SUCCESS == rval);
-    result = MPI_Gather( &count, 1, MPI_INT, &perproc[0], 1, MPI_INT, 0, MPI_COMM_WORLD );
-    assert(MPI_SUCCESS == result);
-    
-    int prev = 0;
-    for (int j = 1; j <= numProc; j++)
-    {
-      int tmp = perproc[j];
-      perproc[j] = prev;
-      prev += tmp;
-    }
-                                           
-    polycount[i] = perproc[numProc];
-    result = MPI_Scatter( &perproc[0], 1, MPI_INT, &count, 1, MPI_INT, 0, MPI_COMM_WORLD );
-    assert(MPI_SUCCESS == result);
-    ppoly->poly_offset = count;
-  }
-  
     // Create element tables
   std::vector<long> start_ids(numtypes);
   if (myRank == 0)
@@ -917,25 +867,10 @@
     long* citer = &counts[numtypes * numProc];
     for (ex_iter = exportList.begin(); ex_iter != exportList.end(); ++ex_iter)
     {
-      switch(ex_iter->type) {
-      case MBPOLYGON:
-        rval = create_poly_tables( MBPOLYGON,
-                                   *citer,
-                                   polycount[0],
-                                   *viter );
-        break;
-      case MBPOLYHEDRON:
-        rval = create_poly_tables( MBPOLYHEDRON,
-                                   *citer,
-                                   polycount[1],
-                                   *viter );
-        break;
-      default:
-        rval = create_elem_tables( ex_iter->type,
-                                   ex_iter->num_nodes,
-                                   *citer,
-                                   *viter );
-      }
+      rval = create_elem_tables( ex_iter->type,
+                                 ex_iter->num_nodes,
+                                 *citer,
+                                 *viter );
       assert(MB_SUCCESS == rval);
       ++citer;
       ++viter;




More information about the moab-dev mailing list