1 /*****************************************************************************
2   FILE           : $Source: /projects/higgs1/SNNS/CVS/SNNS/kernel/sources/krart_df.h,v $
3   SHORTNAME      :
4   SNNS VERSION   : 4.2
5 
6   PURPOSE        : SNNS Kernel definitions for ART-Networks
7   NOTES          :
8 
9   AUTHOR         : Kai-Uwe Herrmann
10   DATE           : 17.05.92
11 
12   CHANGED BY     : Sven Doering
13   RCS VERSION    : $Revision: 2.6 $
14   LAST CHANGE    : $Date: 1998/02/25 15:27:19 $
15 
16     Copyright (c) 1990-1995  SNNS Group, IPVR, Univ. Stuttgart, FRG
17     Copyright (c) 1996-1998  SNNS Group, WSI, Univ. Tuebingen, FRG
18 
19 ******************************************************************************/
20 #ifndef __KR_ART_DEF
21 #define __KR_ART_DEF
22 
23 
24 /* Logical Layers for ART1 networks
25 */
26 #define ART1_INP_LAY 1     /* The ART1 Input layer */
27 #define ART1_CMP_LAY 2     /* The ART1 Comparison layer */
28 #define ART1_REC_LAY 3     /* The ART1 Recognition layer */
29 #define ART1_DEL_LAY 4     /* The ART1 Delay layer */
30 #define ART1_RST_LAY 5     /* The ART1 Reset layer */
31 #define ART1_SPEC_LAY 6    /* The ART1 Special unit layer */
32 
33 
34 /* Logical Layers for ART2 networks
35 */
36 #define ART2_INP_LAY    1   /* The ART2 Input Layer */
37 #define ART2_W_LAY      2   /* The ART2 W Units (belonging to F1) */
38 #define ART2_X_LAY      3   /* The ART2 X Units (belonging to F1) */
39 #define ART2_U_LAY      4   /* The ART2 U Units (belonging to F1) */
40 #define ART2_V_LAY      5   /* The ART2 V Units (belonging to F1) */
41 #define ART2_P_LAY      6   /* The ART2 P Units (belonging to F1) */
42 #define ART2_Q_LAY      7   /* The ART2 Q Units (belonging to F1) */
43 #define ART2_R_LAY      8   /* The ART2 R Units (belonging to F1) */
44 #define ART2_REC_LAY    9   /* The ART2 Recognition Layer */
45 #define ART2_RST_LAY   10   /* The ART2 Reset Layer */
46 
47 /* Logical Layers for ARTMAP networks
48 */
49 #define ARTMAP_INPa_LAY    1       /* the artmap-arta input layer */
50 #define ARTMAP_CMPa_LAY    2       /* the artmap-arta comparison layer */
51 #define ARTMAP_RECa_LAY    3       /* the artmap-arta recognition layer */
52 #define ARTMAP_DELa_LAY    4       /* the artmap-arta delay layer */
53 #define ARTMAP_RSTa_LAY    5       /* the artmap-arta local reset layer */
54 #define ARTMAP_SPECa_LAY   6       /* the artmap-arta special unit layer */
55 #define ARTMAP_INPb_LAY    7       /* the artmap-artb input layer */
56 #define ARTMAP_CMPb_LAY    8       /* the artmap-artb comparison layer */
57 #define ARTMAP_RECb_LAY    9       /* the artmap-artb recognition layer */
58 #define ARTMAP_DELb_LAY   10       /* the artmap-artb delay layer */
59 #define ARTMAP_RSTb_LAY   11       /* the artmap-artb local reset layer */
60 #define ARTMAP_SPECb_LAY  12       /* the artmap-artb special unit layer */
61 #define ARTMAP_MAP_LAY    13       /* the artmap map layer */
62 #define ARTMAP_SPEC_LAY   14       /* the artmap special unit layer */
63 
64 /* Logical unit numbers for ART1 networks
65 */
66 
67   /* special units */
68 #define ART1_NO_OF_SPEC_UNITS   8
69 
70 #define ART1_CL_UNIT    1
71 #define ART1_NCL_UNIT   2
72 #define ART1_G1_UNIT    3
73 #define ART1_RI_UNIT    4
74 #define ART1_RC_UNIT    5
75 #define ART1_RG_UNIT    6
76 #define ART1_RHO_UNIT   7
77 #define ART1_G2_UNIT    8
78 
79   /* delay type units */
80 #define ART1_DEL_REC_UNIT         1
81 #define ART1_D1_UNIT              2
82 #define ART1_D2_UNIT              3
83 #define ART1_D3_UNIT              4
84 
85 
86 /* Logical unit numbers for ARTMAP networks
87 */
88 
89   /* special units */
90 #define ARTMAP_NO_OF_SPECa_UNITS   8
91 
92 #define ARTMAP_CLa_UNIT   1
93 #define ARTMAP_NCa_UNIT   2
94 #define ARTMAP_G1a_UNIT   3
95 #define ARTMAP_RIa_UNIT   4
96 #define ARTMAP_RCa_UNIT   5
97 #define ARTMAP_RGa_UNIT   6
98 #define ARTMAP_RHOa_UNIT  7
99 #define ARTMAP_G2a_UNIT   8
100 
101 
102 #define ARTMAP_NO_OF_SPECb_UNITS   8
103 
104 #define ARTMAP_CLb_UNIT   1
105 #define ARTMAP_NCb_UNIT   2
106 #define ARTMAP_G1b_UNIT   3
107 #define ARTMAP_RIb_UNIT   4
108 #define ARTMAP_RCb_UNIT   5
109 #define ARTMAP_RGb_UNIT   6
110 #define ARTMAP_RHOb_UNIT  7
111 #define ARTMAP_G2b_UNIT   8
112 
113 
114 #define ARTMAP_NO_OF_SPEC_UNITS   10
115 
116 #define ARTMAP_D1_UNIT    1
117 #define ARTMAP_CL_UNIT    2
118 #define ARTMAP_NC_UNIT    3
119 #define ARTMAP_G_UNIT     4
120 #define ARTMAP_RB_UNIT    5
121 #define ARTMAP_RM_UNIT    6
122 #define ARTMAP_RG_UNIT    7
123 #define ARTMAP_RHO_UNIT   8
124 #define ARTMAP_QU_UNIT    9
125 #define ARTMAP_DRHO_UNIT 10
126 
127   /* delay type units */
128 #define ARTMAP_DELa_REC_UNIT   1
129 #define ARTMAP_D1a_UNIT        2
130 #define ARTMAP_D2a_UNIT        3
131 #define ARTMAP_D3a_UNIT        4
132 
133 #define ARTMAP_DELb_REC_UNIT   1
134 #define ARTMAP_D1b_UNIT        2
135 #define ARTMAP_D2b_UNIT        3
136 #define ARTMAP_D3b_UNIT        4
137 
138 
139 
140 
141 /* Link initialization values for the links of an ART1 network.
142    The last two elements of the name indicate the logical source layer
143    and the logical target layer
144 */
145 
146   /* fix links for ART1 */
147 #define ART1_LINK_INP_CMP   1.0
148 #define ART1_LINK_INP_G1    1.0
149 #define ART1_LINK_INP_RI    1.0
150 #define ART1_LINK_INP_G2    1.0
151 #define ART1_LINK_CMP_RC    1.0
152 #define ART1_LINK_REC_G1    1.0
153 #define ART1_LINK_REC_DEL   2.0
154 #define ART1_LINK_DEL_DEL   1.0
155 #define ART1_LINK_DEL_RST   1.0
156 #define ART1_LINK_DEL_CL    1.0
157 #define ART1_LINK_RST_REC   -2.0
158 #define ART1_LINK_RST_RST   1.0
159 #define ART1_LINK_RST_NCL   1.0
160 #define ART1_LINK_G1_CMP    1.0
161 #define ART1_LINK_RI_RG     -1.0
162 #define ART1_LINK_RC_RG     1.0
163 #define ART1_LINK_RG_RST    1.0
164 #define ART1_LINK_RG_REC    -2.0
165 #define ART1_LINK_RG_CL     -1.0
166 #define ART1_LINK_RHO_RI    1.0
167 #define ART1_LINK_RHO_RHO   1.0
168 #define ART1_LINK_G2_REC    -2.0
169 #define ART1_LINK_G2_CL     1.0
170 
171 
172 /* trainable links for ART1 */
173   /* the initial values of the bottom up link weights should be
174              0 < weight < (1 / (beta + |I|))
175              where beta is a value > 0.0 and should not be too big,
176                    I is the number of ones in the binary input vector.
177                    gamma has to be choosen > 1.0.
178   */
179 #define ART1_LINK_CMP_REC(beta,gamma)    (1.0 / ((beta) + (gamma) * NoOfInputUnits))
180 #define ART1_LINK_DEL_CMP                1.0
181 
182   /* Formulas to adjust the link weights in an ART1 network
183   */
184 #define ART1_ADJUST_LINK_DEL_CMP(unit)                      (unit->act)
185 #define ART1_ADJUST_LINK_CMP_REC(unit, beta, norm) \
186                                        ((unit->act)/((beta) + (norm)))
187 
188 
189 
190 
191 /* fix links for ART2 */
192 #define ART2_LINK_INP_W               1.0
193 #define ART2_LINK_U_W(a)              a
194 #define ART2_LINK_W_X                 1.0
195 #define ART2_LINK_V_U                 1.0
196 #define ART2_LINK_X_V                 1.0
197 #define ART2_LINK_Q_V(b)              b
198 #define ART2_LINK_U_P                 1.0
199 #define ART2_LINK_P_Q                 1.0
200 #define ART2_LINK_P_R(c)              c
201 #define ART2_LINK_INP_R               1.0
202 
203 #define ART2_LINK_RST_REC(d)         -(1/(1-(d)))-10
204 #define ART2_LINK_REC_RST             1.0
205 #define ART2_LINK_RST_RST             1.0
206 
207 
208 
209 /* trainable links for ART2 */
210 #define ART2_LINK_P_REC(param_d,gamma) (1.0/(gamma*(1-param_d)*sqrt((double) NoOfInputUnits)))
211 #define ART2_LINK_REC_P                0.0
212 
213   /* Formulas to adjust the link weights in an ART2 network
214   */
215 #define ART2_ADJUST_LINK_REC_P(unit_u, d)       (unit_u->act / (1-d))
216 #define ART2_ADJUST_LINK_P_REC(unit_u, d)       (unit_u->act / (1-d))
217 
218 
219 
220 
221 
222 /* fix links for ARTMAP */
223 #define ARTMAP_LINK_INPa_CMPa   1.0
224 #define ARTMAP_LINK_INPa_G1a    1.0
225 #define ARTMAP_LINK_INPa_RIa    1.0
226 #define ARTMAP_LINK_INPa_G2a    1.0
227 #define ARTMAP_LINK_CMPa_RCa    1.0
228 #define ARTMAP_LINK_RECa_G1a    1.0
229 #define ARTMAP_LINK_RECa_DELa   2.0
230 #define ARTMAP_LINK_DELa_DELa   1.0
231 #define ARTMAP_LINK_DELa_RSTa   1.0
232 #define ARTMAP_LINK_DELa_CLa    1.0
233 #define ARTMAP_LINK_RSTa_RECa  -2.0
234 #define ARTMAP_LINK_RSTa_RSTa   1.0
235 #define ARTMAP_LINK_RSTa_NCa    1.0
236 #define ARTMAP_LINK_G1a_CMPa    1.0
237 #define ARTMAP_LINK_RIa_RGa    -1.0
238 #define ARTMAP_LINK_RCa_RGa     1.0
239 #define ARTMAP_LINK_RGa_RSTa    1.0
240 #define ARTMAP_LINK_RGa_RECa   -2.0
241 #define ARTMAP_LINK_RGa_CLa    -1.0
242 #define ARTMAP_LINK_RGa_DRHO   -1.0
243 #define ARTMAP_LINK_RHOa_RIa    1.0
244 #define ARTMAP_LINK_RHOa_RHOa   1.0
245 #define ARTMAP_LINK_G2a_RECa   -2.0
246 #define ARTMAP_LINK_G2a_CLa     1.0
247 
248 #define ARTMAP_LINK_INPb_CMPb   1.0
249 #define ARTMAP_LINK_INPb_G1b    1.0
250 #define ARTMAP_LINK_INPb_RIb    1.0
251 #define ARTMAP_LINK_INPb_G2b    1.0
252 #define ARTMAP_LINK_CMPb_RCb    1.0
253 #define ARTMAP_LINK_RECb_G1b    1.0
254 #define ARTMAP_LINK_RECb_DELb   2.0
255 #define ARTMAP_LINK_DELb_DELb   1.0
256 #define ARTMAP_LINK_MAP_DELb    1.0
257 #define ARTMAP_LINK_DELb_RSTb   1.0
258 #define ARTMAP_LINK_DELb_CLb    1.0
259 #define ARTMAP_LINK_RSTb_RECb  -2.0
260 #define ARTMAP_LINK_RSTb_RSTb   1.0
261 #define ARTMAP_LINK_RSTb_NCb    1.0
262 #define ARTMAP_LINK_G1b_CMPb    1.0
263 #define ARTMAP_LINK_RIb_RGb    -1.0
264 #define ARTMAP_LINK_RCb_RGb     1.0
265 #define ARTMAP_LINK_RGb_RSTb    1.0
266 #define ARTMAP_LINK_RGb_RECb   -2.0
267 #define ARTMAP_LINK_RGb_CLb    -1.0
268 #define ARTMAP_LINK_RHOb_RIb    1.0
269 #define ARTMAP_LINK_RHOb_RHOb   1.0
270 #define ARTMAP_LINK_G2b_RECb   -2.0
271 #define ARTMAP_LINK_G2b_CLb     1.0
272 
273 #define ARTMAP_LINK_DELb_MAP    1.0
274 #define ARTMAP_LINK_G_MAP       1.0
275 #define ARTMAP_LINK_DELb_D1     1.0
276 #define ARTMAP_LINK_CLa_CL      1.0
277 #define ARTMAP_LINK_CLb_CL      1.0
278 #define ARTMAP_LINK_RG_CL      -2.0
279 #define ARTMAP_LINK_NCa_NC      1.0
280 #define ARTMAP_LINK_NCb_NC      1.0
281 #define ARTMAP_LINK_RECa_G      1.0
282 #define ARTMAP_LINK_RECb_G      1.0
283 #define ARTMAP_LINK_D1_RB       1.0
284 #define ARTMAP_LINK_RHO_RB      1.0
285 #define ARTMAP_LINK_MAP_RM      1.0
286 #define ARTMAP_LINK_RB_RG      -1.0
287 #define ARTMAP_LINK_RM_RG       1.0
288 #define ARTMAP_LINK_RHO_RHO     1.0
289 #define ARTMAP_LINK_INPa_QU     1.0
290 #define ARTMAP_LINK_RHO_RB      1.0
291 #define ARTMAP_LINK_INPa_QU     1.0
292 #define ARTMAP_LINK_CMPa_QU     1.0
293 #define ARTMAP_LINK_RHOa_DRHO  -1.0
294 #define ARTMAP_LINK_CLb_DRHO    1.0
295 #define ARTMAP_LINK_RG_DRHO     1.0
296 #define ARTMAP_LINK_QU_DRHO     1.0
297 #define ARTMAP_LINK_DRHO_DRHO  -1.0
298 #define ARTMAP_LINK_DRHO_RHOa   1.0
299 
300 
301 /* trainable links for ARTMAP */
302   /* the initial values of the bottom up link weights should be
303              0 < weight < (1 / (beta + |I|))
304              where beta is a value > 0.0 and should not be too big,
305                    I is the number of ones in the binary input vector.
306                    gamma has to be choosen > 1.0.
307   */
308 #define ARTMAP_LINK_CMPa_RECa(beta,gamma)    (1.0 / ((beta) + (gamma) * ArtMap_NoOfInpUnits_a))
309 #define ARTMAP_LINK_DELa_CMPa                1.0
310 #define ARTMAP_LINK_CMPb_RECb(beta,gamma)    (1.0 / ((beta) + (gamma) * ArtMap_NoOfInpUnits_b))
311 #define ARTMAP_LINK_DELb_CMPb                1.0
312 #define ARTMAP_LINK_DELa_MAP                 1.0
313 
314 /* Links of ARTMAP networks are adjusted using the ART1 formulas */
315 
316 
317 /******************** Output and Activation function names ******************/
318 
319 /* Definition of the Outputfunctions for ART1 */
320 #define ART1_OUTFUNC    "Out_Identity"
321 
322 /* Definition of the Outputfunctions for ART2 */
323 #define ART2_OUTFUNC    "Out_Identity"
324 
325 /* Definition of the Outputfunctions for ARTMAP */
326 #define ARTMAP_OUTFUNC    "Out_Identity"
327 
328 
329 /* Definition of the Activationfunctions for ART1 */
330 #define ART1_ACTF_INP            "Act_Identity"
331 #define ART1_ACTF_CMP            "Act_at_least_2"
332 #define ART1_ACTF_REC            "Act_Identity"
333 #define ART1_ACTF_DEL            "Act_at_least_2"
334 #define ART1_ACTF_D              "Act_at_least_1"
335 #define ART1_ACTF_RST            "Act_at_least_1"
336 #define ART1_ACTF_G1             "Act_at_least_2"
337 #define ART1_ACTF_RI             "Act_Product"
338 #define ART1_ACTF_RC             "Act_Identity"
339 #define ART1_ACTF_RG             "Act_less_than_0"
340 #define ART1_ACTF_CL             "Act_at_least_1"
341 #define ART1_ACTF_NCL            "Act_ART1_NC"
342 #define ART1_ACTF_RHO            "Act_Identity"
343 #define ART1_ACTF_G2             "Act_at_most_0"
344 
345 /* Definition of the Activationfunctions for ART2 */
346 
347 /* F0-Layer*/
348 #define ART2_ACTF_INP            "Act_Identity"
349 
350 /* F1-Layer */
351 #define ART2_ACTF_W              "Act_ART2_Identity"
352 #define ART2_ACTF_X              "Act_ART2_NormW"
353 #define ART2_ACTF_U              "Act_ART2_NormV"
354 #define ART2_ACTF_V              "Act_ART2_Identity"
355 #define ART2_ACTF_P              "Act_ART2_Identity"
356 #define ART2_ACTF_Q              "Act_ART2_NormP"
357 #define ART2_ACTF_R              "Act_ART2_NormIP"
358 
359 /* F2-Layer */
360 #define ART2_ACTF_REC            "Act_ART2_Rec"
361 #define ART2_ACTF_RST            "Act_ART2_Rst"
362 
363 
364 /* Definition of the Activationfunctions for ARTMAP */
365 #define ARTMAP_ACTF_INPa            "Act_Identity"
366 #define ARTMAP_ACTF_CMPa            "Act_at_least_2"
367 #define ARTMAP_ACTF_RECa            "Act_Identity"
368 #define ARTMAP_ACTF_DELa            "Act_at_least_2"
369 #define ARTMAP_ACTF_Da              "Act_at_least_1"
370 #define ARTMAP_ACTF_RSTa            "Act_at_least_1"
371 #define ARTMAP_ACTF_G1a             "Act_at_least_2"
372 #define ARTMAP_ACTF_RIa             "Act_Product"
373 #define ARTMAP_ACTF_RCa             "Act_Identity"
374 #define ARTMAP_ACTF_RGa             "Act_less_than_0"
375 #define ARTMAP_ACTF_CLa             "Act_at_least_1"
376 #define ARTMAP_ACTF_NCa             "Act_ARTMAP_NCa"
377 #define ARTMAP_ACTF_RHOa            "Act_Identity"
378 #define ARTMAP_ACTF_G2a             "Act_at_most_0"
379 
380 #define ARTMAP_ACTF_INPb            "Act_Identity"
381 #define ARTMAP_ACTF_CMPb            "Act_at_least_2"
382 #define ARTMAP_ACTF_RECb            "Act_Identity"
383 #define ARTMAP_ACTF_DELb            "Act_at_least_2"
384 #define ARTMAP_ACTF_Db              "Act_at_least_1"
385 #define ARTMAP_ACTF_RSTb            "Act_at_least_1"
386 #define ARTMAP_ACTF_G1b             "Act_at_least_2"
387 #define ARTMAP_ACTF_RIb             "Act_Product"
388 #define ARTMAP_ACTF_RCb             "Act_Identity"
389 #define ARTMAP_ACTF_RGb             "Act_less_than_0"
390 #define ARTMAP_ACTF_CLb             "Act_at_least_1"
391 #define ARTMAP_ACTF_NCb             "Act_ARTMAP_NCb"
392 #define ARTMAP_ACTF_RHOb            "Act_Identity"
393 #define ARTMAP_ACTF_G2b             "Act_at_most_0"
394 
395 #define ARTMAP_ACTF_MAP             "Act_at_least_2"
396 #define ARTMAP_ACTF_D1              "Act_Identity"
397 #define ARTMAP_ACTF_CL              "Act_at_least_2"
398 #define ARTMAP_ACTF_NC              "Act_at_least_1"
399 #define ARTMAP_ACTF_G               "Act_exactly_1"
400 #define ARTMAP_ACTF_RB              "Act_Product"
401 #define ARTMAP_ACTF_RM              "Act_Identity"
402 #define ARTMAP_ACTF_RG              "Act_less_than_0"
403 #define ARTMAP_ACTF_RHO             "Act_Identity"
404 #define ARTMAP_ACTF_QU              "Act_Product"
405 #define ARTMAP_ACTF_DRHO            "Act_ARTMAP_DRho"
406 
407 
408 
409 
410 /* Definition of the Sitefunctions for ART1 */
411 #define ART1_SITEF_RST_SELF      "Site_WeightedSum"
412 #define ART1_SITEF_RST_SIGNAL    "Site_at_least_2"
413 #define ART1_SITEF_REC_G1        "Site_at_most_0"
414 #define ART1_SITEF_INP_G1        "Site_at_least_1"
415 #define ART1_SITEF_RI            "Site_WeightedSum"
416 
417 
418 /* Definition of the Sitefunctions for ART2 */
419 #define ART2_SITEF_RST_SELF      "Site_WeightedSum"
420 #define ART2_SITEF_RST_SIGNAL    "Site_at_least_2"
421 
422 
423 /* Definition of the Sitefunctions for ARTMAP */
424 #define ARTMAP_SITEF_RSTa_SELF       "Site_WeightedSum"
425 #define ARTMAP_SITEF_RSTa_SIGNAL     "Site_at_least_2"
426 #define ARTMAP_SITEF_RECa_G1a        "Site_at_most_0"
427 #define ARTMAP_SITEF_INPa_G1a        "Site_at_least_1"
428 #define ARTMAP_SITEF_RIa             "Site_WeightedSum"
429 
430 #define ARTMAP_SITEF_RSTb_SELF       "Site_WeightedSum"
431 #define ARTMAP_SITEF_RSTb_SIGNAL     "Site_at_least_2"
432 #define ARTMAP_SITEF_RECb_G1b        "Site_at_most_0"
433 #define ARTMAP_SITEF_INPb_G1b        "Site_at_least_1"
434 #define ARTMAP_SITEF_RIb             "Site_WeightedSum"
435 
436 #define ARTMAP_SITEF_ARTa_G          "Site_at_least_1"
437 #define ARTMAP_SITEF_ARTb_G          "Site_at_least_1"
438 #define ARTMAP_SITEF_RB              "Site_WeightedSum"
439 #define ARTMAP_SITEF_INPa_QU         "Site_Reciprocal"
440 #define ARTMAP_SITEF_CMPa_QU         "Site_WeightedSum"
441 
442 
443 
444 /* Global fix parameters */
445 
446 /* for ART 2 */
447 #define ART2_PARAM_e                 0.00001
448 
449 
450 
451 
452 /************************** other macros ************************************/
453 
454 /*  Don't call this macro unless kra1_sort() has been run
455 */
456 #define ART1_CLASSIFIED       (Art1_cl_unit->Out.output >= 0.9)
457 
458 /*  Don't call this macro unless kra1_sort() has been run
459 */
460 #define ART1_NOT_CLASSIFIABLE (Art1_nc_unit->Out.output >= 0.9)
461 
462 
463 /*  Don't call this macro unless kra2_sort() has been run
464 */
465 #define ART2_CLASSIFIED       kra2_classified()
466 
467 /*  Don't call this macro unless kra2_sort() has been run
468 */
469 #define ART2_NOT_CLASSIFIABLE kra2_not_classifiable()
470 
471 
472 
473 /* Don't call this macro unless kram_sort() has been run
474 */
475 #define ARTMAP_CLASSIFIED     (ArtMap_cl_unit->Out.output >= 0.9)
476 
477 /* Don't call this macro unless kram_sort() has been run
478 */
479 #define ARTMAP_NOT_CLASSIFIABLE  (ArtMap_nc_unit->Out.output >= 0.9)
480 
481 
482 /* Check if Sitefuncname is OK
483 */
484 #define CHECK_SITE_FUNC(site_ptr, sitef_name)  \
485                  (strcmp (krf_getFuncName ((FunctionPtr) site_ptr->site_table->site_func), \
486                           sitef_name) \
487                  ) == 0
488 
489 /* Check if Actfuncname is OK
490 */
491 #define CHECK_ACT_FUNC(unit_ptr, actf_name) \
492                  (strcmp (krf_getFuncName ((FunctionPtr) unit_ptr->act_func), \
493                           actf_name) \
494                  ) == 0
495 
496 /* Check if Outfuncname is OK
497 */
498 #define CHECK_OUT_FUNC(unit_ptr, outf_name) \
499                  (strcmp (krf_getFuncName ((FunctionPtr) unit_ptr->out_func), \
500                            outf_name) \
501                  ) == 0
502 
503 
504 /* Set topo_msg for unexpexted link
505 */
506 
507 #define TOPO_MSG_NO_OF_UNITS_IN_LAYER(layer_name) \
508                   topo_msg.error_code = KRERR_NO_OF_UNITS_IN_LAYER; \
509                   topo_msg.src_error_unit = 0; \
510                   topo_msg.dest_error_unit = 0; \
511                   strcpy (topo_msg.name, layer_name); \
512                   return (topo_msg.error_code)
513 
514 #define TOPO_MSG_UNIT_MISSING(unit_name) \
515                   topo_msg.error_code = KRERR_UNIT_MISSING; \
516                   topo_msg.src_error_unit = 0; \
517                   topo_msg.dest_error_unit = 0; \
518                   strcpy (topo_msg.name, unit_name); \
519                   return (topo_msg.error_code)
520 
521 #define TOPO_MSG_UNDETERMINED_UNIT(unit_ptr) \
522                   topo_msg.error_code = KRERR_UNDETERMINED_UNIT; \
523                   topo_msg.src_error_unit = 0; \
524                   topo_msg.dest_error_unit = (unit_ptr)-unit_array
525 
526 #define TOPO_MSG_ACT_FUNC(unit_ptr) \
527                   topo_msg.error_code = KRERR_ACT_FUNC; \
528                   topo_msg.src_error_unit = 0; \
529                   topo_msg.dest_error_unit = (unit_ptr)-unit_array; \
530                   return (topo_msg.error_code)
531 
532 #define TOPO_MSG_OUT_FUNC(unit_ptr) \
533                   topo_msg.error_code = KRERR_OUT_FUNC; \
534                   topo_msg.src_error_unit = 0; \
535                   topo_msg.dest_error_unit = (unit_ptr)-unit_array; \
536                   return (topo_msg.error_code)
537 
538 #define TOPO_MSG_SITE_FUNC(unit_ptr) \
539                   topo_msg.error_code = KRERR_SITE_FUNC; \
540                   topo_msg.src_error_unit = 0; \
541                   topo_msg.dest_error_unit = (unit_ptr)-unit_array; \
542                   return (topo_msg.error_code)
543 
544 #define TOPO_MSG_UNEXPECTED_SITES(unit_ptr) \
545                   topo_msg.error_code = KRERR_UNEXPECTED_SITES; \
546                   topo_msg.src_error_unit = 0; \
547                   topo_msg.dest_error_unit = (unit_ptr)-unit_array; \
548                   return (topo_msg.error_code)
549 
550 #define TOPO_MSG_SITE_MISSING(unit_ptr) \
551                   topo_msg.error_code = KRERR_SITE_MISSING; \
552                   topo_msg.src_error_unit = 0; \
553                   topo_msg.dest_error_unit = (unit_ptr)-unit_array; \
554                   return (topo_msg.error_code)
555 
556 #define TOPO_MSG_UNEXPECTED_DIRECT_INPUTS(unit_ptr) \
557                   topo_msg.error_code = KRERR_UNEXPECTED_DIRECT_INPUTS; \
558                   topo_msg.src_error_unit = 0; \
559                   topo_msg.dest_error_unit = (unit_ptr)-unit_array; \
560                   return (topo_msg.error_code)
561 
562 #define TOPO_MSG_UNEXPECTED_LINK(src_unit_ptr, dest_unit_ptr) \
563                   topo_msg.error_code = KRERR_UNEXPECTED_LINK; \
564                   topo_msg.src_error_unit = ((src_unit_ptr)-unit_array); \
565                   topo_msg.dest_error_unit = ((dest_unit_ptr)-unit_array); \
566                   return (topo_msg.error_code)
567 
568 #define TOPO_MSG_LINK_MISSING(dest_unit_ptr) \
569                   topo_msg.error_code = KRERR_LINK_MISSING; \
570                   topo_msg.src_error_unit = 0; \
571                   topo_msg.dest_error_unit = ((dest_unit_ptr)-unit_array); \
572                   return (topo_msg.error_code)
573 
574 #define TOPO_MSG_LINK_TO_WRONG_SITE(src_unit_ptr, dest_unit_ptr) \
575                   topo_msg.error_code = KRERR_LINK_TO_WRONG_SITE; \
576                   topo_msg.src_error_unit = ((src_unit_ptr)-unit_array); \
577                   topo_msg.dest_error_unit = ((dest_unit_ptr)-unit_array); \
578                   return (topo_msg.error_code)
579 
580 
581 #define ART1_RETURN_NET_ERROR(ret_code)  return ((ret_code = KRERR_TOPOLOGY))
582 
583 #define ART2_RETURN_NET_ERROR(ret_code)  return ((ret_code = KRERR_TOPOLOGY))
584 
585 #define ARTMAP_RETURN_NET_ERROR(ret_code) return ((ret_code = KRERR_TOPOLOGY))
586 
587 
588 
589 #endif  /* ifndef __KR_ART_DEF */
590