p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
p4est_vtk.h File Reference

Routines for printing a forest and associated fields to vtk format. More...

#include <p4est_geometry.h>
#include <p4est.h>

Go to the source code of this file.

Functions

void p4est_vtk_write_file (p4est_t *p4est, p4est_geometry_t *geom, const char *filename)
 This writes out the p4est in VTK format. More...
 
void p4est_vtk_write_all (p4est_t *p4est, p4est_geometry_t *geom, double scale, int write_tree, int write_level, int write_rank, int wrap_rank, int num_scalars, int num_vectors, const char *filename,...)
 This writes out the p4est and any number of point fields in VTK format. More...
 
int p4est_vtk_write_header (p4est_t *p4est, p4est_geometry_t *geom, double scale, int write_tree, int write_level, int write_rank, int wrap_rank, const char *point_scalars, const char *point_vectors, const char *filename)
 This will write the header of the vtu file. More...
 
int p4est_vtk_write_point_scalar (p4est_t *p4est, p4est_geometry_t *geom, const char *filename, const char *scalar_name, const double *values)
 This will write a scalar field to the vtu file. More...
 
int p4est_vtk_write_point_vector (p4est_t *p4est, p4est_geometry_t *geom, const char *filename, const char *vector_name, const double *values)
 This will write a 3-vector field to the vtu file. More...
 
int p4est_vtk_write_footer (p4est_t *p4est, const char *filename)
 This will write the footer of the vtu file. More...
 

Detailed Description

Routines for printing a forest and associated fields to vtk format.

Function Documentation

void p4est_vtk_write_all ( p4est_t p4est,
p4est_geometry_t *  geom,
double  scale,
int  write_tree,
int  write_level,
int  write_rank,
int  wrap_rank,
int  num_scalars,
int  num_vectors,
const char *  filename,
  ... 
)

This writes out the p4est and any number of point fields in VTK format.

This is a convenience function that will abort if there is a file error.

Parameters
[in]p4estThe p4est to be written.
[in]geomA p4est_geometry_t structure or NULL for vertex space.
[in]scaleDouble value between 0 and 1 to scale each quadrant.
[in]write_treeInclude the tree id as output field.
[in]write_levelInclude the tree levels as output field.
[in]write_rankInclude the MPI rank as output field.
[in]wrap_treeThe MPI rank is written module wrap_tree, or 0.
filenameFirst part of the name, see p4est_vtk_write_file.
num_scalarsNumber of scalar fields to write.
num_vectorsNumber of vector fields to write.

The variable arguments need to be pairs of (fieldname, fieldvalues) where the scalars come first, then the vectors.

void p4est_vtk_write_file ( p4est_t p4est,
p4est_geometry_t *  geom,
const char *  filename 
)

This writes out the p4est in VTK format.

This is a convenience function for the special case of writing out the tree id, quadrant level, and MPI rank only. One file is written per MPI rank, and one meta file on rank 0. This function will abort if there is a file error.

Parameters
[in]p4estThe p4est to be written.
[in]geomA p4est_geometry_t structure or NULL for vertex space.
[in]filenameThe first part of the file name which will have the MPI rank appended to it: The output file will be filename_rank.vtu, and the meta file filename.pvtu).
int p4est_vtk_write_footer ( p4est_t p4est,
const char *  filename 
)

This will write the footer of the vtu file.

Writing a VTK file is split into a couple of routines. The allows there to be an arbitrary number of fields. To write out two fields the calling sequence would be something like

p4est_vtk_write_header(p4est, ..., "output"); p4est_vtk_write_footer(p4est, "output");

Parameters
p4estThe p4est to be written.
filenameThe first part of the name which will have the proc number appended to it (i.e., the output file will be filename_procNum.vtu).
Returns
This returns 0 if no error and -1 if there is an error.
int p4est_vtk_write_header ( p4est_t p4est,
p4est_geometry_t *  geom,
double  scale,
int  write_tree,
int  write_level,
int  write_rank,
int  wrap_rank,
const char *  point_scalars,
const char *  point_vectors,
const char *  filename 
)

This will write the header of the vtu file.

Writing a VTK file is split into a couple of routines. The allows there to be an arbitrary number of fields. The calling sequence would be something like

p4est_vtk_write_header(p4est, geom, 1., 1, 1, 0, "output"); p4est_vtk_write_point_scalar (...); ... p4est_vtk_write_footer(p4est, "output");

Parameters
p4estThe p4est to be written.
geomA p4est_geometry_t structure or NULL for vertex space.
scaleThe relative length factor of the quadrants. Use 1.0 to fit quadrants exactly, less to create gaps.
write_treeBoolean to determine if the tree id should be output.
write_levelBoolean to determine if the tree levels should be output.
write_rankBoolean to determine if the MPI rank should be output.
wrap_rankNumber to wrap around the rank with a modulo operation. Can be 0 for no wrapping.
point_scalarsComma-separated list of point scalar fields, or NULL.
point_vectorsComma-separated list of point vector fields, or NULL.
filenameThe first part of the name which will have the proc number appended to it (i.e., the output file will be filename_procNum.vtu).
Returns
This returns 0 if no error and -1 if there is an error.
int p4est_vtk_write_point_scalar ( p4est_t p4est,
p4est_geometry_t *  geom,
const char *  filename,
const char *  scalar_name,
const double *  values 
)

This will write a scalar field to the vtu file.

It is good practice to make sure that the scalar field also exists in the comma separated string point_scalars passed to p4est_vtk_write_header.

Writing a VTK file is split into a couple of routines. The allows there to be an arbitrary number of fields.

Parameters
p4estThe p4est to be written.
geomA p4est_geometry_t structure or NULL for vertex space.
filenameThe first part of the name which will have the proc number appended to it (i.e., the output file will be filename_procNum.vtu).
scalar_nameThe name of the scalar field.
valuesThe point values that will be written.
Returns
This returns 0 if no error and -1 if there is an error.
int p4est_vtk_write_point_vector ( p4est_t p4est,
p4est_geometry_t *  geom,
const char *  filename,
const char *  vector_name,
const double *  values 
)

This will write a 3-vector field to the vtu file.

It is good practice to make sure that the vector field also exists in the comma separated string point_vectors passed to p4est_vtk_write_header.

Writing a VTK file is split into a couple of routines. The allows there to be an arbitrary number of fields.

Parameters
p4estThe p4est to be written.
geomA p4est_geometry_t structure or NULL for vertex space.
filenameThe first part of the name which will have the proc number appended to it (i.e., the output file will be filename_procNum.vtu).
vector_nameThe name of the vector field.
valuesThe point values that will be written.
Returns
This returns 0 if no error and -1 if there is an error.