Commit 90bd7442 authored by Emanuele De Rubeis's avatar Emanuele De Rubeis
Browse files

Image writing bug fixed

parent ad9f3647
Loading
Loading
Loading
Loading
+16 −47
Original line number Diff line number Diff line
@@ -278,39 +278,10 @@ void write_fftw_data(){

#endif //FITSIO

  for (int isector=0; isector<size; isector++)
    {

      MPI_Barrier(MPI_COMM_WORLD);
      
      if(isector == rank)
	{

	  printf("%d writing\n",isector);

	 #ifdef FITSIO

	  fpixel[0] = 1;
	  fpixel[1] = isector*yaxis+1;
	  lpixel[0] = xaxis;
	  lpixel[1] = (isector+1)*yaxis;

	  status = 0;
	  fits_open_image(&fptreal, testfitsreal, READWRITE, &status);
	  fits_write_subset(fptreal, TDOUBLE, fpixel, lpixel, image_real, &status);
	  fits_close_file(fptreal, &status);

	  status = 0;
	  fits_open_image(&fptrimg, testfitsimag, READWRITE, &status);
	  fits_write_subset(fptrimg, TDOUBLE, fpixel, lpixel, image_imag, &status);
	  fits_close_file(fptrimg, &status);

	 #endif //FITSIO

	  file.pFilereal = fopen (out.fftfile2,"ab");
	  file.pFileimg = fopen (out.fftfile3,"ab");
  file.pFilereal = fopen (out.fftfile2,"wb");
  file.pFileimg = fopen (out.fftfile3,"wb");

	  uint global_index = isector*(xaxis*yaxis)*sizeof(double);
  long global_index = rank*(xaxis*yaxis)*sizeof(long);

  fseek(file.pFilereal, global_index, SEEK_SET);
  fwrite(image_real, xaxis*yaxis, sizeof(double), file.pFilereal);
@@ -319,8 +290,6 @@ void write_fftw_data(){

  fclose(file.pFilereal);
  fclose(file.pFileimg);
	}
    }
  
  MPI_Barrier(MPI_COMM_WORLD);