Lines Matching refs:loc
26 static inline PetscInt Parent(PetscInt loc) in Parent() argument
28 PetscInt p = loc >> B; in Parent()
29 …if (p < ARITY) return (PetscInt)(loc != 1); /* Parent(1) is 0, otherwise fix entries ending up in … in Parent()
32 #define Value(h, loc) ((h)->base[loc].value) argument
33 #define Id(h, loc) ((h)->base[loc].id) argument
35 static inline void Swap(PetscHeap h, PetscInt loc, PetscInt loc2) in Swap() argument
38 id = Id(h, loc); in Swap()
39 val = Value(h, loc); in Swap()
40 h->base[loc].id = Id(h, loc2); in Swap()
41 h->base[loc].value = Value(h, loc2); in Swap()
45 static inline PetscInt MinChild(PetscHeap h, PetscInt loc) in MinChild() argument
48 left = loc << B; in MinChild()
81 PetscInt loc, par; in PetscHeapAdd() local
85 loc = h->end++; in PetscHeapAdd()
87 h->base[loc].id = id; in PetscHeapAdd()
88 h->base[loc].value = val; in PetscHeapAdd()
91 while ((void)(par = Parent(loc)), Value(h, par) > val) { in PetscHeapAdd()
92 Swap(h, loc, par); in PetscHeapAdd()
93 loc = par; in PetscHeapAdd()
100 PetscInt loc, chld; in PetscHeapPop() local
113 loc = --h->end; in PetscHeapPop()
115 h->base[1].id = Id(h, loc); in PetscHeapPop()
116 h->base[1].value = Value(h, loc); in PetscHeapPop()
119 loc = 1; in PetscHeapPop()
120 while ((chld = MinChild(h, loc)) && Value(h, loc) > Value(h, chld)) { in PetscHeapPop()
121 Swap(h, loc, chld); in PetscHeapPop()
122 loc = chld; in PetscHeapPop()
143 PetscInt loc; in PetscHeapStash() local
146 loc = --h->stash; in PetscHeapStash()
147 h->base[loc].id = id; in PetscHeapStash()
148 h->base[loc].value = val; in PetscHeapStash()