43  void swap(
unsigned int i,
unsigned int j) 
override;
 
   60  inline int parent(
int i)
 const {
return (
i-1)/2;}
 
   62  inline int left(
int i)
   const {
return 2*
i+1;}
 
   64  inline int right(
int i)
  const {
return 2*
i+2;}
 
 
   95    return reinterpret_cast<T*
>(
wp);
 
 
  117  at(
i)->setHeapPosition(
i);
 
  118  at(
j)->setHeapPosition(
j);
 
 
  126  if (
wp == 
nullptr)                  { 
return; }
 
  127  if (
wp->getHeapPosition() != -1) { 
return; }
 
  130  const unsigned int n = num()-1;
 
  131  last()->setHeapPosition(
n);
 
 
  140  if (
wp == 
nullptr) { 
return; }
 
  142  if (
wp->getHeapPosition() == -1)
 
  146    const unsigned int n = num()-1;
 
  147    last()->setHeapPosition(
n);
 
 
  161  if (
wp == 
nullptr) { 
return -1; }
 
  163  const int i = 
wp->getHeapPosition();
 
  164  if (
i == -1) { 
return -1; }
 
  167  if (
i >= 
n) { 
return -1; }
 
  172    wp->setHeapPosition(-1);
 
  185    wp->setHeapPosition(-1);
 
 
  196  const int i = 
wp->getHeapPosition();
 
  197  if (
i == -1) { 
return; }
 
  200  if (
i >= 
n) { 
return; }
 
  202  const double ov = 
wp->getHeapValue();
 
  204  wp->setHeapValue(
nv);
 
 
  221  if (
i == 0) { 
return 0; }
 
  222  const int pi = parent(
i);
 
  234int WEMHeap<T>::downHeap(
int i)
 
  239  if (
i >= 
n) { 
return -1; }
 
  266  const unsigned int n = num();
 
 
  280  const unsigned int n = num();
 
  281  for (
unsigned int i = 0; 
i < 
n; 
i++) {
 
  282    at(
i)->setHeapPosition(-1);
 
 
Min-Heap structure with property v[i]<v[2*i+1] and v[i]<v[2*i+2] Parent at index i has children at in...
 
void update(WEMPrimitive *wp, double nv)
Updates given heap element with the given value and resorts this heap.
 
void clear() override
Remove all elements from heap.
 
void sort()
Sorts this heap.
 
void swap(unsigned int i, unsigned int j) override
Swaps two heap elements given by their indices and resorts this heap.
 
T * root()
Returns the root (first) element of this heap, typecast from WEMPrimitive to T.
 
~WEMHeap() override
Standard destructor.
 
int remove(WEMPrimitive *wp) override
Removes the given heap element and resorts this heap.
 
WEMHeap(WEMHeap &&) noexcept=default
 
void insert(WEMPrimitive *wp)
Inserts the given heap element and resorts this heap.
 
This is the base class for the WEM elements nodes, edges, and faces.
 
Dynamic templated vector.
 
virtual void clear()
Clears all internal pointers.
 
virtual void swap(unsigned int p1, unsigned int p2)
Swaps the two elements given by their indices in this vector.
 
virtual unsigned int appendUnsafe(T *elem)
Append element to back of vector, don't check on element being non-NULL.
 
T * first()
Returns the first element.
 
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
 
IteratorTraits::value_type & at(const ml_iterator_map< IteratorTraits, IDMap > &i, typename property_traits< IDMap >::key_type key)
 
static bool less(const WEMPrimitive &x, const WEMPrimitive &y)