[MOAB-dev] r3004 - in MOAB/trunk: . parallel test/h5file tools tools/dagmc tools/iMesh tools/mbcoupler tools/qvdual

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Jul 13 18:43:11 CDT 2009


Author: kraftche
Date: 2009-07-13 18:43:10 -0500 (Mon, 13 Jul 2009)
New Revision: 3004

Modified:
   MOAB/trunk/DualTool.cpp
   MOAB/trunk/MBCore.cpp
   MOAB/trunk/MBMeshSet.cpp
   MOAB/trunk/MBRange.cpp
   MOAB/trunk/MBRange.hpp
   MOAB/trunk/MBReadUtil.cpp
   MOAB/trunk/MBSkinner.cpp
   MOAB/trunk/MBTest.cpp
   MOAB/trunk/MeshTopoUtil.cpp
   MOAB/trunk/ReadCGM.cpp
   MOAB/trunk/ReadGmsh.cpp
   MOAB/trunk/ReadHDF5.cpp
   MOAB/trunk/ReadNCDF.cpp
   MOAB/trunk/TagServer.cpp
   MOAB/trunk/TagTest.cpp
   MOAB/trunk/Test_MBMeshSet.cpp
   MOAB/trunk/Tqdcfr.cpp
   MOAB/trunk/VtkTest.cpp
   MOAB/trunk/WriteGmsh.cpp
   MOAB/trunk/WriteHDF5.cpp
   MOAB/trunk/WriteVtk.cpp
   MOAB/trunk/cub_file_test.cc
   MOAB/trunk/parallel/MBParallelComm.cpp
   MOAB/trunk/parallel/ReadParallel.cpp
   MOAB/trunk/parallel/WriteHDF5Parallel.cpp
   MOAB/trunk/parallel/parallel_hdf5_test.cc
   MOAB/trunk/parallel/parallel_unit_tests.cpp
   MOAB/trunk/parallel/pcomm_unit.cpp
   MOAB/trunk/test/h5file/h5varlen.cpp
   MOAB/trunk/tools/convert.cpp
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/gsets.cc
   MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp
   MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
   MOAB/trunk/tools/qvdual/DrawDual.cpp
Log:
Remove MBRange::subtract and MBRange::intersect member functions with
functions in the top-level namespace: 'intersect' and 'subtract'.  For
exaple, the rather ambiguous:
  diff = from_this.subtract( some_range );
is now:
  diff = subtract( from_this, some_range );


Modified: MOAB/trunk/DualTool.cpp
===================================================================
--- MOAB/trunk/DualTool.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/DualTool.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -916,7 +916,7 @@
 
       // get the bridge adjacencies through higher dimension
     result = mtu.get_bridge_adjacencies(this_ent, dim+1, dim, tmp_star); RR;
-    tmp_range = star.subtract(tmp_star);
+    tmp_range = subtract( star, tmp_star);
     
     for (MBRange::iterator rit = tmp_range.begin(); rit != tmp_range.end(); rit++) {
       if (new_hyperplane_ents.find(*rit) != new_hyperplane_ents.end()) continue;
@@ -1343,7 +1343,7 @@
   result = mbImpl->get_adjacencies(tcells, 0, false, verts);
   if (MB_SUCCESS != result || verts.empty()) return 0;
   
-  MBRange tmp_verts = other_verts.subtract(verts);
+  MBRange tmp_verts = subtract( other_verts, verts);
   other_verts.swap(tmp_verts);
   if (0 != last_v) other_verts.erase(last_v);
 
@@ -1582,11 +1582,11 @@
   result = mbImpl->get_adjacencies(hexes, 2, 2, false, del_faces); RR;
   assert(5 == del_faces.size());
   std::copy(pcells[2].begin(), pcells[2].end(), mb_range_inserter(tmp_faces));
-  tmp_faces = tmp_faces.subtract(del_faces);
+  tmp_faces = subtract( tmp_faces, del_faces);
   del_faces.insert(*tmp_faces.rbegin());
   result = mbImpl->get_adjacencies(tmp_faces, 0, false, tmp_verts); RR;
   std::copy(pcells[0].begin(), pcells[0].end(), mb_range_inserter(del_verts));
-  del_verts = del_verts.subtract(tmp_verts);
+  del_verts = subtract( del_verts, tmp_verts);
   assert(4 == del_verts.size());
   result = mbImpl->get_adjacencies(del_verts, 1, false, del_edges, MBInterface::UNION); RR;
   assert(8 == del_edges.size());
@@ -1808,7 +1808,7 @@
       result = mbImpl->get_adjacencies(&split_quads[i], 1, 1, false, 
                                        tmp_edges);
       if (MB_SUCCESS != result) return result;
-      tmp_edges = tmp_edges.subtract(common_edges);
+      tmp_edges = subtract( tmp_edges, common_edges);
       assert(tmp_edges.size() == 1);
       other_edges[i] = *tmp_edges.begin();
     }
@@ -2079,7 +2079,7 @@
     MBRange R1, R3;
     result = mbImpl->get_adjacencies(&star_dp1[i][0], star_dp1[i].size(), 1, false, 
                                      R1, MBInterface::UNION); RR;
-    R3 = R1.intersect(R2);
+    R3 = intersect( R1, R2);
     for (int j = 0; j < 3; j++)
       if (split_edges[j]) R3.erase(split_edges[j]);
     addl_ents[i].merge(R3);
@@ -2392,7 +2392,7 @@
   MBRange dum_connect, middle_connect;
   result = mbImpl->get_connectivity(&middle_edge, 1, middle_connect); RR;
   result = mbImpl->get_connectivity(&(*vit), 1, dum_connect); RR;
-  dum_connect = dum_connect.subtract(middle_connect);
+  dum_connect = subtract( dum_connect, middle_connect);
   if (dum_connect.size() != 1) {
     std::cerr << "Trouble traversing chord." << std::endl;
     return MB_FAILURE;
@@ -2407,7 +2407,7 @@
   vit++;
   dum_connect.clear();
   result = mbImpl->get_connectivity(&(*vit), 1, dum_connect); RR;
-  dum_connect = dum_connect.subtract(middle_connect);
+  dum_connect = subtract( dum_connect, middle_connect);
   if (dum_connect.size() != 1) {
     std::cerr << "Trouble traversing chord." << std::endl;
     return MB_FAILURE;
@@ -2993,7 +2993,7 @@
     if (MB_SUCCESS != result) return result;
     assert(quads.size() == 1);
     result = mbImpl->get_adjacencies(&(*quads.begin()), 1, 0, false, tmp_verts); RR;
-    tmp_verts = tmp_verts.subtract(start_verts);
+    tmp_verts = subtract( tmp_verts, start_verts);
     assert(1 == tmp_verts.size());
     connects[3].push_back(*tmp_verts.begin());
   }

Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MBCore.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -1352,7 +1352,7 @@
     return MB_SUCCESS;
   }
   else if (!entities.empty() && MBInterface::INTERSECT == condition) {
-    entities = entities.intersect(tmp_range);
+    entities = intersect( entities, tmp_range);
     if (entities.empty()) return MB_SUCCESS;
     tmp_range = entities;
   }

Modified: MOAB/trunk/MBMeshSet.cpp
===================================================================
--- MOAB/trunk/MBMeshSet.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MBMeshSet.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -998,7 +998,7 @@
     if (MB_SUCCESS != rval)
       return rval;
     rval = other->get_entities(other_ents);
