Date: 2026-03-09T09:12:20+00:00

Actual source code: test1.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: */
     10: /*
     11:    Demonstrates SlepcInitializeNoArguments()
     12: */

     14: #include <slepcsys.h>

     16: int main(int argc,char **argv)
     17: {
     18:   PetscBool      isInitialized,isFinalized;

     20:   PetscCall(SlepcInitialized(&isInitialized));
     21:   if (!isInitialized) {
     22:     PetscCall(SlepcInitializeNoArguments());
     23:     PetscCall(PetscPrintf(PETSC_COMM_WORLD,"Initialize SLEPc.\n"));
     24:     PetscCall(SlepcInitialized(&isInitialized));
     25:     PetscCall(SlepcFinalized(&isFinalized));
     26:     PetscCall(PetscPrintf(PETSC_COMM_WORLD,"SlepcInitialized=%d, SlepcFinalized=%d.\n",(int)isInitialized,(int)isFinalized));
     27:   } else PetscCall(PetscPrintf(PETSC_COMM_WORLD,"SLEPc was already initialized.\n"));
     28:   PetscCall(SlepcFinalize());
     29:   PetscCall(SlepcFinalized(&isFinalized));
     30:   if (!isFinalized) printf("Unexpected value: SlepcFinalized() returned False after SlepcFinalize()\n");
     31:   return 0;
     32: }

     34: /*TEST

     36:    test:
     37:       suffix: 1

     39: TEST*/