xref: /petsc/src/sys/tutorials/ex17.c (revision 327415f76d85372a4417cf1aaa14db707d4d6c04)
1c4762a1bSJed Brown 
2c4762a1bSJed Brown static char help[] = "Demonstrates PetscGetVersonNumber().\n\n";
3c4762a1bSJed Brown 
4c4762a1bSJed Brown #include <petscsys.h>
5c4762a1bSJed Brown int main(int argc,char **argv)
6c4762a1bSJed Brown {
7c4762a1bSJed Brown   char           version[128];
8c4762a1bSJed Brown   PetscInt       major,minor,subminor;
9c4762a1bSJed Brown 
10c4762a1bSJed Brown   /*
11c4762a1bSJed Brown     Every PETSc routine should begin with the PetscInitialize() routine.
12c4762a1bSJed Brown     argc, argv - These command line arguments are taken to extract the options
13c4762a1bSJed Brown                  supplied to PETSc and options supplied to MPI.
14c4762a1bSJed Brown     help       - When PETSc executable is invoked with the option -help,
15c4762a1bSJed Brown                  it prints the various options that can be applied at
16c4762a1bSJed Brown                  runtime.  The user can use the "help" variable place
17c4762a1bSJed Brown                  additional help messages in this printout.
18c4762a1bSJed Brown   */
19*327415f7SBarry Smith   PetscFunctionBeginUser;
209566063dSJacob Faibussowitsch   PetscCall(PetscInitialize(&argc,&argv,(char*)0,help));
219566063dSJacob Faibussowitsch   PetscCall(PetscGetVersion(version,sizeof(version)));
22c4762a1bSJed Brown 
239566063dSJacob Faibussowitsch   PetscCall(PetscGetVersionNumber(&major,&minor,&subminor,NULL));
2408401ef6SPierre Jolivet   PetscCheck(major == PETSC_VERSION_MAJOR,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Library major %d does not equal include %d",(int)major,PETSC_VERSION_MAJOR);
2508401ef6SPierre Jolivet   PetscCheck(minor == PETSC_VERSION_MINOR,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Library minor %d does not equal include %d",(int)minor,PETSC_VERSION_MINOR);
2608401ef6SPierre Jolivet   PetscCheck(subminor == PETSC_VERSION_SUBMINOR,PETSC_COMM_SELF,PETSC_ERR_PLIB,"Library subminor %d does not equal include %d",(int)subminor,PETSC_VERSION_SUBMINOR);
27c4762a1bSJed Brown 
289566063dSJacob Faibussowitsch   PetscCall(PetscFinalize());
29b122ec5aSJacob Faibussowitsch   return 0;
30c4762a1bSJed Brown }
31c4762a1bSJed Brown 
32c4762a1bSJed Brown /*TEST
33c4762a1bSJed Brown 
34c4762a1bSJed Brown    test:
35c4762a1bSJed Brown 
36c4762a1bSJed Brown TEST*/
37