[MOAB-dev] commit/MOAB: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jul 8 22:22:19 CDT 2014


2 new commits in MOAB:

https://bitbucket.org/fathomteam/moab/commits/94b8d9450504/
Changeset:   94b8d9450504
Branch:      None
User:        iulian07
Date:        2014-07-09 05:11:06
Summary:     introduce ParallelComm::delete_entities(Range &)

when a user deletes an entity, in a parallel environment,
it needs to make sure it is deleted from all tasks that might
share it
Also, update the sharedEnts local vector on each

Affected #:  3 files

diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 08dad08..8e5e029 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -408,18 +408,12 @@ int main(int argc, char **argv)
   Range toDelete;
   rval =  mb->get_entities_by_dimension(0, 1, toDelete);
   CHECKE("Can't get edges");
-  rval = mb->delete_entities(toDelete);
-  CHECKE("Can't delete edges");
-
-  toDelete.clear();
 
   rval = mb->get_entities_by_dimension(0, 2, toDelete);
   CHECKE("Can't get faces");
-  rval = mb->delete_entities(toDelete);
-  CHECKE("Can't delete faces");
 
-  rval = pcomm->correct_shared_entities() ;
-  CHECKE("Can't correct local shared")
+  rval = pcomm->delete_entities(toDelete) ;
+  CHECKE("Can't delete entities")
 
   if (0==rank)
   {

diff --git a/src/parallel/ParallelComm.cpp b/src/parallel/ParallelComm.cpp
index a8571af..37f2813 100644
--- a/src/parallel/ParallelComm.cpp
+++ b/src/parallel/ParallelComm.cpp
@@ -8790,19 +8790,75 @@ ErrorCode ParallelComm::settle_intersection_points(Range & edges, Range & shared
   return MB_SUCCESS;
   // end copy
 }
-ErrorCode ParallelComm::correct_shared_entities()
+ErrorCode ParallelComm::delete_entities(Range & to_delete)
 {
 
+  // will not look at shared sets yet, but maybe we should
+  // first, see if any of the entities to delete is shared; then inform the other processors
+  // about their fate (to be deleted), using a crystal router transfer
+  ErrorCode rval=MB_SUCCESS;
+  unsigned char pstat;
+  EntityHandle tmp_handles[MAX_SHARING_PROCS];
+  int tmp_procs[MAX_SHARING_PROCS];
+  unsigned int num_ps;
+  TupleList ents_to_delete;
+  ents_to_delete.initialize(1, 0, 1, 0, to_delete.size() * (MAX_SHARING_PROCS+1) );// a little bit of overkill
+  ents_to_delete.enableWriteAccess();
+  unsigned int i = 0;
+  for (Range::iterator it=to_delete.begin(); it!=to_delete.end(); it++)
+  {
+    EntityHandle eh=*it; // entity to be deleted
+
+    rval = get_sharing_data(eh, tmp_procs, tmp_handles,
+                                   pstat, num_ps);
+    if (rval!=MB_SUCCESS || num_ps==0)
+      continue;
+    // add to the tuple list the information to be sent (to the remote procs)
+
+    for (unsigned int p = 0; p < num_ps; p++)
+    {
+      ents_to_delete.vi_wr[i] = tmp_procs[p];
+      ents_to_delete.vul_wr[i] = (unsigned long)tmp_handles[p];
+      i++;
+      ents_to_delete.inc_n();
+    }
+  }
+
+  gs_data::crystal_data *cd = this->procConfig.crystal_router();
+  // all communication happens here; no other mpi calls
+  // also, this is a collective call
+  rval = cd->gs_transfer(1,ents_to_delete,0);
+
+  if (MB_SUCCESS!= rval)
+  {
+    std::cout << "error in tuple transfer\n";
+    return rval;
+  }
+  // add to the range of ents to delete the new ones that were sent from other procs
+  unsigned int received = ents_to_delete.get_n();
+  for (i=0; i< received; i++)
+  {
+    //int from = ents_to_delete.vi_rd[i];
+    unsigned long valrec = ents_to_delete.vul_rd[i];
+    to_delete.insert((EntityHandle)valrec);
+  }
+  rval = mbImpl->delete_entities(to_delete);
+  if (MB_SUCCESS!= rval)
+  {
+    std::cout << "error in deleting actual entities\n";
+    return rval;
+  }
   std::vector<EntityHandle> good_ents;
-  for (size_t i=0; i<sharedEnts.size(); i++)
+  for (size_t j=0; j<sharedEnts.size(); j++)
   {
-    if (mbImpl->is_valid(sharedEnts[i]))
+    if (mbImpl->is_valid(sharedEnts[j]))
     {
-      good_ents.push_back(sharedEnts[i]);
+      good_ents.push_back(sharedEnts[j]);
     }
   }
   sharedEnts = good_ents;
 
+  // what about shared sets? who is updating them?
   return MB_SUCCESS;
 }
 

diff --git a/src/parallel/moab/ParallelComm.hpp b/src/parallel/moab/ParallelComm.hpp
index 2a16ac2..976236e 100644
--- a/src/parallel/moab/ParallelComm.hpp
+++ b/src/parallel/moab/ParallelComm.hpp
@@ -932,11 +932,11 @@ namespace moab {
     ErrorCode settle_intersection_points(Range & edges, Range & shared_edges_owned,
         std::vector<std::vector<EntityHandle> *> & extraNodesVec, double tolerance);
 
-    /* \brief check the shared entities if they exist anymore
+    /* \brief delete entities from moab database
      * will check the shared ents array, and clean it if necessary
      *
      */
-    ErrorCode correct_shared_entities();
+    ErrorCode delete_entities(Range & to_delete);
 
   private:
 


https://bitbucket.org/fathomteam/moab/commits/cee88787e211/
Changeset:   cee88787e211
Branch:      iulian07/largemesh
User:        iulian07
Date:        2014-07-09 05:20:37
Summary:     add the option to keep the skins

these skins result from resolving shared entities
we may want to keep them

By default, we delete them

Affected #:  1 file

diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 8e5e029..ce67ac9 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -65,6 +65,7 @@ int main(int argc, char **argv)
 
   bool newMergeMethod=false;
   bool quadratic=false;
+  bool keep_skins=false;
 
   MPI_Init(&argc, &argv);
 
@@ -92,6 +93,9 @@ int main(int argc, char **argv)
   opts.addOpt<void>("quadratic,q", "use hex 27 elements",
       &quadratic);
 
+  opts.addOpt<void>("keep_skins,k", "keep skins with shared entities",
+        &keep_skins);
+
   vector<string> intTagNames;
   string firstIntTag;
   opts.addOpt<string>(std::string("int_tag_vert,i"), string("add integer tag on vertices"), &firstIntTag);
@@ -404,22 +408,25 @@ int main(int argc, char **argv)
      tt = clock();
   }
 
-  // delete all quads and edges
-  Range toDelete;
-  rval =  mb->get_entities_by_dimension(0, 1, toDelete);
-  CHECKE("Can't get edges");
+  if (!keep_skins) // default is to delete the 1- and 2-dimensional entities
+  {
+    // delete all quads and edges
+    Range toDelete;
+    rval =  mb->get_entities_by_dimension(0, 1, toDelete);
+    CHECKE("Can't get edges");
 
-  rval = mb->get_entities_by_dimension(0, 2, toDelete);
-  CHECKE("Can't get faces");
+    rval = mb->get_entities_by_dimension(0, 2, toDelete);
+    CHECKE("Can't get faces");
 
-  rval = pcomm->delete_entities(toDelete) ;
-  CHECKE("Can't delete entities")
+    rval = pcomm->delete_entities(toDelete) ;
+    CHECKE("Can't delete entities")
 
-  if (0==rank)
-  {
-    std::cout << "delete edges and faces, and correct sharedEnts:  "
-          << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
-    tt = clock();
+    if (0==rank)
+    {
+      std::cout << "delete edges and faces, and correct sharedEnts:  "
+            << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+      tt = clock();
+    }
   }
 
   rval = mb->write_file("test1.h5m", 0, ";;PARALLEL=WRITE_PART");

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list