1 2 static char help[] = "Demonstrates PetscGetVersonNumber().\n\n"; 3 4 #include <petscsys.h> 5 int main(int argc,char **argv) 6 { 7 char version[128]; 8 PetscInt major,minor,subminor; 9 10 /* 11 Every PETSc routine should begin with the PetscInitialize() routine. 12 argc, argv - These command line arguments are taken to extract the options 13 supplied to PETSc and options supplied to MPI. 14 help - When PETSc executable is invoked with the option -help, 15 it prints the various options that can be applied at 16 runtime. The user can use the "help" variable place 17 additional help messages in this printout. 18 */ 19 PetscCall(PetscInitialize(&argc,&argv,(char*)0,help)); 20 PetscCall(PetscGetVersion(version,sizeof(version))); 21 22 PetscCall(PetscGetVersionNumber(&major,&minor,&subminor,NULL)); 23 PetscCheckFalse(major != PETSC_VERSION_MAJOR,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Library major %d does not equal include %d",(int)major,PETSC_VERSION_MAJOR); 24 PetscCheckFalse(minor != PETSC_VERSION_MINOR,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Library minor %d does not equal include %d",(int)minor,PETSC_VERSION_MINOR); 25 PetscCheckFalse(subminor != PETSC_VERSION_SUBMINOR,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Library subminor %d does not equal include %d",(int)subminor,PETSC_VERSION_SUBMINOR); 26 27 PetscCall(PetscFinalize()); 28 return 0; 29 } 30 31 /*TEST 32 33 test: 34 35 TEST*/ 36