30 static int cmp_int(
const void *a,
const void *b);
31 static int cmp_int_ptr(
const void *a,
const void *b);
43 for (i = 0; i < N; i++)
118 for (i = 0; i < uf->
N; i++)
124 cluster_id_ptr_by_elem_id[i] = &(uf->
clusters[i]);
135 for (i = 0; i < uf-> N; i++)
137 ordered_ids[i] = (cluster_id_ptr_by_elem_id[i] - uf->
clusters);
140 lwfree(cluster_id_ptr_by_elem_id);
149 uint32_t last_old_id, current_new_id, i;
150 char encountered_cluster =
LW_FALSE;
152 current_new_id = 0; last_old_id = 0;
153 for (i = 0; i < uf->
N; i++)
156 if (!is_in_cluster || is_in_cluster[j])
159 if (!encountered_cluster)
162 last_old_id = current_old_id;
165 if (current_old_id != last_old_id)
168 new_ids[j] = current_new_id;
169 last_old_id = current_old_id;
173 lwfree(ordered_components);
void * lwalloc(size_t size)
#define LW_TRUE
Return types for functions with status returns.
This library is the generic geometry handling section of PostGIS.
uint32_t * UF_get_collapsed_cluster_ids(UNIONFIND *uf, const char *is_in_cluster)
void UF_destroy(UNIONFIND *uf)
static int cmp_int_ptr(const void *a, const void *b)
uint32_t UF_find(UNIONFIND *uf, uint32_t i)
uint32_t UF_size(UNIONFIND *uf, uint32_t i)
static int cmp_int(const void *a, const void *b)
UNIONFIND * UF_create(uint32_t N)
uint32_t * UF_ordered_by_cluster(UNIONFIND *uf)
void UF_union(UNIONFIND *uf, uint32_t i, uint32_t j)