/* int chk_bounds(struct visual_buf *vol, int *bdflag) { int i, j, k, l; int bd1, bd2; int n_elem; n_elem = vol->mesh->n_elem; for (i = 0; i < n_elem; i++) { for (j = 0; j < i; j++) { if (*(bdflag + j) < HEX_FACE_INDEX) { bd1 = bd2 = 0; for (k = 0; k < HEX_N_NODE; k++) { for (l = 0; l < HEX_N_NODE; l++) { if ((*(vol->mesh->elem + i + n_elem * k)) == (*(vol->mesh->elem + j + n_elem * l))) { bd1 += 1 << k; bd2 += 1 << l; } } } switch (bd1) { case 15: *(bdflag + i) += 1; break; case 102: *(bdflag + i) += 2; break; case 240: *(bdflag + i) += 4; break; case 153: *(bdflag + i) += 8; break; case 204: *(bdflag + i) += 16; break; case 51: *(bdflag + i) += 32; break; default: break; } switch (bd2) { case 15: *(bdflag + j) += 1; break; case 102: *(bdflag + j) += 2; break; case 240: *(bdflag + j) += 4; break; case 153: *(bdflag + j) += 8; break; case 204: *(bdflag + j) += 16; break; case 51: *(bdflag + j) += 32; break; default: break; } } if (*(bdflag + i) == HEX_FACE_INDEX) break; } } return 1; } */ void find_isoline(int isonum, int sum_polys, double mincolor, double maxcolor, double *vcoord, int *plist, double *vcolor, Isohead *isohead) { int i, j, k; double c[3]; double isocolor, deltac; Fgeom g[3]; if (isonum <= 0) { fprintf(stderr, "isonumber input wrong\n"); exit(0); } deltac = (maxcolor - mincolor) / (isonum + 1); for (k = 0; k < isonum; k++) { isocolor = mincolor + (k + 1) * deltac; for (i = 0; i < sum_polys; i++) { for (j = 0; j < 3; j++) { c[j] = vcolor[plist[i * 3 + j] - 1]; g[j].x = vcoord[(plist[i * 3 + j] - 1) * 3]; g[j].y = vcoord[(plist[i * 3 + j] - 1) * 3 + 1]; g[j].z = vcoord[(plist[i * 3 + j] - 1) * 3 + 2]; } line_find(isocolor, c, g, k, isohead); } } }
/* * Assumptions: * * 1) Cache lines are a multiple of pointer-size words * 2) Cache lines are no larger than 1/4 a page size * 3) Pages are an even multiple of cache lines */ int main(int ac, char **av) { int i, j, l; int verbose = 0; int warmup = 0; int repetitions = TRIES; int c; size_t maxlen = 64 * 1024 * 1024; struct mem_state state; char *usage = "[-v] [-W <warmup>] [-N <repetitions>][-M len[K|M]]\n"; state.line = sizeof(char*); state.pagesize = getpagesize(); while (( c = getopt(ac, av, "avM:W:N:")) != EOF) { switch(c) { case 'v': verbose = 1; break; case 'M': maxlen = bytes(optarg); break; case 'W': warmup = atoi(optarg); break; case 'N': repetitions = atoi(optarg); break; default: lmbench_usage(ac, av, usage); break; } } if ((l = line_find(maxlen, warmup, repetitions, &state)) > 0) { if (verbose) { printf("cache line size: %d bytes\n", l); } else { printf("%d\n", l); } } return (0); }
main(){ FILE *fp; fp=fopen("all_callisto4.txt", "r"); if (fp==NULL){ printf("failed to open file \n"); return -1; } int counter=0; int c; while((c=fgetc(fp))!=EOF){ if (c=='\n'){ counter++; } } rewind(fp); printf("there are %d+1 lines \n",counter); int max_lines=counter+1; int max_char=2808; char **all_lines; all_lines=malloc(sizeof(char*)*max_lines); int i=0; for (i;i<max_lines;i++){ all_lines[i]=malloc(sizeof(char)*max_char); } int n_lines=getlines(all_lines, max_lines, max_char, fp); printf("n_lines is %d \n", n_lines); titles ** titles_head=malloc(sizeof(titles*)); *titles_head=NULL; int n_titles=title_find(all_lines,n_lines,titles_head, max_title_length); printf("%d titles\n",n_titles); FILE *text_file; text_file=fopen("titles_callisto", "wb"); print_titles(*titles_head, text_file); fclose(text_file); int n_posts=line_find(all_lines,n_lines,job_id,job_id_len); printf("there are %d job posts\n",n_posts); counter=line_find(all_lines,n_lines,"Location:",9); printf("there are %d Locations\n",counter); counter=line_find(all_lines,n_lines,"Job Location(s):",16); printf("there are %d Location(s)\n",counter); counter=line_find(all_lines,n_lines,"Description:",12); printf("there are %d Descriptions\n",counter); counter=line_find(all_lines,n_lines,"Job Function:",13); printf("there are %d Job Functions\n",counter); counter=line_find(all_lines,n_lines,"Job Functions:",16); printf("there are %d Job Functions\n",counter); title_lists *all_titles=sep_titles("titles_callisto",n_titles,max_title_length); job_posts * head_post=parse_posts(all_lines, all_titles, n_lines); filter_posts(head_post,all_lines,n_posts); return 0; }