PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ do_dbscan_test()

static void do_dbscan_test ( struct dbscan_test_info  test)
static

Definition at line 269 of file cu_geos_cluster.c.

270 {
271  LWGEOM** geoms = WKTARRAY2LWGEOM(test.wkt_inputs, test.num_geoms);
272  UNIONFIND* uf = UF_create(test.num_geoms);
273  uint32_t* ids;
274  char* in_a_cluster;
275  uint32_t i;
276 
277  union_dbscan(geoms, test.num_geoms, uf, test.eps, test.min_points, &in_a_cluster);
278  ids = UF_get_collapsed_cluster_ids(uf, in_a_cluster);
279 
280  for (i = 0; i < test.num_geoms; i++)
281  {
282  ASSERT_INT_EQUAL(in_a_cluster[i], test.expected_in_cluster[i]);
283  if (in_a_cluster[i])
284  ASSERT_INT_EQUAL(ids[i], test.expected_ids[i]);
285  }
286 
287  UF_destroy(uf);
288  for (i = 0; i < test.num_geoms; i++)
289  {
290  lwgeom_free(geoms[i]);
291  }
292  lwfree(geoms);
293  lwfree(in_a_cluster);
294  lwfree(ids);
295 }
static LWGEOM ** WKTARRAY2LWGEOM(char **wkt_array, size_t num_geoms)
#define ASSERT_INT_EQUAL(o, e)
int union_dbscan(LWGEOM **geoms, uint32_t num_geoms, UNIONFIND *uf, double eps, uint32_t min_points, char **is_in_cluster_ret)
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
void lwfree(void *mem)
Definition: lwutil.c:242
uint32_t * UF_get_collapsed_cluster_ids(UNIONFIND *uf, const char *is_in_cluster)
Definition: lwunionfind.c:146
void UF_destroy(UNIONFIND *uf)
Definition: lwunionfind.c:54
UNIONFIND * UF_create(uint32_t N)
Definition: lwunionfind.c:35
uint32_t * expected_ids

References ASSERT_INT_EQUAL, dbscan_test_info::eps, dbscan_test_info::expected_ids, dbscan_test_info::expected_in_cluster, lwfree(), lwgeom_free(), dbscan_test_info::min_points, dbscan_test_info::num_geoms, UF_create(), UF_destroy(), UF_get_collapsed_cluster_ids(), union_dbscan(), dbscan_test_info::wkt_inputs, and WKTARRAY2LWGEOM().

Referenced by dbscan_test(), dbscan_test_3612a(), dbscan_test_3612b(), and dbscan_test_3612c().

Here is the call graph for this function:
Here is the caller graph for this function: