1 #include <petscsys.h> 2 /*@C 3 PetscGetVersion - Gets the PETSc version information in a string. 4 5 Input Parameter: 6 . len - length of the string 7 8 Output Parameter: 9 . version - version string 10 11 Level: developer 12 13 Fortran Note: 14 This routine is not supported in Fortran. 15 16 For doing runtime checking off supported versions we recommend using PetscGetVersionNumber() instead of this routine. 17 18 Developer Note: The version information is also listed in 19 $ src/docs/tex/manual/intro.tex, 20 $ src/docs/tex/manual/manual.tex. 21 $ src/docs/website/index.html. 22 23 .seealso: PetscGetProgramName(), PetscGetVersionNumber() 24 25 @*/ 26 27 #undef __FUNCT__ 28 #define __FUNCT__ "PetscGetVersion" 29 PetscErrorCode PetscGetVersion(char version[], size_t len) 30 { 31 PetscErrorCode ierr; 32 33 PetscFunctionBegin; 34 #if (PETSC_VERSION_RELEASE == 1) 35 ierr = PetscSNPrintf(version,len,"Petsc Release Version %d.%d.%d, %s ",PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR,PETSC_VERSION_DATE);CHKERRQ(ierr); 36 #else 37 ierr = PetscSNPrintf(version,len,"Petsc Development GIT revision: %s GIT Date: %s",PETSC_VERSION_GIT, PETSC_VERSION_DATE_GIT);CHKERRQ(ierr); 38 #endif 39 PetscFunctionReturn(0); 40 } 41 42 #undef __FUNCT__ 43 #define __FUNCT__ "PetscGetVersionNumber" 44 /*@C 45 PetscGetVersionNumber - Gets the PETSc version information from the library 46 47 Not collective 48 49 Output Parameter: 50 + major - the major version (optional, pass NULL if not requested) 51 . minor - the minor version (optional, pass NULL if not requested) 52 . subminor - the subminor version (patch number) (optional, pass NULL if not requested) 53 - release - indicates the library is from a release, not random git repository (optional, pass NULL if not requested) 54 55 Level: developer 56 57 Notes: The C macros PETSC_VERSION_MAJOR, PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR, PETSC_VERSION_RELEASE provide the information at 58 compile time. This can be used to confirm that the shared library being loaded at runtime has the appropriate version updates. 59 60 This function can be called before PetscInitialize() 61 62 .seealso: PetscGetProgramName(), PetscGetVersion(), PetscInitialize() 63 64 @*/ 65 PetscErrorCode PetscGetVersionNumber(PetscInt *major, PetscInt *minor, PetscInt *subminor,PetscInt *release) 66 { 67 if (major) *major = PETSC_VERSION_MAJOR; 68 if (minor) *minor = PETSC_VERSION_MINOR; 69 if (subminor) *subminor = PETSC_VERSION_SUBMINOR; 70 if (release) *release = PETSC_VERSION_RELEASE; 71 return 0; 72 } 73 74