Write VTK data. More...
#include "pluto.h"
Functions | |
void | WriteVTK_Header (FILE *fvtk, Grid *grid) |
void | WriteVTK_Vector (FILE *fvtk, Data_Arr V, char *var_name, Grid *grid) |
void | WriteVTK_Scalar (FILE *fvtk, double ***V, char *var_name, Grid *grid) |
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 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 pherical 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
void WriteVTK_Header | ( | FILE * | fvtk, |
Grid * | grid | ||
) |
void WriteVTK_Scalar | ( | FILE * | fvtk, |
double *** | V, | ||
char * | var_name, | ||
Grid * | grid | ||
) |
Write VTK scalar field.
[in] | fvtk | pointer to file |
[in] | V | pointer to 3D data array |
[in] | var_name | the variable name appearing in the VTK file |
[in] | grid | pointer to an array of Grid structures |
void WriteVTK_Vector | ( | FILE * | fvtk, |
Data_Arr | V, | ||
char * | var_name, | ||
Grid * | grid | ||
) |
Write VTK vector field data. 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] | var_name | the variable name appearing in the VTK file |
[in] | grid | pointer to an array of Grid structures |