Commit 108509f4 authored by tilman.metz's avatar tilman.metz

bug in writing snapshots and model subsets

seperator between POS[1] and POS[2] to avoid ambiguity in output
if more than 10 processes for at least one dimension are used.
parent b92dc342
......@@ -98,40 +98,40 @@ void checkfd ( FILE *fp, float ** prho, float ** ppi, float ** pu,
switch ( SNAP ) {
case 1 :
sprintf ( xfile,"%s%s.vx.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.vx.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
sprintf ( xfile,"%s%s.vy.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.vy.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
break;
case 2 :
sprintf ( xfile,"%s%s.p.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.p.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
break;
case 4 :
sprintf ( xfile,"%s%s.vx.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.vx.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
sprintf ( xfile,"%s%s.vy.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.vy.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
sprintf ( xfile,"%s%s.p.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.p.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
case 3 :
sprintf ( xfile,"%s%s.div.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.div.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
sprintf ( xfile,"%s%s.curl.%i%i",SNAP_FILE,file_ext,POS[1],POS[2] );
sprintf ( xfile,"%s%s.curl.%i.%i",SNAP_FILE,file_ext,POS[1],POS[2] );
fprintf ( fp," Check accessibility for snapshot file %s... \n",xfile );
if ( ( fpcheck=fopen ( xfile,xmod ) ) ==NULL ) err2 ( " PE0 cannot write snapshots to %s!",xfile );
else fclose ( fpcheck );
......
......@@ -91,7 +91,7 @@ void merge(int nsnap, int type){
for (ip=0;ip<=NPROCX-1; ip++)
for (jp=0;jp<=NPROCY-1; jp++){
sprintf(file,"%s.%i%i",mfile,ip,jp);
sprintf(file,"%s.%i.%i",mfile,ip,jp);
fp[jp][ip]=fopen(file,"r");
if (fp[jp][ip]==NULL) err("merge: can't read snapfile !");
}
......
......@@ -52,7 +52,7 @@ void mergemod(char modfile[STRING_SIZE], int format){
fprintf(FP," Opening model files: %s.??? ",modfile);
for (ip=0;ip<=NPROCX-1; ip++)
for (jp=0;jp<=NPROCY-1; jp++){
sprintf(file,"%s.%i%i",modfile,ip,jp);
sprintf(file,"%s.%i.%i",modfile,ip,jp);
fp[jp][ip]=fopen(file,"r");
if (fp[jp][ip]==NULL) err("merge: can't read model file !");
}
......
......@@ -69,11 +69,11 @@ void snap(FILE *fp,int nt, int nsnap, float **vx, float **vy, float **sxx,
sprintf(ext,".bin");
break;
}
sprintf(snapfile_x,"%s%s.vx.%i%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_y,"%s%s.vy.%i%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_div,"%s%s.div.%i%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_rot,"%s%s.curl.%i%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_p,"%s%s.p.%i%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_x,"%s%s.vx.%i.%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_y,"%s%s.vy.%i.%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_div,"%s%s.div.%i.%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_rot,"%s%s.curl.%i.%i",SNAP_FILE,ext,POS[1],POS[2]);
sprintf(snapfile_p,"%s%s.p.%i.%i",SNAP_FILE,ext,POS[1],POS[2]);
fprintf(fp,"\n\n PE %d is writing snapshot-data at T=%fs to \n",MYID,nt*DT);
......
......@@ -37,7 +37,7 @@ void writemod(char modfile[STRING_SIZE], float ** array, int format){
char file[STRING_SIZE];
fprintf(FP,"\n\n PE %d is writing model to \n",MYID);
sprintf(file,"%s.%i%i",modfile,POS[1],POS[2]);
sprintf(file,"%s.%i.%i",modfile,POS[1],POS[2]);
fprintf(FP,"\t%s\n\n", file);
fpmod=fopen(file,"w");
for (i=1;i<=NX;i+=IDX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment