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