PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ up()

static void up ( MINHEAP tree,
areanode arealist,
int  c 
)
static

Sift Up.

Definition at line 169 of file effectivearea.c.

References area(), MINHEAP::key_array, LWDEBUG, and areanode::treeindex.

Referenced by minheap_update().

170 {
171  LWDEBUG(2, "Entered up");
172  void *tmp;
173 
174  areanode **treearray=tree->key_array;
175 
176  int parent=floor((c-1)/2);
177 
178  while(((areanode*) treearray[c])->area<((areanode*) treearray[parent])->area)
179  {
180  /*ok, we have to swap*/
181  tmp=treearray[parent];
182  treearray[parent]=treearray[c];
183  /*Update reference*/
184  ((areanode*) treearray[parent])->treeindex=parent;
185  treearray[c]=tmp;
186  /*Update reference*/
187  ((areanode*) treearray[c])->treeindex=c;
188  c=parent;
189  parent=floor((c-1)/2);
190  }
191  return;
192 }
This structure is placed in an array with one member per point.
Definition: effectivearea.h:38
Datum area(PG_FUNCTION_ARGS)
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
int treeindex
Definition: effectivearea.h:41
areanode ** key_array
Definition: effectivearea.h:56
Here is the call graph for this function:
Here is the caller graph for this function: