Actual source code: ex33.c

      1: /*
      2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      4:    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain

      6:    This file is part of SLEPc.
      7:    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
      8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      9: */

     11: static char help[] = "Demonstrates SlepcGetVersionNumber().\n\n";

     13: #include <slepcsys.h>

     15: int main(int argc,char **argv)
     16: {
     17:   char           version[128];
     18:   PetscInt       major,minor,subminor;
     19:   PetscBool      verbose;

     21:   PetscFunctionBeginUser;
     22:   PetscCall(SlepcInitialize(&argc,&argv,NULL,help));
     23:   PetscCall(PetscPrintf(PETSC_COMM_WORLD,"Checking SLEPc version.\n"));

     25:   PetscCall(SlepcGetVersion(version,sizeof(version)));
     26:   PetscCall(PetscOptionsHasName(NULL,NULL,"-verbose",&verbose));
     27:   if (verbose) PetscCall(PetscPrintf(PETSC_COMM_WORLD,"Version information:\n%s\n",version));

     29:   PetscCall(SlepcGetVersionNumber(&major,&minor,&subminor,NULL));
     30:   PetscCheck(major==SLEPC_VERSION_MAJOR,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Library major %" PetscInt_FMT " does not equal include %d",major,SLEPC_VERSION_MAJOR);
     31:   PetscCheck(minor==SLEPC_VERSION_MINOR,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Library minor %" PetscInt_FMT " does not equal include %d",minor,SLEPC_VERSION_MINOR);
     32:   PetscCheck(subminor==SLEPC_VERSION_SUBMINOR,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"Library subminor %" PetscInt_FMT " does not equal include %d",subminor,SLEPC_VERSION_SUBMINOR);

     34:   PetscCall(SlepcFinalize());
     35:   return 0;
     36: }

     38: /*TEST

     40:    test:
     41:       suffix: 1

     43: TEST*/