Actual source code: petscsystypes.h

  1: #if !defined(PETSCSYSTYPES_H)
  2: #define PETSCSYSTYPES_H

  4: #include <petscconf.h>
  5: #include <petscconf_poison.h>
  6: #include <petscfix.h>
  7: #include <stddef.h>

  9: /*MC
 10:     PetscErrorCode - datatype used for return error code from almost all PETSc functions

 12:     Level: beginner

 14: .seealso: PetscCall(), SETERRQ()
 15: M*/
 16: typedef int PetscErrorCode;

 18: /*MC

 20:     PetscClassId - A unique id used to identify each PETSc class.

 22:     Notes:
 23:     Use PetscClassIdRegister() to obtain a new value for a new class being created. Usually
 24:          XXXInitializePackage() calls it for each class it defines.

 26:     Developer Notes:
 27:     Internal integer stored in the _p_PetscObject data structure.
 28:          These are all computed by an offset from the lowest one, PETSC_SMALLEST_CLASSID.

 30:     Level: developer

 32: .seealso: PetscClassIdRegister(), PetscLogEventRegister(), PetscHeaderCreate()
 33: M*/
 34: typedef int PetscClassId;

 36: /*MC
 37:     PetscMPIInt - datatype used to represent 'int' parameters to MPI functions.

 39:     Level: intermediate

 41:     Notes:
 42:     usually this is the same as PetscInt, but if PETSc was built with --with-64-bit-indices but
 43:            standard C/Fortran integers are 32 bit then this is NOT the same as PetscInt; it remains 32 bit.

 45:     PetscMPIIntCast(a,&b) checks if the given PetscInt a will fit in a PetscMPIInt, if not it
 46:       generates a PETSC_ERR_ARG_OUTOFRANGE error.

 48: .seealso: PetscBLASInt, PetscInt, PetscMPIIntCast()

 50: M*/
 51: typedef int PetscMPIInt;

 53: /*MC
 54:     PetscSizeT - datatype used to represent sizes in memory (like size_t)

 56:     Level: intermediate

 58:     Notes:
 59:     This is equivalent to size_t, but defined for consistency with Fortran, which lacks a native equivalent of size_t.

 61: .seealso: PetscInt, PetscInt64, PetscCount

 63: M*/
 64: typedef size_t PetscSizeT;

 66: /*MC
 67:     PetscCount - signed datatype used to represent counts

 69:     Level: intermediate

 71:     Notes:
 72:     This is equivalent to ptrdiff_t, but defined for consistency with Fortran, which lacks a native equivalent of ptrdiff_t.

 74:     Use PetscCount_FMT to format with PetscPrintf(), printf(), and related functions.

 76: .seealso: PetscInt, PetscInt64, PetscSizeT

 78: M*/
 79: typedef ptrdiff_t PetscCount;

 81: /*MC
 82:     PetscEnum - datatype used to pass enum types within PETSc functions.

 84:     Level: intermediate

 86: .seealso: PetscOptionsGetEnum(), PetscOptionsEnum(), PetscBagRegisterEnum()
 87: M*/
 88: typedef enum { ENUM_DUMMY } PetscEnum;

 90: typedef short PetscShort;
 91: typedef char  PetscChar;
 92: typedef float PetscFloat;

 94: /*MC
 95:   PetscInt - PETSc type that represents an integer, used primarily to
 96:       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.

 98:   Notes:
 99:   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.

101:   Level: beginner

103: .seealso: PetscBLASInt, PetscMPIInt, PetscReal, PetscScalar, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT
104: M*/

106: #if defined(PETSC_HAVE_STDINT_H)
107: #  include <stdint.h>
108: #endif
109: #if defined (PETSC_HAVE_INTTYPES_H)
110: #  if !defined(__STDC_FORMAT_MACROS)
111: #    define __STDC_FORMAT_MACROS /* required for using PRId64 from c++ */
112: #  endif
113: #  include <inttypes.h>
114: #  if !defined(PRId64)
115: #    define PRId64 "ld"
116: #  endif
117: #endif

