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: char *solution_name;
26: } PetscViewer_CGNS;
28: #define PetscCallCGNS(ierr) \
29: do { \
30: int _cgns_ier = (ierr); \
31: PetscCheck(!_cgns_ier, PETSC_COMM_SELF, PETSC_ERR_LIB, "CGNS error %d %s", _cgns_ier, cg_get_error()); \
32: } while (0)
34: #if !defined(PRIdCGSIZE)
35: #if CG_SIZEOF_SIZE == 32
36: // cgsize_t is defined as int
37: #define MPIU_CGSIZE MPI_INT
38: #define PRIdCGSIZE "d"
39: #else
40: #if defined(_WIN32)
41: // cgsize_t is defined as __int64, which is synonymous with long long
42: #define MPIU_CGSIZE MPI_LONG_LONG
43: #define PRIdCGSIZE "lld"
44: #else
45: // cgsize_t is defined as long
46: #define MPIU_CGSIZE MPI_LONG
47: #define PRIdCGSIZE "ld"
48: #endif
49: #endif
50: #else
51: #if CG_SIZEOF_SIZE == 32
52: // cgsize_t is defined as int32_t
53: #define MPIU_CGSIZE MPI_INT32_T
54: #else
55: // cgsize_t is defined as int64_t
56: #define MPIU_CGSIZE MPI_INT64_T
57: #endif
58: #endif
60: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSCheckBatch_Internal(PetscViewer);
61: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSFileOpen_Internal(PetscViewer, PetscInt);
62: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscViewerCGNSGetSolutionFileIndex_Internal(PetscViewer, int *);