-------------------------------------------------- parse_conway.c -------------------------------------------------- /** ** parse_conway - disposable code to parse Conway files ** ** CREATED: 2014.01.22 ABS copied from t_filter, got parsing node file ** MODIFIED: 2014.01.23 ABS hacked ** MODIFIED: 2014.01.24 ABS got setting vars from parsing node file ** MODIFIED: 2014.01.25 ABS hacked ** MODIFIED: 2014.02.06 ABS added filename arguments, parsing subscriber file ** MODIFIED: 2014.02.07 ABS added parsing loc file ** MODIFIED: 2014.02.11 ABS hacked ** MODIFIED: 2014.02.12 ABS changed to use print_CSV_line; got nodes, ** customers and rods appearing ** MODIFIED: 2014.02.14 ABS reduced output for debugging per EJS ** MODIFIED: 2014.02.15 ABS built up glyphs ** MODIFIED: 2014.02.16 ABS built up glyphs, links ** MODIFIED: 2014.02.17 ABS added VizScenario ** MODIFIED: 2014.02.18 ABS hacked ** MODIFIED: 2014.02.20 ABS hacked ** MODIFIED: 2014.02.23 ABS removed links to 0,0 ** MODIFIED: 2014.02.24 ABS hacked ** MODIFIED: 2014.02.25 ABS got tags working ** MODIFIED: 2014.02.26 ABS got glyph tools working ** MODIFIED: 2014.02.28 ABS added glyph_tools integration ** MODIFIED: 2014.03.01 ABS loaded Dr. Dave glyphs ** MODIFIED: 2014.03.03 ABS fixed tags again ** MODIFIED: 2014.03.08 ABS added HSV_to_RGB, etc. to glyph_tools ** MODIFIED: 2014.03.09 ABS made decimate value variable ** MODIFIED: 2014.03.13 ABS revenue by account type on tori, ** other rev on node ** MODIFIED: 2014.04.20 ABS mods per Mark Sloan 4/9/14 ** MODIFIED: 2014.04.24 ABS minor tweaks ** ** often run with: -n 36069 -s 17086 -l 15943 ** ** ActualSubscribers1 = 16401 ** ActualLocs = 15942 ** ** still to do: ** ** [/] 3 node display scenarios ** [_] customer type changes glyph shape ** [_] compute speed averages quarterly ** [/] finish customer glyphs ** [/] vary params on node glyphs ** [/] better text on tags ** [_] how to do texture? ** [_] legend ** **/ /** The main problem with this program is that it reads data into two sets ** of arrays, and until all the data is read in we don't know which entries ** are complete. ** ** Customer data is in a family of 1D arrays indexed by row number. ** ** Node data is in a family of 2D arrays indexed by letter and number. ** ** In a better world each "family" would be a struct. ** **/ #include "parse_conway.h" main(argc, argv) int argc; char** argv; { /* declare functions */ void print_CSV_line(); /* declare local variables */ int i, j, m, n; int row_num, row, type; int current_node, current_customer_object; char input_line[MAX_LINE]; int len, customer_id; int glyph_row, g_row; int red, green, blue; int up_red, up_green, up_blue; int dn_red, dn_green, dn_blue; int cyl_red, cyl_green, cyl_blue; int c_red, c_green, c_blue; int node_color; int customer_base = 0; int selected; int link_pid; /* KLUDGE */ float node_x, node_y, node_z; float scale, temp_scale, rod_scale; float cust_ratio, rev_ratio; float temp_up, temp_down; float temp_node_cons_rev; float temp_node_biz_rev; float temp_node_rev; FILE *n_fp; /* node file pointer */ FILE *s_fp; /* subscriber file pointer */ FILE *l_fp; /* loc file pointer */ char tag_string[MAX_LINE]; char up_string[MAX_LINE]; char dn_string[MAX_LINE]; /* initialize global variables (including parameters) */ defaultParms(); parseArgs(argc, argv); TagNum = 0; if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: Debug = %d\n", argv[0], Debug); fprintf(stderr, "%s: DEBUG: NodeFile = %s\n", argv[0], NodeFile); fprintf(stderr, "%s: DEBUG: NumNodeLines = %d\n", argv[0], NumNodeLines); fprintf(stderr, "%s: DEBUG: SubscriberFile1 = %s\n", argv[0], SubscriberFile1); fprintf(stderr, "%s: DEBUG: SubscriberFile2 = %s\n", argv[0], SubscriberFile2); fprintf(stderr, "%s: DEBUG: SubscriberFile3 = %s\n", argv[0], SubscriberFile3); fprintf(stderr, "%s: DEBUG: NumSubscriberLines1 = %d\n", argv[0], NumSubscriberLines1); fprintf(stderr, "%s: DEBUG: NumSubscriberLines2 = %d\n", argv[0], NumSubscriberLines2); fprintf(stderr, "%s: DEBUG: NumSubscriberLines3 = %d\n", argv[0], NumSubscriberLines3); fprintf(stderr, "%s: DEBUG: LocFile = %s\n", argv[0], LocFile); fprintf(stderr, "%s: DEBUG: NumLocLines = %d\n", argv[0], NumLocLines); fprintf(stderr, "%s: DEBUG: GlyphFile = %s\n", argv[0], GlyphFile); fprintf(stderr, "%s: DEBUG: NumGlyphLines = %d\n", argv[0], NumGlyphLines); fprintf(stderr, "%s: DEBUG: TagFile = %s\n", argv[0], TagFile); fprintf(stderr, "%s: DEBUG: Scale = %f\n", argv[0], Scale); fprintf(stderr, "%s: DEBUG: RevThresh = %d\n", argv[0], RevThresh); fprintf(stderr, "%s: DEBUG: BizThresh = %d\n", argv[0], BizThresh); fprintf(stderr, "%s: DEBUG: CustThresh = %d\n", argv[0], CustThresh); fprintf(stderr, "%s: DEBUG: VizScenario = %d\n", argv[0], VizScenario); } for (j = 0; j < MAX_NODE_NUM; j++) { for (i = 0; i < MAX_CODE; i++) { Node_antz_num[i][j] = 0; Node_used[i][j] = FALSE; NodeUpl[i][j] = 0L; NodeDnl[i][j] = 0L; for (type = 0; type < 11; type++) { NodeTotRev[type][i][j] = 0.0; } } } for (row_num = 0; row_num < MAX_ROWS; row_num++) { Node_code[row_num] = 9; Node_num[row_num] = 999; Loc_OK[row_num] = FALSE; } /* initialize local variables */ rod_scale = 5.0; cyl_red = cyl_green = cyl_blue = 0; /* read */ /* node file */ n_fp = fopen(NodeFile, "r"); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: n_fp = %d\n", argv[0], n_fp); } while (i < NumNodeLines) { len = getl(n_fp, input_line, MAX_LINE); #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: node lines: i = %d; len = %d\n", argv[0], i, len); } #endif if (i > 0 && len != 0) { /* not first line or empty */ parseNodes(input_line, i); } i++; } fclose(n_fp); /* subscriber file 1 */ s_fp = fopen(SubscriberFile1, "r"); i = 0; ActualSubscribers[1] = 0; Min_actual_down_speed[1] = 0.0; Max_actual_down_speed[1] = 0.0; Min_actual_up_speed[1] = 0.0; Max_actual_up_speed[1] = 0.0; while (i < NumSubscriberLines1) { len = getl(s_fp, input_line, MAX_LINE); if (i > 0 ) { /* not first line */ parseSubscribers(input_line, i, 1); } i++; } fclose(s_fp); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: ActualSubscribers[1] = %d\n", argv[0], ActualSubscribers[1]); fprintf(stderr, "%s: DEBUG: Min_actual_down_speed[1] = %f\n", argv[0], Min_actual_down_speed[1]); fprintf(stderr, "%s: DEBUG: Max_actual_down_speed[1] = %f\n", argv[0], Max_actual_down_speed[1]); fprintf(stderr, "%s: DEBUG: Min_actual_up_speed[1] = %f\n", argv[0], Min_actual_up_speed[1]); fprintf(stderr, "%s: DEBUG: Max_actual_up_speed[1] = %f\n", argv[0], Max_actual_up_speed[1]); } /* subscriber file 2 */ s_fp = fopen(SubscriberFile2, "r"); i = 0; ActualSubscribers[2] = 0; Min_actual_down_speed[2] = 0.0; Max_actual_down_speed[2] = 0.0; Min_actual_up_speed[2] = 0.0; Max_actual_up_speed[2] = 0.0; while (i < NumSubscriberLines2) { len = getl(s_fp, input_line, MAX_LINE); if (i > 0 ) { /* not first line */ parseSubscribers(input_line, i, 2); } i++; } fclose(s_fp); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: ActualSubscribers[2] = %d\n", argv[0], ActualSubscribers[2]); fprintf(stderr, "%s: DEBUG: Min_actual_down_speed[2] = %f\n", argv[0], Min_actual_down_speed[2]); fprintf(stderr, "%s: DEBUG: Max_actual_down_speed[2] = %f\n", argv[0], Max_actual_down_speed[2]); fprintf(stderr, "%s: DEBUG: Min_actual_up_speed[2] = %f\n", argv[0], Min_actual_up_speed[2]); fprintf(stderr, "%s: DEBUG: Max_actual_up_speed[2] = %f\n", argv[0], Max_actual_up_speed[2]); } /* subscriber file 3 */ s_fp = fopen(SubscriberFile3, "r"); i = 0; ActualSubscribers[3] = 0; Min_actual_down_speed[3] = 0.0; Max_actual_down_speed[3] = 0.0; Min_actual_up_speed[3] = 0.0; Max_actual_up_speed[3] = 0.0; while (i < NumSubscriberLines3) { len = getl(s_fp, input_line, MAX_LINE); if (i > 0 ) { /* not first line */ parseSubscribers(input_line, i, 3); } i++; } fclose(s_fp); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: ActualSubscribers[3] = %d\n", argv[0], ActualSubscribers[3]); fprintf(stderr, "%s: DEBUG: Min_actual_down_speed[3] = %f\n", argv[0], Min_actual_down_speed[3]); fprintf(stderr, "%s: DEBUG: Max_actual_down_speed[3] = %f\n", argv[0], Max_actual_down_speed[3]); fprintf(stderr, "%s: DEBUG: Min_actual_up_speed[3] = %f\n", argv[0], Min_actual_up_speed[3]); fprintf(stderr, "%s: DEBUG: Max_actual_up_speed[3] = %f\n", argv[0], Max_actual_up_speed[3]); } /* average 3 quarters */ for (m = 1; m < ActualSubscribers[3]; m++) { Actual_up_speed[0][m] = ( Actual_up_speed[1][m] + Actual_up_speed[2][m] + Actual_up_speed[3][m])/3.0; Actual_down_speed[0][m] = ( Actual_down_speed[1][m] + Actual_down_speed[2][m] + Actual_down_speed[3][m])/3.0; } /* loc file */ l_fp = fopen(LocFile, "r"); i = 0; while (i < NumLocLines) { len = getl(l_fp, input_line, MAX_LINE); if (i > 0 ) { /* not first line */ parseLocs(input_line, i); } i++; } fclose(l_fp); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: ActualLocs = %d\n", argv[0], ActualLocs); } /* compute node coords if needed */ if (VizScenario == 3) { for (j = 0; j < MAX_NODE_NUM; j++) { for (i = 0; i < MAX_CODE; i++) { if (Node_used[i][j]) { Node_x[i][j] = 0.0; Node_y[i][j] = 0.0; Node_z[i][j] = 0.0; Denominator[i][j] = 0.0; NumSubscribersThisNode[i][j] = 0; TotalRevenueThisNode[i][j] = 0; /* for this node add subscribers & revenue, up/down, average customer locs and revenues */ for (n = 0; n < ActualSubscribers[1]; n++) { /* KLUDGE */ /* if subscriber uses node add in locs */ if ((Node_code[n] == i) && (Node_num[n] == j) && (Loc_OK[n] == TRUE)) { if (Node_used[Node_code[i]][Node_num[i]]) { Node_x[i][j] += NewLon[n]; Node_y[i][j] += NewLat[n]; Denominator[i][j] += 1.0; NumSubscribersThisNode[i][j]++; TotalRevenueThisNode[i][j] += Revenue[n]; NodeTotRev[Package_code[n]][i][j] += Revenue[n]; NodeUpl[i][j] += (long int)Actual_up_speed[1][n]; NodeDnl[i][j] += (long int)Actual_down_speed[1][n]; if (Debug != FALSE) { fprintf(stderr, "DEBUG:: Node_x[%d][%d] = %f\n", i, j, Node_x[i][j]); fprintf(stderr, "DEBUG:: Node_y[i][j] = %f\n", Node_y[i][j]); fprintf(stderr, "DEBUG:: Denominator[i][j] = %f\n", Denominator[i][j]); fprintf(stderr, "DEBUG:: NewLat[n] = %f\n", NewLat[n]); fprintf(stderr, "DEBUG:: NewLon[n] = %f\n", NewLon[n]); } } } } /* end for n */ if (Debug != FALSE) { fprintf(stderr, "DEBUG: NumSubscribersThisNode[%d][%d] = %d\n", i, j, NumSubscribersThisNode[i][j]); fprintf(stderr, "DEBUG: TotalRevenueThisNode[%d][%d] = %d\n", i, j, TotalRevenueThisNode[i][j]); fprintf(stderr, "DEBUG: NodeUpl[%d][%d] = %ld\n", i, j, NodeUpl[i][j]); fprintf(stderr, "DEBUG: NodeDnl[%d][%d] = %ld\n", i, j, NodeDnl[i][j]); } } /* end if Node_used... */ } /* end for i */ } /* end for j */ /* go back and divide */ for (j = 0; j < MAX_NODE_NUM; j++) { for (i = 0; i < MAX_CODE; i++) { if (Node_used[i][j]) { if (Denominator[i][j] > 0.0) { Node_x[i][j] = Node_x[i][j]/(Denominator[i][j] - 0.0); Node_y[i][j] = Node_y[i][j]/(Denominator[i][j] - 0.0); if (Debug != FALSE) { fprintf(stderr, "DEBUG: Node_x[%d][%d] = %f\n", i, j, Node_x[i][j]); fprintf(stderr, "DEBUG: Node_y[i][j] = %f\n", Node_y[i][j]); fprintf(stderr, "DEBUG: Denominator[i][j] = %f\n", Denominator[i][j]); for (type = 0; type < 12; type++) { fprintf(stderr, "DEBUG: NodeTotRev[%d][i][j] = %f\n", type, NodeTotRev[type][i][j]); } } } /* end if denominator... */ } } } } /* end if V... */ if (NumGlyphLines != 0) { read_glyph(GlyphFile, NumGlyphLines); /* ok? */ if (Debug != FALSE) { fprintf(stderr, "DEBUG: FirstGoodLine = %d\n", FirstGoodLine); } if ( Glyph_array[PARENT_ID_4][FirstGoodLine] != 0.0) { fprintf(stderr, "ERROR: Glyph_array[PARENT_ID_4][%d] = %f, should be 0.0\n", FirstGoodLine, Glyph_array[PARENT_ID_4][FirstGoodLine]); exit(0); } /* process glyphs -- values that don't change per glyph */ for (g_row = FirstGoodLine; g_row < NumGlyphLines; g_row++) { Glyph_array[SELECTED_3][g_row] = 0.0; } Glyph_array[SCALE_X_25][FirstGoodLine] = Scale*Glyph_array[SCALE_X_25][FirstGoodLine]; Glyph_array[SCALE_Y_26][FirstGoodLine] = Scale*Glyph_array[SCALE_Y_26][FirstGoodLine]; Glyph_array[SCALE_Z_27][FirstGoodLine] = Scale*Glyph_array[SCALE_Z_27][FirstGoodLine]; /********************************************************* Glyph_array[SCALE_X_25][FirstGoodLine + 1] = 0.25*Glyph_array[SCALE_X_25][FirstGoodLine + 1]; Glyph_array[SCALE_Y_26][FirstGoodLine + 1] = 0.25*Glyph_array[SCALE_Y_26][FirstGoodLine + 1]; Glyph_array[SCALE_Z_27][FirstGoodLine + 1] = 0.25*Glyph_array[SCALE_Z_27][FirstGoodLine + 1]; *********************************************************/ Glyph_array[TRANSLATE_X_28][FirstGoodLine + 1] = -90.0; Glyph_array[TRANSLATE_Y_29][FirstGoodLine + 1] = 0.0; Glyph_array[TRANSLATE_Z_30][FirstGoodLine + 1] = 0.0; } /* write tag flag header */ if (TagFlag) { T_fp = fopen(TagFile, "w"); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: T_fp = %d\n", argv[0], T_fp); } } /* write nodes */ current_node = START_ID; for (j = 0; j < MAX_NODE_NUM; j++) { for (i = 0; i < MAX_CODE; i++) { if (NumSubscribersThisNode[i][j] < CustThresh || Node_biz_rev[i][j] < BizThresh || TotalRevenueThisNode[i][j] < RevThresh) { Node_used[i][j] = FALSE; } if (Node_used[i][j]) { if (Debug != FALSE) { fprintf(stderr, "DEBUG: NumSubscribersThisNode[%d][%d] = %d\n", i, j, NumSubscribersThisNode[i][j]); fprintf(stderr, "DEBUG: TotalRevenueThisNode[%d][%d] = %d\n", i, j, TotalRevenueThisNode[i][j]); } red = j*4 + 128; if (red > 255) { red = 255; } if (red < 0) { red = 0; } green = i*40; if (green > 255) { green = 255; } if (green < 0) { green = 0; } blue = 255 - green; if (blue > 255) { blue = 255; } if (blue < 0) { blue = 0; } if (VizScenario == 1) { node_x = (float)(4*j - 150); node_y = 90.0; node_z = (float)(4*i + 4); } else if (VizScenario == 2) { node_x = 0.0; /* KLUDGE */ node_y = 0.0; /* KLUDGE */ node_z = 0.0; /* KLUDGE */ } else if (VizScenario == 3) { node_x = Node_x[i][j]; node_y = Node_y[i][j]; node_z = 15.0; } /* node glyph */ Node_antz_num[i][j] = current_node; if (Debug) { fprintf(stderr, "DEBUG: NODE USAGE: Node_antz_num[%d][%d] = %d\n", i, j, Node_antz_num[i][j]); } sprintf(tag_string, "node %c%d", (char)i + 'A', j); if (NumGlyphLines == 0) { print_CSV_line( current_node, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ UNIVERSAL_PARENT, /* int pid */ 0, /* int branch_level */ current_node, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 0.5, /* float xs */ 0.5, /* float ys */ 0.5, /* float zs */ node_x, /* float xt */ node_y, /* float yt */ node_z, /* float zt */ ANTZ_GEOM_DODEC, /* int geometry */ ANTZ_TOPO_POINT, /* int topo */ red, /* int r */ green, /* int g*/ blue, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_node++; } /* end if NumGlyphLines... */ else { /* process glyphs (surgery) */ Glyph_array[TRANSLATE_X_28][FirstGoodLine] = node_x; Glyph_array[TRANSLATE_Y_29][FirstGoodLine] = node_y; Glyph_array[TRANSLATE_Z_30][FirstGoodLine] = node_z; node_color = (255-64)* ((double)NodeDnl[i][j] + (double)NodeUpl[i][j])/ (double)(UP_MAX + DOWN_MAX); Glyph_array[COLOR_R_55][FirstGoodLine] = 0; Glyph_array[COLOR_G_56][FirstGoodLine] = 0; Glyph_array[COLOR_B_57][FirstGoodLine] = 64 + node_color; /* ring params */ /********************************************************** cust_ratio = (float)NumSubscribersThisNode[i][j]/(float)CUST_MAX; rev_ratio = (float)TotalRevenueThisNode[i][j]/(float)REV_MAX; Glyph_array[SCALE_X_25][FirstGoodLine + 43] = cust_ratio; Glyph_array[SCALE_Y_26][FirstGoodLine + 43] = cust_ratio; Glyph_array[SCALE_Z_27][FirstGoodLine + 43] = cust_ratio; Glyph_array[RATIO_53][FirstGoodLine + 43] = rev_ratio; Glyph_array[SCALE_X_25][FirstGoodLine + 0] = Scale; Glyph_array[SCALE_Y_26][FirstGoodLine + 0] = Scale; Glyph_array[SCALE_Z_27][FirstGoodLine + 0] = Scale; **********************************************************/ /* nodes up/down speeds */ for (row = 14; row >= 9; row--) { temp_scale = 1.0; Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; } for (row = 3; row <= 5; row++) { /* KLUDGE */ temp_scale = 0.1*log(Actual_up_speed[row - 2][1]) + 0.5; Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; } /* KLUDGE */ for (row = 6; row <= 8; row++) { temp_scale = 0.1*log(Actual_down_speed[row - 5][1]) + 0.5; Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; } row = 31; /* node total up */ /* temp_up = 100.0*drand48(); */ temp_up = (float)NodeUpl[i][j]; temp_scale = 0.1*log(temp_up + 0.5); Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; row = 32; /* node total down */ /* temp_down = 100.0*drand48(); */ temp_down = (float)NodeDnl[i][j]; temp_scale = 0.1*log(temp_down + 0.5); Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; row = 33; /* node total up/down */ temp_scale = 0.1*log(temp_up + temp_down + 0.5); Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; row = 37; /* node consumer revenue */ temp_node_cons_rev = 0.0; for (type = 0; type < 12; type++) { if (!isBiz(type)) { temp_node_cons_rev = temp_node_cons_rev + NodeTotRev[type][i][j]; } } Node_cons_rev[i][j] = temp_node_cons_rev; if (Debug != FALSE) { fprintf(stderr, "DEBUG: Node_cons_rev[%d][%d] = %d\n", i, j, Node_cons_rev[i][j]); } temp_scale = 0.5*log(temp_node_cons_rev + 0.5); Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; row = 39; /* node biz revenue */ temp_node_biz_rev = 0.0; for (type = 0; type < 12; type++) { if (isBiz(type)) { temp_node_biz_rev = temp_node_biz_rev + NodeTotRev[type][i][j]; } } Node_biz_rev[i][j] = temp_node_biz_rev; if (Debug != FALSE) { fprintf(stderr, "DEBUG: Node_biz_rev[%d][%d] = %d\n", i, j, Node_biz_rev[i][j]); } temp_scale = 0.5*log(temp_node_biz_rev + 0.5); Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; row = 41; /* node revenue */ temp_node_rev = 0.0; for (type = 0; type < 12; type++) { temp_node_rev = temp_node_rev + NodeTotRev[type][i][j]; } temp_scale = 0.5*log(temp_node_rev + 0.5); Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; /* data for tori */ for (row = 16; row <= 25; row++) { temp_scale = 1.0 *log(NodeTotRev[Toroid_to_package[row - 16]][i][j] + 0.5); Glyph_array[SCALE_X_25][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Y_26][FirstGoodLine + row] = temp_scale; Glyph_array[SCALE_Z_27][FirstGoodLine + row] = temp_scale; } /* write tags */ if (TagFlag) { for (glyph_row = 0; glyph_row < NumGlyphLines; glyph_row++) { if (glyph_row == 16) { /* WiFi */ sprintf(tag_string, "node %c%d - WiFi $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 17) { sprintf(tag_string, "node %c%d - Second Gateway $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 18) { sprintf(tag_string, "node %c%d - Premier $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 19) { sprintf(tag_string, "node %c%d - DSM $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 20) { sprintf(tag_string, "node %c%d - Premium $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 21) { sprintf(tag_string, "node %c%d - Priority $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 22) { sprintf(tag_string, "node %c%d - Extreme $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 23) { sprintf(tag_string, "node %c%d - Turbo $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 24) { sprintf(tag_string, "node %c%d - Phone Only $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 25) { sprintf(tag_string, "node %c%d - Basic $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 26) { sprintf(tag_string, "node %c%d - Express $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 27) { sprintf(tag_string, "node %c%d - Unknown $%.2f", (char)i + 'A', j, NodeTotRev[Toroid_to_package[glyph_row - 16]][i][j]); } else if (glyph_row == 31) { /* node total up */ sprintf(tag_string, "node %c%d - total up %.0f", (char)i + 'A', j, temp_up); } else if (glyph_row == 32) { /* node total down */ sprintf(tag_string, "node %c%d - total down %.0f", (char)i + 'A', j, temp_down); } else if (glyph_row == 33) { /* node total up/down */ sprintf(tag_string, "node %c%d - total up/down %.0f", (char)i + 'A', j, temp_up + temp_down); } else if (glyph_row == 37) { /* node cons revenue */ sprintf(tag_string, "node %c%d - cons rev $%.2f", (char)i + 'A', j, temp_node_cons_rev); } else if (glyph_row == 39) { /* node biz revenue */ sprintf(tag_string, "node %c%d - biz rev $%.2f", (char)i + 'A', j, temp_node_biz_rev); } else if (glyph_row == 41) { /* node revenue */ sprintf(tag_string, "node %c%d - rev $%.2f", (char)i + 'A', j, temp_node_rev); } else { sprintf(tag_string, "node %c%d", (char)i + 'A', j); } /* id,record_id,table_id,title,description */ fprintf(T_fp, "%d,%d,0,\"%s\",\"%s\"\n", TagNum++, glyph_row + current_node, tag_string, "blank"); fflush(T_fp); } /* end for */ } /* end if */ current_node = write_glyph(NumGlyphLines, current_node); } /* end else */ } /* end if Node_used... */ } /* end for i */ } /* end for j */ /* customers */ customer_base = current_node + 512; /* ??? is this enough ??? */ current_customer_object = 0; for (i = 1; i < ActualLocs; i++) { current_customer_object++; /* customers begin with 1 */ if (current_customer_object == 1) { selected = TRUE; /* ??? why doesn't this work ??? */ } else { selected = FALSE; } if ((Node_used[Node_code[i]][Node_num[i]]) && (!Decimate || (drand48()*(float)Decimate <= 1.0))) { customer_id = current_customer_object; sprintf(tag_string, "customer: %s", &Mac_addr[i][0]); /* customer glyphs */ if (isBiz(Package_code[i])) { c_red = 0; c_green = 128; c_blue = 0; } else { c_red = 128; c_green = 64; c_blue = 0; } print_CSV_line( customer_id + customer_base,/* int id */ ANTZ_TYPE_PIN, /* int type */ selected, /* int sel */ UNIVERSAL_PARENT, /* int pid */ 0, /* int branch_level */ customer_id + customer_base,/* int ci */ 2, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 0.2, /* float xs */ 0.2, /* float ys */ 0.2, /* float zs */ NewLon[i], /* float xt */ NewLat[i], /* float yt */ 2.5, /* float zt */ /* customer height */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ c_red, /* int r */ c_green, /* int g*/ c_blue, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer top rod */ print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ customer_id + customer_base, /* int pid */ 1, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 3, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ rod_scale, /* float xs */ rod_scale, /* float ys */ rod_scale, /* float zs */ 0.0, /* float xt */ 90.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_CYLINDER, /* int geometry */ ANTZ_TOPO_ROD, /* int topo */ 128, /* int r */ 255, /* int g*/ 128, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer top rod lowest glyph*/ /* make this into a function */ if (Package_code[i] == 0) { /* Basic = purple */ cyl_red = 128; cyl_green = 0; cyl_blue = 255; sprintf(tag_string, "customer: %s package (c)", "Basic"); } else if (Package_code[i] == 1) { /* Express = green */ cyl_red = 64; cyl_green = 255; cyl_blue = 64; sprintf(tag_string, "customer: %s package (c)", "Express"); } else if (Package_code[i] == 2) { /* Extreme */ cyl_red = 255; cyl_green = 255; cyl_blue = 0; sprintf(tag_string, "customer: %s package (c)", "Extreme"); } else if (Package_code[i] == 3) { /* Turbo */ cyl_red = 255; cyl_green = 0; cyl_blue = 255; sprintf(tag_string, "customer: %s package (c)", "Turbo"); } else if (Package_code[i] == 4) { /* Premier */ cyl_red = 64; cyl_green = 255; cyl_blue = 64; sprintf(tag_string, "customer: %s package (b)", "Premier"); } else if (Package_code[i] == 5) { /* Premium */ cyl_red = 255; cyl_green = 64; cyl_blue = 255; sprintf(tag_string, "customer: %s package (b)", "Premium"); } else if (Package_code[i] == 6) { /* Priority */ cyl_red = 255; cyl_green = 200; cyl_blue = 0; sprintf(tag_string, "customer: %s package (b)", "Priority"); } else if (Package_code[i] == 7) { /* DSM */ cyl_red = 0; cyl_green = 255; cyl_blue = 0; sprintf(tag_string, "customer: %s package (c)", "DSM"); } else if (Package_code[i] == 8) { /* Phone Only */ cyl_red = 0; cyl_green = 64; cyl_blue = 128; sprintf(tag_string, "customer: %s package (c)", "Phone Only"); } else if (Package_code[i] == 9) { /* Second Gateway */ cyl_red = 128; cyl_green = 128; cyl_blue = 128; sprintf(tag_string, "customer: %s package (c)", "Second Gateway"); } else if (Package_code[i] == 10) { /* WiFi */ cyl_red = 0; cyl_green = 128; cyl_blue = 128; sprintf(tag_string, "customer: %s package (c)", "WiFi"); } else { /* unknown */ cyl_red = 128; cyl_green = 128; cyl_blue = 128; sprintf(tag_string, "customer: %s package", "unknown"); } print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 1, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 3.00, /* float xs */ 3.00, /* float ys */ 3.00, /* float zs */ -135.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_CUBE, /* int geometry */ ANTZ_TOPO_CUBE, /* int topo */ cyl_red, /* int r */ cyl_green, /* int g*/ cyl_blue, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer top rod middle glyph*/ if (Actual_down_speed[1][i] <= 1000) { sprintf(tag_string, "customer: %.0f down", Actual_down_speed[1][i]); dn_red = 0; dn_green = 255; dn_blue = 128; } if (Actual_down_speed[1][i] > 1000 && Actual_down_speed[1][i] <= 1000000) { sprintf(tag_string, "customer: %.0f K down", Actual_down_speed[1][i]/1000.0); dn_red = 0; dn_green = 255; dn_blue = 255; } else if (Actual_down_speed[1][i] > 1000000 && Actual_down_speed[1][i] <= 1000000000) { sprintf(tag_string, "customer: %.0f M down", Actual_down_speed[1][i]/1000000.0); dn_red = 0; dn_green = 128; dn_blue = 255; } else if (Actual_down_speed[1][i] > 1000000000) { sprintf(tag_string, "customer: %.0f G down", Actual_down_speed[1][i]/1000000000.0); dn_red = 0; dn_green = 0; dn_blue = 255; } /* scale = log(Actual_down_speed[1][i]) - 3.0; */ /* EXPERIMENT */ scale = Actual_down_speed[1][i]/1856030000000.0; if (scale < 0.0) { scale = 0.0; } print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 2, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 45.0*scale, /* EXPERIMENT */ /* float xs */ 45.0*scale, /* float ys */ 45.0*scale, /* float zs */ -90.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ dn_red, /* int r */ dn_green, /* int g*/ dn_blue, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer top rod top glyph*/ /* scale = log(Actual_up_speed[1][i]) - 3.0; */ /* EXPERIMENT */ scale = Actual_up_speed[1][i]/1856030000000.0; if (scale < 0.0) { scale = 0.0; } if (Actual_up_speed[1][i] <= 1000) { sprintf(tag_string, "customer: %.0f up", Actual_up_speed[1][i]); up_red = 0; up_green = 255; up_blue = 0; } if (Actual_up_speed[1][i] > 1000 && Actual_up_speed[1][i] <= 1000000) { sprintf(tag_string, "customer: %.0f K up", Actual_up_speed[1][i]/1000.0); up_red = 255; up_green = 255; up_blue = 0; } else if (Actual_up_speed[1][i] > 1000000 && Actual_up_speed[1][i] <= 1000000000) { sprintf(tag_string, "customer: %.0f M up", Actual_up_speed[1][i]/1000000.0); up_red = 255; up_green = 128; up_blue = 0; } else if (Actual_up_speed[1][i] > 1000000000) { sprintf(tag_string, "customer: %.0f G up", Actual_up_speed[1][i]/1000000000.0); up_red = 255; up_green = 0; up_blue = 0; } print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 3, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 45.0*scale, /* EXPERIMENT */ /* float xs */ 45.0*scale, /* float ys */ 45.0*scale, /* float zs */ -45.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ up_red, /* int r */ up_green, /* int g*/ up_blue, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod */ print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ customer_id + customer_base, /* int pid */ 1, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 3, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ rod_scale, /* float xs */ rod_scale, /* float ys */ rod_scale, /* float zs */ 0.0, /* float xt */ -90.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_CYLINDER, /* int geometry */ ANTZ_TOPO_ROD, /* int topo */ 128, /* int r */ 128, /* int g*/ 255, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod highest glyph*/ scale = log(Revenue[i]/99.0) + 4.0; if (scale < 0.0) { scale = 0.0; } sprintf(tag_string, "customer: $%.2f per month", Revenue[i]); print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 1, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ scale, /* float xs */ scale, /* float ys */ scale, /* float zs */ -180.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ 0, /* int r */ 200, /* int g*/ 0, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod second glyph*/ sprintf(tag_string, "customer: %s", &Mac_addr[i][0]); print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 2, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 1.00, /* float xs */ 1.00, /* float ys */ 1.00, /* float zs */ -150.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ 128, /* int r */ 128, /* int g*/ 128, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod third glyph*/ print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 3, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 1.00, /* float xs */ 1.00, /* float ys */ 1.00, /* float zs */ -120.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ 128, /* int r */ 128, /* int g*/ 128, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod fourth glyph*/ print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 4, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 1.00, /* float xs */ 1.00, /* float ys */ 1.00, /* float zs */ -90.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ 128, /* int r */ 128, /* int g*/ 128, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod fifth glyph*/ print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 5, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 1.00, /* float xs */ 1.00, /* float ys */ 1.00, /* float zs */ -60.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ 128, /* int r */ 128, /* int g*/ 128, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod sixth glyph*/ print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 6, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 1.00, /* float xs */ 1.00, /* float ys */ 1.00, /* float zs */ -30.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ 128, /* int r */ 128, /* int g*/ 128, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* customer bottom rod seventh glyph*/ print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_PIN, /* int type */ 0, /* int sel */ current_customer_object + customer_base - 7, /* int pid */ 2, /* int branch_level */ current_customer_object + customer_base, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.1, /* float ratio */ 1.00, /* float xs */ 1.00, /* float ys */ 1.00, /* float zs */ 0.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_SPHERE, /* int geometry */ ANTZ_TOPO_SPHERE, /* int topo */ 128, /* int r */ 128, /* int g*/ 128, /* int b */ 255, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; /* ------------- links ------------- */ if (Node_used[Node_code[i]][Node_num[i]] && Node_antz_num[Node_code[i]][Node_num[i]] && Loc_OK[i] && NumSubscribersThisNode[Node_code[i]][Node_num[i]] > CustThresh && TotalRevenueThisNode[Node_code[i]][Node_num[i]] > RevThresh) { link_pid = Node_antz_num[Node_code[i]][Node_num[i]]; if (link_pid < START_ID) { link_pid = START_ID; } /* KLUDGE */ current_customer_object++; if (Debug) { fprintf(stderr, "DEBUG: i = %d, Node_antz_num[Node_code[i]][Node_num[i]] = %d\n", i, Node_antz_num[Node_code[i]][Node_num[i]]); } print_CSV_line( current_customer_object + customer_base, /* int id */ ANTZ_TYPE_LINK, /* int type */ 1, /* int sel */ customer_id + customer_base, /* int pid */ 1, /* int branch_level */ link_pid, /* int ci */ 0, /* int nc */ 0, /* int cc */ 0.03, /* float ratio */ 1.00, /* float xs */ 1.00, /* float ys */ 1.00, /* float zs */ 0.0, /* float xt */ 0.0, /* float yt */ 0.0, /* float zt */ ANTZ_GEOM_CYLINDER, /* int geometry */ ANTZ_TOPO_LINK, /* int topo */ 0, /* int r */ 100, /* int g*/ 100, /* int b */ 100, /* int a */ TagFlag, /* int (Bool) tag_flag */ tag_string /* char* tag_str */ ); current_customer_object++; } /* end if Node_used... */ } /* end if !Decimate */ } /* end for i */ } /* end main */ /* * parseNodes - parse a line from nodes file * * sets Package_code[] (int) * Revenue[] (float) * Package_up_speed[int] * Package_down_speed[int] * Node_code[] (int) * Node_num[] (int) * Node_used[] (Bool) */ parseNodes(a_line, i) char* a_line; int i; { int in_column = 0; int out_column = 0; char c; char temp_package[MAX_LINE]; char temp_up_speed[MAX_LINE]; char temp_down_speed[MAX_LINE]; char temp_node[MAX_LINE]; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line = >%s<\n", a_line); } /* __,Up Speed,Down Speed,Mac,Node */ /* package --------------------------------------------------------------- */ c = a_line[in_column]; /* this is ugly code; it should be a function */ while ((c != ',') && (c != EOS)) { temp_package[out_column++] = c; c = a_line[++in_column]; } temp_package[out_column] = EOS; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: temp_package = %s\n", temp_package); } /* in_column now points to first input comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif /* this is ugly code -- I should read this list from disk, and loop */ /************************************** # Package Customer_Type Rate - ---------------------------------- 0 Basic Residential $36.95 1 Express Residential $41.95 2 Extreme Residential $51.95 3 Turbo Residential $84.95 4 Premier Business $98.95 5 Premium Business $54.95 6 Priority Business $34.95 7 DSM 8 Phone Only 9 Second Gateway 10 WiFi ***************************************/ #define BASIC_0 (0) #define EXPRESS_1 (1) #define EXTREME_2 (2) #define TURBO_3 (3) #define PREMIER_4 (4) #define PREMIUM_5 (5) #define PRIORITY_6 (6) #define DSM_7 (7) #define PHONE_ONLY_8 (8) #define SECOND_GATEWAY_9 (9) #define WIFI_10 (10) #define UNKNOWN_11 (11) Package_code[i] = ERROR_CODE; /* to match Jessica's legend */ Package_to_toroid[BASIC_0] = 2; Package_to_toroid[EXPRESS_1] = 1; Package_to_toroid[EXTREME_2] = 5; Package_to_toroid[TURBO_3] = 4; Package_to_toroid[PREMIER_4] = 9; Package_to_toroid[PREMIUM_5] = 7; Package_to_toroid[PRIORITY_6] = 6; Package_to_toroid[DSM_7] = 8; Package_to_toroid[PHONE_ONLY_8] = 3; Package_to_toroid[SECOND_GATEWAY_9] = 10; Package_to_toroid[WIFI_10] = 11; Package_to_toroid[UNKNOWN_11] = 0; Toroid_to_package[0] = UNKNOWN_11; Toroid_to_package[1] = EXPRESS_1; Toroid_to_package[2] = BASIC_0; Toroid_to_package[3] = PHONE_ONLY_8; Toroid_to_package[4] = TURBO_3; Toroid_to_package[5] = EXTREME_2; Toroid_to_package[6] = PRIORITY_6; Toroid_to_package[7] = PREMIUM_5; Toroid_to_package[8] = DSM_7; Toroid_to_package[9] = PREMIER_4; Toroid_to_package[10] = SECOND_GATEWAY_9; Toroid_to_package[11] = WIFI_10; if (strcmp(temp_package, "Basic") == STRING_EQUAL) { Package_code[i] = BASIC_0; Revenue[i] = 36.95; } if (strcmp(temp_package, "Express") == STRING_EQUAL) { Package_code[i] = EXPRESS_1; Revenue[i] = 41.95; } if (strcmp(temp_package, "Extreme") == STRING_EQUAL) { Package_code[i] = EXTREME_2; Revenue[i] = 51.95; } if (strcmp(temp_package, "Turbo") == STRING_EQUAL) { Package_code[i] = 3; Revenue[i] = 84.95; } if (strcmp(temp_package, "Premier") == STRING_EQUAL) { Package_code[i] = 4; Revenue[i] = 0.00; } if (strcmp(temp_package, "Premium") == STRING_EQUAL) { Package_code[i] = 5; Revenue[i] = 0.00; } if (strcmp(temp_package, "Priority") == STRING_EQUAL) { Package_code[i] = 6; Revenue[i] = 34.95; } if (strcmp(temp_package, "DSM") == STRING_EQUAL) { Package_code[i] = 7; Revenue[i] = 0.00; } if (strcmp(temp_package, "Phone Only") == STRING_EQUAL) { Package_code[i] = 8; Revenue[i] = 0.00; } if (strcmp(temp_package, "Second Gateway") == STRING_EQUAL) { Package_code[i] = 9; Revenue[i] = 0.00; } if (strcmp(temp_package, "WiFi") == STRING_EQUAL) { Package_code[i] = 10; Revenue[i] = 0.00; } if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: Package_code[%d] = %d\n", i, Package_code[i]); fprintf(stderr, "DEBUG: parseNodes: Revenue[%d] = %f\n", i, Revenue[i]); } /* up speed ------------------------------------------------------------ */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_up_speed[out_column++] = c; c = a_line[++in_column]; } temp_up_speed[out_column] = EOS; /* in_column now points to second comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif /* process_speed() defined in .h file */ process_speed(temp_up_speed, Package_up_speed, i) if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: temp_up_speed = %s\n", temp_up_speed); fprintf(stderr, "DEBUG: parseNodes: Package_up_speed[i] = %d\n", Package_up_speed[i]); fprintf(stderr, "DEBUG: parseNodes: i = %d\n", i); } /* down speed ---------------------------------------------------------- */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_down_speed[out_column++] = c; c = a_line[++in_column]; } temp_down_speed[out_column] = EOS; /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif process_speed(temp_down_speed, Package_down_speed, i) if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: temp_down_speed = %s\n", temp_down_speed); fprintf(stderr, "DEBUG: parseNodes: Package_down_speed[i] = %d\n", Package_down_speed[i]); fprintf(stderr, "DEBUG: parseNodes: i = %d\n", i); } /* mac ----------------------------------------------------------------- */ in_column++; out_column = 0; c = a_line[in_column]; /* this is different; skips : and - and writes string */ while ((c != ',') && (c != EOS)) { if ((c != ':') && (c != '-')) { Mac_addr[i][out_column++] = toupper(c); } c = a_line[++in_column]; } Mac_addr[i][out_column] = EOS; /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: Mac_addr[i][] = %s\n", &Mac_addr[i][0]); } /* node ------------------------------------------------------------------ */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_node[out_column++] = c; c = a_line[++in_column]; } temp_node[out_column] = EOS; /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif if (temp_node[0] == 'A') { Node_code[i] = 0; } else if (temp_node[0] == 'B') { Node_code[i] = 1; } else if (temp_node[0] == 'C') { Node_code[i] = 2; } else if (temp_node[0] == 'D') { Node_code[i] = 3; } else { Node_code[i] = 9; } /* parse 2 chars */ Node_num[i] = 99; Node_num[i] = atoi(&temp_node[1]); if ((Node_code[i] != 9) && (Node_num[i] != 999)) { Node_used[Node_code[i]][Node_num[i]] = TRUE; } if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: temp_node = %s\n", temp_node); fprintf(stderr, "DEBUG: parseNodes: Node_code[i] = %d\n", Node_code[i]); fprintf(stderr, "DEBUG: parseNodes: Node_num[i] = %d\n", Node_num[i]); } } /* end parseNodes() */ /* * parseSubscribers - parse a line * * sets Actual_down_speed[][] (float) * Actual_up_speed[][] (float) */ parseSubscribers(a_line, i, quarter) char* a_line; int i; int quarter; { int in_column = 0; int out_column = 0; int node_index; char c; char temp_date[MAX_LINE]; char temp_url[MAX_LINE]; char second_mac_address[MAX_LINE]; char temp_package2[MAX_LINE]; char temp_actual_up[MAX_LINE]; char temp_actual_down[MAX_LINE]; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: a_line = %s\n", a_line); } /* Date,CMTS,MAC Address,Package,dnOctets,upOctets,totalOctets,Name,, */ /* date --------------------------------------------------------------- */ c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_date[out_column++] = c; c = a_line[++in_column]; } temp_date[out_column] = EOS; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: temp_date = %s\n", temp_date); } /* in_column now points to first input comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif /* url --------------------------------------------------------------- */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_url[out_column++] = c; c = a_line[++in_column]; } temp_url[out_column] = EOS; /* in_column now points to second comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: temp_url = %s\n", temp_url); } /* mac ----------------------------------------------------------------- */ in_column++; out_column = 0; c = a_line[in_column]; /* this is different; skips : and - and writes string */ while ((c != ',') && (c != EOS)) { if ((c != ':') && (c != '-')) { second_mac_address[out_column++] = toupper(c); } c = a_line[++in_column]; } second_mac_address[out_column] = EOS; /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: second_mac_address = %s\n", second_mac_address); } node_index = getIndexFromMac(second_mac_address); if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: node_index = %d\n", node_index); } /* package2 ------------------------------------------------------------ */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_package2[out_column++] = c; c = a_line[++in_column]; } temp_package2[out_column] = EOS; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: temp_package2 = %s\n", temp_package2); } /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif /* dnOctets ------------------------------------------------------------ */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_actual_down[out_column++] = c; c = a_line[++in_column]; } temp_actual_down[out_column] = EOS; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: temp_actual_down = %s\n", temp_actual_down); } /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif Actual_down_speed[quarter][i] = atof(temp_actual_down); if (Actual_down_speed[quarter][i] < Min_actual_down_speed[quarter]) { Min_actual_down_speed[quarter] = Actual_down_speed[quarter][i]; } if (Actual_down_speed[quarter][i] > Max_actual_down_speed[quarter]) { Max_actual_down_speed[quarter] = Actual_down_speed[quarter][i]; } if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: Actual_down_speed[quarter][i] = %f\n", Actual_down_speed[quarter][i]); } /* upOctets ------------------------------------------------------------ */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_actual_up[out_column++] = c; c = a_line[++in_column]; } temp_actual_up[out_column] = EOS; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: temp_actual_up = %d\n", temp_actual_up); } /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseNodes: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif Actual_up_speed[quarter][i] = atof(temp_actual_up); if (Actual_up_speed[quarter][i] < Min_actual_up_speed[quarter]) { Min_actual_up_speed[quarter] = Actual_up_speed[quarter][i]; } if (Actual_up_speed[quarter][i] > Max_actual_up_speed[quarter]) { Max_actual_up_speed[quarter] = Actual_up_speed[quarter][i]; } if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: Actual_up_speed[quarter][i] = %f\n", Actual_up_speed[quarter][i]); fprintf(stderr, "DEBUG: parseSubscribers: log(Actual_up_speed[quarter][i]) = %f\n", log(Actual_up_speed[quarter][i])); } /* totalOctets --------------------------------------------------------- */ /* don't need */ /* name ---------------------------------------------------------------- */ /* don't need */ if (node_index != NO_MATCH) { ActualSubscribers[quarter]++; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseSubscribers: Mac_addr[node_index][] = %s\n", &Mac_addr[node_index][0]); } } } /* end parseSubscribers() */ /* * parseLocs - parse a line of loc file * * sets Lat[] (float) * Lon[] (float) */ parseLocs(a_line, i) char* a_line; int i; { int in_column = 0; int out_column = 0; int node_index; char c; char temp_lat[MAX_LINE]; char temp_lon[MAX_LINE]; char third_mac_address[MAX_LINE]; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: a_line = %s\n", a_line); } /* MACAddress,Latitude,Longitude */ /* mac ----------------------------------------------------------------- */ /* in_column++; -- we're at beginning of line, not sitting on a comma */ out_column = 0; c = a_line[in_column]; /* this is different; skips : and - and writes string */ while ((c != ',') && (c != EOS)) { if ((c != ':') && (c != '-')) { third_mac_address[out_column++] = toupper(c); } c = a_line[++in_column]; } third_mac_address[out_column] = EOS; /* in_column now points to comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: third_mac_address = %s\n", third_mac_address); } node_index = getIndexFromMac(third_mac_address); if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: node_index = %d\n", node_index); } /* set stuff here */ if (node_index != NO_MATCH) { if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: Mac_addr[node_index][] = %s\n", &Mac_addr[node_index][0]); } /* lat --------------------------------------------------------------- */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_lat[out_column++] = c; c = a_line[++in_column]; } temp_lat[out_column] = EOS; /* in_column now points to second comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif Lat[node_index] = atof(&temp_lat[0]); NewLat[node_index] = FACTOR_B*(FACTOR_A + Lat[node_index]); if (NewLat[node_index] == 0.0) { fprintf(stderr, "DEBUG= node_index = %d\n", node_index); fprintf(stderr, "DEBUG= Lat[node_index] = %f\n", Lat[node_index]); fprintf(stderr, "DEBUG= NewLat[node_index] = %f\n", NewLat[node_index]); } /* lon ------------------------------------------------------------- */ in_column++; out_column = 0; c = a_line[in_column]; while ((c != ',') && (c != EOS)) { temp_lon[out_column++] = c; c = a_line[++in_column]; } temp_lon[out_column] = EOS; /* in_column now points to second comma */ #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: a_line[%d] = %c (should be comma)\n", in_column, a_line[in_column]); } #endif Lon[node_index] = atof(&temp_lon[0]); NewLon[node_index] = FACTOR_D*(FACTOR_C + Lon[node_index]); Loc_OK[node_index] = TRUE; if (Debug != FALSE) { fprintf(stderr, "DEBUG: parseLocs: temp_lat = %s\n", temp_lat); fprintf(stderr, "DEBUG: parseLocs: Lat[node_index] = %f\n", Lat[node_index]); fprintf(stderr, "DEBUG: parseLocs: temp_lon = %s\n", temp_lon); fprintf(stderr, "DEBUG: parseLocs: Lon[node_index] = %f\n", Lon[node_index]); fprintf(stderr, "DEBUG: parseLocs: node_index = %d\n", node_index); } } ActualLocs++; } /* end parseLocs() */ /* * getIndexFromMac - given a Mac address without colons or dashes return index in Mac_addr[][] array */ int getIndexFromMac(mac_string) char mac_string[MAX_LINE]; { int n; for (n = 1; n < NumNodeLines; n++) { if (strcmp(&Mac_addr[n][0], mac_string) == STRING_EQUAL) { return (n); } } return(NO_MATCH); } /* end getIndexFromMac() */ /* * convertToUpper - convert string to uppercase (from Stackoverflow) */ void convertToUpper(char *text, char *nText){ int i; for(i=0; i<=strlen(text); i++){ if( (text[i] > 96 ) && (text[i] < 123) ) // is the char lower case nText[i] = text[i] - 'a' + 'A'; //make upper else nText[i] = text[i]; //do nothing } } /* * defaultParms - initialize global variables */ defaultParms() { NumNodeLines = 1; NumSubscriberLines1 = 1; NumSubscriberLines2 = 1; NumSubscriberLines3 = 1; NumLocLines = 1; NumGlyphLines = 0; TagFlag = FALSE; VizScenario = 1; Debug = FALSE; Decimate = 1; BizThresh = 0; CustThresh = 0; RevThresh = 0; strcpy(NodeFile, "Conway_nodes.csv"); strcpy(SubscriberFile1, "ConwaySubscriberMonthUsage-10-12_Q1.csv"); strcpy(SubscriberFile2, "ConwaySubscriberMonthUsage-10-12_Q2.csv"); strcpy(SubscriberFile3, "ConwaySubscriberMonthUsage-10-12_Q3.csv"); strcpy(LocFile, "Mac_Lat_Long.csv.txt"); strcpy(GlyphFile, "glyph_old.csv"); strcpy(TagFile, "ANTzTag0001_body.csv"); } /* end defaultParms() */ /* * parseArgs - parse arguments into global variables */ parseArgs(argc, argv) int argc; char** argv; { int i; float foo; for (i = 0; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'b' : BizThresh = atoi(&argv[++i][0]); break; case 'c' : CustThresh = atoi(&argv[++i][0]); break; case 'd' : Decimate = atoi(&argv[++i][0]); break; case 'D' : Debug = TRUE; break; case 'G' : strcpy(GlyphFile, &argv[++i][0]); break; case 'g' : NumGlyphLines = atoi(&argv[++i][0]); break; case 'h' : help(argv); exit(0); break; case 'L' : strcpy(LocFile, &argv[++i][0]); break; case 'l' : NumLocLines = atoi(&argv[++i][0]); break; case 'N' : strcpy(NodeFile, &argv[++i][0]); break; case 'n' : NumNodeLines = atoi(&argv[++i][0]); break; case 'r' : RevThresh = atoi(&argv[++i][0]); break; case 'S' : strcpy(SubscriberFile1, &argv[++i][0]); strcpy(SubscriberFile2, &argv[++i][0]); strcpy(SubscriberFile3, &argv[++i][0]); break; case 's' : NumSubscriberLines1 = atoi(&argv[++i][0]); NumSubscriberLines2 = atoi(&argv[++i][0]); NumSubscriberLines3 = atoi(&argv[++i][0]); break; case 'T' : strcpy(TagFile, &argv[++i][0]); break; case 't' : TagFlag = TRUE; break; case 'u' : usage(argv); exit(0); break; case 'U' : Scale = atof(&argv[++i][0]); break; case 'v' : VizScenario = atoi(&argv[++i][0]); break; default: fprintf(stderr, "%s: ERROR: illegal flag: %s\n", argv[0], argv[i]); usage(argv); exit(0); break; } /* end switch */ } /* end if */ } /* end for(i) */ } /* end parseArgs() */ /* * getl - modified from Kernighan & Ritchie to take stream */ int getl(stream, s, lim) /* get line into s, return length */ FILE *stream; char s[]; int lim; { int c, i; i = 0; while (--lim > 0 && (c = getc(stream)) != EOF && c != '\n') s[i++] = c; if (c == '\n') s[i++] = c; s[i] = '\0'; return(i); } /* end getl() */ /* * isBiz */ int isBiz(pkg) int pkg; { if (pkg == 4) return TRUE; if (pkg == 5) return TRUE; if (pkg == 6) return TRUE; return FALSE; } -------------------------------------------------- parse_conway.h -------------------------------------------------- /* * parse_conway.h -- include file for parse_conway.c */ /* includes */ #include #include #include #include #include #include #include "synglyphx.h" /* constants */ #define TRUE (1) #define FALSE (0) #define MAX_LINE (255) #define MAX_GLYPH_LINE (4096) #define NUM_COLUMNS (94) #define MAX_CODE (5) #define MAX_NODE_NUM (500) #define EOS (0) #define STRING_EQUAL (0) #define MAX_ROWS (400000) #define MAX_GLYPH_ROWS (400000) #define ERROR_CODE (-1) #define NO_MATCH (-1) #define UNIVERSAL_PARENT (0) #define START_ID (33) /************************************ map corners: NW 35.1247, -92.58063 SE 34.9933, -92.31783 ------- --------- 0.1314 0.26280 (long. avg. -92.44923: +0.1314 = -92.31783; -0.1314 = -92.58063) antz-x lon ------ --------- -180 -92.58063 180 -92.31783 antz-y lat ------ ------- 90 34.9933 -90 35.1247 4 equations: ------------ 90 = B*(A + 34.9933) ; -90 = B*(A + 35.1247) -180 = D*(C - 92.31783) ; 180 = D*(C - 92.58063) Wolfram Alpha sez: A = -35.059 ; B = 1369.86 C = 92.4492 ; D = -1369.86 ************************************/ #define FACTOR_A (-35.059) #define FACTOR_B (1369.86) #define FACTOR_C (92.4492) #define FACTOR_D (-1369.86) #define CIRCLE_DEG (360.0) /* KLUDGE constants */ #define REV_MAX (7826) #define CUST_MAX (198) #define UP_MAX (1950073356770) #define DOWN_MAX (10600337417100) /* global variables */ int Package_code[MAX_ROWS]; /* from package */ float Revenue[MAX_ROWS]; /* from package */ int Package_up_speed[MAX_ROWS]; /* from up speed */ int Package_down_speed[MAX_ROWS]; /* from down speed */ int Node_code[MAX_ROWS]; /* from node */ int Node_num[MAX_ROWS]; /* from node */ int Node_used[MAX_CODE][MAX_NODE_NUM]; /* from node */ int Node_antz_num[MAX_CODE][MAX_NODE_NUM];/* from node */ int Node_biz_rev[MAX_CODE][MAX_NODE_NUM]; /* from node */ int Node_cons_rev[MAX_CODE][MAX_NODE_NUM];/* from node */ float Node_x[MAX_CODE][MAX_NODE_NUM]; /* from node */ float Node_y[MAX_CODE][MAX_NODE_NUM]; /* from node */ float Node_z[MAX_CODE][MAX_NODE_NUM]; /* from node */ float Denominator[MAX_CODE][MAX_NODE_NUM];/* from node */ long int NodeUpl[MAX_CODE][MAX_NODE_NUM]; /* computed from subscribers */ long int NodeDnl[MAX_CODE][MAX_NODE_NUM]; /* computed from subscribers */ int Loc_OK[MAX_ROWS]; /* from loc */ char Mac_addr[MAX_ROWS][MAX_LINE]; /* from mac */ int Package_codeS[MAX_ROWS]; /* from subscriber:package */ char Customer_name[MAX_ROWS][MAX_LINE]; /* from name */ float Actual_up_speed[4][MAX_ROWS]; /* from up octets */ float Min_actual_up_speed[4]; /* from up octets */ float Max_actual_up_speed[4]; /* from up octets */ float Actual_down_speed[4][MAX_ROWS]; /* from down octets */ float Min_actual_down_speed[4]; /* from down octets */ float Max_actual_down_speed[4]; /* from down octets */ float Lat[MAX_ROWS]; /* latitude (NS) */ float Lon[MAX_ROWS]; /* longitude (EW) */ float NewLat[MAX_ROWS]; /* adjusted latitude (NS) */ float NewLon[MAX_ROWS]; /* adjusted longitude (EW) */ float NodeTotRev[11][MAX_CODE][MAX_NODE_NUM]; /* node total revenue by type */ int TagNum; /* incremented index that everybody writes */ int Toroid_to_package[12]; int Package_to_toroid[12]; float Glyph_array[NUM_COLUMNS][MAX_GLYPH_ROWS]; int ActualSubscribers[4]; int NumSubscribersThisNode[MAX_CODE][MAX_NODE_NUM]; int TotalRevenueThisNode[MAX_CODE][MAX_NODE_NUM]; int ActualLocs; int FirstGoodLine; int First_id; FILE *T_fp; /* tag file name */ /* flag-settable parameters (global variables) */ int Debug; /* Boolean: TRUE = debug writes */ int BizThresh; /* */ int CustThresh; /* */ int Decimate; /* */ int NumNodeLines; /* */ char NodeFile[MAX_LINE]; /* node file name */ int NumSubscriberLines1; /* */ int NumSubscriberLines2; /* */ int NumSubscriberLines3; /* */ int RevThresh; /* */ char SubscriberFile1[MAX_LINE];/* subscriber file name */ char SubscriberFile2[MAX_LINE];/* subscriber file name */ char SubscriberFile3[MAX_LINE];/* subscriber file name */ int NumLocLines; /* */ char LocFile[MAX_LINE]; /* location file name */ int NumGlyphLines; /* */ char GlyphFile[MAX_LINE]; /* glyph file name */ char TagFile[MAX_LINE]; /* tag file name */ int TagFlag; /* Boolean: tag file? */ int VizScenario; /* which visualization scenario */ float Scale; /* */ /* used by glyph_tools */ char GlyphFile[MAX_LINE]; /* glyph file name */ /* used by test_glyph_tools */ int NumLines; /* */ /* macros */ /* this is ugly code -- I should read this list from disk, and loop */ #define process_speed(buffer, target, i) \ target[i] = -1; \ if (strcmp(buffer, "-") == STRING_EQUAL) { \ target[i] = 1; \ } \ else if (strcmp(buffer, "64K") == STRING_EQUAL) { \ target[i] = 64000; \ } \ else if (strcmp(buffer, "512K") == STRING_EQUAL) { \ target[i] = 512000; \ } \ else if (strcmp(buffer, "1M") == STRING_EQUAL) { \ target[i] = 1000000; \ } \ else if (strcmp(buffer, "1.5M") == STRING_EQUAL) { \ target[i] = 1500000; \ } \ else if (strcmp(buffer, "2M") == STRING_EQUAL) { \ target[i] = 2000000; \ } \ else if (strcmp(buffer, "3M") == STRING_EQUAL) { \ target[i] = 3000000; \ } \ else if (strcmp(buffer, "4M") == STRING_EQUAL) { \ target[i] = 4000000; \ } \ else if (strcmp(buffer, "8M") == STRING_EQUAL) { \ target[i] = 8000000; \ } \ else if (strcmp(buffer, "12M") == STRING_EQUAL) { \ target[i] = 8000000; \ } \ else if (strcmp(buffer, "16M") == STRING_EQUAL) { \ target[i] = 16000000; \ } \ else if (strcmp(buffer, "18M") == STRING_EQUAL) { \ target[i] = 18000000; \ } \ else if (strcmp(buffer, "50M") == STRING_EQUAL) { \ target[i] = 50000000; \ } \ -------------------------------------------------- print_CSV_line.c -------------------------------------------------- /** ** print_CSV_line - print one line of an ANTz CSV file with some values ** defaulted as needed **/ /* * "wheel - A device with so many contradictory applications that each * user must reinvent it to ensure satisfaction." * * -- Stan Kelly-Bootle "The Devil's DP Dictionary" (1981) * */ #include "parse_conway.h" void print_CSV_line( id, type, sel, pid, branch_level, ci, nc, cc, ratio, xs, ys, zs, xt, yt, zt, geometry, topo, r, g, b, a, tag_flag, tag_str ) int id; int type; int sel; int pid; int branch_level; int ci; int nc; int cc; float ratio; float xs; float ys; float zs; float xt; float yt; float zt; int geometry; int topo; int r; int g; int b; int a; int tag_flag; char* tag_str; { int child_index; /* V1: $id, $type, $data, $selected, $parent_id, $branch_level, (1-6) */ fprintf(stdout, "%d,%d,%d,%d,%d,%d,", id, type, id, sel, pid, branch_level); /* V1: $child_id, $child_index, $child_count, (7-9)*/ if (nc == 0) { child_index = 0; } else { child_index = nc - 1; } /* fprintf(stdout, "%d,%d,%d,", ci, id, child_index, nc); ??? */ fprintf(stdout, "%d,%d,%d,", ci, child_index, nc); /* V1: $ch_input_id, $ch_output_id, $ch_last_updated, (10-12)*/ fprintf(stdout, "0,0,0,"); /* V1: $average, $interval (sample), (13-14)*/ fprintf(stdout, "0,1,"); /* V1: $aux_a_x, $aux_a_y, $aux_a_z, (15-17) */ fprintf(stdout, "0,0,0,"); /* V1: $aux_b_x, $aux_b_y, $aux_b_z, (18-20) */ fprintf(stdout, "0,0,0,"); /* V1: $color_shift, (21) */ fprintf(stdout, "0,"); /* V1: $rotate_vec_x, $rotate_vec_y, $rotate_vec_z, $rotate_vec_s, (22-25) */ fprintf(stdout, "0,0,0,1,"); /* V1: $scale_x, $scale_y, $scale_z, (26-28) */ fprintf(stdout, "%f,%f,%f,", xs, ys, zs); /* V1: $translate_x, $translate_y, $translate_z, (29-31) */ fprintf(stdout, "%f,%f,%f,", xt, yt, zt); /* V1: $tag_offset_x, $tag_offset_y, $tag_offset_z, (32-34) */ fprintf(stdout, "0,0,0,"); /* V1: $rotate_rate_x, $rotate_rate_y, $rotate_rate_z, (35-37) */ fprintf(stdout, "0,0,0,"); /* V1: $rotate_x, $rotate_y, $rotate_z, (38-40) */ fprintf(stdout, "0,0,%f,", 0.0); /* ??? */ /* V1: $scale_rate_x, $scale_rate_y, $scale_rate_z, (41-43) */ fprintf(stdout, "0,0,0,"); /* V1: $translate_rate_x, $translate_rate_y, $translate_rate_z, (44-46) */ fprintf(stdout, "0,0,0,"); /* V1: $translate_vec_x, $translate_vec_y, $translate_vec_z, (47-49) */ fprintf(stdout, "0,0,0,"); /* V1: $shader, $geometry, $line_width, (50-52) */ fprintf(stdout, "0,%d,2,", geometry); /* V1: $point_size, $ratio, $color_index, (53-55) */ fprintf(stdout, "0,%f,0,", ratio); /* ratio */ /* ??? */ /* V1: ~colorvarR, ~colorvarG, ~colorvarB, $color_a, (55-57) */ fprintf(stdout, "%d,%d,%d,%d,", r, g, b, a); /* (56-59) */ /* V1: $color_fade, (60) */ fprintf(stdout, "0,"); /* V1: $texture_id, $hide, $freeze, $topo, $facet, (61-65) */ fprintf(stdout, "0,0,0,%d,0,", topo); /* V1: $auto_zoom_x, $auto_zoom_y, $auto_zoom_z, (66-68) */ fprintf(stdout, "0,0,0,"); /* V1: $trigger_hi_x, $trigger_hi_y, $trigger_hi_z, (69-71) */ fprintf(stdout, "0,0,0,"); /* V1: $trigger_lo_x, $trigger_lo_y, $trigger_lo_z, (72-74) */ fprintf(stdout, "0,0,0,"); /* V1: $set_hi_x, $set_hi_y, $set_hi_z, (75-77) */ fprintf(stdout, "0,0,0,"); /* V1: $set_lo_x, $set_lo_y, $set_lo_z, (78-80) */ fprintf(stdout, "0,0,0,"); /* V1: $proximity_x, $proximity_y, $proximity_z, (81-83) */ fprintf(stdout, "0,0,0,"); /* V1: $proximity_mode_x, $proximity_mode_y, $proximity_mode_z, (84-86) */ fprintf(stdout, "0,0,0,"); /* V1: $segments_x, $segments_y, $segments_z, (87-89) */ fprintf(stdout, "32,32,0,"); /* ??? */ /* V1: $tag_mode, $format_id, $table_id, $record_id, (90-93) */ fprintf(stdout, "0,0,0,%d,", id); /* V1: size (94) */ fprintf(stdout, "420\r\n"); /* tag file */ if (tag_flag) { if (Debug != FALSE) { fprintf(stderr, "print_CSV_line: DEBUG: T_fp = %d\n", T_fp); fprintf(stderr, "print_CSV_line: DEBUG: tag_str = %s\n", tag_str); } /* id,record_id,table_id,title,description */ fprintf(T_fp, "%d,%d,0,\"%s\",\"%s\"\n", TagNum++, id, tag_str, "bla bla"); fflush(T_fp); } } -------------------------------------------------- glyph_tools.c -------------------------------------------------- /** ** glyph_tools: contains: ** ** read_glyph() ** write_glyph() ** RGB_to_HSV() ** HSV_to_RGB() ** my_min() ** my_max() **/ #include "parse_conway.h" /* * read_glyph - read from a CSV file into Glyph_array[][] */ void read_glyph(filename, num_lines) char * filename; int num_lines; { /* declare local variables */ int len, col, i_col, d_col, line_num; char temp_char; char input_line[MAX_GLYPH_LINE]; char data_array[MAX_GLYPH_LINE]; FILE* g_fp; /* init local variables */ if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: num_lines = %d\n", "read_glyph()", num_lines); } FirstGoodLine = 0; /* read */ if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: #0 about to fopen() file: %s\n", "read_glyph()", GlyphFile); } g_fp = fopen(GlyphFile, "r"); if (g_fp == NULL) { fprintf(stderr, "%s: ERROR: fopen failed, error: %s\n", "read_glyph()", strerror(errno)); exit(0); } if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: #1 g_fp = %d\n", "read_glyph()", g_fp); } len = getl(g_fp, &input_line, MAX_GLYPH_LINE); /* text header */ if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: #2 header length = %d\n", "read_glyph()", len); fprintf(stderr, "%s: DEBUG: #2 header input_line = >%s<\n", "read_glyph()", input_line); fprintf(stderr, "%s: DEBUG: #2 header input_line[0] = %d ASCII\n", "read_glyph()", (int)input_line[0]); } for (line_num = 1; line_num < num_lines; line_num++) { len = getl(g_fp, &input_line, MAX_GLYPH_LINE); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: input_line number %d: >%s<\n", "read_glyph()", line_num, input_line); } if (len == 0) { fprintf(stderr, "%s: ERROR: zero length line number %d\n", "read_glyph()", line_num); break; } i_col = 0; for (col = 0; col < NUM_COLUMNS - 1; col++) { d_col = 0; temp_char = input_line[i_col]; while (temp_char != ',') { temp_char = input_line[i_col++]; data_array[d_col++] = temp_char; } data_array[d_col - 1] = EOS; sscanf(data_array, "%f", &Glyph_array[col][line_num]); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: data_array = >%s<\n", "read_glyph()", data_array); fprintf(stderr, "%s: DEBUG: Glyph_array[%d][%d] = %f\n", "read_glyph()", col, line_num, Glyph_array[col][line_num]); } } d_col = 0; temp_char = input_line[i_col]; while (temp_char != ',') { temp_char = input_line[i_col++]; data_array[d_col++] = temp_char; } data_array[d_col - 1] = EOS; sscanf(data_array, "%f", &Glyph_array[NUM_COLUMNS - 1][line_num]); if ((!FirstGoodLine) && (Glyph_array[1][line_num] == 5.0)) { FirstGoodLine = line_num; if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: FirstGoodLine = %d\n", "read_glyph()", FirstGoodLine); } } if (Glyph_array[NUM_COLUMNS - 1][line_num] != 420.0) { fprintf(stderr, "%s: ERROR: record %d was: %f, should be 420.0\n", NUM_COLUMNS - 1, "read_glyph()", Glyph_array[NUM_COLUMNS - 1][line_num]); exit(0); } } fclose(g_fp); } /* * write_glyph - write from Glyph_array[][] into a CSV file */ int write_glyph(num_lines, start_id) int num_lines; int start_id; { int col, row, temp_int; if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: num_lines = %d\n", "write_glyph()", num_lines); fprintf(stderr, "%s: DEBUG: start_id = %d\n", "write_glyph()", start_id); } for (row = FirstGoodLine; row < num_lines; row++) { if (FirstGoodLine == row) { First_id = Glyph_array[ID_0][row]; if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: First_id = %d\n", "write_glyph()", First_id); } } /* do all surgery here */ Glyph_array[ID_0][row] = Glyph_array[ID_0][row] - First_id + start_id; Glyph_array[DATA_2][row] = Glyph_array[ID_0][row]; /* anything with parent zero stays that way */ if (Glyph_array[PARENT_ID_4][row] != 0.0) { Glyph_array[PARENT_ID_4][row] = Glyph_array[PARENT_ID_4][row] - First_id + start_id; } Glyph_array[RECORD_ID_92][row] = Glyph_array[ID_0][row]; /* end of surgery */ for (col = 0; col < NUM_COLUMNS; col++) { temp_int = (int)Glyph_array[col][row]; if ((float)temp_int == Glyph_array[col][row]) { fprintf(stdout, "%d", (int)Glyph_array[col][row]); } else { fprintf(stdout, "%f", Glyph_array[col][row]); } if (col < NUM_COLUMNS - 1) { fprintf(stdout, ","); } } fprintf(stdout, "\n"); } return start_id + num_lines - FirstGoodLine; } /* * from https://www.cs.rit.edu/~ncs/color/t_convert.html */ // float my_min(float f1, float f2, float f3) { if ((f1 <= f2) && (f1 <= f3)) { return f1; } else if ((f2 <= f1) && (f2 <= f3)) { return f2; } else if ((f3 <= f1) && (f3 <= f2)) { return f3; } } // float my_max(float f1, float f2, float f3) { if ((f1 >= f2) && (f1 >= f3)) { return f1; } else if ((f2 >= f1) && (f2 >= f3)) { return f2; } else if ((f3 >= f1) && (f3 >= f2)) { return f3; } } // r,g,b values are from 0 to 1 // h = [0,360], s = [0,1], v = [0,1] // if s == 0, then h = -1 (undefined) void RGB_to_HSV(r, g, b, h, s, v) float r; float g; float b; float *h; float *s; float *v; { float min, max, delta; min = my_min( r, g, b ); max = my_max( r, g, b ); *v = max; // v delta = max - min; if( max != 0 ) *s = delta / max; // s else { // r = g = b = 0 // s = 0, v is undefined *s = 0; *h = -1; return; } if( r == max ) *h = ( g - b ) / delta; // between yellow & magenta else if( g == max ) *h = 2 + ( b - r ) / delta; // between cyan & yellow else *h = 4 + ( r - g ) / delta; // between magenta & cyan *h *= 60; // degrees if( *h < 0 ) *h += 360; } void HSV_to_RGB(r, g, b, h, s, v) float *r; float *g; float *b; float h; float s; float v; { int i; float f, p, q, t; if( s == 0.0 ) { // achromatic (grey) *r = *g = *b = v; return; } h /= 60.0; // sector 0 to 5 i = floor( h ); f = h - i; // factorial part of h p = v * ( 1.0 - s ); q = v * ( 1.0 - s * f ); t = v * ( 1.0 - s * ( 1.0 - f ) ); switch( i ) { case 0: *r = v; *g = t; *b = p; break; case 1: *r = q; *g = v; *b = p; break; case 2: *r = p; *g = v; *b = t; break; case 3: *r = p; *g = q; *b = v; break; case 4: *r = t; *g = p; *b = v; break; default: // case 5: *r = v; *g = p; *b = q; break; } } -------------------------------------------------- test_glyph_tools.c -------------------------------------------------- /** ** test_glyph_tools ** ** CREATED: 2014.02.26 ABS copied from parse_conway ** MODIFIED: 2014.02.28 ABS success w/ my data; failure w/ Dave's ** MODIFIED: 2014.03.01 ABS testing ** ** **/ #include "parse_conway.h" main(argc, argv) int argc; char** argv; { /* declare functions */ void read_glyph(); int write_glyph(); /* declare local variables */ int id; float x, y; float r_float, g_float, b_float; /* initialize global variables (including parameters) */ defaultParms(); parseArgs(argc, argv); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: Debug = %d\n", argv[0], Debug); fprintf(stderr, "%s: DEBUG: GlyphFile = %s\n", argv[0], GlyphFile); } /* initialize local variables */ /* read */ read_glyph(GlyphFile, NumLines); /* ok? */ if ( Glyph_array[PARENT_ID_4][FirstGoodLine] != 0.0) { fprintf(stderr, "%s: ERROR: Glyph_array[PARENT_ID_4][%d] = %f, should be 0.0\n", argv[0], FirstGoodLine, Glyph_array[PARENT_ID_4][FirstGoodLine]); exit(0); } /* process & write */ id = 300; for (x = -180.0; x <= 180.0; x+=15.0) { for (y = -90.0; y <= 90.0; y+=15.0) { Glyph_array[SCALE_X_25][FirstGoodLine] = 6.0 + x/30.0; Glyph_array[SCALE_Y_26][FirstGoodLine] = 6.0 + x/30.0; Glyph_array[SCALE_Z_27][FirstGoodLine] = 6.0 + x/30.0; Glyph_array[TRANSLATE_X_28][FirstGoodLine] = x; Glyph_array[TRANSLATE_Y_29][FirstGoodLine] = y; HSV_to_RGB(&r_float, &g_float, &b_float, x + 180.0, 1.0, 0.5 + y/180.0); Glyph_array[COLOR_R_55][FirstGoodLine] = color_float_to_int(r_float); Glyph_array[COLOR_G_56][FirstGoodLine] = color_float_to_int(g_float); Glyph_array[COLOR_B_57][FirstGoodLine] = color_float_to_int(b_float); if (Debug != FALSE) { fprintf(stderr, "FLAPDOODLE DEBUG\n"); fflush(stderr); fprintf(stderr, "%s: DEBUG: 8.0*x = %f\n", argv[0], 8.0*x); fprintf(stderr, "%s: DEBUG: y/45.0 = %f\n", argv[0], y/45.0); fprintf(stderr, "%s: DEBUG: r_float = %f\n", argv[0], r_float); fprintf(stderr, "%s: DEBUG: g_float = %f\n", argv[0], g_float); fprintf(stderr, "%s: DEBUG: b_float = %f\n", argv[0], b_float); fprintf(stderr, "%s: DEBUG: color_float_to_int(0.5) = %d\n", argv[0], color_float_to_int(0.5)); } id = write_glyph(NumLines, id); } } if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: id = %d\n", argv[0], id); } } /* end main */ /* * defaultParms - initialize global variables */ defaultParms() { NumLines = 1; strcpy(GlyphFile, "glyph_old.csv"); } /* end defaultParms() */ /* * parseArgs - parse arguments into global variables */ parseArgs(argc, argv) int argc; char** argv; { int i; float foo; for (i = 0; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'n' : NumLines = atoi(&argv[++i][0]); break; case 'G' : strcpy(GlyphFile, &argv[++i][0]); break; case 'D' : Debug = TRUE; break; default: fprintf(stderr, "%s: ERROR: illegal flag: %s\n", argv[0], argv[i]); exit(0); break; } /* end switch */ } /* end if */ } /* end for(i) */ } /* end parseArgs() */ /* * getl - modified from Kernighan & Ritchie to take stream */ int getl(stream, s, lim) /* get line into s, return length */ FILE *stream; char s[]; int lim; { int c, i; i = 0; while (--lim > 0 && (c = getc(stream)) != EOF && c != '\n') s[i++] = c; if (c == '\n') s[i++] = c; s[i] = EOS; return(i); } /* end getl() */ -------------------------------------------------- synglyphx.h -------------------------------------------------- #define ANTZ_TYPE_PIN (5) #define ANTZ_TYPE_LINK (7) #define ANTZ_GEOM_CUBE_WIRE (0) #define ANTZ_GEOM_CUBE (1) #define ANTZ_GEOM_SPHERE_WIRE (2) #define ANTZ_GEOM_SPHERE (3) #define ANTZ_GEOM_CONE_WIRE (4) #define ANTZ_GEOM_CONE (5) #define ANTZ_GEOM_TOROID (7) #define ANTZ_GEOM_DODEC_WIRE (8) #define ANTZ_GEOM_DODEC (9) #define ANTZ_GEOM_OCTO_WIRE (10) #define ANTZ_GEOM_OCTO (11) #define ANTZ_GEOM_TETRA_WIRE (12) #define ANTZ_GEOM_TETRA (13) #define ANTZ_GEOM_ICOS_WIRE (14) #define ANTZ_GEOM_ICOS (15) #define ANTZ_GEOM_PIN (16) #define ANTZ_GEOM_PIN_WIRE (17) #define ANTZ_GEOM_CYLINDER_WIRE (18) #define ANTZ_GEOM_CYLINDER (19) #define ANTZ_TOPO_LINK (0) #define ANTZ_TOPO_CUBE (1) #define ANTZ_TOPO_SPHERE (2) #define ANTZ_TOPO_TORUS (3) #define ANTZ_TOPO_CYLINDER (4) #define ANTZ_TOPO_PIN (5) #define ANTZ_TOPO_ROD (6) #define ANTZ_TOPO_POINT (7) #define ID_0 (0) #define TYPE_1 (1) #define DATA_2 (2) #define SELECTED_3 (3) #define PARENT_ID_4 (4) #define BRANCH_LEVEL_5 (5) #define CHILD_ID_6 (6) #define CHILD_INDEX_7 (7) #define CHILD_COUNT_8 (8) #define CH_INPUT_ID_9 (9) #define CH_OUTPUT_ID_10 (10) #define CH_LAST_UPDATED_11 (11) #define AVERAGE_12 (12) #define SAMPLE_13 (13) #define AUX_A_X_14 (14) #define AUX_A_Y_15 (15) #define AUX_A_Z_16 (16) #define AUX_B_X_17 (17) #define AUX_B_Y_18 (18) #define AUX_B_Z_19 (19) #define COLOR_SHIFT_20 (20) #define ROTATE_VEC_X_21 (21) #define ROTATE_VEC_Y_22 (22) #define ROTATE_VEC_Z_23 (23) #define ROTATE_VEC_S_24 (24) #define SCALE_X_25 (25) #define SCALE_Y_26 (26) #define SCALE_Z_27 (27) #define TRANSLATE_X_28 (28) #define TRANSLATE_Y_29 (29) #define TRANSLATE_Z_30 (30) #define TAG_OFFSET_X_31 (31) #define TAG_OFFSET_Y_32 (32) #define TAG_OFFSET_Z_33 (33) #define ROTATE_RATE_X_34 (34) #define ROTATE_RATE_Y_35 (35) #define ROTATE_RATE_Z_36 (36) #define ROTATE_X_37 (37) #define ROTATE_Y_38 (38) #define ROTATE_Z_39 (39) #define SCALE_RATE_X_40 (40) #define SCALE_RATE_Y_41 (41) #define SCALE_RATE_Z_42 (42) #define TRANSLATE_RATE_X_43 (43) #define TRANSLATE_RATE_X_44 (44) #define TRANSLATE_RATE_X_45 (45) #define TRANSLATE_VEC_X_46 (46) #define TRANSLATE_VEC_X_47 (47) #define TRANSLATE_VEC_X_48 (48) #define SHADER_49 (49) #define GEOMETRY_50 (50) #define LINE_WIDTH_51 (51) #define POINT_SIZE_52 (52) #define RATIO_53 (53) #define COLOR_INDEX_54 (54) #define COLOR_R_55 (55) #define COLOR_G_56 (56) #define COLOR_B_57 (57) #define COLOR_A_58 (58) /* color_fade texture_id hide freeze topo facet auto_zoom_x auto_zoom_y auto_zoom_z trigger_hi_x trigger_hi_y trigger_hi_z trigger_lo_x trigger_lo_y trigger_lo_z set_hi_x set_hi_y set_hi_z set_lo_x set_lo_y set_lo_z proximity_x proximity_y proximity_z proximity_mode_x proximity_mode_y proximity_mode_z segments_x segments_y segments_z */ #define TAG_MODE_89 (89) #define FORMAT_ID_90 (90) #define TABLE_ID_91 (91) #define RECORD_ID_92 (92) #define SIZE_93 (93) /* macros */ #define color_float_to_int(f) (int)(f * 255.0) -------------------------------------------------- Makefile -------------------------------------------------- O_FILES = parse_conway.o usage.o help.o print_CSV_line.o glyph_tools.o CFLAGS = -lc -g -lm CC = gcc parse_conway: $(O_FILES) $(CC) $(CFLAGS) -o parse_conway $(O_FILES) -------------------------------------------------- Makefile2 -------------------------------------------------- O_FILES = test_glyph_tools.o glyph_tools.o CFLAGS = -lc -g -lm CC = gcc test_glyph_tools: $(O_FILES) $(CC) $(CFLAGS) -o test_glyph_tools $(O_FILES) -------------------------------------------------- Run -------------------------------------------------- # d=/cygdrive/c/Users/Alan/Desktop/Conway_latest_demo/usr/csv e=/cygdrive/c/Users/Alan/Antz2014/antz_msw_2013-11-21/usr/csv cd /home/Alan/Antz2014/Data/Conway rm ANTzTag0001_body.csv cp antzconwaynodes1.csv $e # /home/Alan/swdev/C/parse_conway/parse_conway.exe -g 39 -v 3 -d 12 -D -n 30000 -s 15000 -l 15000 -t > conway_BODY.csv /home/Alan/swdev/C/parse_conway/parse_conway.exe -g `wc -l antzconwaynodes1.csv` -G antzconwaynodes1.csv -v 3 -d 2 -D -n 30000 -s 17086 17010 17287 -l 15000 -t > conway_BODY.csv # # KLUDGE # # head -100 conway_BODY.csv > foo.csv # mv foo.csv conway_BODY.csv # cat HEAD_V1.csv conway_BODY.csv > ANTZ_conway.csv echo copying to $e cp ANTZ_conway.csv $d/ANTz0001.csv cp ANTZ_conway.csv $e/ANTz0001.csv # cat tags_head.csv ANTzTag0001_body.csv > ANTzTag0001.csv cp ANTzTag0001.csv $d cp ANTzTag0001.csv $e # # # head -1000 ANTZ_conway.csv > ANTZ_conway_smaller.csv # cp ANTZ_conway_smaller.csv $e # # # # head -50 ANTZ_conway.csv > ANTZ_conway_frag.csv # tail -50 ANTZ_conway.csv > ANTZ_conway_body_frag.csv # cat HEAD_V1.csv ANTZ_conway_body_frag.csv > ANTZ_conway_frag.csv # /home/Alan/swdev/C/csv2table/csv2table.exe -d -C -D -t < ANTZ_conway_frag.csv > ANTZ_conway.html # mv CSV.dot conway.dot # # # /cygdrive/c/Users/Alan/Desktop/release/bin/dot.exe -Tpng -oconway_tree.png conway.dot -------------------------------------------------- Test -------------------------------------------------- # e=/cygdrive/c/Users/Alan/Antz2014/antz_msw_2013-11-21/usr/csv # echo '------------------------------------------------------------------------------' ./test_glyph_tools.exe -D -G glyph_old.csv -n `wc -l glyph_old.csv` > glyph_body.csv # cat glyph_head.csv glyph_body.csv > glyph_new.csv cp glyph_new.csv $e/glyph_new.csv cp glyph_old.csv $e/glyph_old.csv # # # echo '------------------------------------------------------------------------------' # ./test_glyph_tools.exe -D -G antzconwaynodes.csv -n `wc -l antzconwaynodes.csv` > glyph_body_c.csv # # # cat glyph_head.csv glyph_body_c.csv > glyph_conway.csv # cp glyph_conway.csv $e # cp antzconwaynodes.csv $e/antzconwaynodes.csv # # # ../csv2table/csv2table.exe -d -D < glyph_conway.csv > /dev/null # # # mv CSV.dot glyph_test.dot # /cygdrive/c/Users/Alan/Desktop/release/bin/dot.exe -Tpng -oglyph_test_tree.png glyph_test.dot # # --------------------------------------------------