coursework_1/temp_dist2D/serial_temp_2D.c
/***
*  printdata: generates a .csv file with data contained in parameter double* u1 
***/
generates a .csv file with data contained in parameter double* u1
generates a . csv file with data contained in parameter double * u1
void prtdata(int nx, int ny, int ts, double *u1, char* fname)
{
	int ix, iy;
	FILE *fp;
	fp = fopen(fname, "w");
	for (iy = ny-1; iy >= 0; iy--) {
		for (ix = 0; ix <= nx-1; ix++) {
			fprintf(fp, "%8.3f,", *(u1+ix*ny+iy));
			if (ix != nx-1) {
				fprintf(fp, " ");
			}
			else {
				fprintf(fp, "\n");
			}
		}
	}
	fclose(fp);
	printf(" %s\n",fname);
}
void prtdata ( int nx , int ny , int ts , double * u1 , char * fname ) { int ix , iy ; FILE * fp ; fp = fopen ( fname , " " ) ; for ( iy = ny - 1 ; iy >= 0 ; iy -- ) { for ( ix = 0 ; ix <= nx - 1 ; ix ++ ) { fprintf ( fp , " " , * ( u1 + ix * ny + iy ) ) ; if ( ix != nx - 1 ) { fprintf ( fp , " " ) ; } else { fprintf ( fp , " \n " ) ; } } } fclose ( fp ) ; printf ( " \n " , fname ) ; }
printdata: generates a .csv file with data contained in parameter double* u1
printdata : generates a . csv file with data contained in parameter double * u1