[MOAB-dev] commit/MOAB: iulian07: skip merge if not needed and skip PCOMM if on one proc

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Jul 10 20:28:39 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/852870526329/
Changeset:   852870526329
Branch:      iulian07/largemesh
User:        iulian07
Date:        2014-07-11 03:27:16
Summary:     skip merge if not needed and skip PCOMM if on one proc

will be able to create meshes faster, if the partitioning
is not needed

Affected #:  1 file

diff --git a/examples/GenLargeMesh.cpp b/examples/GenLargeMesh.cpp
index 4ec1e1b..4338601 100644
--- a/examples/GenLargeMesh.cpp
+++ b/examples/GenLargeMesh.cpp
@@ -493,55 +493,58 @@ int main(int argc, char **argv)
   rval = mb->get_entities_by_dimension(0, 0, verts);
 
   CHECKE("Can't get all vertices.");
-
-  if (newMergeMethod)
-    rval = mm.merge_using_integer_tag( verts, global_id_tag);
-  else
-    rval = mm.merge_entities(all3dcells, 0.0001);
-  CHECKE("Can't merge");
-  if (0==rank)
+  if (A*B*C!=1) //  merge needed
   {
-     std::cout << "merge locally:  "
-           << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
-     tt = clock();
+    if (newMergeMethod)
+      rval = mm.merge_using_integer_tag( verts, global_id_tag);
+    else
+      rval = mm.merge_entities(all3dcells, 0.0001);
+    CHECKE("Can't merge");
+    if (0==rank)
+    {
+       std::cout << "merge locally:  "
+             << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+       tt = clock();
+    }
   }
-
-  ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
-  if (pcomm==NULL)
+  if (size>1)
   {
-    pcomm = new ParallelComm( mb, MPI_COMM_WORLD );
-  }
-  rval = pcomm->resolve_shared_ents( 0, all3dcells, 3, 0 );
-  CHECKE("Can't resolve shared ents");
+    ParallelComm* pcomm = ParallelComm::get_pcomm(mb, 0);
+    if (pcomm==NULL)
+    {
+      pcomm = new ParallelComm( mb, MPI_COMM_WORLD );
+    }
+    rval = pcomm->resolve_shared_ents( 0, all3dcells, 3, 0 );
+    CHECKE("Can't resolve shared ents");
 
-  if (0==rank)
-  {
-     std::cout << "resolve shared entities:  "
-           << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
-     tt = clock();
-  }
+    if (0==rank)
+    {
+       std::cout << "resolve shared entities:  "
+             << (clock() - tt) / (double) CLOCKS_PER_SEC << " seconds" << std::endl;
+       tt = clock();
+    }
 
-  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");
+    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(outFileName.c_str(), 0, ";;PARALLEL=WRITE_PART");
   CHECKE("Can't write in parallel");

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