PLUTO
|
Write data in VTK format. More...
#include "pluto.h"
Go to the source code of this file.
Macros | |
#define | RECTILINEAR_GRID 14 |
#define | STRUCTURED_GRID 35 |
#define | VTK_FORMAT STRUCTURED_GRID |
#define | VTK_TIME_INFO NO /* VisIt to display data results */ |
#define | VTK_HEADER_WRITE_STRING(header) fprintf (fvtk,header); |
#define | VTK_HEADER_WRITE_FLTARR(arr, nelem) fwrite(arr, sizeof(float), nelem, fvtk); |
#define | VTK_HEADER_WRITE_DBLARR(arr, nelem) fwrite(arr, sizeof(double), nelem, fvtk); |
Functions | |
void | WriteVTK_Header (FILE *fvtk, Grid *grid) |
void | WriteVTK_Vector (FILE *fvtk, Data_Arr V, double unit, char *var_name, Grid *grid) |
void | WriteVTK_Scalar (FILE *fvtk, double ***V, double unit, char *var_name, Grid *grid) |
Write data in VTK format.
Collection of basic functions to write VTK files using the simple legacy format. Files can be written in serial or parallel mode and consists of the basic five parts :
The mesh topology and the variable datasets are written using single precision (4 bytes) binary format. VTK file are usually written following big endian order. Therefore, we swap endianity only if local architecture has little endian ordering.
The WriteVTK_Header() function provides the basic functionality for steps 1, 2, 3 and 4. Only processor 0 does the actual writing. For cartesian/cylindrical geometries the default grid topology is "RECTILINEAR_GRIDS" whereas for polar/spherical we employ "STRUCTURED_GRID" to provide a convenient mapping to a cartesian mesh.
Note for 2D datasets: in order to produce a strictly 2D dataset we always set the third coordinate (x3) to zero. For this reason, in 2D spherical cordinates we swap the role of the "y" and "z" coordinates.
The WriteVTK_Vector() is fully parallel and is used to write data with the vector attribute (by default these include velocity and magnetic fields).
The WriteVTK_Scalar() is fully parallel and is used to write data with the scalar attribute (by default these include density, pressure, tracer and user-defined variables).
Reference
http://www.vtk.org/VTK/img/file-formats.pdf
Definition in file write_vtk.c.
#define RECTILINEAR_GRID 14 |
Definition at line 53 of file write_vtk.c.
#define STRUCTURED_GRID 35 |
Definition at line 54 of file write_vtk.c.
#define VTK_FORMAT STRUCTURED_GRID |
Definition at line 60 of file write_vtk.c.
#define VTK_HEADER_WRITE_DBLARR | ( | arr, | |
nelem | |||
) | fwrite(arr, sizeof(double), nelem, fvtk); |
Definition at line 86 of file write_vtk.c.
#define VTK_HEADER_WRITE_FLTARR | ( | arr, | |
nelem | |||
) | fwrite(arr, sizeof(float), nelem, fvtk); |
Definition at line 84 of file write_vtk.c.
#define VTK_HEADER_WRITE_STRING | ( | header | ) | fprintf (fvtk,header); |
Definition at line 82 of file write_vtk.c.
#define VTK_TIME_INFO NO /* VisIt to display data results */ |
Definition at line 65 of file write_vtk.c.
void WriteVTK_Header | ( | FILE * | fvtk, |
Grid * | grid | ||
) |
Write VTK header in parallel or serial mode. In parallel mode only processor 0 does the actual writing (see al_io.c/AL_Write_header).
[in] | fvtk | pointer to file |
[in] | grid | pointer to an array of Grid structures |
Definition at line 91 of file write_vtk.c.
void WriteVTK_Scalar | ( | FILE * | fvtk, |
double *** | V, | ||
double | unit, | ||
char * | var_name, | ||
Grid * | grid | ||
) |
Write VTK scalar field.
[in] | fvtk | pointer to file (handle) |
[in] | V | pointer to 3D data array |
[in] | unit | the corresponding cgs unit (if specified, 1 otherwise) |
[in] | var_name | the variable name appearing in the VTK file |
[in] | grid | pointer to an array of Grid structures |
Definition at line 341 of file write_vtk.c.
Write VTK vector field data. This is enabled only when VTK_VECTOR_DUMP is set to YES
. For generality purposes, vectors are written always with 3 components, even when there're only 2 being used.
The following Maple script has been used to find vector components from cyl/sph to cartesian:
[in] | fvtk | pointer to file |
[in] | V | a 4D array [nv][k][j][i] containing the vector components (nv) defined at cell centers (k,j,i). The index nv = 0 marks the vector first component. |
[in] | unit | the corresponding cgs unit (if specified, 1 otherwise) |
[in] | var_name | the variable name appearing in the VTK file |
[in] | grid | pointer to an array of Grid structures |
Definition at line 259 of file write_vtk.c.