Date: 2021-03-03T22:25:48+00:00

Actual source code: ex17.c
petsc-3.14.5 2021-03-03
Report Typos and Errors

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

      4: /*T
      5:    Concepts: introduction to PETSc;
      6:    Processors: n
      7: T*/

      9: #include <petscsys.h>
     10: int main(int argc,char **argv)
     11: {
     13:   char           version[128];
     14:   PetscInt       major,minor,subminor;

     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:   PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
     26:   PetscGetVersion(version,sizeof(version));

     28:   PetscGetVersionNumber(&major,&minor,&subminor,NULL);
     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);

     33:   PetscFinalize();
     34:   return ierr;
     35: }

     38: /*TEST

     40:    test:

     42: TEST*/