163 #ifndef MOAB_RANGE_HPP
164 #define MOAB_RANGE_HPP
241 size_t psize()
const;
245 inline bool empty()
const;
252 return insert( begin(), val );
263 return insert( begin(), val1, val2 );
266 template <
typename T >
270 iterator insert(
typename T::const_iterator begin_iter,
typename T::const_iterator end_iter )
272 return insert_list( begin_iter, end_iter );
275 template <
typename T >
278 return insert_list( begin_iter, end_iter );
282 iterator erase( iterator iter );
285 iterator erase( iterator iter1, iterator iter2 );
303 static const_iterator lower_bound( const_iterator
first, const_iterator last,
EntityHandle val );
304 static const_iterator upper_bound( const_iterator
first, const_iterator last,
EntityHandle val );
308 return lower_bound( begin(), end(), val );
312 return upper_bound( begin(), end(), val );
314 const_iterator lower_bound( EntityType type )
const;
315 const_iterator upper_bound( EntityType type )
const;
316 std::pair< const_iterator, const_iterator > equal_range( EntityType type )
const;
317 const_iterator lower_bound( EntityType type, const_iterator
first )
const;
318 const_iterator upper_bound( EntityType type, const_iterator
first )
const;
322 bool all_of_type( EntityType type )
const;
325 bool all_of_dimension(
int dimension )
const;
327 unsigned num_of_type( EntityType type )
const;
328 unsigned num_of_dimension(
int dim )
const;
334 const std::string str_rep(
const char* indent_prefix = NULL )
const;
336 void print(
const char* indent_prefix = NULL )
const;
337 void print( std::ostream& s,
const char* indent_prefix = NULL )
const;
339 unsigned long get_memory_use()
const;
341 double compactness()
const;
348 insert( range.
begin(), range.
end() );
354 insert( beginr, endr );
358 void swap(
Range& range );
361 void sanity_check()
const;
364 bool contains(
const Range& other )
const;
367 Range subset_by_type( EntityType t )
const;
370 Range subset_by_dimension(
int dim )
const;
372 struct PairNode :
public std::pair< EntityHandle, EntityHandle >
395 void delete_pair_node(
PairNode* dead_node );
416 mNode = mNode->mNext;
428 mNode = mNode->mPrev;
439 return mNode == other.
mNode;
444 return mNode != other.
mNode;
472 : mNode( const_cast<
PairNode* >( iter ) ), mValue( val )
487 if( mValue == mNode->second )
489 mNode = mNode->mNext;
490 mValue = mNode->first;
513 if( mValue == mNode->first )
515 mNode = mNode->mPrev;
517 mValue = mNode->second;
551 return ( mNode == other.
mNode ) && ( mValue == other.
mValue );
558 return ( mNode != other.
mNode ) || ( mValue != other.
mValue );
667 return myIter == other.
myIter;
673 return myIter != other.
myIter;
701 myNode = myNode->
mPrev;
707 myNode = myNode->
mNext;
727 return other.
myNode == myNode;
732 return other.
myNode != myNode;
767 Range
intersect(
const Range&,
const Range& );
770 Range
subtract(
const Range& from,
const Range& );
804 EntityID operator-(
const Range::const_iterator& it1,
const Range::const_iterator& it2 );
822 container->
insert( value );
926 return !( r1 == r2 );
938 if( handle < *
begin() || handle > *
rbegin() )
return -1;
944 i += ( *pit ).second - ( *pit ).first + 1;
947 if( handle < ( *pit ).first || pit ==
const_pair_end() )
return -1;
949 return i + handle - ( *pit ).first;
954 unsigned int num_ents =
size();
958 template <
typename Iterator >
961 size_t n = std::distance( begin_iter, end_iter );
963 std::copy( begin_iter, end_iter, sorted );
964 std::sort( sorted, sorted + n );
970 while( j < n && sorted[j] == 1 + sorted[j - 1] )
972 hint =
insert( hint, sorted[i], sorted[i] + ( ( j - i ) - 1 ) );