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