119: #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 */
120:    typedef int64_t PetscInt64;
121: #elif (PETSC_SIZEOF_LONG_LONG == 8)
122:    typedef long long PetscInt64;
123: #elif defined(PETSC_HAVE___INT64)
124:    typedef __int64 PetscInt64;
125: #else
126: #  error "cannot determine PetscInt64 type"
127: #endif

129: #if defined(PETSC_USE_64BIT_INDICES)
130:    typedef PetscInt64 PetscInt;
131: #else
132:    typedef int PetscInt;
133: #endif

135: #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 */
136: #  define MPIU_INT64     MPI_INT64_T
137: #  define PetscInt64_FMT PRId64
138: #elif (PETSC_SIZEOF_LONG_LONG == 8)
139: #  define MPIU_INT64     MPI_LONG_LONG_INT
140: #  define PetscInt64_FMT "lld"
141: #elif defined(PETSC_HAVE___INT64)
142: #  define MPIU_INT64     MPI_INT64_T
143: #  define PetscInt64_FMT "ld"
144: #else
145: #  error "cannot determine PetscInt64 type"
146: #endif

148: #if PETSC_SIZEOF_SIZE_T == 8
149: #  define PetscCount_FMT PetscInt64_FMT
150: #else
151: #  define PetscCount_FMT "d"
152: #endif

154: /*MC
155:    PetscBLASInt - datatype used to represent 'int' parameters to BLAS/LAPACK functions.

157:    Notes:
158:     Usually this is the same as PetscInt, but if PETSc was built with --with-64-bit-indices but
159:            standard C/Fortran integers are 32 bit then this is NOT the same as PetscInt it remains 32 bit
160:            (except on very rare BLAS/LAPACK implementations that support 64 bit integers see the notes below).

162:     PetscErrorCode PetscBLASIntCast(a,&b) checks if the given PetscInt a will fit in a PetscBLASInt, if not it
163:       generates a PETSC_ERR_ARG_OUTOFRANGE error

165:    Installation Notes:
166:     ./configure automatically determines the size of the integers used by BLAS/LAPACK except when --with-batch is used
167:     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-indice

169:     MATLAB ships with BLAS and LAPACK that use 64 bit integers, for example if you run ./configure with, the option
170:      --with-blaslapack-lib=[/Applications/MATLAB_R2010b.app/bin/maci64/libmwblas.dylib,/Applications/MATLAB_R2010b.app/bin/maci64/libmwlapack.dylib]

172:     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
173:     against the 64 bit version, otherwise it use the 32 bit version

175:     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

177:     External packages such as hypre, ML, SuperLU etc do not provide any support for passing 64 bit integers to BLAS/LAPACK so cannot
178:     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
179:     these external libraries while using 64 bit integer BLAS/LAPACK.

181:    Level: intermediate

183: .seealso: PetscMPIInt, PetscInt, PetscBLASIntCast()

185: M*/
186: #if defined(PETSC_HAVE_64BIT_BLAS_INDICES)
187: #  define PetscBLASInt_FMT PetscInt64_FMT
188:    typedef PetscInt64 PetscBLASInt;
189: #else
190: #  define PetscBLASInt_FMT "d"
191:    typedef int PetscBLASInt;
192: #endif

194: /*MC
195:    PetscCuBLASInt - datatype used to represent 'int' parameters to cuBLAS/cuSOLVER functions.

197:    Notes:
198:     As of this writing PetscCuBLASInt is always the system `int`.

200:     PetscErrorCode PetscCuBLASIntCast(a,&b) checks if the given PetscInt a will fit in a PetscCuBLASInt, if not it
201:       generates a PETSC_ERR_ARG_OUTOFRANGE error

203:    Level: intermediate

205: .seealso: PetscBLASInt, PetscMPIInt, PetscInt, PetscCuBLASIntCast()

207: M*/
208: typedef int PetscCuBLASInt;

