Date: 2022-08-09T09:05:32+00:00

Actual source code: test4.c
slepc-3.17.2 2022-08-09
Report Typos and Errors

      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 SlepcInitialize() after PetscInitialize().\n\n";

     13: #include <slepcsys.h>

     15: int main(int argc,char **argv)
     16: {
     17:   PetscBool pInitialized,sInitialized,pFinalized,sFinalized,skip_petsc_finalize;

     19:   PetscInitialize(&argc,&argv,(char*)0,help);
     20:   PetscInitialized(&pInitialized);
     21:   SlepcInitialized(&sInitialized);
     22:   PetscPrintf(PETSC_COMM_WORLD,"PetscInitialized=%d, SlepcInitialized=%d.\n",(int)pInitialized,(int)sInitialized);
     23:   SlepcInitialize(&argc,&argv,(char*)0,help);
     24:   PetscInitialized(&pInitialized);
     25:   SlepcInitialized(&sInitialized);
     26:   PetscPrintf(PETSC_COMM_WORLD,"PetscInitialized=%d, SlepcInitialized=%d.\n",(int)pInitialized,(int)sInitialized);
     27:   PetscOptionsHasName(NULL,NULL,"-skip_petsc_finalize",&skip_petsc_finalize);
     28:   if (!skip_petsc_finalize) {
     29:     PetscFinalize();
     30:     PetscFinalized(&pFinalized);
     31:     if (!pFinalized) printf("Unexpected value: PetscFinalized() returned False after PetscFinalize()\n");
     32:   }
     33:   SlepcFinalized(&sFinalized);
     34:   if (sFinalized) printf("Unexpected value: SlepcFinalized() returned True before SlepcFinalize()\n");
     35:   SlepcFinalize();
     36:   SlepcFinalized(&sFinalized);
     37:   if (!sFinalized) printf("Unexpected value: SlepcFinalized() returned False after SlepcFinalize()\n");
     38:   return 0;
     39: }

     41: /*TEST

     43:    testset:
     44:       output_file: output/test4_1.out
     45:       test:
     46:          suffix: 1
     47:       test:
     48:          suffix: 2
     49:          args: -skip_petsc_finalize
     50:          TODO: shows an mpiexec error message in C++ jobs

     52: TEST*/