[MOAB-dev] r4316 - in MOAB/trunk: src src/moab src/parallel test/io

tautges at mcs.anl.gov tautges at mcs.anl.gov
Fri Dec 3 11:16:42 CST 2010


Author: tautges
Date: 2010-12-03 11:16:42 -0600 (Fri, 03 Dec 2010)
New Revision: 4316

Added:
   MOAB/trunk/test/io/readutil_test.cpp
Modified:
   MOAB/trunk/src/ReadUtil.cpp
   MOAB/trunk/src/ReadUtil.hpp
   MOAB/trunk/src/moab/ReadUtilIface.hpp
   MOAB/trunk/src/parallel/ReadParallel.cpp
   MOAB/trunk/test/io/Makefile.am
Log:
Change behavior of ReadUtilIface::gather_related_ents in two ways.  First, it now takes a set as the
last argument rather than an optional range.  Instead of the optional range
getting populated with the sets from the related ents, the optional set
is used to get contained sets, rather than the whole instance.  Makes it more 
efficient to get related sets.  Second, any sets containing local entities, or their ancestors (linked
through parent links), are kept, but not sets that are children of any of the ancestors, if they don't 
contain local entities.  In effect, this removes e.g. geometric vertex sets descended from volumes 
bounding the kept volumes, even though the actual vertices for the vertex sets weren't kept.  This also
obviates the need to search for empty sets in ReadParallel::delete_nonlocal_ents after the gather returns.

Also added a readutil test that tests the gather functionality.

This fixes bug #30.



Modified: MOAB/trunk/src/ReadUtil.cpp
===================================================================
--- MOAB/trunk/src/ReadUtil.cpp	2010-12-03 02:11:41 UTC (rev 4315)
+++ MOAB/trunk/src/ReadUtil.cpp	2010-12-03 17:16:42 UTC (rev 4316)
@@ -197,8 +197,8 @@
 }
 
 ErrorCode ReadUtil::gather_related_ents(Range &partition,
-                                            Range &related_ents,
-                                            Range *all_sets) 
+                                        Range &related_ents,
+                                        EntityHandle *file_set) 
 {
     // loop over any sets, getting contained ents
   std::pair<Range::const_iterator, Range::const_iterator> pair_it =
@@ -231,12 +231,16 @@
   
     // get contains-related sets
   Range tmp_ents3, last_related;
-  if (!all_sets) all_sets = &tmp_ents3;
-  result = mMB->get_entities_by_type(0, MBENTITYSET, *all_sets); RR;
+  if (file_set)
+    result = mMB->get_entities_by_type(*file_set, MBENTITYSET, tmp_ents3);
+  else
+    result = mMB->get_entities_by_type(0, MBENTITYSET, tmp_ents3);
+  RR;
+    
   while (related_ents.size() != last_related.size()) {
     last_related = related_ents;
-    for (Range::iterator rit = all_sets->begin(); 
-         rit != all_sets->end(); rit++) {
+    for (Range::iterator rit = tmp_ents3.begin(); 
+         rit != tmp_ents3.end(); rit++) {
       if (related_ents.find(*rit) != related_ents.end()) continue;
       
       tmp_ents.clear();
@@ -248,7 +252,7 @@
     }
   }
   
-    // get parent/child-related sets
+    // get child-related sets
   last_related.clear();
   while (related_ents.size() != last_related.size()) {
     last_related = related_ents;
@@ -257,13 +261,25 @@
 
     for (Range::const_iterator rit = it_pair.first;
          rit != it_pair.second; rit++) {
-        // get all parents/children and add to related ents
+        // get all children and add to related ents


More information about the moab-dev mailing list