210: /*E
211:     PetscBool  - Logical variable. Actually an int in C and a logical in Fortran.

213:    Level: beginner

215:    Developer Note:
216:    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
217:       boolean values. It is not easy to have a simple macro that that will work properly in all circumstances with all three mechanisms.

219: .seealso: PETSC_TRUE, PETSC_FALSE, PetscNot()
220: E*/
221: typedef enum { PETSC_FALSE,PETSC_TRUE } PetscBool;

223: /*MC
224:    PetscReal - PETSc type that represents a real number version of PetscScalar

226:    Notes:
227:    For MPI calls that require datatypes, use MPIU_REAL as the datatype for PetscScalar and MPIU_SUM, MPIU_MAX, etc. for operations.
228:           They will automatically work correctly regardless of the size of PetscReal.

230:           See PetscScalar for details on how to ./configure the size of PetscReal.

232:    Level: beginner

234: .seealso: PetscScalar, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT
235: M*/

237: #if defined(PETSC_USE_REAL_SINGLE)
238:    typedef float PetscReal;
239: #elif defined(PETSC_USE_REAL_DOUBLE)
240:    typedef double PetscReal;
241: #elif defined(PETSC_USE_REAL___FLOAT128)
242: #  if defined(__cplusplus)
243:      extern "C" {
244: #  endif
245: #  include <quadmath.h>
246: #  if defined(__cplusplus)
247:      }
248: #  endif
249:    typedef __float128 PetscReal;
250: #elif defined(PETSC_USE_REAL___FP16)
251:    typedef __fp16 PetscReal;
252: #endif /* PETSC_USE_REAL_* */

254: /*MC
255:    PetscComplex - PETSc type that represents a complex number with precision matching that of PetscReal.

257:    Synopsis:
258: #include <petscsys.h>
259:    PetscComplex number = 1. + 2.*PETSC_i;

261:    Notes:
262:    For MPI calls that require datatypes, use MPIU_COMPLEX as the datatype for PetscComplex and MPIU_SUM etc for operations.
263:           They will automatically work correctly regardless of the size of PetscComplex.

265:           See PetscScalar for details on how to ./configure the size of PetscReal

267:           Complex numbers are automatically available if PETSc was able to find a working complex implementation

269:     Petsc has a 'fix' for complex numbers to support expressions such as std::complex<PetscReal> + PetscInt, which are not supported by the standard
270:     C++ library, but are convenient for petsc users. If the C++ compiler is able to compile code in petsccxxcomplexfix.h (This is checked by
271:     configure), we include petsccxxcomplexfix.h to provide this convenience.

273:     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
274:     at the beginning of the C++ file to skip the fix.

276:    Level: beginner

278: .seealso: PetscReal, PetscScalar, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT, PETSC_i
279: M*/
280: #if !defined(PETSC_SKIP_COMPLEX)
281: #  if defined(PETSC_CLANGUAGE_CXX)
282: #    if !defined(PETSC_USE_REAL___FP16) && !defined(PETSC_USE_REAL___FLOAT128)
283: #      if defined(__cplusplus) && defined(PETSC_HAVE_CXX_COMPLEX)  /* enable complex for library code */
284: #        define PETSC_HAVE_COMPLEX 1
285: #      elif !defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) && defined(PETSC_HAVE_CXX_COMPLEX)  /* User code only - conditional on libary code complex support */
286: #        define PETSC_HAVE_COMPLEX 1
287: #      endif
288: #    elif defined(PETSC_USE_REAL___FLOAT128) && defined(PETSC_HAVE_C99_COMPLEX)
289: #        define PETSC_HAVE_COMPLEX 1
290: #    endif
291: #  else /* !PETSC_CLANGUAGE_CXX */
292: #    if !defined(PETSC_USE_REAL___FP16)
293: #      if !defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) /* enable complex for library code */
294: #        define PETSC_HAVE_COMPLEX 1
295: #      elif defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) && defined(PETSC_HAVE_CXX_COMPLEX)  /* User code only - conditional on libary code complex support */
296: #        define PETSC_HAVE_COMPLEX 1
297: #      endif
298: #    endif
299: #  endif /* PETSC_CLANGUAGE_CXX */
300: #endif /* !PETSC_SKIP_COMPLEX */

