4 #define CLUSTERLOG_BINARY_FILENAME_FORMAT "%s.%08d.%08d.%08d"
5 #define CLUSTERLOG_BINARY_NO_CALCULATION_VALUE (-9999)
9 typedef int clusterTypeInteger;
10 typedef double clusterTypeReal;
12 typedef float clusterTypeReal;
13 typedef short clusterTypeInteger;
15 typedef struct clusterLogOneRecord clusterLogOneRecord;
16 struct clusterLogOneRecord {
17 /* Information of this log line in the logfile */
18 clusterTypeInteger N; /* Current N (shrinked array): Definition: N > M */
19 clusterTypeInteger M; /* Current M : */
20 clusterTypeInteger prevN; /* prevN: N: the nearest pair in the below layer */
21 clusterTypeInteger prevM; /* prevM: M: */
22 clusterTypeReal distance; /* Distance between N and M */
24 /* Original File Number */
25 clusterTypeInteger originalN;
26 clusterTypeInteger originalM;
28 /* File Number within the below layer */
29 clusterTypeInteger firstN;
30 clusterTypeInteger firstM;
32 clusterLogOneRecord* belowLayerStart;
33 clusterLogOneRecord* belowLayer;
34 clusterLogOneRecord* belowLayerEnd;
37 clusterLogOneRecord* upperLayer;
40 clusterLogOneRecord* belowLayerForN;
41 clusterLogOneRecord* belowLayerForM;
43 /* Including the below layer */
44 clusterTypeInteger clusterSize; /* File Number of the cluster */
47 clusterTypeInteger clusterNumber; /* Cluster Numer of this layer */
48 /* Set the number of the cluster where this log line attributes in a function of clusterLogClusterNumberSet or Set2 */
50 clusterLogOneRecord* prev; /* previous record */
51 clusterLogOneRecord* next; /* Next record */
54 typedef struct clusterLog {
55 clusterLogOneRecord* top;
56 clusterLogOneRecord* current;
57 clusterLogOneRecord* bottom;
60 typedef struct clusterLog2OneRecord clusterLog2OneRecord;
62 struct clusterLog2OneRecord {
63 // LogFile Information
65 clusterTypeInteger M; // N > M: merge N to M
66 clusterTypeReal distance;
67 clusterTypeReal linearCorrelation;
70 clusterTypeInteger clusterNumber; // Cluster Number
72 clusterLog2OneRecord* prev;
73 clusterLog2OneRecord* next;
76 typedef struct clusterLog2 {
77 clusterLog2OneRecord* top;
78 clusterLog2OneRecord* current;
79 clusterLog2OneRecord* bottom;
82 typedef struct clusterTreeInfo clusterTreeInfo;
83 struct clusterTreeInfo {
86 clusterTypeReal ShoulderScale;
87 clusterTypeReal ArmScale;
89 clusterTypeReal ArmOffset;
91 clusterTypeInteger flagLog;
92 clusterTypeInteger flagScaling;
96 clusterTypeReal* InPosY;
97 clusterTypeReal* InPosX;
98 clusterTypeInteger argc;
100 clusterTypeInteger* clusterSize;
101 clusterTypeInteger* clusterNumber;
103 clusterTypeInteger currentNo;
105 clusterTypeInteger flagFPTTreeInfo;
111 /* prototype begin */
116 /* in clusterLogRead.c */
117 extern clusterLogOneRecord* clusterLogRead(clusterLog* cluster, FILE* fpt, int mode);
118 extern clusterLog* clusterLogReadAll(clusterLog* cluster, FILE* fpt, int mode);
119 extern clusterLog2OneRecord* clusterLog2Read(clusterLog2* cluster, FILE* fpt, int mode);
120 extern clusterLog2* clusterLog2ReadAll(clusterLog2* cluster, FILE* fpt, int mode);
121 extern clusterLogOneRecord* clusterLogReadBinary(clusterLog* cluster, clusterTypeInteger* prevN, clusterTypeInteger* prevM, char* filename, int mode);
122 extern clusterLog* clusterLogReadAllBinary(clusterLog* cluster, char* basename, int mode);
124 extern clusterLogOneRecord* clusterLogWriteAllBinary(clusterLog* cluster, char* basename, int mode);
125 extern clusterLogOneRecord* clusterLogWrite(clusterLog* cluster, FILE* fpt, int mode);
126 extern clusterLogOneRecord* clusterLogWriteOneRecord(clusterLogOneRecord* cluster, FILE* fpt, int mode);
127 extern clusterLogOneRecord* clusterLogWriteAll(clusterLog* cluster, FILE* fpt, int mode);
128 extern clusterLogOneRecord* clusterLogWriteClusterOnly(clusterLog* cluster, FILE* fpt, int mode);
129 extern void clusterLogWritePS(clusterLog* cluster, clusterTreeInfo* linfo, FILE* fpt, int mode);
131 /* in clusterLogUtil.c */
132 extern void clusterLogClusterInformationSet(clusterLog* cluster, clusterTypeInteger lastNum, int mode);
134 extern void clusterLogClusterNumberSet(clusterLogOneRecord* bottom, clusterTypeInteger lastClusterNum, int mode);
135 extern void clusterLogClusterNumberSetForLog2(clusterLog* cluster, clusterTypeInteger lastClusterNum, int mode);
136 extern void clusterLogClusterNumberSet2(clusterLog* top, clusterTypeInteger firstClusterNum, int mode);
138 extern clusterLogOneRecord* clusterLogGetDistance(clusterLog* cluster, clusterTypeInteger N, clusterTypeInteger M, clusterTypeInteger clusterNum, clusterTypeReal* data);
140 extern void clusterLogBelowLayerPointerSet(clusterLog* cluster, int mode);
141 extern clusterLogOneRecord* clusterLogBottomGet(clusterLog* cluster, int mode);
142 extern int clusterLogClusterSizeGet(clusterLogOneRecord* cluster, int mode);
143 extern void clusterLogClusterSizeSet(clusterLog* cluster, int mode);
144 extern void clusterLogBottomSet(clusterLog* cluster, int mode);
145 extern clusterLog* clusterLogTransformLog2ToLog(clusterLog2* cluster2, clusterTypeInteger lastNum, int mode);
147 /* in clusterLogInit.c */
148 extern clusterLog* clusterLogInit(clusterLog * cluster, int mode);
149 extern clusterLog2* clusterLog2Init(clusterLog2 * cluster, int mode);
150 extern clusterLogOneRecord* clusterLogInitOneRecord(clusterLogOneRecord * cluster, int mode);
151 extern clusterLog2OneRecord* clusterLog2InitOneRecord(clusterLog2OneRecord * cluster, int mode);