PLUTO
write_tab.c File Reference

Write tabulated 1D or 2D ascii data files. More...

#include "pluto.h"
Include dependency graph for write_tab.c:

Go to the source code of this file.

Functions

void WriteTabArray (Output *output, char *filename, Grid *grid)
 

Detailed Description

Write tabulated 1D or 2D ascii data files.

WriteTabArray() provides ascii output for 2-D and 1-D data in tabulated multi-column format:

    .     .         .         .             .
    .     .         .         .             .
    .     .         .         .             .
  x1(i) x2(j)   var_1(i,j)  var_2(i,j)   var_3(i,j) ...
    .     .         .         .             .
    .     .         .         .             .
    .     .         .         .             .

Blocks with different x2 coordinates are separated by a blank row (in more than 1D). One file (with all variables) per output is written to disk. This format does not work in parallel mode and can be used for simple serial runs.

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
June 27, 2014

Definition in file write_tab.c.

Function Documentation

void WriteTabArray ( Output output,
char *  filename,
Grid grid 
)

Write tabulated array.

Parameters
[in]outputa pointer to the output structure corresponding to the tab format
[in]filenamethe output file name
[in]gridpointer to an array of Grid structures

Definition at line 31 of file write_tab.c.

40 {
41  int nv, i, j, k;
42  FILE *fout;
43 
44  #ifdef PARALLEL
45  print1 ("! WriteTabArray: tab output not supported in parallel\n");
46  return;
47  #endif
48 
49  #if DIMENSIONS == 3
50  print1 ("! WriteTabArray: tab output not supported in 3D\n");
51  return;
52  #endif
53 
54 /* ------------------------------------------
55  dump arrays in ascii format to disk
56  ------------------------------------------ */
57 
58  fout = fopen (filename, "w");
59  k = 0;
60  IDOM_LOOP (i){
61  JDOM_LOOP(j){
62  fprintf (fout, "%f %f ", grid[IDIR].x[i], grid[JDIR].x[j]);
63  for (nv = 0; nv < output->nvar; nv++) {
64  if (output->dump_var[nv])
65  fprintf (fout, "%12.6e ", output->V[nv][k][j][i]);
66  }
67  fprintf (fout, "\n"); /* newline */
68  }
69  #if DIMENSIONS > 1
70  fprintf (fout, "\n"); /* skip one more empty line in 2D */
71  #endif
72  }
73  fclose (fout);
74 }
double *** V[64]
pointer to arrays being written - same for all
Definition: structs.h:247
void print1(const char *fmt,...)
Definition: amrPluto.cpp:511
#define JDOM_LOOP(j)
Definition: macros.h:35
#define IDIR
Definition: pluto.h:193
int j
Definition: analysis.c:2
int k
Definition: analysis.c:2
int nvar
tot.
Definition: structs.h:234
double * x
Definition: structs.h:80
int * dump_var
select vars being written - one per output
Definition: structs.h:240
int i
Definition: analysis.c:2
#define JDIR
Definition: pluto.h:194
#define IDOM_LOOP(i)
Definition: macros.h:34

Here is the call graph for this function:

Here is the caller graph for this function: