PostGIS  2.2.8dev-r@@SVN_REVISION@@
lwunionfind.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * Copyright 2015 Daniel Baston <dbaston@gmail.com>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU General Public Licence. See the COPYING file.
10  *
11  **********************************************************************/
12 
13 #ifndef _LWUNIONFIND
14 #define _LWUNIONFIND 1
15 
16 #include "liblwgeom.h"
17 
18 typedef struct
19 {
20  uint32_t* clusters;
21  uint32_t* cluster_sizes;
22  uint32_t num_clusters;
23  uint32_t N;
24 } UNIONFIND;
25 
26 /* Allocate a UNIONFIND structure of capacity N */
27 UNIONFIND* UF_create(uint32_t N);
28 
29 /* Release memory associated with UNIONFIND structure */
30 void UF_destroy(UNIONFIND* uf);
31 
32 /* Identify the cluster id associated with specified component id */
33 uint32_t UF_find(UNIONFIND* uf, uint32_t i);
34 
35 /* Merge the clusters that contain the two specified components ids */
36 void UF_union(UNIONFIND* uf, uint32_t i, uint32_t j);
37 
38 /* Return an array of component ids, where components that are in the
39  * same cluster are contiguous in the array */
40 uint32_t* UF_ordered_by_cluster(UNIONFIND* uf);
41 
42 #endif
uint32_t * clusters
Definition: lwunionfind.h:20
uint32_t * cluster_sizes
Definition: lwunionfind.h:21
uint32_t N
Definition: lwunionfind.h:23
uint32_t UF_find(UNIONFIND *uf, uint32_t i)
Definition: lwunionfind.c:48
uint32_t * UF_ordered_by_cluster(UNIONFIND *uf)
Definition: lwunionfind.c:93
uint32_t num_clusters
Definition: lwunionfind.h:22
UNIONFIND * UF_create(uint32_t N)
Definition: lwunionfind.c:21
void UF_union(UNIONFIND *uf, uint32_t i, uint32_t j)
Definition: lwunionfind.c:65
This library is the generic geometry handling section of PostGIS.
void UF_destroy(UNIONFIND *uf)
Definition: lwunionfind.c:40