1*df4397b0SStefano Zampini #if !defined(__PETSCSYSTYPES_H) 2*df4397b0SStefano Zampini #define __PETSCSYSTYPES_H 3*df4397b0SStefano Zampini 4*df4397b0SStefano Zampini #include <petscconf.h> 5*df4397b0SStefano Zampini #include <petscfix.h> 6*df4397b0SStefano Zampini 7*df4397b0SStefano Zampini /*MC 8*df4397b0SStefano Zampini PetscErrorCode - datatype used for return error code from almost all PETSc functions 9*df4397b0SStefano Zampini 10*df4397b0SStefano Zampini Level: beginner 11*df4397b0SStefano Zampini 12*df4397b0SStefano Zampini .seealso: CHKERRQ, SETERRQ 13*df4397b0SStefano Zampini M*/ 14*df4397b0SStefano Zampini typedef int PetscErrorCode; 15*df4397b0SStefano Zampini 16*df4397b0SStefano Zampini /*MC 17*df4397b0SStefano Zampini 18*df4397b0SStefano Zampini PetscClassId - A unique id used to identify each PETSc class. 19*df4397b0SStefano Zampini 20*df4397b0SStefano Zampini Notes: 21*df4397b0SStefano Zampini Use PetscClassIdRegister() to obtain a new value for a new class being created. Usually 22*df4397b0SStefano Zampini XXXInitializePackage() calls it for each class it defines. 23*df4397b0SStefano Zampini 24*df4397b0SStefano Zampini Developer Notes: 25*df4397b0SStefano Zampini Internal integer stored in the _p_PetscObject data structure. 26*df4397b0SStefano Zampini These are all computed by an offset from the lowest one, PETSC_SMALLEST_CLASSID. 27*df4397b0SStefano Zampini 28*df4397b0SStefano Zampini Level: developer 29*df4397b0SStefano Zampini 30*df4397b0SStefano Zampini .seealso: PetscClassIdRegister(), PetscLogEventRegister(), PetscHeaderCreate() 31*df4397b0SStefano Zampini M*/ 32*df4397b0SStefano Zampini typedef int PetscClassId; 33*df4397b0SStefano Zampini 34*df4397b0SStefano Zampini /*MC 35*df4397b0SStefano Zampini PetscMPIInt - datatype used to represent 'int' parameters to MPI functions. 36*df4397b0SStefano Zampini 37*df4397b0SStefano Zampini Level: intermediate 38*df4397b0SStefano Zampini 39*df4397b0SStefano Zampini Notes: 40*df4397b0SStefano Zampini usually this is the same as PetscInt, but if PETSc was built with --with-64-bit-indices but 41*df4397b0SStefano Zampini standard C/Fortran integers are 32 bit then this is NOT the same as PetscInt; it remains 32 bit. 42*df4397b0SStefano Zampini 43*df4397b0SStefano Zampini PetscMPIIntCast(a,&b) checks if the given PetscInt a will fit in a PetscMPIInt, if not it 44*df4397b0SStefano Zampini generates a PETSC_ERR_ARG_OUTOFRANGE error. 45*df4397b0SStefano Zampini 46*df4397b0SStefano Zampini .seealso: PetscBLASInt, PetscInt, PetscMPIIntCast() 47*df4397b0SStefano Zampini 48*df4397b0SStefano Zampini M*/ 49*df4397b0SStefano Zampini typedef int PetscMPIInt; 50*df4397b0SStefano Zampini 51*df4397b0SStefano Zampini /*MC 52*df4397b0SStefano Zampini PetscEnum - datatype used to pass enum types within PETSc functions. 53*df4397b0SStefano Zampini 54*df4397b0SStefano Zampini Level: intermediate 55*df4397b0SStefano Zampini 56*df4397b0SStefano Zampini .seealso: PetscOptionsGetEnum(), PetscOptionsEnum(), PetscBagRegisterEnum() 57*df4397b0SStefano Zampini M*/ 58*df4397b0SStefano Zampini typedef enum { ENUM_DUMMY } PetscEnum; 59*df4397b0SStefano Zampini 60*df4397b0SStefano Zampini typedef short PetscShort; 61*df4397b0SStefano Zampini typedef char PetscChar; 62*df4397b0SStefano Zampini typedef float PetscFloat; 63*df4397b0SStefano Zampini 64*df4397b0SStefano Zampini /*MC 65*df4397b0SStefano Zampini PetscInt - PETSc type that represents an integer, used primarily to 66*df4397b0SStefano Zampini 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. 67*df4397b0SStefano Zampini 68*df4397b0SStefano Zampini Notes: 69*df4397b0SStefano Zampini 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. 70*df4397b0SStefano Zampini 71*df4397b0SStefano Zampini Level: beginner 72*df4397b0SStefano Zampini 73*df4397b0SStefano Zampini .seealso: PetscBLASInt, PetscMPIInt, PetscReal, PetscScalar, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT 74*df4397b0SStefano Zampini M*/ 75*df4397b0SStefano Zampini 76*df4397b0SStefano Zampini #if defined(PETSC_HAVE_STDINT_H) 77*df4397b0SStefano Zampini # include <stdint.h> 78*df4397b0SStefano Zampini #endif 79*df4397b0SStefano Zampini #if defined (PETSC_HAVE_INTTYPES_H) 80*df4397b0SStefano Zampini # if !defined(__STDC_FORMAT_MACROS) 81*df4397b0SStefano Zampini # define __STDC_FORMAT_MACROS /* required for using PRId64 from c++ */ 82*df4397b0SStefano Zampini # endif 83*df4397b0SStefano Zampini # include <inttypes.h> 84*df4397b0SStefano Zampini # if !defined(PRId64) 85*df4397b0SStefano Zampini # define PRId64 "ld" 86*df4397b0SStefano Zampini # endif 87*df4397b0SStefano Zampini #endif 88*df4397b0SStefano Zampini 89*df4397b0SStefano Zampini #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 */ 90*df4397b0SStefano Zampini typedef int64_t PetscInt64; 91*df4397b0SStefano Zampini #elif (PETSC_SIZEOF_LONG_LONG == 8) 92*df4397b0SStefano Zampini typedef long long PetscInt64; 93*df4397b0SStefano Zampini #elif defined(PETSC_HAVE___INT64) 94*df4397b0SStefano Zampini typedef __int64 PetscInt64; 95*df4397b0SStefano Zampini #else 96*df4397b0SStefano Zampini # error "cannot determine PetscInt64 type" 97*df4397b0SStefano Zampini #endif 98*df4397b0SStefano Zampini 99*df4397b0SStefano Zampini #if defined(PETSC_USE_64BIT_INDICES) 100*df4397b0SStefano Zampini typedef PetscInt64 PetscInt; 101*df4397b0SStefano Zampini #else 102*df4397b0SStefano Zampini typedef int PetscInt; 103*df4397b0SStefano Zampini #endif 104*df4397b0SStefano Zampini 105*df4397b0SStefano Zampini /*MC 106*df4397b0SStefano Zampini PetscBLASInt - datatype used to represent 'int' parameters to BLAS/LAPACK functions. 107*df4397b0SStefano Zampini 108*df4397b0SStefano Zampini Notes: 109*df4397b0SStefano Zampini Usually this is the same as PetscInt, but if PETSc was built with --with-64-bit-indices but 110*df4397b0SStefano Zampini standard C/Fortran integers are 32 bit then this is NOT the same as PetscInt it remains 32 bit 111*df4397b0SStefano Zampini (except on very rare BLAS/LAPACK implementations that support 64 bit integers see the note below). 112*df4397b0SStefano Zampini 113*df4397b0SStefano Zampini PetscErrorCode PetscBLASIntCast(a,&b) checks if the given PetscInt a will fit in a PetscBLASInt, if not it 114*df4397b0SStefano Zampini generates a PETSC_ERR_ARG_OUTOFRANGE error 115*df4397b0SStefano Zampini 116*df4397b0SStefano Zampini Installation Notes: 117*df4397b0SStefano Zampini The 64bit versions of MATLAB ship with BLAS and LAPACK that use 64 bit integers for sizes etc, 118*df4397b0SStefano Zampini if you run ./configure with the option 119*df4397b0SStefano Zampini --with-blaslapack-lib=[/Applications/MATLAB_R2010b.app/bin/maci64/libmwblas.dylib,/Applications/MATLAB_R2010b.app/bin/maci64/libmwlapack.dylib] 120*df4397b0SStefano Zampini but you need to also use --known-64-bit-blas-indices. 121*df4397b0SStefano Zampini 122*df4397b0SStefano Zampini MKL also ships with 64 bit integer versions of the BLAS and LAPACK, if you select those you must also ./configure with 123*df4397b0SStefano Zampini --known-64-bit-blas-indices 124*df4397b0SStefano Zampini 125*df4397b0SStefano Zampini OpenBLAS can also be built to use 64 bit integers. The ./configure options --download-openblas -download-openblas-64-bit-blas-indices 126*df4397b0SStefano Zampini will build a 64 bit integer version 127*df4397b0SStefano Zampini 128*df4397b0SStefano Zampini Developer Notes: 129*df4397b0SStefano Zampini Eventually ./configure should automatically determine the size of the integers used by BLAS/LAPACK. 130*df4397b0SStefano Zampini 131*df4397b0SStefano Zampini External packages such as hypre, ML, SuperLU etc do not provide any support for passing 64 bit integers to BLAS/LAPACK so cannot 132*df4397b0SStefano Zampini be used with PETSc if you have set PetscBLASInt to long int. 133*df4397b0SStefano Zampini 134*df4397b0SStefano Zampini Level: intermediate 135*df4397b0SStefano Zampini 136*df4397b0SStefano Zampini .seealso: PetscMPIInt, PetscInt, PetscBLASIntCast() 137*df4397b0SStefano Zampini 138*df4397b0SStefano Zampini M*/ 139*df4397b0SStefano Zampini #if defined(PETSC_HAVE_64BIT_BLAS_INDICES) 140*df4397b0SStefano Zampini typedef PetscInt64 PetscBLASInt; 141*df4397b0SStefano Zampini #else 142*df4397b0SStefano Zampini typedef int PetscBLASInt; 143*df4397b0SStefano Zampini #endif 144*df4397b0SStefano Zampini 145*df4397b0SStefano Zampini /*E 146*df4397b0SStefano Zampini PetscBool - Logical variable. Actually an int in C and a logical in Fortran. 147*df4397b0SStefano Zampini 148*df4397b0SStefano Zampini Level: beginner 149*df4397b0SStefano Zampini 150*df4397b0SStefano Zampini Developer Note: 151*df4397b0SStefano Zampini 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 152*df4397b0SStefano Zampini boolean values. It is not easy to have a simple macro that that will work properly in all circumstances with all three mechanisms. 153*df4397b0SStefano Zampini 154*df4397b0SStefano Zampini .seealso: PETSC_TRUE, PETSC_FALSE, PetscNot() 155*df4397b0SStefano Zampini E*/ 156*df4397b0SStefano Zampini typedef enum { PETSC_FALSE,PETSC_TRUE } PetscBool; 157*df4397b0SStefano Zampini 158*df4397b0SStefano Zampini /*MC 159*df4397b0SStefano Zampini PetscReal - PETSc type that represents a real number version of PetscScalar 160*df4397b0SStefano Zampini 161*df4397b0SStefano Zampini 162*df4397b0SStefano Zampini Notes: 163*df4397b0SStefano Zampini For MPI calls that require datatypes, use MPIU_REAL as the datatype for PetscScalar and MPIU_SUM, MPIU_MAX, etc. for operations. 164*df4397b0SStefano Zampini They will automatically work correctly regardless of the size of PetscReal. 165*df4397b0SStefano Zampini 166*df4397b0SStefano Zampini See PetscScalar for details on how to ./configure the size of PetscReal. 167*df4397b0SStefano Zampini 168*df4397b0SStefano Zampini Level: beginner 169*df4397b0SStefano Zampini 170*df4397b0SStefano Zampini .seealso: PetscScalar, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT 171*df4397b0SStefano Zampini M*/ 172*df4397b0SStefano Zampini 173*df4397b0SStefano Zampini #if defined(PETSC_USE_REAL_SINGLE) 174*df4397b0SStefano Zampini typedef float PetscReal; 175*df4397b0SStefano Zampini #elif defined(PETSC_USE_REAL_DOUBLE) 176*df4397b0SStefano Zampini typedef double PetscReal; 177*df4397b0SStefano Zampini #elif defined(PETSC_USE_REAL___FLOAT128) 178*df4397b0SStefano Zampini # if defined(__cplusplus) 179*df4397b0SStefano Zampini extern "C" { 180*df4397b0SStefano Zampini # endif 181*df4397b0SStefano Zampini # include <quadmath.h> 182*df4397b0SStefano Zampini # if defined(__cplusplus) 183*df4397b0SStefano Zampini } 184*df4397b0SStefano Zampini # endif 185*df4397b0SStefano Zampini typedef __float128 PetscReal; 186*df4397b0SStefano Zampini #elif defined(PETSC_USE_REAL___FP16) 187*df4397b0SStefano Zampini typedef __fp16 PetscReal; 188*df4397b0SStefano Zampini #endif /* PETSC_USE_REAL_* */ 189*df4397b0SStefano Zampini 190*df4397b0SStefano Zampini /*MC 191*df4397b0SStefano Zampini PetscComplex - PETSc type that represents a complex number with precision matching that of PetscReal. 192*df4397b0SStefano Zampini 193*df4397b0SStefano Zampini Synopsis: 194*df4397b0SStefano Zampini #include <petscsys.h> 195*df4397b0SStefano Zampini PetscComplex number = 1. + 2.*PETSC_i; 196*df4397b0SStefano Zampini 197*df4397b0SStefano Zampini Notes: 198*df4397b0SStefano Zampini For MPI calls that require datatypes, use MPIU_COMPLEX as the datatype for PetscComplex and MPIU_SUM etc for operations. 199*df4397b0SStefano Zampini They will automatically work correctly regardless of the size of PetscComplex. 200*df4397b0SStefano Zampini 201*df4397b0SStefano Zampini See PetscScalar for details on how to ./configure the size of PetscReal 202*df4397b0SStefano Zampini 203*df4397b0SStefano Zampini Complex numbers are automatically available if PETSc was able to find a working complex implementation 204*df4397b0SStefano Zampini 205*df4397b0SStefano Zampini Level: beginner 206*df4397b0SStefano Zampini 207*df4397b0SStefano Zampini .seealso: PetscReal, PetscScalar, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT, PETSC_i 208*df4397b0SStefano Zampini M*/ 209*df4397b0SStefano Zampini 210*df4397b0SStefano Zampini #if defined(__cplusplus) && defined(PETSC_HAVE_CXX_COMPLEX) && !defined(PETSC_USE_REAL___FLOAT128) 211*df4397b0SStefano Zampini # if !defined(PETSC_SKIP_COMPLEX) 212*df4397b0SStefano Zampini /* C++ support of complex number */ 213*df4397b0SStefano Zampini # define PETSC_HAVE_COMPLEX 1 214*df4397b0SStefano Zampini # if defined(PETSC_HAVE_CUDA) && __CUDACC_VER_MAJOR__ > 6 215*df4397b0SStefano Zampini /* complex headers in thrust only available in CUDA 7.0 and above */ 216*df4397b0SStefano Zampini # define petsccomplexlib thrust 217*df4397b0SStefano Zampini # include <thrust/complex.h> 218*df4397b0SStefano Zampini # else 219*df4397b0SStefano Zampini # define petsccomplexlib std 220*df4397b0SStefano Zampini # include <complex> 221*df4397b0SStefano Zampini # endif 222*df4397b0SStefano Zampini # if defined(PETSC_USE_REAL_SINGLE) 223*df4397b0SStefano Zampini typedef petsccomplexlib::complex<float> PetscComplex; 224*df4397b0SStefano Zampini # elif defined(PETSC_USE_REAL_DOUBLE) 225*df4397b0SStefano Zampini typedef petsccomplexlib::complex<double> PetscComplex; 226*df4397b0SStefano Zampini # elif defined(PETSC_USE_REAL___FLOAT128) 227*df4397b0SStefano Zampini typedef petsccomplexlib::complex<__float128> PetscComplex; /* Notstandard and not expected to work, use __complex128 */ 228*df4397b0SStefano Zampini # endif /* PETSC_USE_REAL_ */ 229*df4397b0SStefano Zampini # endif /* ! PETSC_SKIP_COMPLEX */ 230*df4397b0SStefano Zampini #elif defined(PETSC_HAVE_C99_COMPLEX) && !defined(PETSC_USE_REAL___FP16) 231*df4397b0SStefano Zampini # if !defined(PETSC_SKIP_COMPLEX) 232*df4397b0SStefano Zampini # define PETSC_HAVE_COMPLEX 1 233*df4397b0SStefano Zampini # include <complex.h> 234*df4397b0SStefano Zampini # if defined(PETSC_USE_REAL_SINGLE) || defined(PETSC_USE_REAL___FP16) 235*df4397b0SStefano Zampini typedef float _Complex PetscComplex; 236*df4397b0SStefano Zampini # elif defined(PETSC_USE_REAL_DOUBLE) 237*df4397b0SStefano Zampini typedef double _Complex PetscComplex; 238*df4397b0SStefano Zampini # elif defined(PETSC_USE_REAL___FLOAT128) 239*df4397b0SStefano Zampini typedef __complex128 PetscComplex; 240*df4397b0SStefano Zampini # endif /* PETSC_USE_REAL_* */ 241*df4397b0SStefano Zampini # endif /* !PETSC_SKIP_COMPLEX */ 242*df4397b0SStefano Zampini #elif (defined(PETSC_USE_COMPLEX) && !defined(PETSC_SKIP_COMPLEX)) 243*df4397b0SStefano Zampini # error "PETSc was configured --with-scalar-type=complex, but a language-appropriate complex library is not available" 244*df4397b0SStefano Zampini #endif /* !PETSC_SKIP_COMPLEX */ 245*df4397b0SStefano Zampini 246*df4397b0SStefano Zampini /*MC 247*df4397b0SStefano Zampini PetscScalar - PETSc type that represents either a double precision real number, a double precision 248*df4397b0SStefano Zampini complex number, a single precision real number, a __float128 real or complex or a __fp16 real - if the code is configured 249*df4397b0SStefano Zampini with --with-scalar-type=real,complex --with-precision=single,double,__float128,__fp16 250*df4397b0SStefano Zampini 251*df4397b0SStefano Zampini Notes: 252*df4397b0SStefano Zampini 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. 253*df4397b0SStefano Zampini 254*df4397b0SStefano Zampini Level: beginner 255*df4397b0SStefano Zampini 256*df4397b0SStefano Zampini .seealso: PetscReal, PetscComplex, PetscInt, MPIU_REAL, MPIU_SCALAR, MPIU_COMPLEX, MPIU_INT, PetscRealPart(), PetscImaginaryPart() 257*df4397b0SStefano Zampini M*/ 258*df4397b0SStefano Zampini 259*df4397b0SStefano Zampini #if (defined(PETSC_USE_COMPLEX) && !defined(PETSC_SKIP_COMPLEX)) 260*df4397b0SStefano Zampini typedef PetscComplex PetscScalar; 261*df4397b0SStefano Zampini #else /* PETSC_USE_COMPLEX */ 262*df4397b0SStefano Zampini typedef PetscReal PetscScalar; 263*df4397b0SStefano Zampini #endif /* PETSC_USE_COMPLEX */ 264*df4397b0SStefano Zampini 265*df4397b0SStefano Zampini /*E 266*df4397b0SStefano Zampini PetscCopyMode - Determines how an array passed to certain functions is copied or retained 267*df4397b0SStefano Zampini 268*df4397b0SStefano Zampini Level: beginner 269*df4397b0SStefano Zampini 270*df4397b0SStefano Zampini $ PETSC_COPY_VALUES - the array values are copied into new space, the user is free to reuse or delete the passed in array 271*df4397b0SStefano Zampini $ 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 272*df4397b0SStefano Zampini $ delete the array. The array MUST have been obtained with PetscMalloc(). Hence this mode cannot be used in Fortran. 273*df4397b0SStefano Zampini $ 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 274*df4397b0SStefano Zampini the array but the user must delete the array after the object is destroyed. 275*df4397b0SStefano Zampini 276*df4397b0SStefano Zampini E*/ 277*df4397b0SStefano Zampini typedef enum {PETSC_COPY_VALUES, PETSC_OWN_POINTER, PETSC_USE_POINTER} PetscCopyMode; 278*df4397b0SStefano Zampini 279*df4397b0SStefano Zampini /*MC 280*df4397b0SStefano Zampini PETSC_FALSE - False value of PetscBool 281*df4397b0SStefano Zampini 282*df4397b0SStefano Zampini Level: beginner 283*df4397b0SStefano Zampini 284*df4397b0SStefano Zampini Note: 285*df4397b0SStefano Zampini Zero integer 286*df4397b0SStefano Zampini 287*df4397b0SStefano Zampini .seealso: PetscBool, PETSC_TRUE 288*df4397b0SStefano Zampini M*/ 289*df4397b0SStefano Zampini 290*df4397b0SStefano Zampini /*MC 291*df4397b0SStefano Zampini PETSC_TRUE - True value of PetscBool 292*df4397b0SStefano Zampini 293*df4397b0SStefano Zampini Level: beginner 294*df4397b0SStefano Zampini 295*df4397b0SStefano Zampini Note: 296*df4397b0SStefano Zampini Nonzero integer 297*df4397b0SStefano Zampini 298*df4397b0SStefano Zampini .seealso: PetscBool, PETSC_FALSE 299*df4397b0SStefano Zampini M*/ 300*df4397b0SStefano Zampini 301*df4397b0SStefano Zampini /*MC 302*df4397b0SStefano Zampini PetscLogDouble - Used for logging times 303*df4397b0SStefano Zampini 304*df4397b0SStefano Zampini Notes: 305*df4397b0SStefano Zampini Contains double precision numbers that are not used in the numerical computations, but rather in logging, timing etc. 306*df4397b0SStefano Zampini 307*df4397b0SStefano Zampini M*/ 308*df4397b0SStefano Zampini typedef double PetscLogDouble; 309*df4397b0SStefano Zampini 310*df4397b0SStefano Zampini /*E 311*df4397b0SStefano Zampini PetscDataType - Used for handling different basic data types. 312*df4397b0SStefano Zampini 313*df4397b0SStefano Zampini Level: beginner 314*df4397b0SStefano Zampini 315*df4397b0SStefano Zampini Notes: 316*df4397b0SStefano Zampini Use of this should be avoided if one can directly use MPI_Datatype instead. 317*df4397b0SStefano Zampini 318*df4397b0SStefano Zampini Developer comment: 319*df4397b0SStefano Zampini It would be nice if we could always just use MPI Datatypes, why can we not? 320*df4397b0SStefano Zampini 321*df4397b0SStefano Zampini .seealso: PetscBinaryRead(), PetscBinaryWrite(), PetscDataTypeToMPIDataType(), 322*df4397b0SStefano Zampini PetscDataTypeGetSize() 323*df4397b0SStefano Zampini 324*df4397b0SStefano Zampini E*/ 325*df4397b0SStefano Zampini typedef enum {PETSC_INT = 0,PETSC_DOUBLE = 1,PETSC_COMPLEX = 2, PETSC_LONG = 3 ,PETSC_SHORT = 4,PETSC_FLOAT = 5, 326*df4397b0SStefano Zampini PETSC_CHAR = 6,PETSC_BIT_LOGICAL = 7,PETSC_ENUM = 8,PETSC_BOOL=9, PETSC___FLOAT128 = 10,PETSC_OBJECT = 11, PETSC_FUNCTION = 12, PETSC_STRING = 13, PETSC___FP16 = 14,PETSC_STRUCT, PETSC_DATATYPE_UNKNOWN} PetscDataType; 327*df4397b0SStefano Zampini 328*df4397b0SStefano Zampini #if defined(PETSC_USE_COMPLEX) 329*df4397b0SStefano Zampini # define PETSC_SCALAR PETSC_COMPLEX 330*df4397b0SStefano Zampini #else 331*df4397b0SStefano Zampini # if defined(PETSC_USE_REAL_SINGLE) 332*df4397b0SStefano Zampini # define PETSC_SCALAR PETSC_FLOAT 333*df4397b0SStefano Zampini # elif defined(PETSC_USE_REAL___FLOAT128) 334*df4397b0SStefano Zampini # define PETSC_SCALAR PETSC___FLOAT128 335*df4397b0SStefano Zampini # elif defined(PETSC_USE_REAL___FP16) 336*df4397b0SStefano Zampini # define PETSC_SCALAR PETSC___FP16 337*df4397b0SStefano Zampini # else 338*df4397b0SStefano Zampini # define PETSC_SCALAR PETSC_DOUBLE 339*df4397b0SStefano Zampini # endif 340*df4397b0SStefano Zampini #endif 341*df4397b0SStefano Zampini #if defined(PETSC_USE_REAL_SINGLE) 342*df4397b0SStefano Zampini # define PETSC_REAL PETSC_FLOAT 343*df4397b0SStefano Zampini #elif defined(PETSC_USE_REAL___FLOAT128) 344*df4397b0SStefano Zampini # define PETSC_REAL PETSC___FLOAT128 345*df4397b0SStefano Zampini #elif defined(PETSC_USE_REAL___FP16) 346*df4397b0SStefano Zampini # define PETSC_REAL PETSC___FP16 347*df4397b0SStefano Zampini #else 348*df4397b0SStefano Zampini # define PETSC_REAL PETSC_DOUBLE 349*df4397b0SStefano Zampini #endif 350*df4397b0SStefano Zampini #define PETSC_FORTRANADDR PETSC_LONG 351*df4397b0SStefano Zampini 352*df4397b0SStefano Zampini /*S 353*df4397b0SStefano Zampini PetscToken - 'Token' used for managing tokenizing strings 354*df4397b0SStefano Zampini 355*df4397b0SStefano Zampini Level: intermediate 356*df4397b0SStefano Zampini 357*df4397b0SStefano Zampini .seealso: PetscTokenCreate(), PetscTokenFind(), PetscTokenDestroy() 358*df4397b0SStefano Zampini S*/ 359*df4397b0SStefano Zampini typedef struct _p_PetscToken* PetscToken; 360*df4397b0SStefano Zampini 361*df4397b0SStefano Zampini /*S 362*df4397b0SStefano Zampini PetscObject - any PETSc object, PetscViewer, Mat, Vec, KSP etc 363*df4397b0SStefano Zampini 364*df4397b0SStefano Zampini Level: beginner 365*df4397b0SStefano Zampini 366*df4397b0SStefano Zampini Note: 367*df4397b0SStefano Zampini This is the base class from which all PETSc objects are derived from. 368*df4397b0SStefano Zampini 369*df4397b0SStefano Zampini .seealso: PetscObjectDestroy(), PetscObjectView(), PetscObjectGetName(), PetscObjectSetName(), PetscObjectReference(), PetscObjectDereference() 370*df4397b0SStefano Zampini S*/ 371*df4397b0SStefano Zampini typedef struct _p_PetscObject* PetscObject; 372*df4397b0SStefano Zampini 373*df4397b0SStefano Zampini /*MC 374*df4397b0SStefano Zampini PetscObjectId - unique integer Id for a PetscObject 375*df4397b0SStefano Zampini 376*df4397b0SStefano Zampini Level: developer 377*df4397b0SStefano Zampini 378*df4397b0SStefano Zampini Notes: 379*df4397b0SStefano Zampini Unlike pointer values, object ids are never reused. 380*df4397b0SStefano Zampini 381*df4397b0SStefano Zampini .seealso: PetscObjectState, PetscObjectGetId() 382*df4397b0SStefano Zampini M*/ 383*df4397b0SStefano Zampini #if defined(PETSC_USING_F90) && !defined(PETSC_USE_FORTRANKIND) /* compaq F90 */ 384*df4397b0SStefano Zampini typedef int PetscObjectId; 385*df4397b0SStefano Zampini #else 386*df4397b0SStefano Zampini typedef PetscInt64 PetscObjectId; 387*df4397b0SStefano Zampini #endif 388*df4397b0SStefano Zampini 389*df4397b0SStefano Zampini /*MC 390*df4397b0SStefano Zampini PetscObjectState - integer state for a PetscObject 391*df4397b0SStefano Zampini 392*df4397b0SStefano Zampini Level: developer 393*df4397b0SStefano Zampini 394*df4397b0SStefano Zampini Notes: 395*df4397b0SStefano Zampini Object state is always-increasing and (for objects that track state) can be used to determine if an object has 396*df4397b0SStefano Zampini changed since the last time you interacted with it. It is 64-bit so that it will not overflow for a very long time. 397*df4397b0SStefano Zampini 398*df4397b0SStefano Zampini .seealso: PetscObjectId, PetscObjectStateGet(), PetscObjectStateIncrease(), PetscObjectStateSet() 399*df4397b0SStefano Zampini M*/ 400*df4397b0SStefano Zampini #if defined(PETSC_USING_F90) && !defined(PETSC_USE_FORTRANKIND) /* compaq F90 */ 401*df4397b0SStefano Zampini typedef int PetscObjectState; 402*df4397b0SStefano Zampini #else 403*df4397b0SStefano Zampini typedef PetscInt64 PetscObjectState; 404*df4397b0SStefano Zampini #endif 405*df4397b0SStefano Zampini 406*df4397b0SStefano Zampini /*S 407*df4397b0SStefano Zampini PetscFunctionList - Linked list of functions, possibly stored in dynamic libraries, accessed 408*df4397b0SStefano Zampini by string name 409*df4397b0SStefano Zampini 410*df4397b0SStefano Zampini Level: advanced 411*df4397b0SStefano Zampini 412*df4397b0SStefano Zampini .seealso: PetscFunctionListAdd(), PetscFunctionListDestroy(), PetscOpFlist 413*df4397b0SStefano Zampini S*/ 414*df4397b0SStefano Zampini typedef struct _n_PetscFunctionList *PetscFunctionList; 415*df4397b0SStefano Zampini 416*df4397b0SStefano Zampini /*E 417*df4397b0SStefano Zampini PetscFileMode - Access mode for a file. 418*df4397b0SStefano Zampini 419*df4397b0SStefano Zampini Level: beginner 420*df4397b0SStefano Zampini 421*df4397b0SStefano Zampini $ FILE_MODE_READ - open a file at its beginning for reading 422*df4397b0SStefano Zampini $ FILE_MODE_WRITE - open a file at its beginning for writing (will create if the file does not exist) 423*df4397b0SStefano Zampini $ FILE_MODE_APPEND - open a file at end for writing 424*df4397b0SStefano Zampini $ FILE_MODE_UPDATE - open a file for updating, meaning for reading and writing 425*df4397b0SStefano Zampini $ FILE_MODE_APPEND_UPDATE - open a file for updating, meaning for reading and writing, at the end 426*df4397b0SStefano Zampini 427*df4397b0SStefano Zampini .seealso: PetscViewerFileSetMode() 428*df4397b0SStefano Zampini E*/ 429*df4397b0SStefano Zampini typedef enum {FILE_MODE_READ, FILE_MODE_WRITE, FILE_MODE_APPEND, FILE_MODE_UPDATE, FILE_MODE_APPEND_UPDATE} PetscFileMode; 430*df4397b0SStefano Zampini 431*df4397b0SStefano Zampini typedef void* PetscDLHandle; 432*df4397b0SStefano Zampini typedef enum {PETSC_DL_DECIDE=0,PETSC_DL_NOW=1,PETSC_DL_LOCAL=2} PetscDLMode; 433*df4397b0SStefano Zampini 434*df4397b0SStefano Zampini /*S 435*df4397b0SStefano Zampini PetscObjectList - Linked list of PETSc objects, each accessable by string name 436*df4397b0SStefano Zampini 437*df4397b0SStefano Zampini Level: developer 438*df4397b0SStefano Zampini 439*df4397b0SStefano Zampini Notes: 440*df4397b0SStefano Zampini Used by PetscObjectCompose() and PetscObjectQuery() 441*df4397b0SStefano Zampini 442*df4397b0SStefano Zampini .seealso: PetscObjectListAdd(), PetscObjectListDestroy(), PetscObjectListFind(), PetscObjectCompose(), PetscObjectQuery(), PetscFunctionList 443*df4397b0SStefano Zampini S*/ 444*df4397b0SStefano Zampini typedef struct _n_PetscObjectList *PetscObjectList; 445*df4397b0SStefano Zampini 446*df4397b0SStefano Zampini /*S 447*df4397b0SStefano Zampini PetscDLLibrary - Linked list of dynamics libraries to search for functions 448*df4397b0SStefano Zampini 449*df4397b0SStefano Zampini Level: advanced 450*df4397b0SStefano Zampini 451*df4397b0SStefano Zampini .seealso: PetscDLLibraryOpen() 452*df4397b0SStefano Zampini S*/ 453*df4397b0SStefano Zampini typedef struct _n_PetscDLLibrary *PetscDLLibrary; 454*df4397b0SStefano Zampini 455*df4397b0SStefano Zampini /*S 456*df4397b0SStefano Zampini PetscContainer - Simple PETSc object that contains a pointer to any required data 457*df4397b0SStefano Zampini 458*df4397b0SStefano Zampini Level: advanced 459*df4397b0SStefano Zampini 460*df4397b0SStefano Zampini .seealso: PetscObject, PetscContainerCreate() 461*df4397b0SStefano Zampini S*/ 462*df4397b0SStefano Zampini typedef struct _p_PetscContainer* PetscContainer; 463*df4397b0SStefano Zampini 464*df4397b0SStefano Zampini /*S 465*df4397b0SStefano Zampini PetscRandom - Abstract PETSc object that manages generating random numbers 466*df4397b0SStefano Zampini 467*df4397b0SStefano Zampini Level: intermediate 468*df4397b0SStefano Zampini 469*df4397b0SStefano Zampini Concepts: random numbers 470*df4397b0SStefano Zampini 471*df4397b0SStefano Zampini .seealso: PetscRandomCreate(), PetscRandomGetValue(), PetscRandomType 472*df4397b0SStefano Zampini S*/ 473*df4397b0SStefano Zampini typedef struct _p_PetscRandom* PetscRandom; 474*df4397b0SStefano Zampini 475*df4397b0SStefano Zampini /* 476*df4397b0SStefano Zampini In binary files variables are stored using the following lengths, 477*df4397b0SStefano Zampini regardless of how they are stored in memory on any one particular 478*df4397b0SStefano Zampini machine. Use these rather then sizeof() in computing sizes for 479*df4397b0SStefano Zampini PetscBinarySeek(). 480*df4397b0SStefano Zampini */ 481*df4397b0SStefano Zampini #define PETSC_BINARY_INT_SIZE (32/8) 482*df4397b0SStefano Zampini #define PETSC_BINARY_FLOAT_SIZE (32/8) 483*df4397b0SStefano Zampini #define PETSC_BINARY_CHAR_SIZE (8/8) 484*df4397b0SStefano Zampini #define PETSC_BINARY_SHORT_SIZE (16/8) 485*df4397b0SStefano Zampini #define PETSC_BINARY_DOUBLE_SIZE (64/8) 486*df4397b0SStefano Zampini #define PETSC_BINARY_SCALAR_SIZE sizeof(PetscScalar) 487*df4397b0SStefano Zampini 488*df4397b0SStefano Zampini /*E 489*df4397b0SStefano Zampini PetscBinarySeekType - argument to PetscBinarySeek() 490*df4397b0SStefano Zampini 491*df4397b0SStefano Zampini Level: advanced 492*df4397b0SStefano Zampini 493*df4397b0SStefano Zampini .seealso: PetscBinarySeek(), PetscBinarySynchronizedSeek() 494*df4397b0SStefano Zampini E*/ 495*df4397b0SStefano Zampini typedef enum {PETSC_BINARY_SEEK_SET = 0,PETSC_BINARY_SEEK_CUR = 1,PETSC_BINARY_SEEK_END = 2} PetscBinarySeekType; 496*df4397b0SStefano Zampini 497*df4397b0SStefano Zampini /*E 498*df4397b0SStefano Zampini PetscBuildTwoSidedType - algorithm for setting up two-sided communication 499*df4397b0SStefano Zampini 500*df4397b0SStefano Zampini $ PETSC_BUILDTWOSIDED_ALLREDUCE - classical algorithm using an MPI_Allreduce with 501*df4397b0SStefano Zampini $ a buffer of length equal to the communicator size. Not memory-scalable due to 502*df4397b0SStefano Zampini $ the large reduction size. Requires only MPI-1. 503*df4397b0SStefano Zampini $ PETSC_BUILDTWOSIDED_IBARRIER - nonblocking algorithm based on MPI_Issend and MPI_Ibarrier. 504*df4397b0SStefano Zampini $ Proved communication-optimal in Hoefler, Siebert, and Lumsdaine (2010). Requires MPI-3. 505*df4397b0SStefano Zampini $ PETSC_BUILDTWOSIDED_REDSCATTER - similar to above, but use more optimized function 506*df4397b0SStefano Zampini $ that only communicates the part of the reduction that is necessary. Requires MPI-2. 507*df4397b0SStefano Zampini 508*df4397b0SStefano Zampini Level: developer 509*df4397b0SStefano Zampini 510*df4397b0SStefano Zampini .seealso: PetscCommBuildTwoSided(), PetscCommBuildTwoSidedSetType(), PetscCommBuildTwoSidedGetType() 511*df4397b0SStefano Zampini E*/ 512*df4397b0SStefano Zampini typedef enum { 513*df4397b0SStefano Zampini PETSC_BUILDTWOSIDED_NOTSET = -1, 514*df4397b0SStefano Zampini PETSC_BUILDTWOSIDED_ALLREDUCE = 0, 515*df4397b0SStefano Zampini PETSC_BUILDTWOSIDED_IBARRIER = 1, 516*df4397b0SStefano Zampini PETSC_BUILDTWOSIDED_REDSCATTER = 2 517*df4397b0SStefano Zampini /* Updates here must be accompanied by updates in finclude/petscsys.h and the string array in mpits.c */ 518*df4397b0SStefano Zampini } PetscBuildTwoSidedType; 519*df4397b0SStefano Zampini 520*df4397b0SStefano Zampini /*E 521*df4397b0SStefano Zampini InsertMode - Whether entries are inserted or added into vectors or matrices 522*df4397b0SStefano Zampini 523*df4397b0SStefano Zampini Level: beginner 524*df4397b0SStefano Zampini 525*df4397b0SStefano Zampini .seealso: VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(), 526*df4397b0SStefano Zampini VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(), 527*df4397b0SStefano Zampini MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd() 528*df4397b0SStefano Zampini E*/ 529*df4397b0SStefano Zampini typedef enum {NOT_SET_VALUES, INSERT_VALUES, ADD_VALUES, MAX_VALUES, INSERT_ALL_VALUES, ADD_ALL_VALUES, INSERT_BC_VALUES, ADD_BC_VALUES} InsertMode; 530*df4397b0SStefano Zampini 531*df4397b0SStefano Zampini /*MC 532*df4397b0SStefano Zampini INSERT_VALUES - Put a value into a vector or matrix, overwrites any previous value 533*df4397b0SStefano Zampini 534*df4397b0SStefano Zampini Level: beginner 535*df4397b0SStefano Zampini 536*df4397b0SStefano Zampini .seealso: InsertMode, VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(), 537*df4397b0SStefano Zampini VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(), ADD_VALUES, 538*df4397b0SStefano Zampini MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd(), MAX_VALUES 539*df4397b0SStefano Zampini 540*df4397b0SStefano Zampini M*/ 541*df4397b0SStefano Zampini 542*df4397b0SStefano Zampini /*MC 543*df4397b0SStefano Zampini ADD_VALUES - Adds a value into a vector or matrix, if there previously was no value, just puts the 544*df4397b0SStefano Zampini value into that location 545*df4397b0SStefano Zampini 546*df4397b0SStefano Zampini Level: beginner 547*df4397b0SStefano Zampini 548*df4397b0SStefano Zampini .seealso: InsertMode, VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(), 549*df4397b0SStefano Zampini VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(), INSERT_VALUES, 550*df4397b0SStefano Zampini MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd(), MAX_VALUES 551*df4397b0SStefano Zampini 552*df4397b0SStefano Zampini M*/ 553*df4397b0SStefano Zampini 554*df4397b0SStefano Zampini /*MC 555*df4397b0SStefano Zampini MAX_VALUES - Puts the maximum of the scattered/gathered value and the current value into each location 556*df4397b0SStefano Zampini 557*df4397b0SStefano Zampini Level: beginner 558*df4397b0SStefano Zampini 559*df4397b0SStefano Zampini .seealso: InsertMode, VecScatterBegin(), VecScatterEnd(), ADD_VALUES, INSERT_VALUES 560*df4397b0SStefano Zampini 561*df4397b0SStefano Zampini M*/ 562*df4397b0SStefano Zampini 563*df4397b0SStefano Zampini /*S 564*df4397b0SStefano Zampini PetscSubcomm - A decomposition of an MPI communicator into subcommunicators 565*df4397b0SStefano Zampini 566*df4397b0SStefano Zampini Notes: 567*df4397b0SStefano Zampini After a call to PetscSubcommSetType(), PetscSubcommSetTypeGeneral(), or PetscSubcommSetFromOptions() one may call 568*df4397b0SStefano Zampini $ PetscSubcommChild() returns the associated subcommunicator on this process 569*df4397b0SStefano Zampini $ PetscSubcommContiguousParent() returns a parent communitor but with all child of the same subcommunicator having contiguous rank 570*df4397b0SStefano Zampini 571*df4397b0SStefano Zampini Sample Usage: 572*df4397b0SStefano Zampini PetscSubcommCreate() 573*df4397b0SStefano Zampini PetscSubcommSetNumber() 574*df4397b0SStefano Zampini PetscSubcommSetType(PETSC_SUBCOMM_INTERLACED); 575*df4397b0SStefano Zampini ccomm = PetscSubcommChild() 576*df4397b0SStefano Zampini PetscSubcommDestroy() 577*df4397b0SStefano Zampini 578*df4397b0SStefano Zampini Level: advanced 579*df4397b0SStefano Zampini 580*df4397b0SStefano Zampini Concepts: communicator, create 581*df4397b0SStefano Zampini 582*df4397b0SStefano Zampini Notes: 583*df4397b0SStefano Zampini $ 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 584*df4397b0SStefano Zampini $ PETSC_SUBCOMM_CONTIGUOUS - each new communicator contains a set of process with contiguous ranks in the original MPI communicator 585*df4397b0SStefano Zampini $ PETSC_SUBCOMM_INTERLACED - each new communictor contains a set of processes equally far apart in rank from the others in that new communicator 586*df4397b0SStefano Zampini 587*df4397b0SStefano Zampini Example: Consider a communicator with six processes split into 3 subcommunicators. 588*df4397b0SStefano Zampini $ 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 589*df4397b0SStefano Zampini $ PETSC_SUBCOMM_INTERLACED - the first communicator contains rank 0,3, the second 1,4 and the third 2,5 590*df4397b0SStefano Zampini 591*df4397b0SStefano Zampini Developer Notes: 592*df4397b0SStefano Zampini This is used in objects such as PCREDUNDANT to manage the subcommunicators on which the redundant computations 593*df4397b0SStefano Zampini are performed. 594*df4397b0SStefano Zampini 595*df4397b0SStefano Zampini 596*df4397b0SStefano Zampini .seealso: PetscSubcommCreate(), PetscSubcommSetNumber(), PetscSubcommSetType(), PetscSubcommView(), PetscSubcommSetFromOptions() 597*df4397b0SStefano Zampini 598*df4397b0SStefano Zampini S*/ 599*df4397b0SStefano Zampini typedef struct _n_PetscSubcomm* PetscSubcomm; 600*df4397b0SStefano Zampini typedef enum {PETSC_SUBCOMM_GENERAL=0,PETSC_SUBCOMM_CONTIGUOUS=1,PETSC_SUBCOMM_INTERLACED=2} PetscSubcommType; 601*df4397b0SStefano Zampini 602*df4397b0SStefano Zampini /*S 603*df4397b0SStefano Zampini PetscHeap - A simple class for managing heaps 604*df4397b0SStefano Zampini 605*df4397b0SStefano Zampini Level: intermediate 606*df4397b0SStefano Zampini 607*df4397b0SStefano Zampini Concepts: random numbers 608*df4397b0SStefano Zampini 609*df4397b0SStefano Zampini .seealso: PetscHeapCreate(), PetscHeapAdd(), PetscHeapPop(), PetscHeapPeek(), PetscHeapStash(), PetscHeapUnstash(), PetscHeapView(), PetscHeapDestroy() 610*df4397b0SStefano Zampini S*/ 611*df4397b0SStefano Zampini typedef struct _PetscHeap *PetscHeap; 612*df4397b0SStefano Zampini 613*df4397b0SStefano Zampini typedef struct _n_PetscShmComm* PetscShmComm; 614*df4397b0SStefano Zampini typedef struct _n_PetscOmpCtrl* PetscOmpCtrl; 615*df4397b0SStefano Zampini 616*df4397b0SStefano Zampini /*S 617*df4397b0SStefano Zampini PetscSegBuffer - a segmented extendable buffer 618*df4397b0SStefano Zampini 619*df4397b0SStefano Zampini Level: developer 620*df4397b0SStefano Zampini 621*df4397b0SStefano Zampini .seealso: PetscSegBufferCreate(), PetscSegBufferGet(), PetscSegBufferExtract(), PetscSegBufferDestroy() 622*df4397b0SStefano Zampini S*/ 623*df4397b0SStefano Zampini typedef struct _n_PetscSegBuffer *PetscSegBuffer; 624*df4397b0SStefano Zampini 625*df4397b0SStefano Zampini typedef struct _n_PetscOptionsHelpPrinted *PetscOptionsHelpPrinted; 626*df4397b0SStefano Zampini 627*df4397b0SStefano Zampini #endif 628