Actual source code: test3.c
slepc-3.21.2 2024-09-25
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[] = "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;
20: PetscFunctionBeginUser;
21: PetscCall(SlepcInitialize(&argc,&argv,(char*)0,help));
22: PetscCall(PetscOptionsGetString(NULL,NULL,"-pkg",pkg,sizeof(pkg),NULL));
23: PetscCall(SlepcHasExternalPackage(pkg,&has));
24: PetscCall(PetscPrintf(PETSC_COMM_WORLD, "SLEPc has %s? %s\n",pkg,PetscBools[has]));
25: PetscCall(PetscStrcmp(pkg,"arpack",&flg));
26: #if defined(SLEPC_HAVE_ARPACK)
27: PetscCheck(!flg || has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says ARPACK is not configured but SLEPC_HAVE_ARPACK is defined");
28: #else
29: PetscCheck(!flg || !has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says ARPACK is configured but SLEPC_HAVE_ARPACK is undefined");
30: #endif
31: PetscCall(PetscStrcmp(pkg,"primme",&flg));
32: #if defined(SLEPC_HAVE_PRIMME)
33: PetscCheck(!flg || has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says PRIMME is not configured but SLEPC_HAVE_PRIMME is defined");
34: #else
35: PetscCheck(!flg || !has,PETSC_COMM_WORLD,PETSC_ERR_PLIB,"SlepcHasExternalPackage() says PRIMME is configured but SLEPC_HAVE_PRIMME is undefined");
36: #endif
37: PetscCall(SlepcFinalize());
38: return 0;
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*/