Actual source code: test3.c

slepc-3.16.1 2021-11-17
Report Typos and Errors
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2021, 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[] = "Tests SlepcHasExternalPackage().\n\n";

 13: #include <slepcsys.h>

 15: int main(int argc,char **argv)
 16: {
 17:   char           pkg[128] = "arpack";
 18:   PetscBool      has,flg;

 21:   SlepcInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
 22:   PetscOptionsGetString(NULL,NULL,"-pkg",pkg,sizeof(pkg),NULL);
 23:   SlepcHasExternalPackage(pkg,&has);
 24:   PetscPrintf(PETSC_COMM_WORLD, "SLEPc has %s? %s\n",pkg,PetscBools[has]);
 25:   PetscStrcmp(pkg,"arpack",&flg);
 26: #if defined(SLEPC_HAVE_ARPACK)
 27:   if (flg && !has) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says ARPACK is not configured but SLEPC_HAVE_ARPACK is defined");
 28: #else
 29:   if (flg && has)  SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says ARPACK is configured but SLEPC_HAVE_ARPACK is undefined");
 30: #endif
 31:   PetscStrcmp(pkg,"primme",&flg);
 32: #if defined(SLEPC_HAVE_PRIMME)
 33:   if (flg && !has) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says PRIMME is not configured but SLEPC_HAVE_PRIMME is defined");
 34: #else
 35:   if (flg && has)  SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says PRIMME is configured but SLEPC_HAVE_PRIMME is undefined");
 36: #endif
 37:   SlepcFinalize();
 38:   return ierr;
 39: }

 41: /*TEST

 43:    test:
 44:       suffix: arpack
 45:       args: -pkg arpack
 46:       requires: arpack
 47:    test:
 48:       suffix: no-arpack
 49:       args: -pkg arpack
 50:       requires: !arpack
 51:    test:
 52:       suffix: primme
 53:       args: -pkg primme
 54:       requires: primme
 55:    test:
 56:       suffix: no-primme
 57:       args: -pkg primme
 58:       requires: !primme

 60: TEST*/