Actual source code: zstart.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:    This file contains the Fortran version of SlepcInitialize()
     12: */

     14: #include <slepc/private/slepcimpl.h>
     15: #include <petsc/private/ftnimpl.h>

     17: #if defined(PETSC_HAVE_FORTRAN_CAPS)
     18: #define petscinitializef_             PETSCINITIALIZEF
     19: #define petscfinalize_                PETSCFINALIZE
     20: #define slepcinitializef_             SLEPCINITIALIZEF
     21: #define slepcfinalize_                SLEPCFINALIZE
     22: #define slepcinitializefortran_       SLEPCINITIALIZEFORTRAN
     23: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
     24: #define petscinitializef_             petscinitializef
     25: #define petscfinalize_                petscfinalize
     26: #define slepcinitializef_             slepcinitializef
     27: #define slepcfinalize_                slepcfinalize
     28: #define slepcinitializefortran_       slepcinitializefortran
     29: #endif

     31: SLEPC_EXTERN void petscinitializef_(char *filename,char* help,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len,PETSC_FORTRAN_CHARLEN_T helplen);
     32: SLEPC_EXTERN void petscfinalize_(PetscErrorCode *ierr);

     34: /*
     35:     SlepcInitialize - Version called from Fortran.

     37:     Notes:
     38:     Since this routine is called from Fortran it does not return error codes.
     39: */
     40: SLEPC_EXTERN void slepcinitializef_(char *filename,char* help,PetscErrorCode *ierr,PETSC_FORTRAN_CHARLEN_T len,PETSC_FORTRAN_CHARLEN_T helplen)
     41: {
     42:   PetscBool flg;

     44:   if (SlepcInitializeCalled) { *ierr = PETSC_SUCCESS; return; }

     46:   *ierr = PetscInitialized(&flg);
     47:   if (*ierr) { (void)(*PetscErrorPrintf)("SlepcInitialize:PetscInitialized failed");return; }
     48:   if (!flg) {
     49:     petscinitializef_(filename,help,ierr,len,helplen);
     50:     if (*ierr) { (void)(*PetscErrorPrintf)("SlepcInitialize:PetscInitialize failed");return; }
     51:     SlepcBeganPetsc = PETSC_TRUE;
     52:   }

     54:   *ierr = SlepcCitationsInitialize();
     55:   if (*ierr) { (void)(*PetscErrorPrintf)("SlepcInitialize:SlepcCitationsInitialize()\n");return; }

     57:   *ierr = SlepcInitialize_DynamicLibraries();
     58:   if (*ierr) { (void)(*PetscErrorPrintf)("SlepcInitialize:Initializing dynamic libraries\n");return; }

     60:   SlepcInitializeCalled = PETSC_TRUE;
     61:   SlepcFinalizeCalled   = PETSC_FALSE;
     62:   *ierr = PetscInfo(0,"SLEPc successfully started from Fortran\n");
     63:   if (*ierr) { (void)(*PetscErrorPrintf)("SlepcInitialize:Calling PetscInfo()");return; }
     64: }