302: #if defined(PETSC_HAVE_COMPLEX)
303:   #if defined(__cplusplus)  /* C++ complex support */
304:     /* Locate a C++ complex template library */
305:     #if defined(PETSC_DESIRE_KOKKOS_COMPLEX) /* Defined in petscvec_kokkos.hpp for *.kokkos.cxx files */
306:       #define petsccomplexlib Kokkos
307:       #include <Kokkos_Complex.hpp>
308:     #elif defined(__CUDACC__) || defined(__HIPCC__)
309:       #define petsccomplexlib thrust
310:       #include <thrust/complex.h>
311:     #elif defined(PETSC_USE_REAL___FLOAT128)
312:       #include <complex.h>
313:     #else
314:       #define petsccomplexlib std
315:       #include <complex>
316:     #endif

318:     /* Define PetscComplex based on the precision */
319:     #if defined(PETSC_USE_REAL_SINGLE)
320:       typedef petsccomplexlib::complex<float> PetscComplex;
321:     #elif defined(PETSC_USE_REAL_DOUBLE)
322:       typedef petsccomplexlib::complex<double> PetscComplex;
323:     #elif defined(PETSC_USE_REAL___FLOAT128)
324:       typedef __complex128 PetscComplex;
325:     #endif

327:     /* Include a PETSc C++ complex 'fix'. Check PetscComplex manual page for details */
328:     #if defined(PETSC_HAVE_CXX_COMPLEX_FIX) && !defined(PETSC_SKIP_CXX_COMPLEX_FIX)
329: #include <petsccxxcomplexfix.h>
330:     #endif
331:   #else /* c99 complex support */
332:     #include <complex.h>
333:     #if defined(PETSC_USE_REAL_SINGLE) || defined(PETSC_USE_REAL___FP16)
334:       typedef float _Complex PetscComplex;
335:     #elif defined(PETSC_USE_REAL_DOUBLE)
336:       typedef double _Complex PetscComplex;
337:     #elif defined(PETSC_USE_REAL___FLOAT128)
338:       typedef __complex128 PetscComplex;
339:     #endif /* PETSC_USE_REAL_* */
340:   #endif /* !__cplusplus */
341: #endif /* PETSC_HAVE_COMPLEX */

343: /*MC
344:    PetscScalar - PETSc type that represents either a double precision real number, a double precision
345:        complex number, a single precision real number, a __float128 real or complex or a __fp16 real - if the code is configured
346:        with --with-scalar-type=real,complex --with-precision=single,double,__float128,__fp16

348:    Notes:
349:    For MPI calls that require datatypes, use MPIU_SCALAR as the datatype for PetscScalar and MPIU_SUM, MPIU_MAX etc for operations. They will automatically work correctly regardless of the size of PetscScalar.

351:    Level: beginner

353: .seealso: PetscReal, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT, PetscRealPart(), PetscImaginaryPart()
354: M*/

356: #if defined(PETSC_USE_COMPLEX) && defined(PETSC_HAVE_COMPLEX)
357:    typedef PetscComplex PetscScalar;
358: #else /* PETSC_USE_COMPLEX */
359:    typedef PetscReal PetscScalar;
360: #endif /* PETSC_USE_COMPLEX */

