1c4762a1bSJed Brown static char help[] = "Demonstrates PetscGetVersonNumber().\n\n"; 2c4762a1bSJed Brown 3c4762a1bSJed Brown #include <petscsys.h> 4d71ae5a4SJacob Faibussowitsch int main(int argc, char **argv) 5d71ae5a4SJacob Faibussowitsch { 6c4762a1bSJed Brown char version[128]; 7c4762a1bSJed Brown PetscInt major, minor, subminor; 8c4762a1bSJed Brown 9c4762a1bSJed Brown /* 10c4762a1bSJed Brown Every PETSc routine should begin with the PetscInitialize() routine. 11c4762a1bSJed Brown argc, argv - These command line arguments are taken to extract the options 12c4762a1bSJed Brown supplied to PETSc and options supplied to MPI. 13c4762a1bSJed Brown help - When PETSc executable is invoked with the option -help, 14c4762a1bSJed Brown it prints the various options that can be applied at 15c4762a1bSJed Brown runtime. The user can use the "help" variable place 16c4762a1bSJed Brown additional help messages in this printout. 17c4762a1bSJed Brown */ 18327415f7SBarry Smith PetscFunctionBeginUser; 19c8025a54SPierre Jolivet PetscCall(PetscInitialize(&argc, &argv, NULL, help)); 209566063dSJacob Faibussowitsch PetscCall(PetscGetVersion(version, sizeof(version))); 21c4762a1bSJed Brown 229566063dSJacob Faibussowitsch PetscCall(PetscGetVersionNumber(&major, &minor, &subminor, NULL)); 23300f1712SStefano Zampini PetscCheck(major == PETSC_VERSION_MAJOR, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Library major %" PetscInt_FMT " does not equal include %d", major, PETSC_VERSION_MAJOR); 24300f1712SStefano Zampini PetscCheck(minor == PETSC_VERSION_MINOR, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Library minor %" PetscInt_FMT " does not equal include %d", minor, PETSC_VERSION_MINOR); 25300f1712SStefano Zampini PetscCheck(subminor == PETSC_VERSION_SUBMINOR, PETSC_COMM_SELF, PETSC_ERR_PLIB, "Library subminor %" PetscInt_FMT " does not equal include %d", subminor, PETSC_VERSION_SUBMINOR); 26c4762a1bSJed Brown 279566063dSJacob Faibussowitsch PetscCall(PetscFinalize()); 28b122ec5aSJacob Faibussowitsch return 0; 29c4762a1bSJed Brown } 30c4762a1bSJed Brown 31c4762a1bSJed Brown /*TEST 32c4762a1bSJed Brown 33c4762a1bSJed Brown test: 34*3886731fSPierre Jolivet output_file: output/empty.out 35c4762a1bSJed Brown 36c4762a1bSJed Brown TEST*/ 37