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