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