Date: 2023-01-26T12:18:29+00:00

Actual source code: test4.c
slepc-3.18.2 2023-01-26
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);
     24:   SlepcInitialize(&argc,&argv,(char*)0,help);
     25:   PetscInitialized(&pInitialized);
     26:   SlepcInitialized(&sInitialized);
     27:   PetscPrintf(PETSC_COMM_WORLD,"PetscInitialized=%d, SlepcInitialized=%d.\n",(int)pInitialized,(int)sInitialized);
     28:   PetscOptionsHasName(NULL,NULL,"-skip_petsc_finalize",&skip_petsc_finalize);
     29:   if (!skip_petsc_finalize) {
     30:     PetscFinalize();
     31:     PetscFinalized(&pFinalized);
     32:     if (!pFinalized) printf("Unexpected value: PetscFinalized() returned False after PetscFinalize()\n");
     33:   }
     34:   SlepcFinalized(&sFinalized);
     35:   if (sFinalized) printf("Unexpected value: SlepcFinalized() returned True before SlepcFinalize()\n");
     36:   SlepcFinalize();
     37:   SlepcFinalized(&sFinalized);
     38:   if (!sFinalized) printf("Unexpected value: SlepcFinalized() returned False after SlepcFinalize()\n");
     39:   if (skip_petsc_finalize) PetscFinalize();
     40:   return 0;
     41: }

     43: /*TEST

     45:    testset:
     46:       output_file: output/test4_1.out
     47:       test:
     48:          suffix: 1
     49:       test:
     50:          suffix: 2
     51:          args: -skip_petsc_finalize

     53: TEST*/