Actual source code: slepcmfn.h

  1: /*
  2:    User interface for the SLEPC matrix function object.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2013, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.

 10:    SLEPc is free software: you can redistribute it and/or modify it under  the
 11:    terms of version 3 of the GNU Lesser General Public License as published by
 12:    the Free Software Foundation.

 14:    SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 15:    WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 16:    FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 17:    more details.

 19:    You  should have received a copy of the GNU Lesser General  Public  License
 20:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: */

 26: #include <slepcip.h>
 27: #include <slepcds.h>

 29: PETSC_EXTERN PetscErrorCode MFNInitializePackage(void);

 31: /*S
 32:     MFN - SLEPc object that encapsulates functionality for matrix functions.

 34:     Level: beginner

 36: .seealso:  MFNCreate()
 37: S*/
 38: typedef struct _p_MFN* MFN;

 40: /*J
 41:     MFNType - String with the name of a method for computing matrix functions.

 43:     Level: beginner

 45: .seealso: MFNSetType(), MFN
 46: J*/
 47: typedef const char* MFNType;
 48: #define MFNKRYLOV   "krylov"

 50: /* Logging support */
 51: PETSC_EXTERN PetscClassId MFN_CLASSID;

 53: PETSC_EXTERN PetscErrorCode MFNCreate(MPI_Comm,MFN *);
 54: PETSC_EXTERN PetscErrorCode MFNDestroy(MFN*);
 55: PETSC_EXTERN PetscErrorCode MFNReset(MFN);
 56: PETSC_EXTERN PetscErrorCode MFNSetType(MFN,MFNType);
 57: PETSC_EXTERN PetscErrorCode MFNGetType(MFN,MFNType*);
 58: PETSC_EXTERN PetscErrorCode MFNSetFunction(MFN,SlepcFunction);
 59: PETSC_EXTERN PetscErrorCode MFNGetFunction(MFN,SlepcFunction*);
 60: PETSC_EXTERN PetscErrorCode MFNSetOperator(MFN,Mat);
 61: PETSC_EXTERN PetscErrorCode MFNGetOperator(MFN,Mat*);
 62: PETSC_EXTERN PetscErrorCode MFNSetFromOptions(MFN);
 63: PETSC_EXTERN PetscErrorCode MFNSetUp(MFN);
 64: PETSC_EXTERN PetscErrorCode MFNSolve(MFN,Vec,Vec);
 65: PETSC_EXTERN PetscErrorCode MFNView(MFN,PetscViewer);

 67: PETSC_EXTERN PetscErrorCode MFNSetIP(MFN,IP);
 68: PETSC_EXTERN PetscErrorCode MFNGetIP(MFN,IP*);
 69: PETSC_EXTERN PetscErrorCode MFNSetDS(MFN,DS);
 70: PETSC_EXTERN PetscErrorCode MFNGetDS(MFN,DS*);
 71: PETSC_EXTERN PetscErrorCode MFNSetTolerances(MFN,PetscReal,PetscInt);
 72: PETSC_EXTERN PetscErrorCode MFNGetTolerances(MFN,PetscReal*,PetscInt*);
 73: PETSC_EXTERN PetscErrorCode MFNSetDimensions(MFN,PetscInt);
 74: PETSC_EXTERN PetscErrorCode MFNGetDimensions(MFN,PetscInt*);
 75: PETSC_EXTERN PetscErrorCode MFNSetScaleFactor(MFN,PetscScalar);
 76: PETSC_EXTERN PetscErrorCode MFNGetScaleFactor(MFN,PetscScalar*);

 78: PETSC_EXTERN PetscErrorCode MFNMonitor(MFN,PetscInt,PetscReal);
 79: PETSC_EXTERN PetscErrorCode MFNMonitorSet(MFN,PetscErrorCode (*)(MFN,PetscInt,PetscReal,void*),void*,PetscErrorCode (*)(void**));
 80: PETSC_EXTERN PetscErrorCode MFNMonitorCancel(MFN);
 81: PETSC_EXTERN PetscErrorCode MFNGetMonitorContext(MFN,void **);
 82: PETSC_EXTERN PetscErrorCode MFNGetIterationNumber(MFN,PetscInt*);

 84: PETSC_EXTERN PetscErrorCode MFNSetErrorIfNotConverged(MFN,PetscBool);
 85: PETSC_EXTERN PetscErrorCode MFNGetErrorIfNotConverged(MFN,PetscBool*);

 87: PETSC_EXTERN PetscErrorCode MFNMonitorDefault(MFN,PetscInt,PetscReal,void*);
 88: PETSC_EXTERN PetscErrorCode MFNMonitorLG(MFN,PetscInt,PetscReal,void*);

 90: PETSC_EXTERN PetscErrorCode MFNSetOptionsPrefix(MFN,const char*);
 91: PETSC_EXTERN PetscErrorCode MFNAppendOptionsPrefix(MFN,const char*);
 92: PETSC_EXTERN PetscErrorCode MFNGetOptionsPrefix(MFN,const char*[]);

 94: /*E
 95:     MFNConvergedReason - reason a matrix function iteration was said to
 96:          have converged or diverged

 98:     Level: beginner

100: .seealso: MFNSolve(), MFNGetConvergedReason(), MFNSetTolerances()
101: E*/
102: typedef enum {/* converged */
103:               MFN_CONVERGED_TOL                =  2,
104:               /* diverged */
105:               MFN_DIVERGED_ITS                 = -3,
106:               MFN_DIVERGED_BREAKDOWN           = -4,
107:               MFN_CONVERGED_ITERATING          =  0} MFNConvergedReason;

109: PETSC_EXTERN PetscErrorCode MFNGetConvergedReason(MFN,MFNConvergedReason *);

111: PETSC_EXTERN PetscFunctionList MFNList;
112: PETSC_EXTERN PetscBool         MFNRegisterAllCalled;
113: PETSC_EXTERN PetscErrorCode MFNRegisterAll(void);
114: PETSC_EXTERN PetscErrorCode MFNRegister(const char[],PetscErrorCode(*)(MFN));

116: #endif