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];
void print1(const char *fmt,...)
FILE * OpenBinaryFile(char *filename, int sz, char *mode)
int gend
Global end index for the global array.
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)
int CloseBinaryFile(FILE *fbin, int sz)
#define QUIT_PLUTO(e_code)
void WriteBinaryArray(void *V, size_t dsize, int sz, FILE *fl, int istag)