xref: /petsc/include/petscsystypes.h (revision fbf9dbe564678ed6eff1806adbc4c4f01b9743f4)
1 /* Portions of this code are under:
2    Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
3 */
4 
5 #ifndef PETSCSYSTYPES_H
6 #define PETSCSYSTYPES_H
7 
8 #include <petscconf.h>
9 #include <petscconf_poison.h>
10 #include <petscfix.h>
11 #include <petscmacros.h> // PETSC_NODISCARD, PETSC_CPP_VERSION
12 #include <stddef.h>
13 
14 /* SUBMANSEC = Sys */
15 
16 #include <limits.h> // INT_MIN, INT_MAX
17 
18 #if defined(__clang__) || (PETSC_CPP_VERSION >= 17)
19   // clang allows both [[nodiscard]] and __attribute__((warn_unused_result)) on type
20   // definitions. GCC, however, does not, so check that we are using C++17 [[nodiscard]]
21   // instead of __attribute__((warn_unused_result))
22   #define PETSC_ERROR_CODE_NODISCARD PETSC_NODISCARD
23 #else
24   #define PETSC_ERROR_CODE_NODISCARD
25 #endif
26 
27 #ifdef PETSC_CLANG_STATIC_ANALYZER
28   #undef PETSC_USE_STRICT_PETSCERRORCODE
29 #endif
30 
31 #ifdef PETSC_USE_STRICT_PETSCERRORCODE
32   #define PETSC_ERROR_CODE_TYPEDEF   typedef
33   #define PETSC_ERROR_CODE_ENUM_NAME PetscErrorCode
34 #else
35   #define PETSC_ERROR_CODE_TYPEDEF
36   #define PETSC_ERROR_CODE_ENUM_NAME
37 #endif
38 
39 /*E
40   PetscErrorCode - Datatype used to return PETSc error codes.
41 
42   Level: beginner
43 
44   Notes:
45   Virtually all PETSc functions return an error code. It is the callers responsibility to check
46   the value of the returned error code after each PETSc call to determine if any errors
47   occurred. A set of convenience macros (e.g. `PetscCall()`, `PetscCallVoid()`) are provided
48   for this purpose. Failing to properly check for errors is not supported, as errors may leave
49   PETSc in an undetermined state.
50 
51   One can retrieve the error string corresponding to a particular error code using
52   `PetscErrorMessage()`.
53 
54   The user can also configure PETSc with the `--with-strict-petscerrorcode` option to enable
55   compiler warnings when the returned error codes are not captured and checked. Users are
56   *heavily* encouraged to opt-in to this option, as it will become enabled by default in a
57   future release.
58 
59   Developer Notes:
60 
61   These are the generic error codes. These error codes are used in many different places in the
62   PETSc source code. The C-string versions are at defined in `PetscErrorStrings[]` in
63   `src/sys/error/err.c`, while the Fortran versions are defined in
64   `src/sys/f90-mod/petscerror.h`. Any changes here must also be made in both locations.
65 
66 .seealso: `PetscErrorMessage()`, `PetscCall()`, `SETERRQ()`
67 E*/
68 PETSC_ERROR_CODE_TYPEDEF enum PETSC_ERROR_CODE_NODISCARD {
69   PETSC_SUCCESS                   = 0,
70   PETSC_ERR_BOOLEAN_MACRO_FAILURE = 1, /* do not use */
71 
72   PETSC_ERR_MIN_VALUE = 54, /* should always be one less then the smallest value */
73 
74   PETSC_ERR_MEM            = 55, /* unable to allocate requested memory */
75   PETSC_ERR_SUP            = 56, /* no support for requested operation */
76   PETSC_ERR_SUP_SYS        = 57, /* no support for requested operation on this computer system */
77   PETSC_ERR_ORDER          = 58, /* operation done in wrong order */
78   PETSC_ERR_SIG            = 59, /* signal received */
79   PETSC_ERR_FP             = 72, /* floating point exception */
80   PETSC_ERR_COR            = 74, /* corrupted PETSc object */
81   PETSC_ERR_LIB            = 76, /* error in library called by PETSc */
82   PETSC_ERR_PLIB           = 77, /* PETSc library generated inconsistent data */
83   PETSC_ERR_MEMC           = 78, /* memory corruption */
84   PETSC_ERR_CONV_FAILED    = 82, /* iterative method (KSP or SNES) failed */
85   PETSC_ERR_USER           = 83, /* user has not provided needed function */
86   PETSC_ERR_SYS            = 88, /* error in system call */
87   PETSC_ERR_POINTER        = 70, /* pointer does not point to valid address */
88   PETSC_ERR_MPI_LIB_INCOMP = 87, /* MPI library at runtime is not compatible with MPI user compiled with */
89 
90   PETSC_ERR_ARG_SIZ          = 60, /* nonconforming object sizes used in operation */
91   PETSC_ERR_ARG_IDN          = 61, /* two arguments not allowed to be the same */
92   PETSC_ERR_ARG_WRONG        = 62, /* wrong argument (but object probably ok) */
93   PETSC_ERR_ARG_CORRUPT      = 64, /* null or corrupted PETSc object as argument */
94   PETSC_ERR_ARG_OUTOFRANGE   = 63, /* input argument, out of range */
95   PETSC_ERR_ARG_BADPTR       = 68, /* invalid pointer argument */
96   PETSC_ERR_ARG_NOTSAMETYPE  = 69, /* two args must be same object type */
97   PETSC_ERR_ARG_NOTSAMECOMM  = 80, /* two args must be same communicators */
98   PETSC_ERR_ARG_WRONGSTATE   = 73, /* object in argument is in wrong state, e.g. unassembled mat */
99   PETSC_ERR_ARG_TYPENOTSET   = 89, /* the type of the object has not yet been set */
100   PETSC_ERR_ARG_INCOMP       = 75, /* two arguments are incompatible */
101   PETSC_ERR_ARG_NULL         = 85, /* argument is null that should not be */
102   PETSC_ERR_ARG_UNKNOWN_TYPE = 86, /* type name doesn't match any registered type */
103 
104   PETSC_ERR_FILE_OPEN       = 65, /* unable to open file */
105   PETSC_ERR_FILE_READ       = 66, /* unable to read from file */
106   PETSC_ERR_FILE_WRITE      = 67, /* unable to write to file */
107   PETSC_ERR_FILE_UNEXPECTED = 79, /* unexpected data in file */
108 
109   PETSC_ERR_MAT_LU_ZRPVT = 71, /* detected a zero pivot during LU factorization */
110   PETSC_ERR_MAT_CH_ZRPVT = 81, /* detected a zero pivot during Cholesky factorization */
111 
112   PETSC_ERR_INT_OVERFLOW   = 84,
113   PETSC_ERR_FLOP_COUNT     = 90,
114   PETSC_ERR_NOT_CONVERGED  = 91,  /* solver did not converge */
115   PETSC_ERR_MISSING_FACTOR = 92,  /* MatGetFactor() failed */
116   PETSC_ERR_OPT_OVERWRITE  = 93,  /* attempted to over write options which should not be changed */
117   PETSC_ERR_WRONG_MPI_SIZE = 94,  /* example/application run with number of MPI ranks it does not support */
118   PETSC_ERR_USER_INPUT     = 95,  /* missing or incorrect user input */
119   PETSC_ERR_GPU_RESOURCE   = 96,  /* unable to load a GPU resource, for example cuBLAS */
120   PETSC_ERR_GPU            = 97,  /* An error from a GPU call, this may be due to lack of resources on the GPU or a true error in the call */
121   PETSC_ERR_MPI            = 98,  /* general MPI error */
122   PETSC_ERR_RETURN         = 99,  /* PetscError() incorrectly returned an error code of 0 */
123   PETSC_ERR_MAX_VALUE      = 100, /* this is always the one more than the largest error code */
124 
125   /*
126     do not use, exist purely to make the enum bounds equal that of a regular int (so conversion
127     to int in main() is not undefined behavior)
128   */
129   PETSC_ERR_MIN_SIGNED_BOUND_DO_NOT_USE = INT_MIN,
130   PETSC_ERR_MAX_SIGNED_BOUND_DO_NOT_USE = INT_MAX
131 } PETSC_ERROR_CODE_ENUM_NAME;
132 
133 #ifndef PETSC_USE_STRICT_PETSCERRORCODE
134 typedef int PetscErrorCode;
135 
136   /*
137   Needed so that C++ lambdas can deduce the return type as PetscErrorCode from
138   PetscFunctionReturn(PETSC_SUCCESS). Otherwise we get
139 
140   error: return type '(unnamed enum at include/petscsystypes.h:50:1)' must match previous
141   return type 'int' when lambda expression has unspecified explicit return type
142   PetscFunctionReturn(PETSC_SUCCESS);
143   ^
144 */
145   #define PETSC_SUCCESS ((PetscErrorCode)0)
146 #endif
147 
148 #undef PETSC_ERROR_CODE_NODISCARD
149 #undef PETSC_ERROR_CODE_TYPEDEF
150 #undef PETSC_ERROR_CODE_ENUM_NAME
151 
152 /*MC
153     PetscClassId - A unique id used to identify each PETSc class.
154 
155     Level: developer
156 
157     Note:
158     Use `PetscClassIdRegister()` to obtain a new value for a new class being created. Usually
159          XXXInitializePackage() calls it for each class it defines.
160 
161     Developer Note:
162     Internal integer stored in the `_p_PetscObject` data structure. These are all computed by an offset from the lowest one, `PETSC_SMALLEST_CLASSID`.
163 
164 .seealso: `PetscClassIdRegister()`, `PetscLogEventRegister()`, `PetscHeaderCreate()`
165 M*/
166 typedef int PetscClassId;
167 
168 /*MC
169     PetscMPIInt - datatype used to represent 'int' parameters to MPI functions.
170 
171     Level: intermediate
172 
173     Notes:
174     This is always a 32-bit integer, sometimes it is the same as `PetscInt`, but if PETSc was built with `--with-64-bit-indices` but
175            standard C/Fortran integers are 32-bit then this is NOT the same as `PetscInt`; it remains 32-bit.
176 
177     `PetscMPIIntCast`(a,&b) checks if the given `PetscInt` a will fit in a `PetscMPIInt`, if not it
178       generates a `PETSC_ERR_ARG_OUTOFRANGE` error.
179 
180 .seealso: `PetscBLASInt`, `PetscInt`, `PetscMPIIntCast()`
181 M*/
182 typedef int PetscMPIInt;
183 
184 /* Limit MPI to 32-bits */
185 enum {
186   PETSC_MPI_INT_MIN = INT_MIN,
187   PETSC_MPI_INT_MAX = INT_MAX
188 };
189 
190 /*MC
191     PetscSizeT - datatype used to represent sizes in memory (like `size_t`)
192 
193     Level: intermediate
194 
195     Notes:
196     This is equivalent to `size_t`, but defined for consistency with Fortran, which lacks a native equivalent of `size_t`.
197 
198 .seealso: `PetscInt`, `PetscInt64`, `PetscCount`
199 M*/
200 typedef size_t PetscSizeT;
201 
202 /*MC
203     PetscCount - signed datatype used to represent counts
204 
205     Level: intermediate
206 
207     Notes:
208     This is equivalent to `ptrdiff_t`, but defined for consistency with Fortran, which lacks a native equivalent of `ptrdiff_t`.
209 
210     Use `PetscCount_FMT` to format with `PetscPrintf()`, `printf()`, and related functions.
211 
212 .seealso: `PetscInt`, `PetscInt64`, `PetscSizeT`
213 M*/
214 typedef ptrdiff_t PetscCount;
215 #define PetscCount_FMT "td"
216 
217 /*MC
218     PetscEnum - datatype used to pass enum types within PETSc functions.
219 
220     Level: intermediate
221 
222 .seealso: `PetscOptionsGetEnum()`, `PetscOptionsEnum()`, `PetscBagRegisterEnum()`
223 M*/
224 typedef enum {
225   ENUM_DUMMY
226 } PetscEnum;
227 
228 typedef short PetscShort;
229 typedef char  PetscChar;
230 typedef float PetscFloat;
231 
232 /*MC
233   PetscInt - PETSc type that represents an integer, used primarily to
234       represent size of arrays and indexing into arrays. Its size can be configured with the option `--with-64-bit-indices` to be either 32-bit (default) or 64-bit.
235 
236   Level: beginner
237 
238   Notes:
239   For MPI calls that require datatypes, use `MPIU_INT` as the datatype for `PetscInt`. It will automatically work correctly regardless of the size of `PetscInt`.
240 
241 .seealso: `PetscBLASInt`, `PetscMPIInt`, `PetscReal`, `PetscScalar`, `PetscComplex`, `PetscInt`, `MPIU_REAL`, `MPIU_SCALAR`, `MPIU_COMPLEX`, `MPIU_INT`, `PetscIntCast()`
242 M*/
243 
244 #if defined(PETSC_HAVE_STDINT_H)
245   #include <stdint.h>
246 #endif
247 #if defined(PETSC_HAVE_INTTYPES_H)
248   #if !defined(__STDC_FORMAT_MACROS)
249     #define __STDC_FORMAT_MACROS /* required for using PRId64 from c++ */
250   #endif
251   #include <inttypes.h>
252   #if !defined(PRId64)
253     #define PRId64 "ld"
254   #endif
255 #endif
256 
257 #if defined(PETSC_HAVE_STDINT_H) && defined(PETSC_HAVE_INTTYPES_H) && defined(PETSC_HAVE_MPI_INT64_T) /* MPI_INT64_T is not guaranteed to be a macro */
258 typedef int64_t PetscInt64;
259 
260   #define PETSC_INT64_MIN INT64_MIN
261   #define PETSC_INT64_MAX INT64_MAX
262 
263 #elif (PETSC_SIZEOF_LONG_LONG == 8)
264 typedef long long PetscInt64;
265 
266   #define PETSC_INT64_MIN LLONG_MIN
267   #define PETSC_INT64_MAX LLONG_MAX
268 
269 #elif defined(PETSC_HAVE___INT64)
270 typedef __int64 PetscInt64;
271 
272   #define PETSC_INT64_MIN INT64_MIN
273   #define PETSC_INT64_MAX INT64_MAX
274 
275 #else
276   #error "cannot determine PetscInt64 type"
277 #endif
278 
279 #if defined(PETSC_USE_64BIT_INDICES)
280 typedef PetscInt64 PetscInt;
281 
282   #define PETSC_INT_MIN PETSC_INT64_MIN
283   #define PETSC_INT_MAX PETSC_INT64_MAX
284   #define PetscInt_FMT  PetscInt64_FMT
285 #else
286 typedef int       PetscInt;
287 
288 enum {
289   PETSC_INT_MIN = INT_MIN,
290   PETSC_INT_MAX = INT_MAX
291 };
292 
293   #define PetscInt_FMT "d"
294 #endif
295 
296 #define PETSC_MIN_INT    PETSC_INT_MIN
297 #define PETSC_MAX_INT    PETSC_INT_MAX
298 #define PETSC_MAX_UINT16 65535
299 
300 #if defined(PETSC_HAVE_STDINT_H) && defined(PETSC_HAVE_INTTYPES_H) && defined(PETSC_HAVE_MPI_INT64_T) /* MPI_INT64_T is not guaranteed to be a macro */
301   #define MPIU_INT64     MPI_INT64_T
302   #define PetscInt64_FMT PRId64
303 #elif (PETSC_SIZEOF_LONG_LONG == 8)
304   #define MPIU_INT64     MPI_LONG_LONG_INT
305   #define PetscInt64_FMT "lld"
306 #elif defined(PETSC_HAVE___INT64)
307   #define MPIU_INT64     MPI_INT64_T
308   #define PetscInt64_FMT "ld"
309 #else
310   #error "cannot determine PetscInt64 type"
311 #endif
312 
313 /*MC
314    PetscBLASInt - datatype used to represent 'int' parameters to BLAS/LAPACK functions.
315 
316    Level: intermediate
317 
318    Notes:
319    Usually this is the same as `PetscInt`, but if PETSc was built with `--with-64-bit-indices` but
320    standard C/Fortran integers are 32-bit then this may not be the same as `PetscInt`,
321    except on some BLAS/LAPACK implementations that support 64-bit integers see the notes below.
322 
323    `PetscErrorCode` `PetscBLASIntCast`(a,&b) checks if the given `PetscInt` a will fit in a `PetscBLASInt`, if not it
324     generates a `PETSC_ERR_ARG_OUTOFRANGE` error
325 
326    Installation Notes:
327     ./configure automatically determines the size of the integers used by BLAS/LAPACK except when `--with-batch` is used
328     in that situation one must know (by some other means) if the integers used by BLAS/LAPACK are 64-bit and if so pass the flag `--known-64-bit-blas-indices`
329 
330     MATLAB ships with BLAS and LAPACK that use 64-bit integers, for example if you run ./configure with, the option
331      `--with-blaslapack-lib`=[/Applications/MATLAB_R2010b.app/bin/maci64/libmwblas.dylib,/Applications/MATLAB_R2010b.app/bin/maci64/libmwlapack.dylib]
332 
333     MKL ships with both 32 and 64-bit integer versions of the BLAS and LAPACK. If you pass the flag `-with-64-bit-blas-indices` PETSc will link
334     against the 64-bit version, otherwise it uses the 32-bit version
335 
336     OpenBLAS can be built to use 64-bit integers. The ./configure options `--download-openblas` `-with-64-bit-blas-indices` will build a 64-bit integer version
337 
338     External packages such as hypre, ML, SuperLU etc do not provide any support for passing 64-bit integers to BLAS/LAPACK so cannot
339     be used with PETSc when PETSc links against 64-bit integer BLAS/LAPACK. ./configure will generate an error if you attempt to link PETSc against any of
340     these external libraries while using 64-bit integer BLAS/LAPACK.
341 
342 .seealso: `PetscMPIInt`, `PetscInt`, `PetscBLASIntCast()`
343 M*/
344 #if defined(PETSC_HAVE_64BIT_BLAS_INDICES)
345 typedef PetscInt64 PetscBLASInt;
346 
347   #define PETSC_BLAS_INT_MIN PETSC_INT64_MIN
348   #define PETSC_BLAS_INT_MAX PETSC_INT64_MAX
349   #define PetscBLASInt_FMT   PetscInt64_FMT
350 #else
351 typedef int PetscBLASInt;
352 
353 enum {
354   PETSC_BLAS_INT_MIN = INT_MIN,
355   PETSC_BLAS_INT_MAX = INT_MAX
356 };
357 
358   #define PetscBLASInt_FMT "d"
359 #endif
360 
361 /*MC
362    PetscCuBLASInt - datatype used to represent 'int' parameters to cuBLAS/cuSOLVER functions.
363 
364    Level: intermediate
365 
366    Notes:
367    As of this writing `PetscCuBLASInt` is always the system `int`.
368 
369   `PetscErrorCode` `PetscCuBLASIntCast`(a,&b) checks if the given `PetscInt` a will fit in a `PetscCuBLASInt`, if not it
370    generates a `PETSC_ERR_ARG_OUTOFRANGE` error
371 
372 .seealso: `PetscBLASInt`, `PetscMPIInt`, `PetscInt`, `PetscCuBLASIntCast()`
373 M*/
374 typedef int PetscCuBLASInt;
375 
376 enum {
377   PETSC_CUBLAS_INT_MIN = INT_MIN,
378   PETSC_CUBLAS_INT_MAX = INT_MAX
379 };
380 
381 /*MC
382    PetscHipBLASInt - datatype used to represent 'int' parameters to hipBLAS/hipSOLVER functions.
383 
384    Level: intermediate
385 
386    Notes:
387    As of this writing `PetscHipBLASInt` is always the system `int`.
388 
389    `PetscErrorCode` `PetscHipBLASIntCast`(a,&b) checks if the given `PetscInt` a will fit in a `PetscHipBLASInt`, if not it
390    generates a `PETSC_ERR_ARG_OUTOFRANGE` error
391 
392 .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscHipBLASIntCast()
393 M*/
394 typedef int PetscHipBLASInt;
395 
396 enum {
397   PETSC_HIPBLAS_INT_MIN = INT_MIN,
398   PETSC_HIPBLAS_INT_MAX = INT_MAX
399 };
400 
401 /*E
402     PetscBool  - Logical variable. Actually an enum in C and a logical in Fortran.
403 
404    Level: beginner
405 
406    Developer Note:
407    Why have `PetscBool`, why not use bool in C? The problem is that K and R C, C99 and C++ all have different mechanisms for
408       boolean values. It is not easy to have a simple macro that that will work properly in all circumstances with all three mechanisms.
409 
410 .seealso: `PETSC_TRUE`, `PETSC_FALSE`, `PetscNot()`, `PetscBool3`
411 E*/
412 typedef enum {
413   PETSC_FALSE,
414   PETSC_TRUE
415 } PetscBool;
416 PETSC_EXTERN const char *const PetscBools[];
417 
418 /*E
419     PetscBool3  - Ternary logical variable. Actually an enum in C and a 4 byte integer in Fortran.
420 
421    Level: beginner
422 
423    Note:
424    Should not be used with the if (flg) or if (!flg) syntax.
425 
426 .seealso: `PETSC_TRUE`, `PETSC_FALSE`, `PetscNot()`, `PETSC_BOOL3_TRUE`, `PETSC_BOOL3_FALSE`, `PETSC_BOOL3_UNKNOWN`
427 E*/
428 typedef enum {
429   PETSC_BOOL3_FALSE,
430   PETSC_BOOL3_TRUE,
431   PETSC_BOOL3_UNKNOWN = -1
432 } PetscBool3;
433 
434 #define PetscBool3ToBool(a) ((a) == PETSC_BOOL3_TRUE ? PETSC_TRUE : PETSC_FALSE)
435 #define PetscBoolToBool3(a) ((a) == PETSC_TRUE ? PETSC_BOOL3_TRUE : PETSC_BOOL3_FALSE)
436 
437 /*MC
438    PetscReal - PETSc type that represents a real number version of `PetscScalar`
439 
440    Level: beginner
441 
442    Notes:
443    For MPI calls that require datatypes, use `MPIU_REAL` as the datatype for `PetscReal` and `MPIU_SUM`, `MPIU_MAX`, etc. for operations.
444    They will automatically work correctly regardless of the size of `PetscReal`.
445 
446    See `PetscScalar` for details on how to ./configure the size of `PetscReal`.
447 
448 .seealso: `PetscScalar`, `PetscComplex`, `PetscInt`, `MPIU_REAL`, `MPIU_SCALAR`, `MPIU_COMPLEX`, `MPIU_INT`
449 M*/
450 
451 #if defined(PETSC_USE_REAL_SINGLE)
452 typedef float PetscReal;
453 #elif defined(PETSC_USE_REAL_DOUBLE)
454 typedef double    PetscReal;
455 #elif defined(PETSC_USE_REAL___FLOAT128)
456   #if defined(__cplusplus)
457 extern "C" {
458   #endif
459   #include <quadmath.h>
460   #if defined(__cplusplus)
461 }
462   #endif
463 typedef __float128 PetscReal;
464 #elif defined(PETSC_USE_REAL___FP16)
465 typedef __fp16 PetscReal;
466 #endif /* PETSC_USE_REAL_* */
467 
468 /*MC
469    PetscComplex - PETSc type that represents a complex number with precision matching that of `PetscReal`.
470 
471    Synopsis:
472    #include <petscsys.h>
473    PetscComplex number = 1. + 2.*PETSC_i;
474 
475    Level: beginner
476 
477    Notes:
478    For MPI calls that require datatypes, use `MPIU_COMPLEX` as the datatype for `PetscComplex` and `MPIU_SUM` etc for operations.
479           They will automatically work correctly regardless of the size of `PetscComplex`.
480 
481           See `PetscScalar` for details on how to ./configure the size of `PetscReal`
482 
483           Complex numbers are automatically available if PETSc was able to find a working complex implementation
484 
485     PETSc has a 'fix' for complex numbers to support expressions such as `std::complex<PetscReal>` + `PetscInt`, which are not supported by the standard
486     C++ library, but are convenient for petsc users. If the C++ compiler is able to compile code in `petsccxxcomplexfix.h` (This is checked by
487     configure), we include `petsccxxcomplexfix.h` to provide this convenience.
488 
489     If the fix causes conflicts, or one really does not want this fix for a particular C++ file, one can define `PETSC_SKIP_CXX_COMPLEX_FIX`
490     at the beginning of the C++ file to skip the fix.
491 
492 .seealso: `PetscReal`, `PetscScalar`, `PetscComplex`, `PetscInt`, `MPIU_REAL`, `MPIU_SCALAR`, `MPIU_COMPLEX`, `MPIU_INT`, `PETSC_i`
493 M*/
494 #if !defined(PETSC_SKIP_COMPLEX)
495   #if defined(PETSC_CLANGUAGE_CXX)
496     #if !defined(PETSC_USE_REAL___FP16) && !defined(PETSC_USE_REAL___FLOAT128)
497       #if defined(__cplusplus) && defined(PETSC_HAVE_CXX_COMPLEX) /* enable complex for library code */
498         #define PETSC_HAVE_COMPLEX 1
499       #elif !defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) && defined(PETSC_HAVE_CXX_COMPLEX) /* User code only - conditional on library code complex support */
500         #define PETSC_HAVE_COMPLEX 1
501       #endif
502     #elif defined(PETSC_USE_REAL___FLOAT128) && defined(PETSC_HAVE_C99_COMPLEX)
503       #define PETSC_HAVE_COMPLEX 1
504     #endif
505   #else /* !PETSC_CLANGUAGE_CXX */
506     #if !defined(PETSC_USE_REAL___FP16)
507       #if !defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) /* enable complex for library code */
508         #define PETSC_HAVE_COMPLEX 1
509       #elif defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) && defined(PETSC_HAVE_CXX_COMPLEX) /* User code only - conditional on library code complex support */
510         #define PETSC_HAVE_COMPLEX 1
511       #endif
512     #endif
513   #endif /* PETSC_CLANGUAGE_CXX */
514 #endif   /* !PETSC_SKIP_COMPLEX */
515 
516 #if defined(PETSC_HAVE_COMPLEX)
517   #if defined(__cplusplus) /* C++ complex support */
518     /* Locate a C++ complex template library */
519     #if defined(PETSC_DESIRE_KOKKOS_COMPLEX) /* Defined in petscvec_kokkos.hpp for *.kokkos.cxx files */
520       #define petsccomplexlib Kokkos
521       #include <Kokkos_Complex.hpp>
522     #elif defined(__CUDACC__) || defined(__HIPCC__)
523       #define petsccomplexlib thrust
524       #include <thrust/complex.h>
525     #elif defined(PETSC_USE_REAL___FLOAT128)
526       #include <complex.h>
527     #else
528       #define petsccomplexlib std
529       #include <complex>
530     #endif
531 
532     /* Define PetscComplex based on the precision */
533     #if defined(PETSC_USE_REAL_SINGLE)
534 typedef petsccomplexlib::complex<float> PetscComplex;
535     #elif defined(PETSC_USE_REAL_DOUBLE)
536 typedef petsccomplexlib::complex<double> PetscComplex;
537     #elif defined(PETSC_USE_REAL___FLOAT128)
538 typedef __complex128 PetscComplex;
539     #endif
540 
541     /* Include a PETSc C++ complex 'fix'. Check PetscComplex manual page for details */
542     #if defined(PETSC_HAVE_CXX_COMPLEX_FIX) && !defined(PETSC_SKIP_CXX_COMPLEX_FIX)
543       #include <petsccxxcomplexfix.h>
544     #endif
545   #else /* c99 complex support */
546     #include <complex.h>
547     #if defined(PETSC_USE_REAL_SINGLE) || defined(PETSC_USE_REAL___FP16)
548 typedef float _Complex PetscComplex;
549     #elif defined(PETSC_USE_REAL_DOUBLE)
550 typedef double _Complex PetscComplex;
551     #elif defined(PETSC_USE_REAL___FLOAT128)
552 typedef __complex128 PetscComplex;
553     #endif /* PETSC_USE_REAL_* */
554   #endif   /* !__cplusplus */
555 #endif     /* PETSC_HAVE_COMPLEX */
556 
557 /*MC
558    PetscScalar - PETSc type that represents either a double precision real number, a double precision
559        complex number, a single precision real number, a __float128 real or complex or a __fp16 real - if the code is configured
560        with `--with-scalar-type`=real,complex `--with-precision`=single,double,__float128,__fp16
561 
562    Level: beginner
563 
564    Note:
565    For MPI calls that require datatypes, use `MPIU_SCALAR` as the datatype for `PetscScalar` and `MPIU_SUM`, etc for operations. They will automatically work correctly regardless of the size of `PetscScalar`.
566 
567 .seealso: `PetscReal`, `PetscComplex`, `PetscInt`, `MPIU_REAL`, `MPIU_SCALAR`, `MPIU_COMPLEX`, `MPIU_INT`, `PetscRealPart()`, `PetscImaginaryPart()`
568 M*/
569 
570 #if defined(PETSC_USE_COMPLEX) && defined(PETSC_HAVE_COMPLEX)
571 typedef PetscComplex PetscScalar;
572 #else  /* PETSC_USE_COMPLEX */
573 typedef PetscReal PetscScalar;
574 #endif /* PETSC_USE_COMPLEX */
575 
576 /*E
577     PetscCopyMode  - Determines how an array or `PetscObject` passed to certain functions is copied or retained by the aggregate `PetscObject`
578 
579    Level: beginner
580 
581    Values for array input:
582 +   `PETSC_COPY_VALUES` - the array values are copied into new space, the user is free to reuse or delete the passed in array
583 .   `PETSC_OWN_POINTER` - the array values are NOT copied, the object takes ownership of the array and will free it later, the user cannot change or
584                           delete the array. The array MUST have been obtained with `PetscMalloc()`. Hence this mode cannot be used in Fortran.
585 -   `PETSC_USE_POINTER` - the array values are NOT copied, the object uses the array but does NOT take ownership of the array. The user cannot use
586                           the array but the user must delete the array after the object is destroyed.
587 
588    Values for PetscObject:
589 +   `PETSC_COPY_VALUES` - the input `PetscObject` is cloned into the aggregate `PetscObject`; the user is free to reuse/modify the input `PetscObject` without side effects.
590 .   `PETSC_OWN_POINTER` - the input `PetscObject` is referenced by pointer (with reference count), thus should not be modified by the user.
591                           increases its reference count).
592 -   `PETSC_USE_POINTER` - invalid for `PetscObject` inputs.
593 
594 .seealso: `PetscInsertMode`
595 E*/
596 typedef enum {
597   PETSC_COPY_VALUES,
598   PETSC_OWN_POINTER,
599   PETSC_USE_POINTER
600 } PetscCopyMode;
601 PETSC_EXTERN const char *const PetscCopyModes[];
602 
603 /*MC
604     PETSC_FALSE - False value of `PetscBool`
605 
606     Level: beginner
607 
608     Note:
609     Zero integer
610 
611 .seealso: `PetscBool`, `PetscBool3`, `PETSC_TRUE`
612 M*/
613 
614 /*MC
615     PETSC_TRUE - True value of `PetscBool`
616 
617     Level: beginner
618 
619     Note:
620     Nonzero integer
621 
622 .seealso: `PetscBool`, `PetscBool3`, `PETSC_FALSE`
623 M*/
624 
625 /*MC
626     PetscLogDouble - Used for logging times
627 
628   Level: developer
629 
630   Note:
631   Contains double precision numbers that are not used in the numerical computations, but rather in logging, timing etc.
632 
633 .seealso: `PetscBool`, `PetscDataType`
634 M*/
635 typedef double PetscLogDouble;
636 
637 /*E
638     PetscDataType - Used for handling different basic data types.
639 
640    Level: beginner
641 
642    Notes:
643    Use of this should be avoided if one can directly use `MPI_Datatype` instead.
644 
645    `PETSC_INT` is the datatype for a `PetscInt`, regardless of whether it is 4 or 8 bytes.
646    `PETSC_REAL`, `PETSC_COMPLEX` and `PETSC_SCALAR` are the datatypes for `PetscReal`, `PetscComplex` and `PetscScalar`, regardless of their sizes.
647 
648    Developer Notes:
649    It would be nice if we could always just use MPI Datatypes, why can we not?
650 
651    If you change any values in `PetscDatatype` make sure you update their usage in
652    share/petsc/matlab/PetscBagRead.m and share/petsc/matlab/@PetscOpenSocket/read/write.m
653 
654    TODO:
655    Add PETSC_INT32 and remove use of improper `PETSC_ENUM`
656 
657 .seealso: `PetscBinaryRead()`, `PetscBinaryWrite()`, `PetscDataTypeToMPIDataType()`,
658           `PetscDataTypeGetSize()`
659 E*/
660 typedef enum {
661   PETSC_DATATYPE_UNKNOWN = 0,
662   PETSC_DOUBLE           = 1,
663   PETSC_COMPLEX          = 2,
664   PETSC_LONG             = 3,
665   PETSC_SHORT            = 4,
666   PETSC_FLOAT            = 5,
667   PETSC_CHAR             = 6,
668   PETSC_BIT_LOGICAL      = 7,
669   PETSC_ENUM             = 8,
670   PETSC_BOOL             = 9,
671   PETSC___FLOAT128       = 10,
672   PETSC_OBJECT           = 11,
673   PETSC_FUNCTION         = 12,
674   PETSC_STRING           = 13,
675   PETSC___FP16           = 14,
676   PETSC_STRUCT           = 15,
677   PETSC_INT              = 16,
678   PETSC_INT64            = 17,
679   PETSC_COUNT            = 18
680 } PetscDataType;
681 PETSC_EXTERN const char *const PetscDataTypes[];
682 
683 #if defined(PETSC_USE_REAL_SINGLE)
684   #define PETSC_REAL PETSC_FLOAT
685 #elif defined(PETSC_USE_REAL_DOUBLE)
686   #define PETSC_REAL PETSC_DOUBLE
687 #elif defined(PETSC_USE_REAL___FLOAT128)
688   #define PETSC_REAL PETSC___FLOAT128
689 #elif defined(PETSC_USE_REAL___FP16)
690   #define PETSC_REAL PETSC___FP16
691 #else
692   #define PETSC_REAL PETSC_DOUBLE
693 #endif
694 
695 #if defined(PETSC_USE_COMPLEX)
696   #define PETSC_SCALAR PETSC_COMPLEX
697 #else
698   #define PETSC_SCALAR PETSC_REAL
699 #endif
700 
701 #define PETSC_FORTRANADDR PETSC_LONG
702 
703 /*S
704     PetscToken - 'Token' used for managing tokenizing strings
705 
706   Level: intermediate
707 
708 .seealso: `PetscTokenCreate()`, `PetscTokenFind()`, `PetscTokenDestroy()`
709 S*/
710 typedef struct _p_PetscToken *PetscToken;
711 
712 /*S
713      PetscObject - any PETSc object, `PetscViewer`, `Mat`, `Vec`, `KSP` etc
714 
715    Level: beginner
716 
717    Notes:
718    This is the base class from which all PETSc objects are derived from.
719 
720    In certain situations one can cast an object, for example a `Vec`, to a `PetscObject` with (`PetscObject`)vec
721 
722 .seealso: `PetscObjectDestroy()`, `PetscObjectView()`, `PetscObjectGetName()`, `PetscObjectSetName()`, `PetscObjectReference()`, `PetscObjectDereference()`
723 S*/
724 typedef struct _p_PetscObject *PetscObject;
725 
726 /*MC
727     PetscObjectId - unique integer Id for a `PetscObject`
728 
729     Level: developer
730 
731     Note:
732     Unlike pointer values, object ids are never reused so one may save a `PetscObjectId` and compare it to one obtained later from a `PetscObject` to determine
733     if the objects are the same. Never compare two object pointer values.
734 
735 .seealso: `PetscObjectState`, `PetscObjectGetId()`
736 M*/
737 typedef PetscInt64 PetscObjectId;
738 
739 /*MC
740     PetscObjectState - integer state for a `PetscObject`
741 
742     Level: developer
743 
744     Notes:
745     Object state is always-increasing and (for objects that track state) can be used to determine if an object has
746     changed since the last time you interacted with it.  It is 64-bit so that it will not overflow for a very long time.
747 
748 .seealso: `PetscObjectId`, `PetscObjectStateGet()`, `PetscObjectStateIncrease()`, `PetscObjectStateSet()`
749 M*/
750 typedef PetscInt64 PetscObjectState;
751 
752 /*S
753      PetscFunctionList - Linked list of functions, possibly stored in dynamic libraries, accessed
754       by string name
755 
756    Level: advanced
757 
758 .seealso: `PetscFunctionListAdd()`, `PetscFunctionListDestroy()`
759 S*/
760 typedef struct _n_PetscFunctionList *PetscFunctionList;
761 
762 /*E
763   PetscFileMode - Access mode for a file.
764 
765   Values:
766 +  `FILE_MODE_UNDEFINED` - initial invalid value
767 .  `FILE_MODE_READ` - open a file at its beginning for reading
768 .  `FILE_MODE_WRITE` - open a file at its beginning for writing (will create if the file does not exist)
769 .  `FILE_MODE_APPEND` - open a file at end for writing
770 .  `FILE_MODE_UPDATE` - open a file for updating, meaning for reading and writing
771 -  `FILE_MODE_APPEND_UPDATE` - open a file for updating, meaning for reading and writing, at the end
772 
773   Level: beginner
774 
775 .seealso: `PetscViewerFileSetMode()`
776 E*/
777 typedef enum {
778   FILE_MODE_UNDEFINED = -1,
779   FILE_MODE_READ      = 0,
780   FILE_MODE_WRITE,
781   FILE_MODE_APPEND,
782   FILE_MODE_UPDATE,
783   FILE_MODE_APPEND_UPDATE
784 } PetscFileMode;
785 PETSC_EXTERN const char *const PetscFileModes[];
786 
787 typedef void *PetscDLHandle;
788 typedef enum {
789   PETSC_DL_DECIDE = 0,
790   PETSC_DL_NOW    = 1,
791   PETSC_DL_LOCAL  = 2
792 } PetscDLMode;
793 
794 /*S
795      PetscObjectList - Linked list of PETSc objects, each accessible by string name
796 
797    Level: developer
798 
799    Note:
800    Used by `PetscObjectCompose()` and `PetscObjectQuery()`
801 
802 .seealso: `PetscObjectListAdd()`, `PetscObjectListDestroy()`, `PetscObjectListFind()`, `PetscObjectCompose()`, `PetscObjectQuery()`, `PetscFunctionList`
803 S*/
804 typedef struct _n_PetscObjectList *PetscObjectList;
805 
806 /*S
807      PetscDLLibrary - Linked list of dynamic libraries to search for functions
808 
809    Level: developer
810 
811 .seealso: `PetscDLLibraryOpen()`
812 S*/
813 typedef struct _n_PetscDLLibrary *PetscDLLibrary;
814 
815 /*S
816      PetscContainer - Simple PETSc object that contains a pointer to any required data
817 
818    Level: advanced
819 
820    Note:
821    This is useful to attach arbitrary data to a `PetscObject` with `PetscObjectCompose()` and `PetscObjectQuery()`
822 
823 .seealso: `PetscObject`, `PetscContainerCreate()`, `PetscObjectCompose()`, `PetscObjectQuery()`
824 S*/
825 typedef struct _p_PetscContainer *PetscContainer;
826 
827 /*S
828      PetscRandom - Abstract PETSc object that manages generating random numbers
829 
830    Level: intermediate
831 
832 .seealso: `PetscRandomCreate()`, `PetscRandomGetValue()`, `PetscRandomType`
833 S*/
834 typedef struct _p_PetscRandom *PetscRandom;
835 
836 /*
837    In binary files variables are stored using the following lengths,
838   regardless of how they are stored in memory on any one particular
839   machine. Use these rather then sizeof() in computing sizes for
840   PetscBinarySeek().
841 */
842 #define PETSC_BINARY_INT_SIZE    (32 / 8)
843 #define PETSC_BINARY_FLOAT_SIZE  (32 / 8)
844 #define PETSC_BINARY_CHAR_SIZE   (8 / 8)
845 #define PETSC_BINARY_SHORT_SIZE  (16 / 8)
846 #define PETSC_BINARY_DOUBLE_SIZE (64 / 8)
847 #define PETSC_BINARY_SCALAR_SIZE sizeof(PetscScalar)
848 
849 /*E
850   PetscBinarySeekType - argument to `PetscBinarySeek()`
851 
852   Values:
853 +  `PETSC_BINARY_SEEK_SET` - offset is an absolute location in the file
854 .  `PETSC_BINARY_SEEK_CUR` - offset is an offset from the current location of the file pointer
855 -  `PETSC_BINARY_SEEK_END` - offset is an offset from the end of the file
856 
857   Level: advanced
858 
859 .seealso: `PetscBinarySeek()`, `PetscBinarySynchronizedSeek()`
860 E*/
861 typedef enum {
862   PETSC_BINARY_SEEK_SET = 0,
863   PETSC_BINARY_SEEK_CUR = 1,
864   PETSC_BINARY_SEEK_END = 2
865 } PetscBinarySeekType;
866 
867 /*E
868     PetscBuildTwoSidedType - algorithm for setting up two-sided communication for use with `PetscSF`
869 
870    Values:
871 +  `PETSC_BUILDTWOSIDED_ALLREDUCE` - classical algorithm using an `MPI_Allreduce()` with
872       a buffer of length equal to the communicator size. Not memory-scalable due to
873       the large reduction size. Requires only an MPI-1 implementation.
874 .  `PETSC_BUILDTWOSIDED_IBARRIER` - nonblocking algorithm based on `MPI_Issend()` and `MPI_Ibarrier()`.
875       Proved communication-optimal in Hoefler, Siebert, and Lumsdaine (2010). Requires an MPI-3 implementation.
876 -  `PETSC_BUILDTWOSIDED_REDSCATTER` - similar to above, but use more optimized function
877       that only communicates the part of the reduction that is necessary.  Requires an MPI-2 implementation.
878 
879    Level: developer
880 
881 .seealso: `PetscCommBuildTwoSided()`, `PetscCommBuildTwoSidedSetType()`, `PetscCommBuildTwoSidedGetType()`
882 E*/
883 typedef enum {
884   PETSC_BUILDTWOSIDED_NOTSET     = -1,
885   PETSC_BUILDTWOSIDED_ALLREDUCE  = 0,
886   PETSC_BUILDTWOSIDED_IBARRIER   = 1,
887   PETSC_BUILDTWOSIDED_REDSCATTER = 2
888   /* Updates here must be accompanied by updates in finclude/petscsys.h and the string array in mpits.c */
889 } PetscBuildTwoSidedType;
890 PETSC_EXTERN const char *const PetscBuildTwoSidedTypes[];
891 
892 /* NOTE: If you change this, you must also change the values in src/vec/f90-mod/petscvec.h */
893 /*E
894   InsertMode - How the entries are combined with the current values in the vectors or matrices
895 
896   Values:
897 +  `NOT_SET_VALUES` - do not actually use the values
898 .  `INSERT_VALUES` - replace the current values with the provided values, unless the index is marked as constrained by the `PetscSection`
899 .  `ADD_VALUES` - add the values to the current values, unless the index is marked as constrained by the `PetscSection`
900 .  `MAX_VALUES` - use the maximum of each current value and provided value
901 .  `MIN_VALUES` - use the minimum of each current value and provided value
902 .  `INSERT_ALL_VALUES` - insert, even if indices that are not marked as constrained by the `PetscSection`
903 .  `ADD_ALL_VALUES` - add, even if indices that are not marked as constrained by the `PetscSection`
904 .  `INSERT_BC_VALUES` - insert, but ignore indices that are not marked as constrained by the `PetscSection`
905 -  `ADD_BC_VALUES` - add, but ignore indices that are not marked as constrained by the `PetscSection`
906 
907   Level: beginner
908 
909   Note:
910   The `PetscSection` that determines the effects of the `InsertMode` values can be obtained by the `Vec` object with `VecGetDM()`
911   and `DMGetLocalSection()`.
912 
913   Not all options are supported for all operations or PETSc object types.
914 
915 .seealso: `VecSetValues()`, `MatSetValues()`, `VecSetValue()`, `VecSetValuesBlocked()`,
916           `VecSetValuesLocal()`, `VecSetValuesBlockedLocal()`, `MatSetValuesBlocked()`,
917           `MatSetValuesBlockedLocal()`, `MatSetValuesLocal()`, `VecScatterBegin()`, `VecScatterEnd()`
918 E*/
919 typedef enum {
920   NOT_SET_VALUES,
921   INSERT_VALUES,
922   ADD_VALUES,
923   MAX_VALUES,
924   MIN_VALUES,
925   INSERT_ALL_VALUES,
926   ADD_ALL_VALUES,
927   INSERT_BC_VALUES,
928   ADD_BC_VALUES
929 } InsertMode;
930 
931 /*MC
932     INSERT_VALUES - Put a value into a vector or matrix, overwrites any previous value
933 
934     Level: beginner
935 
936 .seealso: `InsertMode`, `VecSetValues()`, `MatSetValues()`, `VecSetValue()`, `VecSetValuesBlocked()`,
937           `VecSetValuesLocal()`, `VecSetValuesBlockedLocal()`, `MatSetValuesBlocked()`, `ADD_VALUES`,
938           `MatSetValuesBlockedLocal()`, `MatSetValuesLocal()`, `VecScatterBegin()`, `VecScatterEnd()`, `MAX_VALUES`
939 M*/
940 
941 /*MC
942     ADD_VALUES - Adds a value into a vector or matrix, if there previously was no value, just puts the
943                 value into that location
944 
945     Level: beginner
946 
947 .seealso: `InsertMode`, `VecSetValues()`, `MatSetValues()`, `VecSetValue()`, `VecSetValuesBlocked()`,
948           `VecSetValuesLocal()`, `VecSetValuesBlockedLocal()`, `MatSetValuesBlocked()`, `INSERT_VALUES`,
949           `MatSetValuesBlockedLocal()`, `MatSetValuesLocal()`, `VecScatterBegin()`, `VecScatterEnd()`, `MAX_VALUES`
950 M*/
951 
952 /*MC
953     MAX_VALUES - Puts the maximum of the scattered/gathered value and the current value into each location
954 
955     Level: beginner
956 
957 .seealso: `InsertMode`, `VecScatterBegin()`, `VecScatterEnd()`, `ADD_VALUES`, `INSERT_VALUES`
958 M*/
959 
960 /*MC
961     MIN_VALUES - Puts the minimal of the scattered/gathered value and the current value into each location
962 
963     Level: beginner
964 
965 .seealso: `InsertMode`, `VecScatterBegin()`, `VecScatterEnd()`, `ADD_VALUES`, `INSERT_VALUES`
966 M*/
967 
968 /*S
969    PetscSubcomm - A decomposition of an MPI communicator into subcommunicators
970 
971    Values:
972 +   `PETSC_SUBCOMM_GENERAL` - similar to `MPI_Comm_split()` each process sets the new communicator (color) they will belong to and the order within that communicator
973 .   `PETSC_SUBCOMM_CONTIGUOUS` - each new communicator contains a set of process with contiguous ranks in the original MPI communicator
974 -   `PETSC_SUBCOMM_INTERLACED` - each new communictor contains a set of processes equally far apart in rank from the others in that new communicator
975 
976    Sample Usage:
977 .vb
978        PetscSubcommCreate()
979        PetscSubcommSetNumber()
980        PetscSubcommSetType(PETSC_SUBCOMM_INTERLACED);
981        ccomm = PetscSubcommChild()
982        PetscSubcommDestroy()
983 .ve
984 
985    Example:
986    Consider a communicator with six processes split into 3 subcommunicators.
987 .vb
988    PETSC_SUBCOMM_CONTIGUOUS - the first communicator contains rank 0,1  the second rank 2,3 and the third rank 4,5 in the original ordering of the original communicator
989    PETSC_SUBCOMM_INTERLACED - the first communicator contains rank 0,3, the second 1,4 and the third 2,5
990 .ve
991 
992    Level: advanced
993 
994    Note:
995    After a call to `PetscSubcommSetType()`, `PetscSubcommSetTypeGeneral()`, or `PetscSubcommSetFromOptions()` one may call
996 .vb
997      PetscSubcommChild() returns the associated subcommunicator on this process
998      PetscSubcommContiguousParent() returns a parent communitor but with all child of the same subcommunicator having contiguous rank
999 .ve
1000 
1001    Developer Note:
1002    This is used in objects such as `PCREDUNDANT` to manage the subcommunicators on which the redundant computations
1003    are performed.
1004 
1005 .seealso: `PetscSubcommCreate()`, `PetscSubcommSetNumber()`, `PetscSubcommSetType()`, `PetscSubcommView()`, `PetscSubcommSetFromOptions()`
1006 S*/
1007 typedef struct _n_PetscSubcomm *PetscSubcomm;
1008 typedef enum {
1009   PETSC_SUBCOMM_GENERAL    = 0,
1010   PETSC_SUBCOMM_CONTIGUOUS = 1,
1011   PETSC_SUBCOMM_INTERLACED = 2
1012 } PetscSubcommType;
1013 PETSC_EXTERN const char *const PetscSubcommTypes[];
1014 
1015 /*S
1016      PetscHeap - A simple class for managing heaps
1017 
1018    Level: intermediate
1019 
1020 .seealso: `PetscHeapCreate()`, `PetscHeapAdd()`, `PetscHeapPop()`, `PetscHeapPeek()`, `PetscHeapStash()`, `PetscHeapUnstash()`, `PetscHeapView()`, `PetscHeapDestroy()`
1021 S*/
1022 typedef struct _PetscHeap *PetscHeap;
1023 
1024 typedef struct _n_PetscShmComm *PetscShmComm;
1025 typedef struct _n_PetscOmpCtrl *PetscOmpCtrl;
1026 
1027 /*S
1028    PetscSegBuffer - a segmented extendable buffer
1029 
1030    Level: developer
1031 
1032 .seealso: `PetscSegBufferCreate()`, `PetscSegBufferGet()`, `PetscSegBufferExtract()`, `PetscSegBufferDestroy()`
1033 S*/
1034 typedef struct _n_PetscSegBuffer *PetscSegBuffer;
1035 
1036 typedef struct _n_PetscOptionsHelpPrinted *PetscOptionsHelpPrinted;
1037 #endif
1038