-    return remove_entities( my_ents.subtract(other_ents), my_handle, adj );
+    return remove_entities( ::subtract(my_ents, other_ents), my_handle, adj );
   }
 }
 

Modified: MOAB/trunk/MBRange.cpp
===================================================================
--- MOAB/trunk/MBRange.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MBRange.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -590,16 +590,17 @@
   // intersect two ranges, placing the results in the return range
 #define MAX(a,b) (a < b ? b : a)
 #define MIN(a,b) (a > b ? b : a)
-MBRange MBRange::intersect(const MBRange &range2) const 
+MBRange intersect(const MBRange &range1, const MBRange &range2) 
 {
-  pair_iterator r_it[2] = {pair_iterator(begin()), pair_iterator(range2.begin())};
+  MBRange::const_pair_iterator r_it[2] = { range1.const_pair_begin(), 
+                                           range2.const_pair_begin() };
   MBEntityHandle low_it, high_it;
   
   MBRange lhs;
   
     // terminate the while loop when at least one "start" iterator is at the
     // end of the list
-  while (r_it[0] != end() && r_it[1] != range2.end()) {
+  while (r_it[0] != range1.end() && r_it[1] != range2.end()) {
     
     if (r_it[0]->second < r_it[1]->first)
         // 1st subrange completely below 2nd subrange
@@ -625,58 +626,58 @@
   return lhs;
 }
 
-MBRange MBRange::subtract(const MBRange &range2) const 
+MBRange subtract(const MBRange &range1, const MBRange &range2) 
 {
   const bool braindead = false;
   
   if (braindead) {
       // brain-dead implementation right now
-    MBRange res = *this;
+    MBRange res( range1 );
     for (MBRange::const_iterator rit = range2.begin(); rit != range2.end(); rit++)
       res.erase(*rit);
 
     return res;
   }
   else {
-    MBRange lhs = *this;
+    MBRange lhs( range1 );
   
-    pair_iterator r_it[2] = {pair_iterator(lhs.begin()), 
-                             pair_iterator(range2.begin())};
+    MBRange::pair_iterator r_it0 = lhs.pair_begin();
+    MBRange::const_pair_iterator r_it1 = range2.const_pair_begin();
   
       // terminate the while loop when at least one "start" iterator is at the
       // end of the list
-    while (r_it[0] != lhs.end() && r_it[1] != range2.end()) {
+    while (r_it0 != lhs.end() && r_it1 != range2.end()) {
         // case a: pair wholly within subtracted pair
-      if (r_it[0]->first >= r_it[1]->first && r_it[0]->second <= r_it[1]->second) {
-        PairNode *rtmp = r_it[0].mNode;
-        r_it[0]++;
+      if (r_it0->first >= r_it1->first && r_it0->second <= r_it1->second) {
+        MBRange::PairNode *rtmp = r_it0.node();
+        r_it0++;
         lhs.delete_pair_node(rtmp);
       }
         // case b: pair overlaps upper part of subtracted pair
-      else if (r_it[0]->first <= r_it[1]->second &&
-               r_it[0]->first >= r_it[1]->first) {
-        r_it[0]->first = r_it[1]->second + 1;
-        r_it[1]++;
+      else if (r_it0->first <= r_it1->second &&
+               r_it0->first >= r_it1->first) {
+        r_it0->first = r_it1->second + 1;
+        r_it1++;
       }
         // case c: pair overlaps lower part of subtracted pair
-      else if (r_it[0]->second >= r_it[1]->first &&
-               r_it[0]->second <= r_it[1]->second) {
-        r_it[0]->second = r_it[1]->first - 1;
-        r_it[0]++;
+      else if (r_it0->second >= r_it1->first &&
+               r_it0->second <= r_it1->second) {
+        r_it0->second = r_it1->first - 1;
+        r_it0++;
       }
         // case d: pair completely surrounds subtracted pair
-      else if (r_it[0]->first < r_it[1]->first && 
-               r_it[0]->second > r_it[1]->second) {
-        PairNode* new_node = alloc_pair(r_it[0].mNode, r_it[0].mNode->mPrev, 
-                                        r_it[0]->first, r_it[1]->first - 1);
+      else if (r_it0->first < r_it1->first && 
+               r_it0->second > r_it1->second) {
+        MBRange::PairNode* new_node = alloc_pair(r_it0.node(), r_it0.node()->mPrev, 
+                                        r_it0->first, r_it1->first - 1);
         new_node->mPrev->mNext = new_node->mNext->mPrev = new_node;
-        r_it[0].mNode->first = r_it[1]->second+1;
-        r_it[1]++;
+        r_it0.node()->first = r_it1->second+1;
+        r_it1++;
       }
       else {
-        while (r_it[0]->second < r_it[1]->first && r_it[0] != lhs.end()) r_it[0]++;
-        if (r_it[0] == lhs.end()) break;
-        while (r_it[1]->second < r_it[0]->first && r_it[1] != range2.end()) r_it[1]++;
+        while (r_it0->second < r_it1->first && r_it0 != lhs.end()) r_it0++;
+        if (r_it0 == lhs.end()) break;
+        while (r_it1->second < r_it0->first && r_it1 != range2.end()) r_it1++;
       }
     }
     

Modified: MOAB/trunk/MBRange.hpp
===================================================================
--- MOAB/trunk/MBRange.hpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MBRange.hpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -197,12 +197,9 @@
   typedef const_iterator iterator;
   typedef const_reverse_iterator reverse_iterator;
  
-    //! intersect two ranges, placing the results in the return range
-  MBRange intersect(const MBRange &range2) const;
+  friend MBRange intersect( const MBRange&, const MBRange& );
+  friend MBRange subtract( const MBRange&, const MBRange& );
 
-    //! subtract range2 from this, placing the results in the return range
-  MBRange subtract(const MBRange &range2) const;
-
   //! for short hand notation, lets typedef the 
   //! container class that holds the ranges
   typedef MBEntityHandle value_type;
@@ -403,6 +400,8 @@
     {
       return mNode != other.mNode;
     }
+  
+    PairNode* node() { return mNode; }
 
   private:
     
@@ -653,6 +652,18 @@
   const_pair_iterator const_pair_end() const { return const_pair_iterator( &mHead ); }
 };
 
+ 
+    //! intersect two ranges, placing the results in the return range
+MBRange intersect( const MBRange&, const MBRange& );
+
+    //! subtract range2 from this, placing the results in the return range
+MBRange subtract( const MBRange& from, const MBRange& );
+
+    //! unite two ranges, placing the results in the return range
+inline MBRange unite( const MBRange& r1, const MBRange& r2 )
+  { MBRange r(r1); r.merge(r2); return r; }
+
+
 inline MBRange::const_iterator 
 operator+( const MBRange::const_iterator& it, MBEntityID step )
   { MBRange::const_iterator tmp(it); return tmp += step; }

Modified: MOAB/trunk/MBReadUtil.cpp
===================================================================
--- MOAB/trunk/MBReadUtil.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MBReadUtil.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -239,7 +239,7 @@
       
       tmp_ents.clear();
       result = mMB->get_entities_by_handle(*rit, tmp_ents, true); RR;
-      MBRange tmp_ents2 = tmp_ents.intersect(related_ents);
+      MBRange tmp_ents2 = intersect( tmp_ents, related_ents);
     
         // if the intersection is not empty, set is related
       if (!tmp_ents2.empty()) related_ents.insert(*rit);

Modified: MOAB/trunk/MBSkinner.cpp
===================================================================
--- MOAB/trunk/MBSkinner.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MBSkinner.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -312,7 +312,7 @@
         result = thisMB->get_adjacencies(sub_conn, num_sub_nodes, source_dim, false,
                                          dum_elems);
         if (MB_SUCCESS != result) return result;
-        dum_elems = dum_elems.intersect( source_entities );
+        dum_elems = intersect( dum_elems, source_entities );
         if (dum_elems.empty()) {
           assert(false);  // should never happen
           return MB_FAILURE;

Modified: MOAB/trunk/MBTest.cpp
===================================================================
--- MOAB/trunk/MBTest.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MBTest.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -4775,7 +4775,7 @@
   r2.insert(h5, h10);
   r2.insert(h15, h20);
   
-  rhs = r1.intersect(r2);
+  rhs = intersect( r1, r2);
   if (rhs.size() != 3) {
     result = MB_FAILURE;
     std::cout << "Range test equal start/end failed." << std::endl;
@@ -4785,7 +4785,7 @@
   r1.clear(); r2.clear(); rhs.clear();
   r1.insert(h1, h5); r1.insert(h10, h20); 
   r2.insert(h1, h5); r2.insert(h10, h20); 
-  rhs = r1.intersect(r2);
+  rhs = intersect( r1, r2);
   if (rhs.size() != r1.size() || rhs.size() != r2.size()) {
     result = MB_FAILURE;
     std::cout << "Range test identical ranges failed." << std::endl;
@@ -4795,7 +4795,7 @@
   r1.clear(); r2.clear(); rhs.clear();
   r1.insert(h1, h4); r1.insert(h10, h15); 
   r2.insert(h5, h9); r2.insert(h16, h20);
-  rhs = r1.intersect(r2);
+  rhs = intersect( r1, r2);
   if (rhs.size() != 0) {
     result = MB_FAILURE;
     std::cout << "Range test off by one failed." << std::endl;
@@ -4805,7 +4805,7 @@
   r1.clear(); r2.clear(); rhs.clear();
   r1.insert(h1, h20); 
   r2.insert(h5, h10); 
-  rhs = r1.intersect(r2);
+  rhs = intersect( r1, r2);
   if (rhs.size() != r2.size()) {
     result = MB_FAILURE;
     std::cout << "Range test interior failed." << std::endl;
@@ -4815,7 +4815,7 @@
   r1.clear(); r2.clear(); rhs.clear();
   r1.insert(h1, h10);
   r2.insert(h5, h20);
-  rhs = r1.intersect(r2);
+  rhs = intersect( r1, r2);
   if (rhs.size() != h10-h5+1) {
     result = MB_FAILURE;
     std::cout << "Range test half-above failed." << std::endl;
@@ -4825,7 +4825,7 @@
   r1.clear(); r2.clear(); rhs.clear();
   r1.insert(h5, h20);
   r2.insert(h1, h10);
-  rhs = r1.intersect(r2);
+  rhs = intersect( r1, r2);
   if (rhs.size() != h10-h5+1) {
     result = MB_FAILURE;
     std::cout << "Range test half-below failed." << std::endl;
@@ -4945,7 +4945,7 @@
   r1.insert(h4);
   r1.insert(h5);
   r2.insert(h4);
-  MBRange r3 = r1.subtract(r2);
+  MBRange r3 = subtract( r1, r2);
   if (r3.size() != 2 ||
       r3.find(h1) == r3.end() ||
       r3.find(h5) == r3.end() ||
@@ -4961,7 +4961,7 @@
   r1.insert(h1);
   r1.insert(h4);
   r1.insert(h5);
-  r3 = r1.subtract(r2);
+  r3 = subtract( r1, r2);
   if (r3.size() != 3 ||
       r3.find(h1) == r3.end() ||
       r3.find(h4) == r3.end() ||

Modified: MOAB/trunk/MeshTopoUtil.cpp
===================================================================
--- MOAB/trunk/MeshTopoUtil.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/MeshTopoUtil.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -227,7 +227,7 @@
     result = mbImpl->get_adjacencies(*star_candidates_dp1, dim+1, false,
                                      from_ents, MBInterface::UNION);
     if (MB_SUCCESS != result) return result;
-    to_ents = to_ents.intersect(from_ents);
+    to_ents = intersect( to_ents, from_ents);
   }
   
   if (!to_ents.empty()) next_entity = *to_ents.begin();
@@ -430,7 +430,7 @@
 
       // subtract last_toents to get new_toents
     if (nl < num_layers-1)
-      new_toents = to_ents.subtract(last_toents);
+      new_toents = subtract( to_ents, last_toents);
   }
 
   return MB_SUCCESS;
@@ -742,8 +742,8 @@
       result = mbImpl->get_adjacencies(&split_ent, 1, i, false, other_adjs, 
                                        MBInterface::UNION); RR;
     }
-    other_adjs = other_adjs.subtract(old_adjs);
-    other_adjs = other_adjs.subtract(new_adjs);
+    other_adjs = subtract( other_adjs, old_adjs);
+    other_adjs = subtract( other_adjs, new_adjs);
     for (MBRange::iterator rit1 = other_adjs.begin(); rit1 != other_adjs.end(); rit1++) {
         // find an adjacent lower-dimensional entity in old_ or new_ adjs
       bool found = false;

Modified: MOAB/trunk/ReadCGM.cpp
===================================================================
--- MOAB/trunk/ReadCGM.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/ReadCGM.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -551,7 +551,7 @@
   rval = mdbImpl->get_entities_by_handle(0, loaded_range);
   if (MB_FAILURE == rval) return rval;
   rval = mdbImpl->get_entities_by_handle(0, init_range);
-  loaded_range = loaded_range.subtract(init_range);
+  loaded_range = subtract( loaded_range, init_range);
   rval = mdbImpl->add_entities(mCurrentMeshHandle, loaded_range);
   if (MB_FAILURE == rval) return rval;
 

Modified: MOAB/trunk/ReadGmsh.cpp
===================================================================
--- MOAB/trunk/ReadGmsh.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/ReadGmsh.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -519,7 +519,7 @@
     
       // Don't use existing geometry sets (from some other file)
     if (1 == set_type) // geometry
-      sets = sets.intersect( geomSets );
+      sets = intersect( sets,  geomSets );
     
       // Get set handle
     MBEntityHandle set;

Modified: MOAB/trunk/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/ReadHDF5.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/ReadHDF5.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -1213,7 +1213,7 @@
       MBRange subset;
       intersect( fileInfo->elems[i].desc, elem_ids, subset );
       if (!subset.empty()) {
-        elem_ids.subtract( subset );
+        subtract( elem_ids,  subset );
         rval = read_elems( fileInfo->elems[i],  subset );
         if (MB_SUCCESS != rval)
           return error(rval); 
@@ -1261,9 +1261,9 @@
   all_elems.erase( all_elems.lower_bound( MBCN::TypeDimensionMap[max_dim].first ), all_elems.end() );
     // remove explicit elements < max_dim
   if (!explicit_elems[1].empty() && max_dim > 1)
-    all_elems = all_elems.subtract( explicit_elems[1] );
+    all_elems = subtract( all_elems,  explicit_elems[1] );
   if (!explicit_elems[2].empty() && max_dim > 2)
-    all_elems = all_elems.subtract( explicit_elems[2] );
+    all_elems = subtract( all_elems,  explicit_elems[2] );
  
     // remove any elements that are adjacent to some explicity specified element.
   if (max_dim > 1 && !explicit_elems[2].empty()) {
@@ -1272,7 +1272,7 @@
     if (MB_SUCCESS != rval)
       return error(rval);
     if (!adj.empty())
-      all_elems = all_elems.subtract( adj );
+      all_elems = subtract( all_elems,  adj );
   }
   if (max_dim == 3) {
     MBRange adj;
@@ -1280,13 +1280,13 @@
     if (MB_SUCCESS != rval)
       return error(rval);
     if (!adj.empty())
-      all_elems = all_elems.subtract( adj );
+      all_elems = subtract( all_elems,  adj );
     adj.clear();
     rval = iFace->get_adjacencies( explicit_elems[3], 2, false, adj, MBInterface::UNION );
     if (MB_SUCCESS != rval)
       return error(rval);
     if (!adj.empty())
-      all_elems = all_elems.subtract( adj );
+      all_elems = subtract( all_elems,  adj );
   }
   
     // now delete anything remaining in all_elems
@@ -1462,7 +1462,7 @@
       if (MB_SUCCESS != rval)
         break;
     }
-    new_children = children.subtract( sets_in_out );
+    new_children = subtract( children,  sets_in_out );
     sets_in_out.merge( new_children );
   } while (!new_children.empty());
   
@@ -1878,7 +1878,7 @@
 #endif
     
     // things will get messed up if this isn't true
-  assert( ranged_ids_in.subtract( file_ids ).empty() );
+  assert( subtract( ranged_ids_in, file_ids ).empty() );
   assert( file_ids.front() >= (MBEntityHandle)start_id );
   assert( file_ids.back() - start_id < (MBEntityHandle)entity_count );
 

Modified: MOAB/trunk/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/ReadNCDF.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/ReadNCDF.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -509,7 +509,7 @@
   MBRange loaded_range;
   status = mdbImpl->get_entities_by_handle(0, loaded_range);
   if (MB_FAILURE == status) return status;
-  loaded_range = loaded_range.subtract(initRange);
+  loaded_range = subtract( loaded_range, initRange);
   status = mdbImpl->add_entities(mCurrentMeshHandle, loaded_range);
   if (MB_FAILURE == status) return status;
   
@@ -780,7 +780,7 @@
   if(mdbImpl->get_entities_by_type(0, MBENTITYSET, child_meshsets ) != MB_SUCCESS )
     return MB_FAILURE;
 
-  child_meshsets = child_meshsets.subtract(initRange);
+  child_meshsets = subtract( child_meshsets, initRange);
 
   MBTag tag_handle;
 
@@ -1147,7 +1147,7 @@
     if( mdbImpl->get_entities_by_handle(0, child_meshsets ) != MB_SUCCESS ) 
       return MB_FAILURE;
 
-    child_meshsets = child_meshsets.subtract(initRange);
+    child_meshsets = subtract( child_meshsets, initRange);
 
     MBRange::iterator iter, end_iter;
     iter = child_meshsets.begin();
@@ -1295,7 +1295,7 @@
                                     child_meshsets ) != MB_SUCCESS ) 
     return MB_FAILURE;
 
-  child_meshsets = child_meshsets.subtract(initRange);
+  child_meshsets = subtract( child_meshsets, initRange);
 
   MBRange::iterator iter, end_iter;
 

Modified: MOAB/trunk/TagServer.cpp
===================================================================
--- MOAB/trunk/TagServer.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/TagServer.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -797,7 +797,7 @@
     case MB_TAG_DENSE: {
       MBRange temp;
       result = sequenceManager->get_tagged_entities(id, type, temp);
-      entities.merge( range.intersect(temp) );
+      entities.merge( intersect( range, temp) );
       }
       break;
     case MB_TAG_BIT:
@@ -919,14 +919,14 @@
       // if we're doing a running intersection and we're just starting and
       // the list comes in empty, the 1st result is the start
     if (0 == it && condition == MBInterface::INTERSECT && entities.empty()) {
-      entities = temp1.intersect(range);
+      entities = intersect( temp1, range);
     }
 
       // else if we're doing a running intersection, intersect this result (temp1)
       // with the running result (entities) into temp2, then move that to the running
       // result (entities)
     else if (condition == MBInterface::INTERSECT) {
-      entities = entities.intersect(temp1);
+      entities = intersect( entities, temp1);
       if (entities.empty()) return MB_SUCCESS;
 
         // also restrict the range at which we look; entities has already been 

Modified: MOAB/trunk/TagTest.cpp
===================================================================
--- MOAB/trunk/TagTest.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/TagTest.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -390,7 +390,7 @@
       handle_range.insert( mid+1, i->second );
     }
   }
-  entities = entities.subtract( handle_range );
+  entities = subtract( entities,  handle_range );
   for (unsigned i = 0; i < handle_list.size(); ++i)
     entities.erase( handle_list[i] );
   
@@ -1391,7 +1391,7 @@
       handle_range.insert( mid+1, i->second );
     }
   }
-  entities = entities.subtract( handle_range );
+  entities = subtract( entities,  handle_range );
   for (unsigned i = 0; i < handle_list.size(); ++i)
     entities.erase( handle_list[i] );
   

Modified: MOAB/trunk/Test_MBMeshSet.cpp
===================================================================
--- MOAB/trunk/Test_MBMeshSet.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/Test_MBMeshSet.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -846,7 +846,7 @@
   remove.insert( 190, 200 );
   remove.insert( 210, 220 );
   remove.insert( 230, 240 );
-  range = range.subtract( remove );
+  range = subtract( range,  remove );
   
   contents.clear();
   std::copy( range.begin(), range.end(), std::back_inserter(contents) );
@@ -953,13 +953,13 @@
       rval = mb.unite_meshset( set1, set2 );
       break;
     case INTERSECT:
-      tmp_range = set1_ents.intersect( set2_ents );
+      tmp_range = intersect( set1_ents, set2_ents );
       expected.resize(tmp_range.size());
       std::copy( tmp_range.begin(), tmp_range.end(), expected.begin() );
       rval = mb.intersect_meshset( set1, set2 );
       break;
     case SUBTRACT:
-      tmp_range = set1_ents.subtract( set2_ents );
+      tmp_range = subtract( set1_ents, set2_ents );
       expected.resize(tmp_range.size());
       std::copy( tmp_range.begin(), tmp_range.end(), expected.begin() );
       rval = mb.subtract_meshset( set1, set2 );

Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/Tqdcfr.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -384,7 +384,7 @@
   if (MB_SUCCESS != result) 
     return result;
 
-  after_ents = after_ents.subtract(beforeEnts);
+  after_ents = subtract( after_ents, beforeEnts);
   result = mdbImpl->add_entities(mFileSet, after_ents);
 
   return result;
@@ -1069,7 +1069,7 @@
     MBRange vrange, tmp_range(dum_range);
     result = mdbImpl->get_entities_by_type(0, MBVERTEX, vrange); RR;
     if (!beforeEnts.empty()) tmp_range.merge(beforeEnts.subset_by_type(MBVERTEX));
-    vrange = vrange.subtract(tmp_range);
+    vrange = subtract( vrange, tmp_range);
       // compute the max cid; map is indexed by cid, so size is max_cid+1
 #define MAX(a,b) (a > b ? a : b)
 #define MIN(a,b) (a < b ? a : b)

Modified: MOAB/trunk/VtkTest.cpp
===================================================================
--- MOAB/trunk/VtkTest.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/VtkTest.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -1335,7 +1335,7 @@
   rval = moab.get_adjacencies( new_elems, 0, false, elem_verts, MBInterface::UNION );
   MBCHECK(rval);
   CHECK(elem_verts.size() == 6);
-  MBRange free_verts( new_verts.subtract(elem_verts ) );
+  MBRange free_verts( subtract( new_verts, elem_verts ) );
   CHECK(free_verts.size() == 1 );
   double vcoords[3];
   rval = moab.get_coords( free_verts, vcoords );

Modified: MOAB/trunk/WriteGmsh.cpp
===================================================================
--- MOAB/trunk/WriteGmsh.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/WriteGmsh.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -239,7 +239,7 @@
       if (MB_SUCCESS != rval)
         return rval;
 
-      elems = elems.intersect( elements );
+      elems = intersect( elems,  elements );
       for (MBRange::iterator j = elems.begin(); j != elems.end(); ++j)
         elem_sets[*j].set( s, id );
     }

Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/WriteHDF5.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -2092,19 +2092,19 @@
       range.clear();
       result = iFace->get_entities_by_type_and_tag( 0, e_iter->type, &handle, NULL, 1, range );
       CHK_MB_ERR_0(result);
-      td_iter->range.merge( range.intersect( e_iter->range ) );
+      td_iter->range.merge( intersect( range, e_iter->range ) );
     }
     
     range.clear();
     result = iFace->get_entities_by_type_and_tag( 0, MBVERTEX, &handle, NULL, 1, range );
     CHK_MB_ERR_0(result);
-    td_iter->range.merge( range.intersect( nodeSet.range ) );
+    td_iter->range.merge( intersect( range, nodeSet.range ) );
 
 
     range.clear();
     result = iFace->get_entities_by_type_and_tag( 0, MBENTITYSET, &handle, NULL, 1, range );
     CHK_MB_ERR_0(result);
-    td_iter->range.merge( range.intersect( setSet.range ) );
+    td_iter->range.merge( intersect( range, setSet.range ) );
 
 /* This breaks for variable-length tags, is slow, and is questionable.
    Is it really better to not write the tag at all, as opposed to writing

Modified: MOAB/trunk/WriteVtk.cpp
===================================================================
--- MOAB/trunk/WriteVtk.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/WriteVtk.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -402,7 +402,7 @@
       rval = mbImpl->get_entities_by_type_and_tag( 0, type, &*i, 0, 1, tmp_tagged );
       if (MB_SUCCESS != rval)
         return rval;
-      tmp_tagged = tmp_tagged.intersect( entities );
+      tmp_tagged = intersect( tmp_tagged, entities );
       tagged.merge( tmp_tagged );
     }
 

Modified: MOAB/trunk/cub_file_test.cc
===================================================================
--- MOAB/trunk/cub_file_test.cc	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/cub_file_test.cc	2009-07-13 23:43:10 UTC (rev 3004)
@@ -705,7 +705,7 @@
       tmp.clear();
       rval = mb.get_adjacencies( ents, 0, false, tmp, MBInterface::UNION );
       CHECK_ERR(rval);
-      nodes = nodes.subtract( tmp );
+      nodes = subtract( nodes, tmp );
       CHECK( nodes.empty() );
     }
   }
@@ -1058,7 +1058,7 @@
   CHECK_ERR(rval);
   CHECK( !file2_verts.empty() );
   CHECK_EQUAL( file1_verts.size(), file2_verts.size() );
-  CHECK( file1_verts.intersect( file2_verts ).empty() );
+  CHECK( intersect( file1_verts,  file2_verts ).empty() );
   
     // now check that we get the same number of elements from 
     // each file and that they are distinct
@@ -1070,7 +1070,7 @@
   CHECK_ERR(rval);
   CHECK( !file2_elems.empty() );
   CHECK_EQUAL( file1_elems.size(), file2_elems.size() );
-  CHECK( file1_elems.intersect( file2_elems ).empty() );
+  CHECK( intersect( file1_elems,  file2_elems ).empty() );
 
     // now check that the connectivity for each element is
     // defined using the appropriate vertex instances
@@ -1080,8 +1080,8 @@
   rval = mb.get_adjacencies( file2_elems, 0, false, file2_elem_verts, MBInterface::UNION );
   CHECK_ERR(rval);
   CHECK_EQUAL( file1_elem_verts.size(), file2_elem_verts.size() );
-  CHECK( file1_elem_verts.intersect( file1_verts ) == file1_elem_verts );
-  CHECK( file2_elem_verts.intersect( file2_verts ) == file2_elem_verts );
+  CHECK( intersect( file1_elem_verts,  file1_verts ) == file1_elem_verts );
+  CHECK( intersect( file2_elem_verts,  file2_verts ) == file2_elem_verts );
 }
 
   

Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/parallel/MBParallelComm.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -289,7 +289,7 @@
     for (rit = entities[dim].begin(), i = 0; rit != entities[dim].end(); rit++, i++)
       if (pstatus[i] & PSTATUS_NOT_OWNED)
         dum_range.insert(*rit);
-    entities[dim] = entities[dim].subtract(dum_range);
+    entities[dim] = subtract( entities[dim], dum_range);
     
     local_num_elements[dim] = entities[dim].size();
   }
@@ -2307,7 +2307,7 @@
     MBRange tmp_range;
     result = tagServer->get_entities(*tag_it, tmp_range);
     RRA("Failed to get entities for tag in pack_tags.");
-    tmp_range = tmp_range.intersect(whole_range);
+    tmp_range = intersect( tmp_range, whole_range);
 
     if (tmp_range.empty()) continue;
         
@@ -3773,7 +3773,7 @@
                             buffProcs[ind], &tmp_range);
     RRA("Couldn't filter on owner.");
     if (!tmp_range.empty()) 
-      sent_ents[ind] = sent_ents[ind].subtract(tmp_range);
+      sent_ents[ind] = subtract( sent_ents[ind], tmp_range);
 
     allsent.merge(sent_ents[ind]);
   }
@@ -4194,7 +4194,7 @@
       if (tagServer->get_default_data_ref( *vit, ptr, size ) != MB_SUCCESS) {
         MBRange tagged_ents;
         tagServer->get_entities( *vit, tagged_ents );
-        tag_ranges.push_back(tag_ents.intersect(tagged_ents));
+        tag_ranges.push_back( intersect( tag_ents, tagged_ents ) );
       } 
       else {
         tag_ranges.push_back(tag_ents);
@@ -5138,7 +5138,7 @@
   rval = get_pstatus_entities(-1, 0, dum_range);
   if (MB_SUCCESS != rval)
     return rval;
-  all_shared = all_shared.subtract(dum_range);
+  all_shared = subtract( all_shared, dum_range);
   all_shared.erase(all_shared.upper_bound(MBPOLYHEDRON), all_shared.end());
   assert(sharedEnts == all_shared);
 

Modified: MOAB/trunk/parallel/ReadParallel.cpp
===================================================================
--- MOAB/trunk/parallel/ReadParallel.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/parallel/ReadParallel.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -522,11 +522,11 @@
   }
   
     // get deletable entities by subtracting partition ents from file ents
-  MBRange deletable_ents = file_ents.subtract(partition_ents);
+  MBRange deletable_ents = subtract( file_ents, partition_ents);
 
     // cache deletable vs. keepable sets
-  MBRange deletable_sets = all_sets.intersect(deletable_ents);
-  MBRange keepable_sets = all_sets.subtract(deletable_sets);
+  MBRange deletable_sets = intersect( all_sets, deletable_ents);
+  MBRange keepable_sets = subtract( all_sets, deletable_sets);
   
   if (debug) std::cout << "Removing deletable entities from keepable sets." << std::endl;
 
@@ -551,7 +551,7 @@
     result = mbImpl->delete_entities(deletable_sets);
   RR("Failure deleting sets in delete_nonlocal_entities.");
 
-  deletable_ents = deletable_ents.subtract(deletable_sets);
+  deletable_ents = subtract( deletable_ents, deletable_sets);
 
   if (debug && myPcomm->proc_config().proc_rank() == 0) {
     std::cout << "Deletable entities: " << std::endl;

Modified: MOAB/trunk/parallel/WriteHDF5Parallel.cpp
===================================================================
--- MOAB/trunk/parallel/WriteHDF5Parallel.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/parallel/WriteHDF5Parallel.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -216,7 +216,7 @@
 
   if (removed.size())
   {
-    MBRange tmp = from.subtract(removed);
+    MBRange tmp = subtract( from, removed);
     from.swap( tmp );
   }
 }
@@ -316,7 +316,7 @@
   result = myPcomm->filter_pstatus( nodeSet.range, PSTATUS_NOT_OWNED, PSTATUS_AND, -1, &nonowned);
   if (MB_SUCCESS != result)
     return result;
-  nodeSet.range = nodeSet.range.subtract(nonowned);
+  nodeSet.range = subtract( nodeSet.range, nonowned);
   
   for (std::list<ExportSet>::iterator eiter = exportList.begin();
        eiter != exportList.end(); ++eiter ) {
@@ -324,7 +324,7 @@
     result = myPcomm->filter_pstatus( eiter->range, PSTATUS_NOT_OWNED, PSTATUS_AND, -1, &tmpset);
     if (MB_SUCCESS != result)
       return result;
-    eiter->range = eiter->range.subtract( tmpset );
+    eiter->range = subtract( eiter->range,  tmpset );
     nonowned.merge(tmpset);
   }
   
@@ -333,7 +333,7 @@
     // (on any processor.)
   for (proc_iter i = interfaceMesh.begin(); i != interfaceMesh.end(); ++i)
     if (i->first != myPcomm->proc_config().proc_rank())
-      i->second = nonowned.intersect( i->second );
+      i->second = intersect( nonowned,  i->second );
   
     // For the 'interfaceMesh' list for this processor, just remove
     // entities we aren't writing.
@@ -343,7 +343,7 @@
        eiter != exportList.end(); ++eiter ) 
     tmpset.merge( eiter->range );
   MBRange& my_remote_mesh = interfaceMesh[myPcomm->proc_config().proc_rank()];
-  my_remote_mesh = my_remote_mesh.intersect( tmpset );
+  my_remote_mesh = intersect( my_remote_mesh,  tmpset );
   
     // print some debug output summarizing what we've accomplished
   printdebug("Remote mesh:\n");
@@ -483,6 +483,7 @@
   std::vector<unsigned long>::iterator tag_off_iter = tag_counts.begin();
   for (tag_iter = tagList.begin(); tag_iter != tagList.end(); ++tag_iter) {
     int s;
+    assert(tag_off_iter < tag_counts.begin() + tag_counts.size());
     *tag_off_iter = tag_iter->range.size();
     ++tag_off_iter;
     if (MB_VARIABLE_DATA_LENGTH == iFace->tag_get_size( tag_iter->tag_id, s )) {
@@ -491,6 +492,7 @@
       if (MB_SUCCESS != rval)
         return rval;
       
+      assert(tag_off_iter < tag_counts.begin() + tag_counts.size());
       *tag_off_iter = total_len;
       assert(total_len == *tag_off_iter);
     }
@@ -519,19 +521,26 @@
   tag_iter = tagList.begin();
   for (int i = 0; i < num_tags; ++i, ++tag_iter)
   {
+    assert((unsigned)(2*i+1) < tag_counts.size());
     tag_counts[2*i] = tag_counts[2*i+1] = 0;
     unsigned long next_offset = 0;
     unsigned long next_var_len_offset = 0;
     for (unsigned int j = 0; j < myPcomm->proc_config().proc_size(); j++)
     {
-      unsigned long count = proc_tag_offsets[2*i + j*2*num_tags];
-      proc_tag_offsets[2*i + j*2*num_tags] = next_offset;
+      unsigned idx = 2*i + j*2*num_tags;
+      assert(idx < proc_tag_offsets.size());
+      unsigned long count = proc_tag_offsets[idx];
+      proc_tag_offsets[idx] = next_offset;
       next_offset += count;
+      assert((unsigned)(2*i) < tag_counts.size());
       tag_counts[2*i] += count;
       
-      count = proc_tag_offsets[2*i + 1 + j*2*num_tags];
-      proc_tag_offsets[2*i + 1 + j*2*num_tags] = next_var_len_offset;
+      ++idx;
+      assert(idx < proc_tag_offsets.size());
+      count = proc_tag_offsets[idx];
+      proc_tag_offsets[idx] = next_var_len_offset;
       next_var_len_offset += count;
+      assert((unsigned)(2*i + 1) < tag_counts.size());
       tag_counts[2*i + 1] += count;
     }
 
@@ -560,6 +569,7 @@
   tag_iter = tagList.begin();
   for (int i = 0; i < num_tags; ++i, ++tag_iter)
   {
+    assert((unsigned)(2*i) < tag_counts.size());
     tag_iter->offset = tag_offsets[2*i];
     tag_iter->write = tag_counts[2*i] > 0;
     tag_iter->varDataOffset = tag_offsets[2*i + 1];
@@ -1115,7 +1125,7 @@
                                                 2,
                                                 data.range );
     if (rval != MB_SUCCESS) return rval;
-    MBRange tmp = data.range.intersect( setSet.range );
+    MBRange tmp = intersect( data.range,  setSet.range );
     data.range.swap( tmp );
     range_remove( setSet.range, data.range );
   }
@@ -1405,14 +1415,14 @@
                                                 MBRange& range )
 {
   MBRange result;
-  result.merge( range.intersect( nodeSet.range ) );
-  result.merge( range.intersect( setSet.range ) );  
+  result.merge( intersect( range,  nodeSet.range ) );
+  result.merge( intersect( range,  setSet.range ) );  
   for (std::list<ExportSet>::iterator eiter = exportList.begin();
            eiter != exportList.end(); ++eiter )
   {
-    result.merge( range.intersect( eiter->range ) );
+    result.merge( intersect( range, eiter->range ) );
   }
-  //result.merge( range.intersect( myParallelSets ) );
+  //result.merge( intersect( range, myParallelSets ) );
   MBRange sets;
   int junk;
   sets.merge( MBRange::lower_bound( range.begin(), range.end(), CREATE_HANDLE(MBENTITYSET, 0, junk )), range.end() );
@@ -1424,9 +1434,9 @@
 void WriteHDF5Parallel::remove_remote_sets( MBEntityHandle relative, 
                                             MBRange& range )
 {
-  MBRange result( range.intersect( setSet.range ) );
-  //result.merge( range.intersect( myParallelSets ) );
-  MBRange remaining( range.subtract( result ) );
+  MBRange result( intersect( range,  setSet.range ) );
+  //result.merge( intersect( range, yParallelSets ) );
+  MBRange remaining( subtract( range, result ) );
   
   for(MBRange::iterator i = remaining.begin(); i != remaining.end(); ++i)
   {

Modified: MOAB/trunk/parallel/parallel_hdf5_test.cc
===================================================================
--- MOAB/trunk/parallel/parallel_hdf5_test.cc	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/parallel/parallel_hdf5_test.cc	2009-07-13 23:43:10 UTC (rev 3004)
@@ -125,7 +125,7 @@
       for (MBRange::const_iterator j = children.begin(); j != children.end(); ++j) {
         tmp_entities.clear();
         rval = moab.get_entities_by_handle( *j, tmp_entities ); CHECK_ERR(rval);
-        diff = entities.subtract( tmp_entities );
+        diff = subtract( entities, tmp_entities );
         entities.swap( diff );
       }
       

Modified: MOAB/trunk/parallel/parallel_unit_tests.cpp
===================================================================
--- MOAB/trunk/parallel/parallel_unit_tests.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/parallel/parallel_unit_tests.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -291,7 +291,7 @@
   for (MBRange::iterator i = children.begin(); i != children.end(); ++i) {
     child_ents.clear();
     rval = get_set_contents( moab, *i, type, child_ents );  CHKERR(rval);
-    tmp_range = contents_out.subtract( child_ents );
+    tmp_range = subtract( contents_out,  child_ents );
     contents_out.swap( tmp_range );
   }
   
@@ -619,7 +619,7 @@
       rval = moab.get_adjacencies( adj_proc_ents, d, false, tmprange, MBInterface::UNION );
       CHKERR(rval);
     }
-    adj_proc_ents.merge( tmprange.subtract( all_iface_ents ) );
+    adj_proc_ents.merge( subtract( tmprange,  all_iface_ents ) );
     
       // get adjacent entities
     MBRange iface_ghosts, iface_ents;
@@ -632,7 +632,7 @@
     }
     
       // intersect with entities in adjacent partitions
-    ghosts.merge( iface_ghosts.intersect( adj_proc_ents ) );
+    ghosts.merge( intersect( iface_ghosts,  adj_proc_ents ) );
   }
   
     // get ids

Modified: MOAB/trunk/parallel/pcomm_unit.cpp
===================================================================
--- MOAB/trunk/parallel/pcomm_unit.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/parallel/pcomm_unit.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -98,7 +98,7 @@
 
     // get the necessary vertices too
   MBRange tmp_range = entities.subset_by_type(MBENTITYSET);
-  entities = entities.subtract(tmp_range);
+  entities = subtract( entities, tmp_range);
   rval = moab.get_adjacencies(entities, 0, false, entities, MBInterface::UNION);
   CHECK_ERR(rval);
   entities.merge(tmp_range);

Modified: MOAB/trunk/test/h5file/h5varlen.cpp
===================================================================
--- MOAB/trunk/test/h5file/h5varlen.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/test/h5file/h5varlen.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -131,7 +131,7 @@
     // remove sets created during read/write process
   MBRange sets;
   mb2.get_entities_by_type( 0, MBENTITYSET, sets );
-  entities = entities.subtract(sets);
+  entities = subtract( entities, sets);
   for (MBRange::const_iterator i = entities.begin(); i != entities.end(); ++i) {
       // get data
     const void* ptrarr[] = { NULL };

Modified: MOAB/trunk/tools/convert.cpp
===================================================================
--- MOAB/trunk/tools/convert.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/tools/convert.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -459,7 +459,7 @@
       dead_entities.merge( empty_sets );
       MBRange tmp_range;
       remove_entities_from_sets( gMB, empty_sets, tmp_range );
-      empty_sets = tmp_range.subtract( dead_entities );
+      empty_sets = subtract( tmp_range,  dead_entities );
     }
       // Destroy dead entities
     result = gMB->delete_entities( dead_entities );
@@ -752,7 +752,7 @@
   for (MBRange::iterator i = sets.begin(); i != sets.end(); ++i) {
     MBRange set_contents;
     gMB->get_entities_by_handle( *i, set_contents, false );
-    set_contents = set_contents.intersect( dead_entities );
+    set_contents = intersect( set_contents, dead_entities );
     gMB->remove_entities( *i, set_contents );
     set_contents.clear();
     gMB->get_entities_by_handle( *i, set_contents, false );

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -1101,7 +1101,7 @@
       else {
 
           // Get the volumes in the current group                                    
-        MBRange grp_vols = grp_sets.intersect(vols_save);
+        MBRange grp_vols = intersect( grp_sets, vols_save);
         for (MBRange::iterator rit = grp_vols.begin(); 
              rit != grp_vols.end(); rit++) {
           MBEntityHandle vol = *rit;
@@ -1121,7 +1121,7 @@
       else
         bc_id = 2;
         // Get the surfaces in the current group                                   
-      MBRange grp_faces = grp_sets.intersect(surfs_save);
+      MBRange grp_faces = intersect( grp_sets, surfs_save);
       for (MBRange::iterator rit = grp_faces.begin(); rit != grp_faces.end(); rit++) {
         MBEntityHandle surf = *rit;
         int surf_num = index_by_handle(surf);
@@ -1141,7 +1141,7 @@
       const char *cbc_id = bc_str.c_str();
       bc_id = -1*atoi(cbc_id);
         // Get the surfaces in the current group                                   
-      MBRange grp_faces = grp_sets.intersect(surfs_save);
+      MBRange grp_faces = intersect( grp_sets, surfs_save);
       for (MBRange::iterator rit = grp_faces.begin(); rit != grp_faces.end(); rit++) {
         MBEntityHandle surf = *rit;
         int surf_num = index_by_handle(surf);
@@ -1152,7 +1152,7 @@
     else if ((grp_names[0].find("graveyard",0)==0)||(grp_names[0].find("outside_world",0)==0)
              ||(grp_names[0].find("rest_of_world",0)==0)) {
         // Get the volumes in the current group                                    
-      MBRange grp_vols = grp_sets.intersect(vols_save);
+      MBRange grp_vols = intersect( grp_sets, vols_save);
       for (MBRange::iterator rit = grp_vols.begin(); rit != grp_vols.end(); rit++) {
         MBEntityHandle vol = *rit;
         int vol_num = index_by_handle(vol);
@@ -1312,7 +1312,7 @@
             MBErrorCode result = moab_instance()->get_entities_by_type(group, MBENTITYSET, grp_sets);
             if (MB_SUCCESS != result) continue;
             if ((tidx == 1) || (tidx == 2)) {
-              MBRange grp_faces = grp_sets.intersect(surfs_save);
+              MBRange grp_faces = intersect( grp_sets, surfs_save);
               for (MBRange::iterator rit = grp_faces.begin(); rit != grp_faces.end(); rit++) {
                 int jtal = get_entity_id(*rit);
                 std::stringstream spos1;
@@ -1326,7 +1326,7 @@
               }
             }
             else if ((tidx == 4) || ((tidx >= 6) && (tidx <= 8))) {
-              MBRange grp_vols = grp_sets.intersect(vols_save);
+              MBRange grp_vols = intersect( grp_sets, vols_save);
               for (MBRange::iterator rit = grp_vols.begin(); rit != grp_vols.end(); rit++) {
                 int jtal = get_entity_id(*rit);
                 std::stringstream spos1;

Modified: MOAB/trunk/tools/gsets.cc
===================================================================
--- MOAB/trunk/tools/gsets.cc	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/tools/gsets.cc	2009-07-13 23:43:10 UTC (rev 3004)
@@ -156,7 +156,7 @@
     
   result_sets.clear();
   mb.get_entities_by_type_and_tag( 0, MBENTITYSET, &tag, &tag_val, 1, result_sets );
-  result_sets = result_sets.subtract( curr_sets );
+  result_sets = subtract( result_sets,  curr_sets );
   curr_sets.merge( result_sets );
 }
 
@@ -203,7 +203,7 @@
 
   if (printAnonSets) {
     mb.get_entities_by_type( 0, MBENTITYSET, other_sets );
-    MBRange xsect = other_sets.subtract( sets );
+    MBRange xsect = subtract( other_sets,  sets );
     sets.swap(other_sets);
     other_sets.swap(xsect);
   }
@@ -257,7 +257,7 @@
   for (MBRange::iterator i = sets.begin(); i != sets.end(); ++i) {
     MBRange parents;
     mb.get_parent_meshsets( *i, parents );
-    parents = parents.intersect( sets );
+    parents = intersect( parents,  sets );
     
     for (MBRange::iterator j = parents.begin(); j != parents.end(); ++j) {
       const char* linklabel = 0;
@@ -276,7 +276,7 @@
   for (MBRange::iterator i = sets.begin(); i != sets.end(); ++i) {
     MBRange contained;
     mb.get_entities_by_type(*i, MBENTITYSET, contained );
-    contained = contained.intersect( sets );
+    contained = intersect( contained,  sets );
     
     for (MBRange::iterator j = contained.begin(); j != contained.end(); ++j)
       dot_down_link( s, *i, *j, dashed );

Modified: MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/tools/iMesh/iMeshP_MOAB.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -254,7 +254,7 @@
     CHKERR(rval);
     rval = get_entities( MBI, itaps_cast<MBEntityHandle>(set2), type, topo, r2 );
     CHKERR(rval);
-    result.merge( r1.intersect(r2) );
+    result.merge( intersect( r1, r2) );
   }
   
   RETURN (iBase_SUCCESS);

Modified: MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
===================================================================
--- MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -268,7 +268,7 @@
     // then get non-owned verts and subtract 
   result = pcs[1]->get_pstatus_entities(0, PSTATUS_NOT_OWNED, tmp_verts);
   PRINT_LAST_ERROR;
-  targ_verts = targ_verts.subtract(tmp_verts);
+  targ_verts = subtract( targ_verts, tmp_verts);
   
     // get position of these entities; these are the target points
   std::vector<double> vpos(3*targ_verts.size());

Modified: MOAB/trunk/tools/qvdual/DrawDual.cpp
===================================================================
--- MOAB/trunk/tools/qvdual/DrawDual.cpp	2009-07-13 23:42:27 UTC (rev 3003)
+++ MOAB/trunk/tools/qvdual/DrawDual.cpp	2009-07-13 23:43:10 UTC (rev 3004)
@@ -678,8 +678,8 @@
     MBRange adj_2cells;
     result = MBI->get_connectivity(tcell1, connect, num_connect); RR;
     result = MBI->get_adjacencies(connect, num_connect, 2, false, adj_2cells); RR;
-    adj_2cells = degen_2cells.intersect(adj_2cells);
-    if (!adj_2cells.empty()) degen_2cells = degen_2cells.subtract(adj_2cells);
+    adj_2cells = intersect( degen_2cells, adj_2cells);
+    if (!adj_2cells.empty()) degen_2cells = subtract( degen_2cells, adj_2cells);
     
       // ok, have all the adjacent degen 2cells; get the 1cells
     MBRange adj_1cells;
@@ -736,7 +736,7 @@
           // get the other 2cell
         MBRange dum = dcells;
         result = MBI->get_adjacencies(&(*rit), 1, 2, false, dum);
-        dum = dum.subtract(adj_2cells);
+        dum = subtract( dum, adj_2cells);
         assert(1 == dum.size());
           // get the vertices and points of them, and average their positions
         const MBEntityHandle *connect2;
@@ -777,7 +777,7 @@
           // get the other 2cell
         MBRange dum = dcells;
         result = MBI->get_adjacencies(&(*rit), 1, 2, false, dum);
-        dum = dum.subtract(adj_2cells);
+        dum = subtract( dum, adj_2cells);
         assert(1 == dum.size());
           // get the vertices and points of them, and average their positions
         const MBEntityHandle *connect;
@@ -818,7 +818,7 @@
           // check that 1cells are in proper order, i.e. they share 2cell with adj 1cell
         MBRange dum;
         result = MBI->get_adjacencies(&edges[0], 2, 2, false, dum); RR;
-        dum = dum.intersect(adj_2cells);
+        dum = intersect( dum, adj_2cells);
         if (dum.empty()) {
             // not adjacent - switch list order
           MBEntityHandle dum_h = edges[1];
@@ -1088,7 +1088,7 @@
       result = MBI->get_adjacencies(tmp_verts, 1, false, shared_edges); RR;
       if (shared_edges.size() > 1) {
           // filter for ones in this cell
-        shared_edges = shared_edges.intersect(cell_edges);
+        shared_edges = intersect( shared_edges, cell_edges);
         assert(!shared_edges.empty());
           // get the mid-pt of this edge and include in list; if we're inside a 2-edge
           // cell and we're on the 2nd vertex, take the 2nd edge
@@ -1679,7 +1679,7 @@
     loops.push_back(loop_vs);
     
       // ok, we've got them all; first, remove them from face_verts
-    MBRange temp_range = new_face_verts.subtract(temp_face_verts);
+    MBRange temp_range = subtract( new_face_verts, temp_face_verts);
     new_face_verts.swap(temp_range);
   }
   
@@ -1811,7 +1811,7 @@
   MBRange tmp_verts;
   result = MBI->get_entities_by_dimension(chords[1], 1, tmp_range); RR;
   result = MBI->get_adjacencies(tmp_range, 0, false, tmp_verts, MBInterface::UNION); RR;
-  tmp_verts = tmp_verts.subtract(face_verts);
+  tmp_verts = subtract( tmp_verts, face_verts);
   assert(!tmp_verts.empty());
   face_verts.insert(*tmp_verts.begin());
   
@@ -2315,7 +2315,7 @@
 
   const int num_its = 10;
   
-  dverts = dverts.subtract(face_verts);
+  dverts = subtract( dverts, face_verts);
   double tmp_coords[12];
   MeshTopoUtil mtu(vtkMOABUtils::mbImpl);
 
@@ -2417,7 +2417,7 @@
   MBRange int_verts, face_verts;
   MBErrorCode result = vtkMOABUtils::dualTool->get_dual_entities(dual_surf, NULL, NULL, 
                                                    &int_verts, &face_verts, NULL);
-  int_verts = int_verts.subtract(face_verts);
+  int_verts = subtract( int_verts, face_verts);
   
     // get vertices on sheet drawing for that sheet, and their positions
   std::vector<MBEntityHandle> int_points(int_verts.size());



More information about the moab-dev mailing list