Actual source code: vtkvimpl.h
petsc-3.7.1 2016-05-15
Report Typos and Errors

      1: #if !defined(_VTKVIMPL_H)
      2: #define _VTKVIMPL_H

      4: #include <petsc/private/viewerimpl.h>    /*I   "petscsys.h"   I*/

      6: typedef struct _n_PetscViewerVTKObjectLink *PetscViewerVTKObjectLink;
      7: struct _n_PetscViewerVTKObjectLink {
      8:   PetscViewerVTKFieldType  ft;
      9:   PetscObject              vec;
     10:   PetscViewerVTKObjectLink next;
     11: };

     13: typedef struct {
     14:   char                     *filename;
     15:   PetscFileMode            btype;
     16:   PetscBool                written;
     17:   PetscObject              dm;
     18:   PetscViewerVTKObjectLink link;
     19:   PetscErrorCode (*write)(PetscObject,PetscViewer);
     20: } PetscViewer_VTK;

     22: PETSC_EXTERN PetscErrorCode PetscViewerVTKFWrite(PetscViewer,FILE*,const void*,PetscInt,PetscDataType);

     24: #if defined(PETSC_HAVE_STDINT_H) /* The VTK format requires a 32-bit integer */
     25: typedef int32_t PetscVTKInt;
     26: #else                            /* Hope int is 32 bits */
     27: typedef int PetscVTKInt;
     28: #endif

     30: /* Hack: Our enums are guaranteed to be the same size as normal int. A better fix would be to distinguish PETSC_INT32
     31:  * and PETSC_INT64 in the PetscDataType enum. */
     32: #define PETSC_INT32 PETSC_ENUM

     34: typedef unsigned char PetscVTKType;
     35: #define PETSC_UINT8 PETSC_CHAR

     37: #define PETSC_VTK_INT_MAX  2147483647
     38: #define PETSC_VTK_INT_MIN -2147483647
     39: #if defined(PETSC_USE_64BIT_INDICES)
     40: #  define PetscVTKIntCheck(a)  if ((a) > PETSC_VTK_INT_MAX) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Array too long for 32-bit VTK binary format")
     41: #  define PetscVTKIntCast(a) (PetscVTKInt)(a);PetscVTKIntCheck(a)
     42: #else
     43: #  define PetscVTKIntCheck(a)
     44: #  define PetscVTKIntCast(a) a
     45: #endif

     47: #endif