34 #ifndef __H__UG__LIB_DISC__AMG_SOLVER__BoxPriorityQueue_H__
35 #define __H__UG__LIB_DISC__AMG_SOLVER__BoxPriorityQueue_H__
42 #define MYASSERT(a, b) UGASSERT(a, b)
44 #define MYASSERT(a, b) assert(a && ##b)
141 if(
m_box.size() < val+1)
150 m_box[val].push_back(i);
179 for(
size_t j=0; j<
m_box[val].size(); j++)
186 while(
m_box.size() &&
m_box.back().size() == 0)
197 size_t val =
m_box.size()-1;
198 size_t i =
m_box[val][0];
209 size_t val =
m_box.size()-1;
210 return m_box[val][0];
updateable priority queue class. this priority queue works on an external array of elements T.
Definition: boxsort.h:79
BoxPriorityQueue(const std::vector< T > &v)
Definition: boxsort.h:97
BoxPriorityQueue(size_t n, const T *arr_)
Definition: boxsort.h:92
~BoxPriorityQueue()
deconstructor
Definition: boxsort.h:102
stdvector< size_t > m_values
Definition: boxsort.h:278
void size_check(size_t i)
Definition: boxsort.h:269
stdvector< stdvector< size_t > > m_box
Definition: boxsort.h:275
void create(size_t n, const T *arr_)
creates the queue on a external array arr_[0]..arr_[n-1]
Definition: boxsort.h:109
void remove(size_t i)
removes index i in arr
Definition: boxsort.h:158
size_t m_size
Definition: boxsort.h:279
size_t remove_max()
returns the index in arr of maximal element of the heap
Definition: boxsort.h:193
void update(size_t i)
Definition: boxsort.h:215
void insert_item(size_t i)
Definition: boxsort.h:136
const T * arr
Definition: boxsort.h:273
size_t get_max() const
returns the index in m_arr of maximal element of the heap
Definition: boxsort.h:205
void reset()
Definition: boxsort.h:128
size_t arr_size() const
returns size of external array
Definition: boxsort.h:230
BoxPriorityQueue(const BoxPriorityQueue< T > &other)
size_t m_height
Definition: boxsort.h:280
void create(const std::vector< T > &v)
Definition: boxsort.h:123
BoxPriorityQueue()
Definition: boxsort.h:84
stdvector< int > m_posInBox
Definition: boxsort.h:277
size_t height() const
returns nr of elements in the heap.
Definition: boxsort.h:236
bool is_in(size_t i)
Definition: boxsort.h:224
Definition: stl_debug.h:45
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
size_t get_val(const T &t)
Definition: boxsort.h:48
const int BOXPRIORITYQUEUE_MAXIMAL_VALUE
maximal value for T::get_val(). Keep in mind that memory requirements are O(max get_val()).
Definition: boxsort.h:59