127710113SBarry Smith #include <petscsys.h> 227710113SBarry Smith /*@C 327710113SBarry Smith PetscGetVersion - Gets the PETSc version information in a string. 427710113SBarry Smith 527710113SBarry Smith Input Parameter: 627710113SBarry Smith . len - length of the string 727710113SBarry Smith 827710113SBarry Smith Output Parameter: 927710113SBarry Smith . version - version string 1027710113SBarry Smith 1127710113SBarry Smith Level: developer 1227710113SBarry Smith 1327710113SBarry Smith Fortran Note: 1427710113SBarry Smith This routine is not supported in Fortran. 1527710113SBarry Smith 1627710113SBarry Smith Developer Note: The version information is also listed in 1727710113SBarry Smith $ src/docs/tex/manual/intro.tex, 1827710113SBarry Smith $ src/docs/tex/manual/manual.tex. 1927710113SBarry Smith $ src/docs/website/index.html. 2027710113SBarry Smith 21*5f309d01SBarry Smith .seealso: PetscGetProgramName(), PetscGetVersionNumber() 2227710113SBarry Smith 2327710113SBarry Smith @*/ 2427710113SBarry Smith 2527710113SBarry Smith #undef __FUNCT__ 2627710113SBarry Smith #define __FUNCT__ "PetscGetVersion" 2727710113SBarry Smith PetscErrorCode PetscGetVersion(char version[], size_t len) 2827710113SBarry Smith { 2927710113SBarry Smith PetscErrorCode ierr; 3027710113SBarry Smith #if (PETSC_VERSION_RELEASE == 1) 31e4643290SSatish Balay 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); 3227710113SBarry Smith #else 337078edc9SSatish Balay ierr = PetscSNPrintf(version,len,"Petsc Development GIT revision: %s GIT Date: %s",PETSC_VERSION_GIT, PETSC_VERSION_DATE_GIT);CHKERRQ(ierr); 3427710113SBarry Smith #endif 3527710113SBarry Smith PetscFunctionReturn(0); 3627710113SBarry Smith } 3727710113SBarry Smith 38*5f309d01SBarry Smith #undef __FUNCT__ 39*5f309d01SBarry Smith #define __FUNCT__ "PetscGetVersionNumber" 40*5f309d01SBarry Smith /*@C 41*5f309d01SBarry Smith PetscGetVersionNumber - Gets the PETSc version information from the library 42*5f309d01SBarry Smith 43*5f309d01SBarry Smith Not collective 44*5f309d01SBarry Smith 45*5f309d01SBarry Smith Output Parameter: 46*5f309d01SBarry Smith + major - the major version (optional, pass NULL if not requested) 47*5f309d01SBarry Smith . minor - the minor version (optional, pass NULL if not requested) 48*5f309d01SBarry Smith . subminor - the subminor version (patch number) (optional, pass NULL if not requested) 49*5f309d01SBarry Smith - release - indicates the library is from a release, not random git repository (optional, pass NULL if not requested) 50*5f309d01SBarry Smith 51*5f309d01SBarry Smith Level: developer 52*5f309d01SBarry Smith 53*5f309d01SBarry Smith Notes: The C macros PETSC_VERSION_MAJOR, PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR, PETSC_VERSION_RELEASE provide the information at 54*5f309d01SBarry Smith compile time. This can be used to confirm that the shared library being loaded at runtime has the appropriate version updates. 55*5f309d01SBarry Smith 56*5f309d01SBarry Smith .seealso: PetscGetProgramName(), PetscGetVersion() 57*5f309d01SBarry Smith 58*5f309d01SBarry Smith @*/ 59*5f309d01SBarry Smith PetscErrorCode PetscGetVersionNumber(PetscInt *major, PetscInt *minor, PetscInt *subminor,PetscInt *release) 60*5f309d01SBarry Smith { 61*5f309d01SBarry Smith PetscFunctionBegin; 62*5f309d01SBarry Smith if (major) *major = PETSC_VERSION_MAJOR; 63*5f309d01SBarry Smith if (minor) *minor = PETSC_VERSION_MINOR; 64*5f309d01SBarry Smith if (subminor) *subminor = PETSC_VERSION_SUBMINOR; 65*5f309d01SBarry Smith if (release) *release = PETSC_VERSION_RELEASE; 66*5f309d01SBarry Smith PetscFunctionReturn(0); 67*5f309d01SBarry Smith } 6827710113SBarry Smith 69