PostGIS  2.5.7dev-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  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright 2015 Daniel Baston <dbaston@gmail.com>
22  *
23  **********************************************************************/
24 
25 
26 #ifndef _LWUNIONFIND
27 #define _LWUNIONFIND 1
28 
29 #include "liblwgeom.h"
30 
31 typedef struct
32 {
37 } UNIONFIND;
38 
39 /* Allocate a UNIONFIND structure of capacity N */
41 
42 /* Release memory associated with UNIONFIND structure */
43 void UF_destroy(UNIONFIND* uf);
44 
45 /* Identify the cluster id associated with specified component id */
47 
48 /* Get the size of the cluster associated with the specified component id */
50 
51 /* Merge the clusters that contain the two specified component ids */
52 void UF_union(UNIONFIND* uf, uint32_t i, uint32_t j);
53 
54 /* Return an array of component ids, where components that are in the
55  * same cluster are contiguous in the array */
57 
58 /* Replace the cluster ids in a UNIONFIND with sequential ids starting at one.
59  * If is_in_cluster array is provided, it will be used to skip any indexes
60  * that are not in a cluster.
61  * */
62 uint32_t* UF_get_collapsed_cluster_ids(UNIONFIND* uf, const char* is_in_cluster);
63 
64 #endif
This library is the generic geometry handling section of PostGIS.
uint32_t * UF_get_collapsed_cluster_ids(UNIONFIND *uf, const char *is_in_cluster)
Definition: lwunionfind.c:145
void UF_destroy(UNIONFIND *uf)
Definition: lwunionfind.c:53
uint32_t UF_find(UNIONFIND *uf, uint32_t i)
Definition: lwunionfind.c:61
uint32_t UF_size(UNIONFIND *uf, uint32_t i)
Definition: lwunionfind.c:78
UNIONFIND * UF_create(uint32_t N)
Definition: lwunionfind.c:34
uint32_t * UF_ordered_by_cluster(UNIONFIND *uf)
Definition: lwunionfind.c:112
void UF_union(UNIONFIND *uf, uint32_t i, uint32_t j)
Definition: lwunionfind.c:84
uint32_t N
Definition: lwunionfind.h:36
uint32_t * cluster_sizes
Definition: lwunionfind.h:34
uint32_t * clusters
Definition: lwunionfind.h:33
uint32_t num_clusters
Definition: lwunionfind.h:35
unsigned int uint32_t
Definition: uthash.h:78