[MOAB-dev] r2037 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Tue Aug 12 10:56:29 CDT 2008


Author: kraftche
Date: 2008-08-12 10:56:29 -0500 (Tue, 12 Aug 2008)
New Revision: 2037

Modified:
   MOAB/trunk/MBRange.cpp
   MOAB/trunk/MBRange.hpp
Log:

Fixes to MBRange::subset_by_type:
 o fix mismatched argument type between header (MBEntityType) and
   source (const MBEntityType).
 o function should be const, as it doesn't modify the object it is
   called on.
 o use 'equal_range' rather than 'lower_bound' and 'upper_bound' so
   the range is searched once rather than twice.
 


Modified: MOAB/trunk/MBRange.cpp
===================================================================
--- MOAB/trunk/MBRange.cpp	2008-08-05 17:52:08 UTC (rev 2036)
+++ MOAB/trunk/MBRange.cpp	2008-08-12 15:56:29 UTC (rev 2037)
@@ -850,10 +850,11 @@
 }
 
     //! return a subset of this range, by type
-MBRange MBRange::subset_by_type(const MBEntityType t) 
+MBRange MBRange::subset_by_type(MBEntityType t) const
 {
   MBRange result;
-  result.merge( lower_bound(t), upper_bound(t) );
+  std::pair<const_iterator, const_iterator> iters = equal_range(t);
+  result.merge( iters.first, iters.second );
   return result;
 }
 

Modified: MOAB/trunk/MBRange.hpp
===================================================================
--- MOAB/trunk/MBRange.hpp	2008-08-05 17:52:08 UTC (rev 2036)
+++ MOAB/trunk/MBRange.hpp	2008-08-12 15:56:29 UTC (rev 2037)
@@ -316,7 +316,7 @@
   void sanity_check() const;
 
     //! return a subset of this range, by type
-  MBRange subset_by_type(MBEntityType t);
+  MBRange subset_by_type(MBEntityType t) const;
   
   struct PairNode : public std::pair<MBEntityHandle,MBEntityHandle>
   {




More information about the moab-dev mailing list