362: /*E
363:     PetscCopyMode  - Determines how an array or PetscObject passed to certain functions is copied or retained by the aggregate PetscObject

365:    Level: beginner

367:    For the array input:
368: $   PETSC_COPY_VALUES - the array values are copied into new space, the user is free to reuse or delete the passed in array
369: $   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
370: $                       delete the array. The array MUST have been obtained with PetscMalloc(). Hence this mode cannot be used in Fortran.
371: $   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
372: $                       the array but the user must delete the array after the object is destroyed.

374:    For the PetscObject input:
375: $   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.
376: $   PETSC_OWN_POINTER - the input PetscObject is referenced by pointer (with reference count), thus should not be modified by the user. (Modification may cause errors or unintended side-effects in this or a future version of PETSc.)
377:    For either case above, the input PetscObject should be destroyed by the user when no longer needed (the aggregate object increases its reference count).
378: $   PETSC_USE_POINTER - invalid for PetscObject inputs.

380: E*/
381: typedef enum {PETSC_COPY_VALUES, PETSC_OWN_POINTER, PETSC_USE_POINTER} PetscCopyMode;

383: /*MC
384:     PETSC_FALSE - False value of PetscBool

386:     Level: beginner

388:     Note:
389:     Zero integer

391: .seealso: PetscBool, PETSC_TRUE
392: M*/

394: /*MC
395:     PETSC_TRUE - True value of PetscBool

397:     Level: beginner

399:     Note:
400:     Nonzero integer

402: .seealso: PetscBool, PETSC_FALSE
403: M*/

405: /*MC
406:     PetscLogDouble - Used for logging times

408:   Notes:
409:   Contains double precision numbers that are not used in the numerical computations, but rather in logging, timing etc.

411:   Level: developer

413: M*/
414: typedef double PetscLogDouble;

416: /*E
417:     PetscDataType - Used for handling different basic data types.

419:    Level: beginner

421:    Notes:
422:    Use of this should be avoided if one can directly use MPI_Datatype instead.

424:    PETSC_INT is the datatype for a PetscInt, regardless of whether it is 4 or 8 bytes.
425:    PETSC_REAL, PETSC_COMPLEX and PETSC_SCALAR are the datatypes for PetscReal, PetscComplex and PetscScalar, regardless of their sizes.

427:    Developer comment:
428:    It would be nice if we could always just use MPI Datatypes, why can we not?

430:    If you change any values in PetscDatatype make sure you update their usage in
431:    share/petsc/matlab/PetscBagRead.m and share/petsc/matlab/@PetscOpenSocket/read/write.m

433:    TODO: Add PETSC_INT32 and remove use of improper PETSC_ENUM

435: .seealso: PetscBinaryRead(), PetscBinaryWrite(), PetscDataTypeToMPIDataType(),
436:           PetscDataTypeGetSize()

438: E*/
439: typedef enum {PETSC_DATATYPE_UNKNOWN = 0,
440:               PETSC_DOUBLE = 1, PETSC_COMPLEX = 2, PETSC_LONG = 3, PETSC_SHORT = 4, PETSC_FLOAT = 5,
441:               PETSC_CHAR = 6, PETSC_BIT_LOGICAL = 7, PETSC_ENUM = 8, PETSC_BOOL = 9, PETSC___FLOAT128 = 10,
442:               PETSC_OBJECT = 11, PETSC_FUNCTION = 12, PETSC_STRING = 13, PETSC___FP16 = 14, PETSC_STRUCT = 15,
443:               PETSC_INT = 16, PETSC_INT64 = 17} PetscDataType;

445: #if defined(PETSC_USE_REAL_SINGLE)
446: #  define PETSC_REAL PETSC_FLOAT
447: #elif defined(PETSC_USE_REAL_DOUBLE)
448: #  define PETSC_REAL PETSC_DOUBLE
449: #elif defined(PETSC_USE_REAL___FLOAT128)
450: #  define PETSC_REAL PETSC___FLOAT128
451: #elif defined(PETSC_USE_REAL___FP16)
452: #  define PETSC_REAL PETSC___FP16
453: #else
454: #  define PETSC_REAL PETSC_DOUBLE
455: #endif

