Actual source code: dlregismfn.c

slepc-3.8.0 2017-10-20
Report Typos and Errors
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-2017, 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: #include <slepc/private/mfnimpl.h>

 13: static PetscBool MFNPackageInitialized = PETSC_FALSE;

 15: const char *const MFNConvergedReasons_Shifted[] = {"DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","CONVERGED_ITS","MFNConvergedReason","MFN_",0};
 16: const char *const*MFNConvergedReasons = MFNConvergedReasons_Shifted + 2;

 18: /*@C
 19:   MFNFinalizePackage - This function destroys everything in the SLEPc interface
 20:   to the MFN package. It is called from SlepcFinalize().

 22:   Level: developer

 24: .seealso: SlepcFinalize()
 25: @*/
 26: PetscErrorCode MFNFinalizePackage(void)
 27: {

 31:   PetscFunctionListDestroy(&MFNList);
 32:   MFNPackageInitialized = PETSC_FALSE;
 33:   MFNRegisterAllCalled  = PETSC_FALSE;
 34:   return(0);
 35: }

 37: /*@C
 38:   MFNInitializePackage - This function initializes everything in the MFN package.
 39:   It is called from PetscDLLibraryRegister() when using dynamic libraries, and
 40:   on the first call to MFNCreate() when using static libraries.

 42:   Level: developer

 44: .seealso: SlepcInitialize()
 45: @*/
 46: PetscErrorCode MFNInitializePackage(void)
 47: {
 48:   char           logList[256];
 49:   char           *className;
 50:   PetscBool      opt;

 54:   if (MFNPackageInitialized) return(0);
 55:   MFNPackageInitialized = PETSC_TRUE;
 56:   /* Register Classes */
 57:   PetscClassIdRegister("Matrix Function",&MFN_CLASSID);
 58:   /* Register Constructors */
 59:   MFNRegisterAll();
 60:   /* Register Events */
 61:   PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp);
 62:   PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve);
 63:   /* Process info exclusions */
 64:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,256,&opt);
 65:   if (opt) {
 66:     PetscStrstr(logList,"mfn",&className);
 67:     if (className) {
 68:       PetscInfoDeactivateClass(MFN_CLASSID);
 69:     }
 70:   }
 71:   /* Process summary exclusions */
 72:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,256,&opt);
 73:   if (opt) {
 74:     PetscStrstr(logList,"mfn",&className);
 75:     if (className) {
 76:       PetscLogEventDeactivateClass(MFN_CLASSID);
 77:     }
 78:   }
 79:   PetscRegisterFinalize(MFNFinalizePackage);
 80:   return(0);
 81: }

 83: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 84: /*
 85:   PetscDLLibraryRegister - This function is called when the dynamic library
 86:   it is in is opened.

 88:   This one registers all the MFN methods that are in the basic SLEPc libslepcmfn
 89:   library.
 90:  */
 91: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcmfn()
 92: {

 96:   MFNInitializePackage();
 97:   return(0);
 98: }
 99: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */