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:   const char *config;
  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, NULL, help));
 21:   PetscCall(PetscGetVersion(version, sizeof(version)));
 22:   PetscCall(PetscGetConfiguration(&config));

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

 29:   PetscCall(PetscFinalize());
 30:   return 0;
 31: }

 33: /*TEST

 35:    test:
 36:      output_file: output/empty.out

 38: TEST*/