10 void WritePPM (
double ***Vdbl, 
char *var_name, 
char *filename, 
 
   28   if (
prank != 0) 
return;
 
   30   sprintf (header,
"P6\n%d %d\n255\n", ppm->
ncol, ppm->
nrow);
 
   31   fl  = fopen (filename,
"w");
 
   32   fprintf(fl,
"%s",header);
 
   33   for (ir = 0; ir < ppm->
nrow; ir++){
 
   34     fwrite (ppm->
rgb[ir], 
sizeof(
RGB), ppm->
ncol, fl);
 
   41 void WritePNG (
double ***Vdbl, 
char *var_name, 
char *filename, 
 
   53   int backgroundcolour_;
 
   56   int compressionlevel_;
 
   60   unsigned char **
image;
 
   66   if (
prank != 0) 
return;
 
   68   image = (png_bytepp)malloc(png->
nrow*
sizeof(png_bytep));
 
   69   for (ir = 0; ir < png->
nrow; ir++) {
 
   70     image[ir] = (png_bytep)malloc(6*png->
ncol*
sizeof(png_byte));
 
   73   for(ic = 0; ic < png->
ncol; ic++){
 
   74   for(ir = 0; ir < png->
nrow; ir++){
 
   76     image[ir][
i]   = png->
rgb[ir][ic].
r;      
 
   78     image[ir][i+2] = png->
rgb[ir][ic].
g;     
 
   80     image[ir][i+4] = png->
rgb[ir][ic].
b;     
 
   87   compressionlevel_ = 6;
 
   88   backgroundcolour_ = 0;
 
   93   fp = fopen(filename, 
"wb");
 
   95     printf(
" ! error opening file in writing data\n");
 
   99   png_ptr  = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
 
  100   info_ptr = png_create_info_struct(png_ptr);
 
  101   png_init_io(png_ptr, fp);
 
  104         png_set_compression_level(png_ptr, compressionlevel_);
 
  111   png_set_IHDR(png_ptr, info_ptr, png->
ncol, png->
nrow,
 
  112                bit_depth_, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
 
  113                PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
 
  115   if(filegamma_ < 1.0e-1){
 
  119   png_set_gAMA(png_ptr, info_ptr, filegamma_);
 
  130   png_write_info(png_ptr, info_ptr);
 
  131   png_write_image(png_ptr, image); 
 
  132   png_write_end(png_ptr, info_ptr);
 
  133   png_destroy_write_struct(&png_ptr, &info_ptr);
 
  136   free((
char *) image[0]);
 
  137   free((
char *) image);
 
  162   int col_offset, row_offset;
 
  165   float xflt, slice_min, slice_max;
 
  166   static float **slice;
 
  169   size_t dsize = 
sizeof(float);
 
  172    print1 (
"! PPM output disabled in 1-D\n");
 
  185    MPI_Barrier (MPI_COMM_WORLD);
 
  188   if (
prank != 0) 
return; 
 
  215   fl = fopen (
"tmp_file.out", 
"rb");
 
  219     offset = k*nx*ny*dsize; 
 
  220     fseek (fl, offset, SEEK_SET);
 
  230     fseek (fl, offset, SEEK_CUR);
 
  232     row_offset = nx*(ny - 1)*dsize; 
 
  240     fseek (fl, offset, SEEK_CUR);
 
  241     col_offset = (nx - 1)*dsize; 
 
  252   for (ir = 0; ir < image->
nrow; ir++) {
 
  253     for (ic = 0; ic < image->
ncol; ic++) {     
 
  254       fread (&xflt, dsize, 1, fl);
 
  256          printf (
" ! end of file reached\n");
 
  259       slice[image->
nrow - 1 - ir][ic] = xflt;  
 
  260       if (col_offset > 0) fseek(fl, col_offset, SEEK_CUR);
 
  262     if (row_offset > 0) fseek(fl, row_offset, SEEK_CUR);
 
  270   if (fabs(image->
max - image->
min) < 1.e-8) { 
 
  273     for (ir = 0; ir < image->
nrow; ir++){
 
  274     for (ic = 0; ic < image->
ncol; ic++){
 
  275       slice_min = 
MIN(slice_min, slice[ir][ic]);
 
  276       slice_max = 
MAX(slice_max, slice[ir][ic]);
 
  279     slice_min = image->
min;
 
  280     slice_max = image->
max;
 
  290   for (ir = 0; ir < image->
nrow; ir++){
 
  291   for (ic = 0; ic < image->
ncol; ic++){
 
  294       xflt  = log10(slice[ir][ic]/slice_min)*255.;
 
  295       xflt /= log10(slice_max/slice_min);
 
  297       xflt  = (slice[ir][ic] - slice_min)*255.;
 
  298       xflt /= (slice_max - slice_min);
 
  305     image->
rgb[ir][ic].
r = image->
r[
i];
 
  306     image->
rgb[ir][ic].
g = image->
g[
i];
 
  307     image->
rgb[ir][ic].
b = image->
b[
i];
 
  334     if (x >= xl && x <= xr) 
return MAX(i-
IBEG,0);
 
void WritePNG(double ***, char *, char *, Grid *)
 
void SetColorMap(unsigned char *r, unsigned char *g, unsigned char *b, char *map_name)
 
void print1(const char *fmt,...)
 
FILE * OpenBinaryFile(char *filename, int sz, char *mode)
 
double * x_glob
Cell geometrical central points. 
 
double * dx_glob
Cell size. 
 
int gend
Global end index for the global array. 
 
int np_tot_glob
Total number of points in the global domain (boundaries included). 
 
float *** Convert_dbl2flt(double ***Vdbl, double unit, int swap_endian)
 
int nghost
Number of ghost zones. 
 
static int GET_SLICE_INDEX(int, double, Grid *)
 
#define ARRAY_2D(nx, ny, type)          
 
void WritePPM(double ***Vdbl, char *var_name, char *filename, Grid *grid)
 
int CloseBinaryFile(FILE *fbin, int sz)
 
#define QUIT_PLUTO(e_code)  
 
void WriteBinaryArray(void *V, size_t dsize, int sz, FILE *fl, int istag)
 
static void GetSlice(double ***, Image *, Grid *)
 
static Image image[MAX_IMAGE_NUMBER]
 
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...