457: #if defined(PETSC_USE_COMPLEX)
458: #  define PETSC_SCALAR PETSC_COMPLEX
459: #else
460: #  define PETSC_SCALAR PETSC_REAL
461: #endif

463: #define PETSC_FORTRANADDR PETSC_LONG

465: /*S
466:     PetscToken - 'Token' used for managing tokenizing strings

468:   Level: intermediate

470: .seealso: PetscTokenCreate(), PetscTokenFind(), PetscTokenDestroy()
471: S*/
472: typedef struct _p_PetscToken* PetscToken;

474: /*S
475:      PetscObject - any PETSc object, PetscViewer, Mat, Vec, KSP etc

477:    Level: beginner

479:    Note:
480:    This is the base class from which all PETSc objects are derived from.

482: .seealso:  PetscObjectDestroy(), PetscObjectView(), PetscObjectGetName(), PetscObjectSetName(), PetscObjectReference(), PetscObjectDereference()
483: S*/
484: typedef struct _p_PetscObject* PetscObject;

486: /*MC
487:     PetscObjectId - unique integer Id for a PetscObject

489:     Level: developer

491:     Notes:
492:     Unlike pointer values, object ids are never reused.

494: .seealso: PetscObjectState, PetscObjectGetId()
495: M*/
496: typedef PetscInt64 PetscObjectId;

498: /*MC
499:     PetscObjectState - integer state for a PetscObject

501:     Level: developer

503:     Notes:
504:     Object state is always-increasing and (for objects that track state) can be used to determine if an object has
505:     changed since the last time you interacted with it.  It is 64-bit so that it will not overflow for a very long time.

507: .seealso: PetscObjectId, PetscObjectStateGet(), PetscObjectStateIncrease(), PetscObjectStateSet()
508: M*/
509: typedef PetscInt64 PetscObjectState;

511: /*S
512:      PetscFunctionList - Linked list of functions, possibly stored in dynamic libraries, accessed
513:       by string name

515:    Level: advanced

517: .seealso:  PetscFunctionListAdd(), PetscFunctionListDestroy()
518: S*/
519: typedef struct _n_PetscFunctionList *PetscFunctionList;

521: /*E
522:   PetscFileMode - Access mode for a file.

524:   Level: beginner

526: $  FILE_MODE_UNDEFINED - initial invalid value
527: $  FILE_MODE_READ - open a file at its beginning for reading
528: $  FILE_MODE_WRITE - open a file at its beginning for writing (will create if the file does not exist)
529: $  FILE_MODE_APPEND - open a file at end for writing
530: $  FILE_MODE_UPDATE - open a file for updating, meaning for reading and writing
531: $  FILE_MODE_APPEND_UPDATE - open a file for updating, meaning for reading and writing, at the end

533: .seealso: PetscViewerFileSetMode()
534: E*/
535: typedef enum {FILE_MODE_UNDEFINED=-1, FILE_MODE_READ=0, FILE_MODE_WRITE, FILE_MODE_APPEND, FILE_MODE_UPDATE, FILE_MODE_APPEND_UPDATE} PetscFileMode;

537: typedef void* PetscDLHandle;
538: typedef enum {PETSC_DL_DECIDE=0,PETSC_DL_NOW=1,PETSC_DL_LOCAL=2} PetscDLMode;

540: /*S
541:      PetscObjectList - Linked list of PETSc objects, each accessible by string name

543:    Level: developer

545:    Notes:
546:    Used by PetscObjectCompose() and PetscObjectQuery()

548: .seealso:  PetscObjectListAdd(), PetscObjectListDestroy(), PetscObjectListFind(), PetscObjectCompose(), PetscObjectQuery(), PetscFunctionList
549: S*/
550: typedef struct _n_PetscObjectList *PetscObjectList;

552: /*S
553:      PetscDLLibrary - Linked list of dynamics libraries to search for functions

555:    Level: advanced

557: .seealso:  PetscDLLibraryOpen()
558: S*/
559: typedef struct _n_PetscDLLibrary *PetscDLLibrary;

