void printIrene(int x, int y) { printI(x,y); printR(x+SIZE+GAP,y); printE(x+5*SIZE+2*GAP,y); printN(x+8*SIZE+3*GAP,y); printE(x+12*SIZE+4*GAP,y); }
main(){ char str[50]; printf("Enter your name: "); gets(str); printW(); printf("\n"); delay(50); printE(); printf("\n"); delay(50); printL(); printf("\n"); delay(50); printC(); printf("\n"); delay(50); printO(); printf("\n"); delay(50); printM(); printf("\n"); delay(50); printE(); printf("\n"); delay(50); }
void printGameOver(int x, int y) { printG(x,y); printA(x+5*SIZE+GAP, y); printM(x+8*SIZE+2*GAP, y); printE(x+13*SIZE+3*GAP, y); printO(x+16*SIZE+5*GAP, y); printV(x+20*SIZE+6*GAP, y); printE(x+24*SIZE+7*GAP, y); printR(x+27*SIZE+8*GAP, y); }
void showlist(list_t list) { node_ad_t tmp=Nodepool[list.head].adnext ; while(tmp!=list.last) { printE(tmp); printf("->"); tmp=Nodepool[tmp].adnext; } printE(tmp); printf("\n"); }
int Tmlex::readCall(Ttoken &token) { int ch = Dinput.get(); Tstr posn = Dinput.posn(); char *pos = Dbuff; while ((EOF != ch) && ('\n' != ch) && (SEP_CALL != ch)) { if (SEP_S_VAR == ch) { // Posible var if (!readVar()) *(pos++) = ch; } else { *(pos++) = ch; } ch = Dinput.get(); } *pos = '\0'; if (SEP_CALL != ch) { printE("%s : Unterminated text\n", (char const*)posn); if (EOF != ch) Dinput.putBack(ch); } token.setType(TOK_CALL); token.setText(Dbuff); return(1); }
int main (int argc, char ** argv) { int err; MPI_Init (&argc, &argv); MPI_Comm_rank (comm, &rank); MPI_Comm_size (comm, &size); init_vars(); adios_init_noxml (comm); err = adios_read_init_method(ADIOS_READ_METHOD_BP, comm, "verbose=2"); if (err) { printE ("%s\n", adios_errmsg()); } if (!err) err = declare_group (); if (!err) err = write_file ("reuse_dim.bp"); if (!err) err = read_file ("reuse_dim.bp"); adios_finalize (rank); fini_vars(); MPI_Finalize (); return err; }
void printKevin(int x, int y) { printK(x,y); printE(x+4*SIZE+GAP,y); printV(x+7*SIZE+2*GAP,y); printI(x+11*SIZE+3*GAP,y); printN(x+12*SIZE+4*GAP,y); }
int read_file (char *fname) { ADIOS_SELECTION *sel; ADIOS_FILE * f; ADIOS_VARINFO * vi; int err=0,i,n; uint64_t start[1] = {0}; uint64_t count[2] = {NX}; uint64_t ndim; reset_rarrays(); log ("Read and check data in %s\n", fname); f = adios_read_open_file (fname, ADIOS_READ_METHOD_BP, comm); if (f == NULL) { printE ("Error at opening file: %s\n", adios_errmsg()); return 1; } sel = adios_selection_boundingbox (1, start, count); adios_schedule_read (f, sel, "t1", 0, 1, r1); adios_schedule_read (f, sel, "t2", 0, 1, r2); adios_perform_reads (f, 1); adios_selection_delete (sel); CHECK_ARRAY (t, r1, NX); CHECK_ARRAY (t, r2, NX); endread: adios_read_close(f); MPI_Barrier (comm); return err; }
static uchar Hex_i2h_char(uchar d) { if ( (d >= 0) && (d <= 9) ) // aqui da um warning mas e porque "ele" nao esta a ver a expressao completa return '0'+d; // indica a penas que a primeira sub-expressao e redubndante porque if ( (d >= 10) && (d <= 15) ) // se trata de unsigned mas fica melhor deixar ficar return 'a'+d-10; printE("i2h(uchar): got invalid char - this cannot be"); return 0; // treta }
void printAngela(int x, int y) { printA(x,y); printN(x+3*SIZE+GAP,y); printG(x+7*SIZE+2*GAP,y); printE(x+12*SIZE+3*GAP,y); printL(x+15*SIZE+4*GAP,y); printA(x+18*SIZE+5*GAP,y); }
void printDevina(int x, int y) { printD(x,y); printE(x+4*SIZE+GAP,y); printV(x+7*SIZE+2*GAP,y); printI(x+11*SIZE+3*GAP,y); printN(x+12*SIZE+4*GAP,y); printA(x+16*SIZE+5*GAP,y); }
void printMarcel(int x, int y) { printM(x,y); printA(x+5*SIZE+GAP,y); printR(x+8*SIZE+2*GAP,y); printC(x+12*SIZE+3*GAP,y); printE(x+16*SIZE+4*GAP,y); printL(x+19*SIZE+5*GAP,y); }
static uchar Hex_h2i_char(char d) { d = tolower(d); if ( (d >= '0') && (d <= '9') ) return d - '0'; if ( (d >= 'a') && (d <= 'f') ) return d - 'a' + 10; // EXTREME DANGER // PATCH FOR 6-digit space-padded exe addresses // may not work anymore if (d == ' ') return 0; // EXTREME DANGER // nao faco a menor ideia do que e que aquele comentario queria dizer // estou farto deste programa e desta porra toda printE("h2i(char): got invalid char - this cannot be"); return 0; // treta }
int main (int argc, char ** argv) { int err,i,M; int iconnect; MPI_Init (&argc, &argv); MPI_Comm_rank (wcomm, &wrank); MPI_Comm_size (wcomm, &wsize); if (argc < 2) { Usage(); return 1; } errno = 0; M = strtol (argv[1], NULL, 10); if (errno || M < 1 || M > wsize) { printE("Invalid 1st argument %s\n", argv[1]); Usage(); return 1; } iconnect = (wrank >= wsize-M); // connect to server from ranks N-M, N-M+1, ..., N MPI_Comm_split (wcomm, iconnect, wrank+M-wsize, &subcomm); MPI_Comm_rank (subcomm, &subrank); MPI_Comm_size (subcomm, &subsize); if (iconnect) { if (subsize != M) { printE ("Something wrong with communicator split: N=%d, M=%d, splitted size=%d\n", wsize, M, subsize); return 2; } log ("connect as subrank %d\n", subrank); } alloc_vars(); adios_read_init_method(ADIOS_READ_METHOD_DATASPACES, subcomm, "verbose=4"); adios_init_noxml (subcomm); adios_allocate_buffer (ADIOS_BUFFER_ALLOC_NOW, 1); if (iconnect) { adios_declare_group (&m_adios_group, "connect", "iter", adios_flag_yes); adios_select_method (m_adios_group, "DATASPACES", "verbose=4", ""); adios_define_var (m_adios_group, "ldim1", "", adios_integer, 0, 0, 0); adios_define_var (m_adios_group, "gdim1", "", adios_integer, 0, 0, 0); adios_define_var (m_adios_group, "offs1", "", adios_integer, 0, 0, 0); adios_define_var (m_adios_group, "a1", "", adios_integer, "ldim1", "gdim1", "offs1"); for (i=0; i<NSTEPS; i++) { if (!err) { set_vars (i); err = write_file (i); } } } log ("done with work, sync with others...\n"); MPI_Barrier (wcomm); log ("call adios_finalize...\n"); adios_finalize (wrank); log ("call adios_read_finalize_method...\n"); adios_read_finalize_method (ADIOS_READ_METHOD_DATASPACES); fini_vars(); MPI_Finalize (); return err; }
int Tmlex::readText(Ttoken &token) { static TstrBuf buff; int ch = Dinput.get(); Tstr posn = Dinput.posn(); unsigned long pos = 0; while ((EOF != ch) && ('\n' != ch) && (SEP_TEXT != ch)) { if (SEP_ESC == ch) // 005 { // Escaped Charactor ch = Dinput.get(); if ((EOF != ch) && ('\n' != ch)) { switch (ch) { case 'n' : buff[pos++] = '\n'; break; case 'r' : buff[pos++] = '\r'; break; case 't' : buff[pos++] = '\t'; break; case 'v' : buff[pos++] = '\v'; break; case 'b' : buff[pos++] = '\b'; break; default : buff[pos++] = ch; break; } } } else if (SEP_S_VAR == ch) { // Posible var if (!readVar()) buff[pos++] = ch; } else if (SEP_CALL == ch) // 005 { // Call argument Ttoken token; token.setPosn(Dinput.posn()); readCall(token); Dinput.push(new Tpipe(token.text())); } else if (SEP_WHICH_OPEN == ch) // 005 { // Posible which argument Ttoken token; token.setPosn(Dinput.posn()); Dinput.putBack(findExecs(token.text())); } else { buff[pos++] = ch; } ch = Dinput.get(); } buff[pos++] = '\0'; if (SEP_TEXT != ch) { printE("%s : Unterminated text\n", (char const*)posn); } token.setType(TOK_TEXT); token.setText((char const*)buff); return(1); }
int main() { inicializar(); int lugar_juan= reservar("juan", 1); printf("juan reservo el lugar %d\n", lugar_juan); if (lugar_juan!=0) { fprintf(stderr, "juan debio haber estacionado en 0, no en %d\n", lugar_juan); exit(1); } printE(); int lugar_eva= reservar("eva", 2); printf("eva reservo el lugar %d\n", lugar_eva); if (lugar_eva!=1) { fprintf(stderr, "eva debio haber estacionado en 1, no en %d\n", lugar_eva); exit(2); } printE(); pthread_t hebra_pato; Args args_pato= { "pato", 3, -1 }; pthread_create(&hebra_pato, NULL, carro, &args_pato); printf("Verificando que pato espera por obtener su lugar\n"); sleep(1); if (args_pato.lugar!=-1) { fprintf(stderr, "pato debio haber esperado, pero recibio\n"); fprintf(stderr, "incorrectamente el lugar %d\n", args_pato.lugar); exit(3); } printE(); int lugar_ana= reservar("ana", 1); printf("ana reservo el lugar %d\n", lugar_ana); if (lugar_ana!=3) { fprintf(stderr, "ana debio haber estacionado en 3, no en %d\n", lugar_ana); exit(4); } printE(); pthread_t hebra_pedro; Args args_pedro= { "pedro", 5, -1 }; pthread_create(&hebra_pedro, NULL, carro, &args_pedro); printf("Verificando que pedro espera por obtener su lugar\n"); sleep(1); if (args_pedro.lugar!=-1) { fprintf(stderr, "pedro debio haber esperado, pero recibio\n"); fprintf(stderr, "incorrectamente el lugar %d\n", args_pedro.lugar); exit(5); } printE(); liberar("eva"); printf("eva libera su lugar\n"); printE(); if (args_pato.lugar!=-1) { fprintf(stderr, "pato debio haber esperado, pero recibio\n"); fprintf(stderr, "incorrectamente el lugar %d\n", args_pato.lugar); exit(6); } printE(); liberar("juan"); printf("juan libera su lugar\n"); printE(); pthread_join(hebra_pato, NULL); printf("pato reservo el lugar %d\n", args_pato.lugar); if (args_pato.lugar!=0) { fprintf(stderr, "pato debio haber estacionado en 0, no en %d\n", args_pato.lugar); exit(7); } printE(); liberar("pato"); printf("pato libera su lugar\n"); if (args_pedro.lugar!=-1) { fprintf(stderr, "pedro debio haber esperado, pero recibio\n"); fprintf(stderr, "incorrectamente el lugar %d\n", args_pedro.lugar); exit(8); } printE(); /* Al liberar ana usamos una copia del string "ana". En el enunciado * se pide que se haga una copia del string y por lo tanto en la * comparacion se debe usar strcmp y no la igualdad de punteros. */ char copia_ana[4]; strcpy(copia_ana, "ana"); liberar(copia_ana); printf("ana libera su lugar\n"); pthread_join(hebra_pedro, NULL); printf("pedro reservo el lugar %d\n", args_pedro.lugar); if (args_pedro.lugar!=0) { fprintf(stderr, "pedro debio haber estacionado en 0, no en %d\n", args_pedro.lugar); exit(9); } printE(); liberar("pedro"); printf("pedro libera su lugar\n"); printE(); printf("\nFelicitaciones: su solucion funciona de acuerdo al enunciado.\n"); return 0; }
int MYspawnve(int wait, char *script, char const **argv, char **envp) { RTN_TYPE rtn = 0; int pid = 0; #if defined(INTEL_NT) || defined(INTEL_9X) static char *shell = NULL; if (NULL == shell) { //char const *local = findExec("sh.exe"); char const *local = Tenv::appGet("SHELL"); shell = new char [strlen(local) +1]; strcpy(shell, local); } char *(MYargv[1024]); char **p; char **q; MYargv[0] = shell; MYargv[1] = script; for (p = argv +1, q = MYargv +2; (NULL != *p); p++, q++) *q = *p; *q = NULL; if (MY_WAIT == wait) rtn = spawnve(_P_WAIT, shell, (const char* const*)MYargv, (const char* const*)envp); else pid = spawnve(_P_NOWAIT, shell, (const char* const*)MYargv, (const char* const*)envp); #else #if defined(CYGWIN) /* 006 */ static char *shell = NULL; if (NULL == shell) { char const *local = Tenv::appGet("SHELL"); shell = new char [strlen(local) +1]; strcpy(shell, local); } char *(MYargv[1024]); char **p; char **q; MYargv[0] = shell; MYargv[1] = script; for (p = argv +1, q = MYargv +2; (NULL != *p); p++, q++) *q = *p; *q = NULL; argv = MYargv; script = shell; #endif if (0 == (pid = fork())) { // Child execve(script, (char**)argv, envp); printE("Executeable [%s] not found or not executable\n", script); exit(-1); } else if (-1 < pid) { // Parent if (MY_WAIT == wait) { waitpid(pid, &rtn, 0); } } else { // Fork fail printT("Fork failed [-1]\n"); return (-1); } #endif if (MY_WAIT == wait) { return(RTN_VALUE(rtn)); } else { return(pid); } }
int main (int argc, char ** argv) { int err, step ; int do_write = 1; int do_read = 1; int m = 0; char write_method[16]; MPI_Init (&argc, &argv); MPI_Comm_rank (comm, &rank); MPI_Comm_size (comm, &size); if (argc > 1) { m = strtol (argv[1], NULL, 10); if (errno) { printf("Invalid 1st argument %s\n", argv[1]); Usage(); return 1;} } if (argc > 2) { if (argv[2][0] == 'w' || argv[2][0] == 'W') { do_read = 0; } else if (argv[2][0] == 'r' || argv[2][0] == 'R') { do_write = 0; } else { printE ("Invalid command line argument %s. Allowed ones:\n" " w: do write only\n" " r: do read only\n", argv[2]); MPI_Finalize (); return 1; } } if (m==0) { read_method = ADIOS_READ_METHOD_BP; strcpy(write_method,"MPI"); } else { read_method = ADIOS_READ_METHOD_DATASPACES; strcpy(write_method,"DATASPACES"); } log ("Writing: %s method=%s\n" "Reading: %s method=%d\n", (do_write ? "yes" : "no"), write_method, (do_read ? "yes" : "no"), read_method); alloc_vars(); if (do_write) { adios_init_noxml (comm); adios_allocate_buffer (ADIOS_BUFFER_ALLOC_NOW, 10); } if (do_read) { err = adios_read_init_method(read_method, comm, "verbose=2"); if (err) { printE ("%s\n", adios_errmsg()); } } if (do_write) { adios_declare_group (&m_adios_group, "selections", "iter", adios_flag_yes); adios_select_method (m_adios_group, write_method, "verbose=2", ""); define_vars(); for (step=0; step<NSTEPS; step++) { if (!err) { set_vars (step); err = write_file (step); sleep(1); } } adios_free_group (m_adios_group); } if (!err && do_read) err = read_points (); //if (!err && do_read) // err = read_writerblocks (); if (do_read) { adios_read_finalize_method (read_method); } fini_vars(); if (do_write) { adios_finalize (rank); } MPI_Finalize (); return err; }
int sourceFile (char const *filename, char const *envProg, char const *envArg) /* 002 */ { extern char **globalArgv; if ('\0' == *filename) { return(0); } else { char script[512]; MYtmpFile(script, "sirea"); FILE *file = NULL; if (NULL == (file = fopen(script, "w"))) { return(-1); } else { static char buff[2048]; // Working space !! Fixed size space !! char *shell; // Name of the shell char *q; // Transient pointer char const *scriptText; // Right - First off lets try and figure out what kind of shell // we are using ! // Get the name of the shell executable buff[0] = '\0'; // Working space !! Fixed size space !! shell = buff; q = (char*)Tenv::appGet("SHELL"); if (NULL != q) { // Strip out the first space separated token from ${SHELL} while (isspace(*q)) q++; while (!isspace(*q) && ('\0' != *q)) *(shell++) = *(q++); *(shell++) = '\0'; // Strip out the program name (no suffix) shell = buff; if (NULL != (q = (char*)strrchr(shell, '\\'))) shell = q+1; if (NULL != (q = (char*)strrchr(shell, '/'))) shell = q+1; // Strip off the suffix if (NULL != (q = (char*)strchr(shell, '.'))) *q = '\0'; } // Get the script to run the correct shell fprintf(file, "#!%s\n\n", Tenv::appGet("SHELL")); if (NULL != (scriptText = findTempl(shell))) // 005 { //// Template shell script definition //// // Run the command fprintf(file, scriptText, filename, SIRE_ENV_TAG, envProg, envArg); } else if (!strncmp(shell, CSH_NAME, sizeof(CSH_NAME)-1)) { //// C shell script //// // Run the command fprintf(file, "source %s\n\n", filename); fprintf(file, "echo '%s'\n\n", SIRE_ENV_TAG); fprintf(file, "%s %s\n\n", envProg, envArg); } else if ((!strncmp(shell, SH_NAME, sizeof(SH_NAME)-1)) || (!strncmp(shell, KSH_NAME, sizeof(KSH_NAME)-1)) || (!strncmp(shell, RKSH_NAME, sizeof(RKSH_NAME)-1)) || (!strncmp(shell, BASH_NAME, sizeof(BASH_NAME)-1))) { //// Bourn/Korn shell script //// fprintf(file, ". %s\n", filename); fprintf(file, "echo '%s'\n\n", SIRE_ENV_TAG); fprintf(file, "%s %s\n\n", envProg, envArg); } else { // Unknown script type printE("Unsupported shell [%s]\n", shell); fclose(file); unlink (script); return(1); //// BAILING OUT //// } fclose(file); chmod (script, S_IRWXU | S_IRWXG); Tenv::appUnsetStd(); // Right I admit it this is cut and paste with a bit re-hacking // Run the script and capture the environment variable settings // that 'sirenv' passes back. { char buff[1024]; int pipes[2]; if (0 == pipe(pipes)) { char *p; FILE *fd; int tmpStd = -1; // Configure the pipes for the sub-process tmpStd = dup(1); // Take a copy of standard out dup2(pipes[1], 1); // Make the pipe standard out close(pipes[1]); // Spawn the sub process MYspawnve(MY_NOWAIT, script, (const char**)globalArgv, Tenv::appGetEnvp()); // Reset the pipes dup2(tmpStd, 1); // Put back standard out close(tmpStd); // Close the spare copy fd = fdopen(pipes[0], "r"); // Read the other end while (NULL != (p = fgets(buff, sizeof(buff), fd))) { while (isspace(*p)) p++; if ('\0' == *p) { // Pass through the blank lines printf("%s", buff); } else if (!strncmp(p, SIRE_ENV_TAG, sizeof(SIRE_ENV_TAG)-1)) { // Read the environment // The tag marks the start of the environment // Clear any output fflush(stdout); // Read the environment Tenv::setApp(fd); } else { // Pass through any other output printf("%s", buff); } } fclose(fd); } } unlink (script); } } return (0); }
int read_points () { ADIOS_SELECTION *sel0,*sel1,*sel2,*sel3; ADIOS_FILE * f; ADIOS_VARINFO * vi; int err=0,n,n1, i,j,k; int nsteps_a, nsteps_b, nsteps_c; int v; uint64_t *pts1; uint64_t *pts2; uint64_t *pts3; uint64_t start[3] = {offs1,offs2,offs3}; uint64_t count[3] = {ldim1,ldim2,ldim3}; pts1 = (uint64_t*) malloc (1*sizeof(uint64_t)*ldim1); pts2 = (uint64_t*) malloc (2*sizeof(uint64_t)*ldim1*ldim2); pts3 = (uint64_t*) malloc (3*sizeof(uint64_t)*ldim1*ldim2*ldim3); for (i=0; i<ldim1; i++) { pts1[i] = offs1 + i; for (j=0; j<ldim2; j++) { pts2[i*2*ldim2 + 2*j] = offs1 + i; pts2[i*2*ldim2 + 2*j+1] = j; for (k=0; k<ldim3; k++) { pts3[i*3*ldim2*ldim3+j*3*ldim3+3*k] = offs1 + i; pts3[i*3*ldim2*ldim3+j*3*ldim3+3*k+1] = j; pts3[i*3*ldim2*ldim3+j*3*ldim3+3*k+2] = k; } } } //Force error on very last point: pts3[3*ldim1*ldim2*ldim3-1] = 0; reset_readvars(); log ("Read and check data in %s using point selections\n", FILENAME); f = adios_read_open (FILENAME, read_method, comm, ADIOS_LOCKMODE_CURRENT, 0.0); if (f == NULL) { printE ("Error at opening file: %s\n", rank, adios_errmsg()); return 1; } sel1 = adios_selection_points (1, ldim1, pts1); sel2 = adios_selection_points (2, ldim1*ldim2, pts2); sel3 = adios_selection_points (3, ldim1*ldim2*ldim3, pts3); #ifdef DEBUG_PRINTS fprintf(stderr, "1D selection: {"); for (i=0; i<ldim1; i++) { fprintf (stderr, "%d ", i, i, pts1[i]); } fprintf(stderr, "}\n"); fprintf(stderr, "2D selection :\n"); for (i=0; i<ldim1; i++) { fprintf (stderr, "i=%d, idx=%2d- = ", i, i*2*ldim2); for (j=0; j<ldim2; j++) { n = i*2*ldim2+2*j; fprintf (stderr, "{%d,%d} ", pts2[n], pts2[n+1]); } fprintf(stderr, "\n"); } fprintf(stderr, "3D selection :\n"); for (i=0; i<ldim1; i++) { for (j=0; j<ldim2; j++) { fprintf (stderr, "i=%d, j=%d, idx=%3d- = ", i, j, i*3*ldim2*ldim3+j*3*ldim3); for (k=0; k<ldim3; k++) { n = i*3*ldim2*ldim3+j*3*ldim3+3*k; fprintf (stderr, "{%d,%d,%d} ", pts3[n], pts3[n+1], pts3[n+2]); } fprintf(stderr, "\n"); } } #endif n1=0; while (n1 < NSTEPS && adios_errno != err_end_of_stream) { n1++; log (" Step %d\n", f->current_step); log (" Check 1D variable a1...\n"); adios_schedule_read (f, sel1, "a1", 0, 1, r1); adios_perform_reads (f, 1); #ifdef DEBUG_PRINTS fprintf(stderr, "1D result: {"); for (i=0; i<ldim1; i++) { fprintf (stderr, "%d ", i, i, r1[i]); } fprintf(stderr, "}\n"); #endif for (i=0; i<ldim1; i++) { v = VALUE1D(rank,f->current_step,i); if (r1[i] != v) { printE ("Error: a1[%d]=%d != read=%d\n", i, v, r1[i]); //goto endread; } } log (" Check 2D variable a2...\n"); adios_schedule_read (f, sel2, "a2", 0, 1, r2); adios_perform_reads (f, 1); #ifdef DEBUG_PRINTS fprintf(stderr, "2D result :\n"); n = 0; for (i=0; i<ldim1; i++) { fprintf (stderr, "row=%2d- = {", i); for (j=0; j<ldim2; j++) { fprintf (stderr, "%d ", r2[n]); n++; } fprintf(stderr, "}\n"); } #endif n = 0; for (i=0; i<ldim1; i++) { for (j=0; j<ldim2; j++) { v = VALUE2D(rank,f->current_step,i,j); if (v != r2[n]) { printE ("Error: a2[%d,%d]=%d != read=%d\n", i, j, v, r2[n]); //goto endread; } n++; } } log (" Check 3D variable a3...\n"); adios_schedule_read (f, sel3, "a3", 0, 1, r3); adios_perform_reads (f, 1); #ifdef DEBUG_PRINTS fprintf(stderr, "3D selection :\n"); n=0; for (i=0; i<ldim1; i++) { for (j=0; j<ldim2; j++) { fprintf (stderr, "[%d,%d] = {", i, j); for (k=0; k<ldim3; k++) { fprintf (stderr, "%d ", r3[n]); n++; } fprintf(stderr, "}\n"); } } #endif n = 0; for (i=0; i<ldim1; i++) { for (j=0; j<ldim2; j++) { for (k=0; k<ldim3; k++) { v = VALUE3D(rank,f->current_step,i,j,k); if (v != r3[n]) { printE ("Error: a3[%d,%d,%d]=%d != read=%d\n", i, j, k, v, r3[n]); //goto endread; } n++; } } } if (n1 < NSTEPS) { adios_advance_step (f, 0, -1.0); } } endread: adios_selection_delete (sel1); adios_selection_delete (sel2); adios_selection_delete (sel3); free(pts1); free(pts2); free(pts3); adios_read_close(f); MPI_Barrier (comm); return err; }
static void printExamples(const char *p){ const color iter = 64; const color iter2 = 256; printf("%s\n", "Mandelbrot Examples:"); printE("BIG picture", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_CLASSIC, iter, -0.500, +0.000, 1.800); printE("Bulb Mandelbrot", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_CLASSIC, iter, -1.770, +0.000, 0.060); printE("Elephant valley", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_CLASSIC, iter2, +0.336, +0.052, 0.012); printE("Elephant valley (Cosmos colors)", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_COSMOSMIX, iter2, +0.336, +0.052, 0.012); printE("Seahorse valley", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_CLASSIC, 1024, -0.747, +0.102, 0.005); printE("Seahorse valley (Cosmos colors)", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_COSMOSMIX, iter2, -0.747, +0.102, 0.005); printE("Triple spiral", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_CLASSIC, iter2, -0.041, +0.682, 0.008); printE("Triple spiral (Cosmos colors)", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_COSMOSMIX, iter2, -0.041, +0.682, 0.008); printE("Imperial Orb valley", p, MANDELBROT_TYPE_MANDELBROT, MANDELBROT_COLOR_CLASSIC, iter2, -1.370, +0.040, 0.018); printf("%s\n", "Burning Ship Examples:"); printE("BIG picture", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter, -0.500, -0.500, 1.800); printE("Burning ship in the armada", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -1.760, -0.040, 0.060); printE("Burning ship in the armada (low iter)", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter, -1.760, -0.040, 0.060); printE("Antenna detail", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter, -1.772, -0.040, 0.010); printE("Mysterious lady", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter, +0.000, -1.015, 0.015); printE("Hidden treasure", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, 4096, -1.73723891, -0.028338253, 0.000000005); printE("Hidden Forest", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, 2048, -1.73723000, -0.028248, 0.00001); printE("Hidden treasure", p, MANDELBROT_TYPE_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, 2048, -1.73723480, -0.028248, 0.0000005); printf("%s\n", "Perpendicular Burning Ship Examples:"); printE("BIG picture", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.500000, -0.500000, 1.80000); printE("First IFS Tree Cardioid", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.064150, +0.649680, 0.00015); printE("Rhombus inside First IFS Tree Cardioid", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.064154, +0.649703, 0.00001); printE("Common IFS Tree Cardioid", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.069900, +0.649800, 0.00040); printE("Spiral galaxy", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, 1024, -0.074000, +0.650710, 0.00030); printE("Humanoid creature - The Alien", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.079500, +0.659000, 0.00050); printE("Humanoid creature - The Minotaur", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.081830, +0.649450, 0.00005); printE("Humanoid creature - The Skull", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.096750, +0.652460, 0.00005); printE("Butterflies BIG Picture", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.232180, +0.708370, 0.00100); printE("Butterfly", p, MANDELBROT_TYPE_PERPENDICULAR_BURNINGSHIP, MANDELBROT_COLOR_CLASSIC, iter2, -0.232180, +0.708370, 0.00005); printf("%s\n", "Perpendicular Mandelbrot Examples:"); printE("BIG picture", p, MANDELBROT_TYPE_PERPENDICULAR_MANDELBROT, MANDELBROT_COLOR_CLASSIC, iter2, -0.500000, +0.000000, 1.80000); printf("%s\n", "Conjugate (Symmetrical) Mandelbrot Examples:"); printE("BIG picture", p, MANDELBROT_TYPE_MANDELBAR, MANDELBROT_COLOR_CLASSIC, iter, +0.000000, 0.000000, 2.50000); printE("Elephant valley in Mandelbar", p, MANDELBROT_TYPE_MANDELBAR, MANDELBROT_COLOR_CLASSIC, 2048, -1.474075, 0.000336, 0.000300); }