Actual source code: viewercgnsimpl.h

  1: #pragma once

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

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

 22:   // Solution reading information
 23:   PetscInt solution_index;              // User set solution index
 24:   int      solution_file_index;         // CGNS file solution index for direct access
 25:   int      solution_file_pointer_index; // CGNS file solution index for FlowSolutionPointers (and other related arrays), index by 1
 26:   char    *solution_name;
 27: } PetscViewer_CGNS;

 29: #define PetscCallCGNS(ierr) \
 30:   do { \
 31:     int _cgns_ier = (ierr); \
 32:     PetscCheck(!_cgns_ier, PETSC_COMM_SELF, PETSC_ERR_LIB, "CGNS error %d %s", _cgns_ier, cg_get_error()); \
 33:   } while (0)

 35: #if !defined(PRIdCGSIZE)
 36:   #if CG_SIZEOF_SIZE == 32
 37:     // cgsize_t is defined as int
 38:     #define MPIU_CGSIZE MPI_INT
 39:     #define PRIdCGSIZE  "d"
 40:   #else
 41:     #if defined(_WIN32)
 42:       // cgsize_t is defined as __int64, which is synonymous with long long
 43:       #define MPIU_CGSIZE MPI_LONG_LONG
 44:       #define PRIdCGSIZE  "lld"
 45:     #else
 46:       // cgsize_t is defined as long
 47:       #define MPIU_CGSIZE MPI_LONG
 48:       #define PRIdCGSIZE  "ld"
 49:     #endif
 50:   #endif
 51: #else
 52:   #if CG_SIZEOF_SIZE == 32
 53:     // cgsize_t is defined as int32_t
 54:     #define MPIU_CGSIZE MPI_INT32_T
 55:   #else
 56:     // cgsize_t is defined as int64_t
 57:     #define MPIU_CGSIZE MPI_INT64_T
 58:   #endif
 59: #endif

 61: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSCheckBatch_Internal(PetscViewer);
 62: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSFileOpen_Internal(PetscViewer, PetscInt);
 63: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSGetSolutionFileIndex_Internal(PetscViewer, int *);