xref: /petsc/src/sys/tutorials/ex17.c (revision 5f80ce2ab25dff0f4601e710601cbbcecf323266)
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   PetscErrorCode ierr;
13c4762a1bSJed Brown   char           version[128];
14c4762a1bSJed Brown   PetscInt       major,minor,subminor;
15c4762a1bSJed Brown 
16c4762a1bSJed Brown   /*
17c4762a1bSJed Brown     Every PETSc routine should begin with the PetscInitialize() routine.
18c4762a1bSJed Brown     argc, argv - These command line arguments are taken to extract the options
19c4762a1bSJed Brown                  supplied to PETSc and options supplied to MPI.
20c4762a1bSJed Brown     help       - When PETSc executable is invoked with the option -help,
21c4762a1bSJed Brown                  it prints the various options that can be applied at
22c4762a1bSJed Brown                  runtime.  The user can use the "help" variable place
23c4762a1bSJed Brown                  additional help messages in this printout.
24c4762a1bSJed Brown   */
25c4762a1bSJed Brown   ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
26*5f80ce2aSJacob Faibussowitsch   CHKERRQ(PetscGetVersion(version,sizeof(version)));
27c4762a1bSJed Brown 
28*5f80ce2aSJacob Faibussowitsch   CHKERRQ(PetscGetVersionNumber(&major,&minor,&subminor,NULL));
292c71b3e2SJacob 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);
302c71b3e2SJacob 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);
312c71b3e2SJacob 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);
32c4762a1bSJed Brown 
33c4762a1bSJed Brown   ierr = PetscFinalize();
34c4762a1bSJed Brown   return ierr;
35c4762a1bSJed Brown }
36c4762a1bSJed Brown 
37c4762a1bSJed Brown /*TEST
38c4762a1bSJed Brown 
39c4762a1bSJed Brown    test:
40c4762a1bSJed Brown 
41c4762a1bSJed Brown TEST*/
42