561: /*S
562:      PetscContainer - Simple PETSc object that contains a pointer to any required data

564:    Level: advanced

566: .seealso:  PetscObject, PetscContainerCreate()
567: S*/
568: typedef struct _p_PetscContainer*  PetscContainer;

570: /*S
571:      PetscRandom - Abstract PETSc object that manages generating random numbers

573:    Level: intermediate

575: .seealso:  PetscRandomCreate(), PetscRandomGetValue(), PetscRandomType
576: S*/
577: typedef struct _p_PetscRandom*   PetscRandom;

579: /*
580:    In binary files variables are stored using the following lengths,
581:   regardless of how they are stored in memory on any one particular
582:   machine. Use these rather then sizeof() in computing sizes for
583:   PetscBinarySeek().
584: */
585: #define PETSC_BINARY_INT_SIZE    (32/8)
586: #define PETSC_BINARY_FLOAT_SIZE  (32/8)
587: #define PETSC_BINARY_CHAR_SIZE   (8/8)
588: #define PETSC_BINARY_SHORT_SIZE  (16/8)
589: #define PETSC_BINARY_DOUBLE_SIZE (64/8)
590: #define PETSC_BINARY_SCALAR_SIZE sizeof(PetscScalar)

592: /*E
593:   PetscBinarySeekType - argument to PetscBinarySeek()

595:   Level: advanced

597: .seealso: PetscBinarySeek(), PetscBinarySynchronizedSeek()
598: E*/
599: typedef enum {PETSC_BINARY_SEEK_SET = 0,PETSC_BINARY_SEEK_CUR = 1,PETSC_BINARY_SEEK_END = 2} PetscBinarySeekType;

601: /*E
602:     PetscBuildTwoSidedType - algorithm for setting up two-sided communication

604: $  PETSC_BUILDTWOSIDED_ALLREDUCE - classical algorithm using an MPI_Allreduce with
605: $      a buffer of length equal to the communicator size. Not memory-scalable due to
606: $      the large reduction size. Requires only MPI-1.
607: $  PETSC_BUILDTWOSIDED_IBARRIER - nonblocking algorithm based on MPI_Issend and MPI_Ibarrier.
608: $      Proved communication-optimal in Hoefler, Siebert, and Lumsdaine (2010). Requires MPI-3.
609: $  PETSC_BUILDTWOSIDED_REDSCATTER - similar to above, but use more optimized function
610: $      that only communicates the part of the reduction that is necessary.  Requires MPI-2.

612:    Level: developer

614: .seealso: PetscCommBuildTwoSided(), PetscCommBuildTwoSidedSetType(), PetscCommBuildTwoSidedGetType()
615: E*/
616: typedef enum {
617:   PETSC_BUILDTWOSIDED_NOTSET = -1,
618:   PETSC_BUILDTWOSIDED_ALLREDUCE = 0,
619:   PETSC_BUILDTWOSIDED_IBARRIER = 1,
620:   PETSC_BUILDTWOSIDED_REDSCATTER = 2
621:   /* Updates here must be accompanied by updates in finclude/petscsys.h and the string array in mpits.c */
622: } PetscBuildTwoSidedType;

624: /* NOTE: If you change this, you must also change the values in src/vec/f90-mod/petscvec.h */
625: /*E
626:   InsertMode - Whether entries are inserted or added into vectors or matrices

628:   Level: beginner

630: .seealso: VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(),
631:           VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(),
632:           MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd()
633: E*/
634:  typedef enum {NOT_SET_VALUES, INSERT_VALUES, ADD_VALUES, MAX_VALUES, MIN_VALUES, INSERT_ALL_VALUES, ADD_ALL_VALUES, INSERT_BC_VALUES, ADD_BC_VALUES} InsertMode;

636: /*MC
637:     INSERT_VALUES - Put a value into a vector or matrix, overwrites any previous value

639:     Level: beginner

641: .seealso: InsertMode, VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(),
642:           VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(), ADD_VALUES,
643:           MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd(), MAX_VALUES

645: M*/

