Actual source code: viewercgnsimpl.h

  1: #pragma once

  3: #include <petsc/private/viewerimpl.h>
  4: #include <cgnstypes.h>

  6: typedef struct {
  7:   char           *filename_template;
  8:   char           *filename;
  9:   PetscFileMode   btype;
 10:   int             file_num;
 11:   const PetscInt *node_l2g;
 12:   int             base, zone;
 13:   PetscInt        num_local_nodes, nStart, nEnd;
 14:   PetscInt        eStart, eEnd;
 15:   PetscScalar    *nodal_field;
 16:   PetscSegBuffer  output_steps;
 17:   PetscSegBuffer  output_times;
 18:   PetscInt        batch_size;
 19: } PetscViewer_CGNS;

 21: #define PetscCallCGNS(ierr) \
 22:   do { \
 23:     int _cgns_ier = (ierr); \
 24:     PetscCheck(!_cgns_ier, PETSC_COMM_SELF, PETSC_ERR_LIB, "CGNS error %d %s", _cgns_ier, cg_get_error()); \
 25:   } while (0)

 27: #if !defined(PRIdCGSIZE)
 28:   #if CG_SIZEOF_SIZE == 32
 29:     // cgsize_t is defined as int
 30:     #define MPIU_CGSIZE MPI_INT
 31:     #define PRIdCGSIZE  "d"
 32:   #else
 33:     #if defined(_WIN32)
 34:       // cgsize_t is defined as __int64, which is synonymous with long long
 35:       #define MPIU_CGSIZE MPI_LONG_LONG
 36:       #define PRIdCGSIZE  "lld"
 37:     #else
 38:       // cgsize_t is defined as long
 39:       #define MPIU_CGSIZE MPI_LONG
 40:       #define PRIdCGSIZE  "ld"
 41:     #endif
 42:   #endif
 43: #else
 44:   #if CG_SIZEOF_SIZE == 32
 45:     // cgsize_t is defined as int32_t
 46:     #define MPIU_CGSIZE MPI_INT32_T
 47:   #else
 48:     // cgsize_t is defined as int64_t
 49:     #define MPIU_CGSIZE MPI_INT64_T
 50:   #endif
 51: #endif

 53: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSCheckBatch_Internal(PetscViewer);
 54: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSFileOpen_Internal(PetscViewer, PetscInt);