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 E*/ 594 typedef enum { 595 PETSC_COPY_VALUES, 596 PETSC_OWN_POINTER, 597 PETSC_USE_POINTER 598 } PetscCopyMode; 599 PETSC_EXTERN const char *const PetscCopyModes[]; 600 601 /*MC 602 PETSC_FALSE - False value of `PetscBool` 603 604 Level: beginner 605 606 Note: 607 Zero integer 608 609 .seealso: `PetscBool`, `PetscBool3`, `PETSC_TRUE` 610 M*/ 611 612 /*MC 613 PETSC_TRUE - True value of `PetscBool` 614 615 Level: beginner 616 617 Note: 618 Nonzero integer 619 620 .seealso: `PetscBool`, `PetscBool3`, `PETSC_FALSE` 621 M*/ 622 623 /*MC 624 PetscLogDouble - Used for logging times 625 626 Level: developer 627 628 Note: 629 Contains double precision numbers that are not used in the numerical computations, but rather in logging, timing etc. 630 631 M*/ 632 typedef double PetscLogDouble; 633 634 /*E 635 PetscDataType - Used for handling different basic data types. 636 637 Level: beginner 638 639 Notes: 640 Use of this should be avoided if one can directly use `MPI_Datatype` instead. 641 642 `PETSC_INT` is the datatype for a `PetscInt`, regardless of whether it is 4 or 8 bytes. 643 `PETSC_REAL`, `PETSC_COMPLEX` and `PETSC_SCALAR` are the datatypes for `PetscReal`, `PetscComplex` and `PetscScalar`, regardless of their sizes. 644 645 Developer Notes: 646 It would be nice if we could always just use MPI Datatypes, why can we not? 647 648 If you change any values in `PetscDatatype` make sure you update their usage in 649 share/petsc/matlab/PetscBagRead.m and share/petsc/matlab/@PetscOpenSocket/read/write.m 650 651 TODO: 652 Add PETSC_INT32 and remove use of improper `PETSC_ENUM` 653 654 .seealso: `PetscBinaryRead()`, `PetscBinaryWrite()`, `PetscDataTypeToMPIDataType()`, 655 `PetscDataTypeGetSize()` 656 E*/ 657 typedef enum { 658 PETSC_DATATYPE_UNKNOWN = 0, 659 PETSC_DOUBLE = 1, 660 PETSC_COMPLEX = 2, 661 PETSC_LONG = 3, 662 PETSC_SHORT = 4, 663 PETSC_FLOAT = 5, 664 PETSC_CHAR = 6, 665 PETSC_BIT_LOGICAL = 7, 666 PETSC_ENUM = 8, 667 PETSC_BOOL = 9, 668 PETSC___FLOAT128 = 10, 669 PETSC_OBJECT = 11, 670 PETSC_FUNCTION = 12, 671 PETSC_STRING = 13, 672 PETSC___FP16 = 14, 673 PETSC_STRUCT = 15, 674 PETSC_INT = 16, 675 PETSC_INT64 = 17, 676 PETSC_COUNT = 18 677 } PetscDataType; 678 PETSC_EXTERN const char *const PetscDataTypes[]; 679 680 #if defined(PETSC_USE_REAL_SINGLE) 681 #define PETSC_REAL PETSC_FLOAT 682 #elif defined(PETSC_USE_REAL_DOUBLE) 683 #define PETSC_REAL PETSC_DOUBLE 684 #elif defined(PETSC_USE_REAL___FLOAT128) 685 #define PETSC_REAL PETSC___FLOAT128 686 #elif defined(PETSC_USE_REAL___FP16) 687 #define PETSC_REAL PETSC___FP16 688 #else 689 #define PETSC_REAL PETSC_DOUBLE 690 #endif 691 692 #if defined(PETSC_USE_COMPLEX) 693 #define PETSC_SCALAR PETSC_COMPLEX 694 #else 695 #define PETSC_SCALAR PETSC_REAL 696 #endif 697 698 #define PETSC_FORTRANADDR PETSC_LONG 699 700 /*S 701 PetscToken - 'Token' used for managing tokenizing strings 702 703 Level: intermediate 704 705 .seealso: `PetscTokenCreate()`, `PetscTokenFind()`, `PetscTokenDestroy()` 706 S*/ 707 typedef struct _p_PetscToken *PetscToken; 708 709 /*S 710 PetscObject - any PETSc object, `PetscViewer`, `Mat`, `Vec`, `KSP` etc 711 712 Level: beginner 713 714 Notes: 715 This is the base class from which all PETSc objects are derived from. 716 717 In certain situations one can cast an object, for example a `Vec`, to a `PetscObject` with (`PetscObject`)vec 718 719 .seealso: `PetscObjectDestroy()`, `PetscObjectView()`, `PetscObjectGetName()`, `PetscObjectSetName()`, `PetscObjectReference()`, `PetscObjectDereference()` 720 S*/ 721 typedef struct _p_PetscObject *PetscObject; 722 723 /*MC 724 PetscObjectId - unique integer Id for a `PetscObject` 725 726 Level: developer 727 728 Note: 729 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 730 if the objects are the same. Never compare two object pointer values. 731 732 .seealso: `PetscObjectState`, `PetscObjectGetId()` 733 M*/ 734 typedef PetscInt64 PetscObjectId; 735 736 /*MC 737 PetscObjectState - integer state for a `PetscObject` 738 739 Level: developer 740 741 Notes: 742 Object state is always-increasing and (for objects that track state) can be used to determine if an object has 743 changed since the last time you interacted with it. It is 64-bit so that it will not overflow for a very long time. 744 745 .seealso: `PetscObjectId`, `PetscObjectStateGet()`, `PetscObjectStateIncrease()`, `PetscObjectStateSet()` 746 M*/ 747 typedef PetscInt64 PetscObjectState; 748 749 /*S 750 PetscFunctionList - Linked list of functions, possibly stored in dynamic libraries, accessed 751 by string name 752 753 Level: advanced 754 755 .seealso: `PetscFunctionListAdd()`, `PetscFunctionListDestroy()` 756 S*/ 757 typedef struct _n_PetscFunctionList *PetscFunctionList; 758 759 /*E 760 PetscFileMode - Access mode for a file. 761 762 Values: 763 + `FILE_MODE_UNDEFINED` - initial invalid value 764 . `FILE_MODE_READ` - open a file at its beginning for reading 765 . `FILE_MODE_WRITE` - open a file at its beginning for writing (will create if the file does not exist) 766 . `FILE_MODE_APPEND` - open a file at end for writing 767 . `FILE_MODE_UPDATE` - open a file for updating, meaning for reading and writing 768 - `FILE_MODE_APPEND_UPDATE` - open a file for updating, meaning for reading and writing, at the end 769 770 Level: beginner 771 772 .seealso: `PetscViewerFileSetMode()` 773 E*/ 774 typedef enum { 775 FILE_MODE_UNDEFINED = -1, 776 FILE_MODE_READ = 0, 777 FILE_MODE_WRITE, 778 FILE_MODE_APPEND, 779 FILE_MODE_UPDATE, 780 FILE_MODE_APPEND_UPDATE 781 } PetscFileMode; 782 PETSC_EXTERN const char *const PetscFileModes[]; 783 784 typedef void *PetscDLHandle; 785 typedef enum { 786 PETSC_DL_DECIDE = 0, 787 PETSC_DL_NOW = 1, 788 PETSC_DL_LOCAL = 2 789 } PetscDLMode; 790 791 /*S 792 PetscObjectList - Linked list of PETSc objects, each accessible by string name 793 794 Level: developer 795 796 Note: 797 Used by `PetscObjectCompose()` and `PetscObjectQuery()` 798 799 .seealso: `PetscObjectListAdd()`, `PetscObjectListDestroy()`, `PetscObjectListFind()`, `PetscObjectCompose()`, `PetscObjectQuery()`, `PetscFunctionList` 800 S*/ 801 typedef struct _n_PetscObjectList *PetscObjectList; 802 803 /*S 804 PetscDLLibrary - Linked list of dynamic libraries to search for functions 805 806 Level: developer 807 808 .seealso: `PetscDLLibraryOpen()` 809 S*/ 810 typedef struct _n_PetscDLLibrary *PetscDLLibrary; 811 812 /*S 813 PetscContainer - Simple PETSc object that contains a pointer to any required data 814 815 Level: advanced 816 817 Note: 818 This is useful to attach arbitrary data to a `PetscObject` with `PetscObjectCompose()` and `PetscObjectQuery()` 819 820 .seealso: `PetscObject`, `PetscContainerCreate()`, `PetscObjectCompose()`, `PetscObjectQuery()` 821 S*/ 822 typedef struct _p_PetscContainer *PetscContainer; 823 824 /*S 825 PetscRandom - Abstract PETSc object that manages generating random numbers 826 827 Level: intermediate 828 829 .seealso: `PetscRandomCreate()`, `PetscRandomGetValue()`, `PetscRandomType` 830 S*/ 831 typedef struct _p_PetscRandom *PetscRandom; 832 833 /* 834 In binary files variables are stored using the following lengths, 835 regardless of how they are stored in memory on any one particular 836 machine. Use these rather then sizeof() in computing sizes for 837 PetscBinarySeek(). 838 */ 839 #define PETSC_BINARY_INT_SIZE (32 / 8) 840 #define PETSC_BINARY_FLOAT_SIZE (32 / 8) 841 #define PETSC_BINARY_CHAR_SIZE (8 / 8) 842 #define PETSC_BINARY_SHORT_SIZE (16 / 8) 843 #define PETSC_BINARY_DOUBLE_SIZE (64 / 8) 844 #define PETSC_BINARY_SCALAR_SIZE sizeof(PetscScalar) 845 846 /*E 847 PetscBinarySeekType - argument to `PetscBinarySeek()` 848 849 Values: 850 + `PETSC_BINARY_SEEK_SET` - offset is an absolute location in the file 851 . `PETSC_BINARY_SEEK_CUR` - offset is an offset from the current location of the file pointer 852 - `PETSC_BINARY_SEEK_END` - offset is an offset from the end of the file 853 854 Level: advanced 855 856 .seealso: `PetscBinarySeek()`, `PetscBinarySynchronizedSeek()` 857 E*/ 858 typedef enum { 859 PETSC_BINARY_SEEK_SET = 0, 860 PETSC_BINARY_SEEK_CUR = 1, 861 PETSC_BINARY_SEEK_END = 2 862 } PetscBinarySeekType; 863 864 /*E 865 PetscBuildTwoSidedType - algorithm for setting up two-sided communication for use with `PetscSF` 866 867 Values: 868 + `PETSC_BUILDTWOSIDED_ALLREDUCE` - classical algorithm using an `MPI_Allreduce()` with 869 a buffer of length equal to the communicator size. Not memory-scalable due to 870 the large reduction size. Requires only an MPI-1 implementation. 871 . `PETSC_BUILDTWOSIDED_IBARRIER` - nonblocking algorithm based on `MPI_Issend()` and `MPI_Ibarrier()`. 872 Proved communication-optimal in Hoefler, Siebert, and Lumsdaine (2010). Requires an MPI-3 implementation. 873 - `PETSC_BUILDTWOSIDED_REDSCATTER` - similar to above, but use more optimized function 874 that only communicates the part of the reduction that is necessary. Requires an MPI-2 implementation. 875 876 Level: developer 877 878 .seealso: `PetscCommBuildTwoSided()`, `PetscCommBuildTwoSidedSetType()`, `PetscCommBuildTwoSidedGetType()` 879 E*/ 880 typedef enum { 881 PETSC_BUILDTWOSIDED_NOTSET = -1, 882 PETSC_BUILDTWOSIDED_ALLREDUCE = 0, 883 PETSC_BUILDTWOSIDED_IBARRIER = 1, 884 PETSC_BUILDTWOSIDED_REDSCATTER = 2 885 /* Updates here must be accompanied by updates in finclude/petscsys.h and the string array in mpits.c */ 886 } PetscBuildTwoSidedType; 887 PETSC_EXTERN const char *const PetscBuildTwoSidedTypes[]; 888 889 /* NOTE: If you change this, you must also change the values in src/vec/f90-mod/petscvec.h */ 890 /*E 891 InsertMode - How the entries are combined with the current values in the vectors or matrices 892 893 Values: 894 + `NOT_SET_VALUES` - do not actually use the values 895 . `INSERT_VALUES` - replace the current values with the provided values, unless the index is marked as constrained by the `PetscSection` 896 . `ADD_VALUES` - add the values to the current values, unless the index is marked as constrained by the `PetscSection` 897 . `MAX_VALUES` - use the maximum of each current value and provided value 898 . `MIN_VALUES` - use the minimum of each current value and provided value 899 . `INSERT_ALL_VALUES` - insert, even if indices that are not marked as constrained by the `PetscSection` 900 . `ADD_ALL_VALUES` - add, even if indices that are not marked as constrained by the `PetscSection` 901 . `INSERT_BC_VALUES` - insert, but ignore indices that are not marked as constrained by the `PetscSection` 902 - `ADD_BC_VALUES` - add, but ignore indices that are not marked as constrained by the `PetscSection` 903 904 Level: beginner 905 906 Note: 907 The `PetscSection` that determines the effects of the `InsertMode` values can be obtained by the `Vec` object with `VecGetDM()` 908 and `DMGetLocalSection()`. 909 910 Not all options are supported for all operations or PETSc object types. 911 912 .seealso: `VecSetValues()`, `MatSetValues()`, `VecSetValue()`, `VecSetValuesBlocked()`, 913 `VecSetValuesLocal()`, `VecSetValuesBlockedLocal()`, `MatSetValuesBlocked()`, 914 `MatSetValuesBlockedLocal()`, `MatSetValuesLocal()`, `VecScatterBegin()`, `VecScatterEnd()` 915 E*/ 916 typedef enum { 917 NOT_SET_VALUES, 918 INSERT_VALUES, 919 ADD_VALUES, 920 MAX_VALUES, 921 MIN_VALUES, 922 INSERT_ALL_VALUES, 923 ADD_ALL_VALUES, 924 INSERT_BC_VALUES, 925 ADD_BC_VALUES 926 } InsertMode; 927 928 /*MC 929 INSERT_VALUES - Put a value into a vector or matrix, overwrites any previous value 930 931 Level: beginner 932 933 .seealso: `InsertMode`, `VecSetValues()`, `MatSetValues()`, `VecSetValue()`, `VecSetValuesBlocked()`, 934 `VecSetValuesLocal()`, `VecSetValuesBlockedLocal()`, `MatSetValuesBlocked()`, `ADD_VALUES`, 935 `MatSetValuesBlockedLocal()`, `MatSetValuesLocal()`, `VecScatterBegin()`, `VecScatterEnd()`, `MAX_VALUES` 936 M*/ 937 938 /*MC 939 ADD_VALUES - Adds a value into a vector or matrix, if there previously was no value, just puts the 940 value into that location 941 942 Level: beginner 943 944 .seealso: `InsertMode`, `VecSetValues()`, `MatSetValues()`, `VecSetValue()`, `VecSetValuesBlocked()`, 945 `VecSetValuesLocal()`, `VecSetValuesBlockedLocal()`, `MatSetValuesBlocked()`, `INSERT_VALUES`, 946 `MatSetValuesBlockedLocal()`, `MatSetValuesLocal()`, `VecScatterBegin()`, `VecScatterEnd()`, `MAX_VALUES` 947 M*/ 948 949 /*MC 950 MAX_VALUES - Puts the maximum of the scattered/gathered value and the current value into each location 951 952 Level: beginner 953 954 .seealso: `InsertMode`, `VecScatterBegin()`, `VecScatterEnd()`, `ADD_VALUES`, `INSERT_VALUES` 955 M*/ 956 957 /*MC 958 MIN_VALUES - Puts the minimal of the scattered/gathered value and the current value into each location 959 960 Level: beginner 961 962 .seealso: `InsertMode`, `VecScatterBegin()`, `VecScatterEnd()`, `ADD_VALUES`, `INSERT_VALUES` 963 M*/ 964 965 /*S 966 PetscSubcomm - A decomposition of an MPI communicator into subcommunicators 967 968 Values: 969 + `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 970 . `PETSC_SUBCOMM_CONTIGUOUS` - each new communicator contains a set of process with contiguous ranks in the original MPI communicator 971 - `PETSC_SUBCOMM_INTERLACED` - each new communictor contains a set of processes equally far apart in rank from the others in that new communicator 972 973 Sample Usage: 974 .vb 975 PetscSubcommCreate() 976 PetscSubcommSetNumber() 977 PetscSubcommSetType(PETSC_SUBCOMM_INTERLACED); 978 ccomm = PetscSubcommChild() 979 PetscSubcommDestroy() 980 .ve 981 982 Example: 983 Consider a communicator with six processes split into 3 subcommunicators. 984 .vb 985 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 986 PETSC_SUBCOMM_INTERLACED - the first communicator contains rank 0,3, the second 1,4 and the third 2,5 987 .ve 988 989 Level: advanced 990 991 Note: 992 After a call to `PetscSubcommSetType()`, `PetscSubcommSetTypeGeneral()`, or `PetscSubcommSetFromOptions()` one may call 993 .vb 994 PetscSubcommChild() returns the associated subcommunicator on this process 995 PetscSubcommContiguousParent() returns a parent communitor but with all child of the same subcommunicator having contiguous rank 996 .ve 997 998 Developer Note: 999 This is used in objects such as `PCREDUNDANT` to manage the subcommunicators on which the redundant computations 1000 are performed. 1001 1002 .seealso: `PetscSubcommCreate()`, `PetscSubcommSetNumber()`, `PetscSubcommSetType()`, `PetscSubcommView()`, `PetscSubcommSetFromOptions()` 1003 S*/ 1004 typedef struct _n_PetscSubcomm *PetscSubcomm; 1005 typedef enum { 1006 PETSC_SUBCOMM_GENERAL = 0, 1007 PETSC_SUBCOMM_CONTIGUOUS = 1, 1008 PETSC_SUBCOMM_INTERLACED = 2 1009 } PetscSubcommType; 1010 PETSC_EXTERN const char *const PetscSubcommTypes[]; 1011 1012 /*S 1013 PetscHeap - A simple class for managing heaps 1014 1015 Level: intermediate 1016 1017 .seealso: `PetscHeapCreate()`, `PetscHeapAdd()`, `PetscHeapPop()`, `PetscHeapPeek()`, `PetscHeapStash()`, `PetscHeapUnstash()`, `PetscHeapView()`, `PetscHeapDestroy()` 1018 S*/ 1019 typedef struct _PetscHeap *PetscHeap; 1020 1021 typedef struct _n_PetscShmComm *PetscShmComm; 1022 typedef struct _n_PetscOmpCtrl *PetscOmpCtrl; 1023 1024 /*S 1025 PetscSegBuffer - a segmented extendable buffer 1026 1027 Level: developer 1028 1029 .seealso: `PetscSegBufferCreate()`, `PetscSegBufferGet()`, `PetscSegBufferExtract()`, `PetscSegBufferDestroy()` 1030 S*/ 1031 typedef struct _n_PetscSegBuffer *PetscSegBuffer; 1032 1033 typedef struct _n_PetscOptionsHelpPrinted *PetscOptionsHelpPrinted; 1034 #endif 1035