647: /*MC
648:     ADD_VALUES - Adds a value into a vector or matrix, if there previously was no value, just puts the
649:                 value into that location

651:     Level: beginner

653: .seealso: InsertMode, VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(),
654:           VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(), INSERT_VALUES,
655:           MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd(), MAX_VALUES

657: M*/

659: /*MC
660:     MAX_VALUES - Puts the maximum of the scattered/gathered value and the current value into each location

662:     Level: beginner

664: .seealso: InsertMode, VecScatterBegin(), VecScatterEnd(), ADD_VALUES, INSERT_VALUES

666: M*/

668: /*MC
669:     MIN_VALUES - Puts the minimal of the scattered/gathered value and the current value into each location

671:     Level: beginner

673: .seealso: InsertMode, VecScatterBegin(), VecScatterEnd(), ADD_VALUES, INSERT_VALUES

675: M*/

677: /*S
678:    PetscSubcomm - A decomposition of an MPI communicator into subcommunicators

680:    Notes:
681:    After a call to PetscSubcommSetType(), PetscSubcommSetTypeGeneral(), or PetscSubcommSetFromOptions() one may call
682: $     PetscSubcommChild() returns the associated subcommunicator on this process
683: $     PetscSubcommContiguousParent() returns a parent communitor but with all child of the same subcommunicator having contiguous rank

685:    Sample Usage:
686:        PetscSubcommCreate()
687:        PetscSubcommSetNumber()
688:        PetscSubcommSetType(PETSC_SUBCOMM_INTERLACED);
689:        ccomm = PetscSubcommChild()
690:        PetscSubcommDestroy()

692:    Level: advanced

694:    Notes:
695: $   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
696: $   PETSC_SUBCOMM_CONTIGUOUS - each new communicator contains a set of process with contiguous ranks in the original MPI communicator
697: $   PETSC_SUBCOMM_INTERLACED - each new communictor contains a set of processes equally far apart in rank from the others in that new communicator

699:    Example: Consider a communicator with six processes split into 3 subcommunicators.
700: $     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
701: $     PETSC_SUBCOMM_INTERLACED - the first communicator contains rank 0,3, the second 1,4 and the third 2,5

703:    Developer Notes:
704:    This is used in objects such as PCREDUNDANT to manage the subcommunicators on which the redundant computations
705:       are performed.

707: .seealso: PetscSubcommCreate(), PetscSubcommSetNumber(), PetscSubcommSetType(), PetscSubcommView(), PetscSubcommSetFromOptions()

709: S*/
710: typedef struct _n_PetscSubcomm* PetscSubcomm;
711: typedef enum {PETSC_SUBCOMM_GENERAL=0,PETSC_SUBCOMM_CONTIGUOUS=1,PETSC_SUBCOMM_INTERLACED=2} PetscSubcommType;

713: /*S
714:      PetscHeap - A simple class for managing heaps

716:    Level: intermediate

718: .seealso:  PetscHeapCreate(), PetscHeapAdd(), PetscHeapPop(), PetscHeapPeek(), PetscHeapStash(), PetscHeapUnstash(), PetscHeapView(), PetscHeapDestroy()
719: S*/
720: typedef struct _PetscHeap *PetscHeap;

722: typedef struct _n_PetscShmComm* PetscShmComm;
723: typedef struct _n_PetscOmpCtrl* PetscOmpCtrl;

725: /*S
726:    PetscSegBuffer - a segmented extendable buffer

728:    Level: developer

730: .seealso: PetscSegBufferCreate(), PetscSegBufferGet(), PetscSegBufferExtract(), PetscSegBufferDestroy()
731: S*/
732: typedef struct _n_PetscSegBuffer *PetscSegBuffer;

734: typedef struct _n_PetscOptionsHelpPrinted *PetscOptionsHelpPrinted;
735: #endif