Actual source code: ex17.c

      1: static char help[] = "Demonstrates PetscGetVersonNumber().\n\n";

      3: #include <petscsys.h>
      4: int main(int argc, char **argv)
      5: {
      6:   char     version[128];
      7:   PetscInt major, minor, subminor;

      9:   /*
     10:     Every PETSc routine should begin with the PetscInitialize() routine.
     11:     argc, argv - These command line arguments are taken to extract the options
     12:                  supplied to PETSc and options supplied to MPI.
     13:     help       - When PETSc executable is invoked with the option -help,
     14:                  it prints the various options that can be applied at
     15:                  runtime.  The user can use the "help" variable place
     16:                  additional help messages in this printout.
     17:   */
     18:   PetscFunctionBeginUser;
     19:   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
     20:   PetscCall(PetscGetVersion(version, sizeof(version)));

     22:   PetscCall(PetscGetVersionNumber(&major, &minor, &subminor, NULL));
     23:   PetscCheck(major == PETSC_VERSION_MAJOR, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Library major %" PetscInt_FMT " does not equal include %d", major, PETSC_VERSION_MAJOR);
     24:   PetscCheck(minor == PETSC_VERSION_MINOR, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Library minor %" PetscInt_FMT " does not equal include %d", minor, PETSC_VERSION_MINOR);
     25:   PetscCheck(subminor == PETSC_VERSION_SUBMINOR, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Library subminor %" PetscInt_FMT " does not equal include %d", subminor, PETSC_VERSION_SUBMINOR);

     27:   PetscCall(PetscFinalize());
     28:   return 0;
     29: }

     31: /*TEST

     33:    test:
     34:      output_file: output/empty.out

     36: TEST*/