Actual source code: version.c

petsc-3.10.5 2019-03-28
Report Typos and Errors
  1:  #include <petscsys.h>
  2: /*@C
  3:     PetscGetVersion - Gets the PETSc version information in a string.

  5:     Input Parameter:
  6: .   len - length of the string

  8:     Output Parameter:
  9: .   version - version string

 11:     Level: developer

 13:     Fortran Note:
 14:     This routine is not supported in Fortran.

 16:     For doing runtime checking off supported versions we recommend using PetscGetVersionNumber() instead of this routine.

 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.

 23: .seealso: PetscGetProgramName(), PetscGetVersionNumber()

 25: @*/

 27: PetscErrorCode PetscGetVersion(char version[], size_t len)
 28: {

 32: #if (PETSC_VERSION_RELEASE == 1)
 33:   PetscSNPrintf(version,len,"Petsc Release Version %d.%d.%d, %s ",PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR,PETSC_VERSION_DATE);
 34: #else
 35:   PetscSNPrintf(version,len,"Petsc Development GIT revision: %s  GIT Date: %s",PETSC_VERSION_GIT, PETSC_VERSION_DATE_GIT);
 36: #endif
 37:   return(0);
 38: }

 40: /*@C
 41:     PetscGetVersionNumber - Gets the PETSc version information from the library

 43:     Not collective

 45:     Output Parameter:
 46: +   major - the major version (optional, pass NULL if not requested)
 47: .   minor - the minor version (optional, pass NULL if not requested)
 48: .   subminor - the subminor version (patch number)  (optional, pass NULL if not requested)
 49: -   release - indicates the library is from a release, not random git repository  (optional, pass NULL if not requested)

 51:     Level: developer

 53:     Notes:
 54:     The C macros PETSC_VERSION_MAJOR, PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR, PETSC_VERSION_RELEASE provide the information at 
 55:        compile time. This can be used to confirm that the shared library being loaded at runtime has the appropriate version updates.

 57:        This function can be called before PetscInitialize()

 59: .seealso: PetscGetProgramName(), PetscGetVersion(), PetscInitialize()

 61: @*/
 62: PetscErrorCode PetscGetVersionNumber(PetscInt *major, PetscInt *minor, PetscInt *subminor,PetscInt *release)
 63: {
 64:   if (major) *major = PETSC_VERSION_MAJOR;
 65:   if (minor) *minor = PETSC_VERSION_MINOR;
 66:   if (subminor) *subminor = PETSC_VERSION_SUBMINOR;
 67:   if (release) *release = PETSC_VERSION_RELEASE;
 68:   return 0;
 69: }