H2Lib  3.0
cluster.h
Go to the documentation of this file.
1 
2 /* ------------------------------------------------------------
3  * This is the file "cluster.h" of the H2Lib package.
4  * All rights reserved, Knut Reimer 2009
5  * ------------------------------------------------------------ */
6 
11 #ifndef CLUSTER_H
12 #define CLUSTER_H
13 
22 typedef struct _cluster cluster;
23 
25 typedef cluster* pcluster;
26 
28 typedef const cluster *pccluster;
29 
30 #include "settings.h"
31 #include "clustergeometry.h"
32 
40 struct _cluster {
43 
46 
49 
52 
55 
58 
61 
64 
70 };
71 
72 /* ------------------------------------------------------------
73  * Constructors and destructors
74  * ------------------------------------------------------------ */
75 
89 
96 HEADER_PREFIX void
98 
107 HEADER_PREFIX void
109 
110 
111 /* ------------------------------------------------------------
112  Clustering strategies
113  ------------------------------------------------------------ */
114 
122 typedef enum {
131 } clustermode;
132 
153 
176  uint direction);
177 
194 
210 
229  clustermode mode);
230 
231 
232 
233 /* ------------------------------------------------------------
234  * Statistics
235  * ------------------------------------------------------------ */
236 
246 
256 
257 /* ------------------------------------------------------------
258  * Structure Adaptation
259  * ------------------------------------------------------------ */
260 
268 HEADER_PREFIX void
269 extend_cluster(pcluster t, uint depth);
270 
279 HEADER_PREFIX void
280 cut_cluster(pcluster t, uint depth);
281 
291 HEADER_PREFIX void
292 balance_cluster(pcluster t, uint depth);
293 
302 HEADER_PREFIX void
303 coarsen_cluster(pcluster t, uint minsize);
304 
313 HEADER_PREFIX void
315 
316 /* ------------------------------------------------------------
317  * Bounding box
318  * ------------------------------------------------------------ */
319 
331 
344 
356 
369 
370 /* ------------------------------------------------------------
371  * Hierarchical iterator
372  * ------------------------------------------------------------ */
373 
397 HEADER_PREFIX void
399  void (*pre)(pccluster t, uint tname, void *data),
400  void (*post)(pccluster t, uint tname, void *data), void *data);
401 
426 HEADER_PREFIX void
427 iterate_parallel_cluster(pccluster t, uint tname, uint pardepth,
428  void (*pre)(pccluster t, uint tname, void *data),
429  void (*post)(pccluster t, uint tname, void *data), void *data);
430 
431 /* ------------------------------------------------------------
432  Enumeration
433  ------------------------------------------------------------ */
434 
450 
451 /* ------------------------------------------------------------
452  * File I/O
453  * ------------------------------------------------------------ */
454 
455 #ifdef USE_NETCDF
456 
460 HEADER_PREFIX void
461 write_cdf_cluster(pccluster t, const char *name);
462 
468 HEADER_PREFIX void
469 write_cdfpart_cluster(pccluster t, int nc_file, const char *prefix);
470 
476 read_cdf_cluster(const char *name);
477 
484 read_cdfpart_cluster(int nc_file, const char *prefix);
485 #endif
486 
489 #endif
pcluster build_cluster(pclustergeometry cf, uint size, uint *idx, uint clf, clustermode mode)
Build a cluster tree from a clustergeometry object using cluster strategy clustermode.
real getdist_max_cluster(pccluster t, pccluster s)
Compute the distance of two clusters in the maximum norm.
real getdiam_max_cluster(pccluster t)
Compute the diameter of the bounding of a cluster in the maximum norm.
pcluster build_pca_cluster(pclustergeometry cf, uint size, uint *idx, uint clf)
Build a cluster tree from a clustergeometry object based on the principal component analysis...
void update_cluster(pcluster t)
Complete the initialisation of a cluster object.
void write_cdf_cluster(pccluster t, const char *name)
Write cluster to NetCDF file.
void iterate_cluster(pccluster t, uint tname, void(*pre)(pccluster t, uint tname, void *data), void(*post)(pccluster t, uint tname, void *data), void *data)
Hierarchical iterator for a cluster tree.
real * bmax
Maximal coordinates of bounding box.
Definition: cluster.h:60
Geometrically clustering based principal component analysis (PCA).
Definition: cluster.h:130
void coarsen_cluster(pcluster t, uint minsize)
Coarsen a cluster tree to a minimal size.
pcluster read_cdfpart_cluster(int nc_file, const char *prefix)
Read cluster from part of a NetCDF file.
Geometrically regular clustering.
Definition: cluster.h:126
pcluster read_cdf_cluster(const char *name)
Read cluster from NetCDF file.
uint getdepth_cluster(pccluster t)
Compute the depth of a cluster object.
unsigned uint
Unsigned integer type.
Definition: settings.h:70
Representation of a clustergeometry object.
Definition: clustergeometry.h:45
void balance_cluster(pcluster t, uint depth)
Balance a cluster tree to a given depth.
clustermode
Set the clustering strategy.
Definition: cluster.h:122
void cut_cluster(pcluster t, uint depth)
Cut a cluster object until a new depth is reached.
cluster * pcluster
Pointer to cluster object.
Definition: cluster.h:25
real * bmin
Minimal coordinates of bounding box.
Definition: cluster.h:57
uint getmindepth_cluster(pccluster t)
Compute the minimal level of a cluster object.
pcluster * son
Pointer to son clusters.
Definition: cluster.h:51
Simultaneous subdivision clustering.
Definition: cluster.h:128
uint * idx
Index set.
Definition: cluster.h:45
uint type
Type of cluster, necessary for domain decomposition clustering. 1 : domain cluster 2 : interface clus...
Definition: cluster.h:69
uint sons
Number of sons.
Definition: cluster.h:48
uint desc
Number of descendants.
Definition: cluster.h:63
pcluster build_regular_cluster(pclustergeometry cf, uint size, uint *idx, uint clf, uint direction)
Build a cluster tree from a clustergeometry object using regular clustering.
real getdist_2_cluster(pccluster t, pccluster s)
Compute the euclidian distance of two clusters.
#define HEADER_PREFIX
Prefix for function declarations.
Definition: settings.h:43
double real
real floating point type.
Definition: settings.h:97
pcluster build_simsub_cluster(pclustergeometry cf, uint size, uint *idx, uint clf)
Build a cluster tree from a clustergeometry object using simultaneous subdivision clustering...
pcluster new_cluster(uint size, uint *idx, uint sons, uint dim)
Create a new cluster object.
void write_cdfpart_cluster(pccluster t, int nc_file, const char *prefix)
Write cluster to part of a NetCDF file.
pcluster build_adaptive_cluster(pclustergeometry cf, uint size, uint *idx, uint clf)
Build a cluster tree from a clustergeometry object using adaptive clustering.
void del_cluster(pcluster t)
Delete a cluster object.
uint dim
Spatial dimension of bounding box.
Definition: cluster.h:54
pcluster * enumerate_cluster(pcluster t)
Enumerate all clusters in a cluster tree.
Representation of cluster trees.
Definition: cluster.h:40
void iterate_parallel_cluster(pccluster t, uint tname, uint pardepth, void(*pre)(pccluster t, uint tname, void *data), void(*post)(pccluster t, uint tname, void *data), void *data)
Parallel hierarchical iterator for a cluster tree.
void setsons_cluster(pcluster t, uint sons)
Set the number of sons of a cluster tree.
const cluster * pccluster
Pointer to constant cluster object.
Definition: cluster.h:28
uint size
Number of indices.
Definition: cluster.h:42
real getdiam_2_cluster(pccluster t)
Compute the euclidian diameter of the bounding box of a cluster.
Geometrically adaptive clustering.
Definition: cluster.h:124
void extend_cluster(pcluster t, uint depth)
Extends a given cluster until getmindepth_cluster(t) == depth.