Actual source code: slepcnep.h

slepc-3.5.2 2014-10-10
Report Typos and Errors
  1: /*
  2:    User interface for SLEPc's nonlinear eigenvalue solvers.

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2014, 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 <slepceps.h>
 27: #include <slepcpep.h>
 28: #include <slepcfn.h>

 30: PETSC_EXTERN PetscErrorCode NEPInitializePackage(void);

 32: /*S
 33:      NEP - Abstract SLEPc object that manages all solvers for
 34:      nonlinear eigenvalue problems.

 36:    Level: beginner

 38: .seealso:  NEPCreate()
 39: S*/
 40: typedef struct _p_NEP* NEP;

 42: /*J
 43:     NEPType - String with the name of a nonlinear eigensolver

 45:    Level: beginner

 47: .seealso: NEPSetType(), NEP
 48: J*/
 49: typedef const char* NEPType;
 50: #define NEPRII       "rii"
 51: #define NEPSLP       "slp"
 52: #define NEPNARNOLDI  "narnoldi"
 53: #define NEPINTERPOL  "interpol"

 55: /* Logging support */
 56: PETSC_EXTERN PetscClassId NEP_CLASSID;

 58: /*E
 59:     NEPWhich - Determines which part of the spectrum is requested

 61:     Level: intermediate

 63: .seealso: NEPSetWhichEigenpairs(), NEPGetWhichEigenpairs()
 64: E*/
 65: typedef enum { NEP_LARGEST_MAGNITUDE=1,
 66:                NEP_SMALLEST_MAGNITUDE,
 67:                NEP_LARGEST_REAL,
 68:                NEP_SMALLEST_REAL,
 69:                NEP_LARGEST_IMAGINARY,
 70:                NEP_SMALLEST_IMAGINARY,
 71:                NEP_TARGET_MAGNITUDE,
 72:                NEP_TARGET_REAL,
 73:                NEP_TARGET_IMAGINARY} NEPWhich;

 75: /*E
 76:     NEPRefine - The refinement type

 78:     Level: intermediate

 80: .seealso: NEPSetRefine()
 81: E*/
 82: typedef enum { NEP_REFINE_NONE,
 83:                NEP_REFINE_SIMPLE,
 84:                NEP_REFINE_MULTIPLE } NEPRefine;
 85: PETSC_EXTERN const char *NEPRefineTypes[];

 87: /*E
 88:     NEPConvergedReason - Reason a nonlinear eigensolver was said to
 89:          have converged or diverged

 91:     Level: beginner

 93: .seealso: NEPSolve(), NEPGetConvergedReason(), NEPSetTolerances()
 94: E*/
 95: typedef enum {/* converged */
 96:               NEP_CONVERGED_FNORM_ABS          =  2,
 97:               NEP_CONVERGED_FNORM_RELATIVE     =  3,
 98:               NEP_CONVERGED_SNORM_RELATIVE     =  4,
 99:               /* diverged */
100:               NEP_DIVERGED_LINEAR_SOLVE        = -1,
101:               NEP_DIVERGED_FUNCTION_COUNT      = -2,
102:               NEP_DIVERGED_MAX_IT              = -3,
103:               NEP_DIVERGED_BREAKDOWN           = -4,
104:               NEP_DIVERGED_FNORM_NAN           = -5,
105:               NEP_CONVERGED_ITERATING          =  0} NEPConvergedReason;

107: PETSC_EXTERN PetscErrorCode NEPCreate(MPI_Comm,NEP*);
108: PETSC_EXTERN PetscErrorCode NEPDestroy(NEP*);
109: PETSC_EXTERN PetscErrorCode NEPReset(NEP);
110: PETSC_EXTERN PetscErrorCode NEPSetType(NEP,NEPType);
111: PETSC_EXTERN PetscErrorCode NEPGetType(NEP,NEPType*);
112: PETSC_EXTERN PetscErrorCode NEPSetTarget(NEP,PetscScalar);
113: PETSC_EXTERN PetscErrorCode NEPGetTarget(NEP,PetscScalar*);
114: PETSC_EXTERN PetscErrorCode NEPSetKSP(NEP,KSP);
115: PETSC_EXTERN PetscErrorCode NEPGetKSP(NEP,KSP*);
116: PETSC_EXTERN PetscErrorCode NEPSetFromOptions(NEP);
117: PETSC_EXTERN PetscErrorCode NEPSetUp(NEP);
118: PETSC_EXTERN PetscErrorCode NEPSolve(NEP);
119: PETSC_EXTERN PetscErrorCode NEPView(NEP,PetscViewer);

121: PETSC_EXTERN PetscErrorCode NEPSetFunction(NEP,Mat,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat,Mat,void*),void*);
122: PETSC_EXTERN PetscErrorCode NEPGetFunction(NEP,Mat*,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat,Mat,void*),void**);
123: PETSC_EXTERN PetscErrorCode NEPSetJacobian(NEP,Mat,PetscErrorCode (*)(NEP,PetscScalar,Mat,void*),void*);
124: PETSC_EXTERN PetscErrorCode NEPGetJacobian(NEP,Mat*,PetscErrorCode (**)(NEP,PetscScalar,Mat,void*),void**);
125: PETSC_EXTERN PetscErrorCode NEPSetSplitOperator(NEP,PetscInt,Mat*,FN*,MatStructure);
126: PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorTerm(NEP,PetscInt,Mat*,FN*);
127: PETSC_EXTERN PetscErrorCode NEPGetSplitOperatorInfo(NEP,PetscInt*,MatStructure*);

129: PETSC_EXTERN PetscErrorCode NEPSetBV(NEP,BV);
130: PETSC_EXTERN PetscErrorCode NEPGetBV(NEP,BV*);
131: PETSC_EXTERN PetscErrorCode NEPSetRG(NEP,RG);
132: PETSC_EXTERN PetscErrorCode NEPGetRG(NEP,RG*);
133: PETSC_EXTERN PetscErrorCode NEPSetDS(NEP,DS);
134: PETSC_EXTERN PetscErrorCode NEPGetDS(NEP,DS*);
135: PETSC_EXTERN PetscErrorCode NEPSetTolerances(NEP,PetscReal,PetscReal,PetscReal,PetscInt,PetscInt);
136: PETSC_EXTERN PetscErrorCode NEPGetTolerances(NEP,PetscReal*,PetscReal*,PetscReal*,PetscInt*,PetscInt*);
137: PETSC_EXTERN PetscErrorCode NEPSetConvergenceTest(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*),void*,PetscErrorCode (*)(void*));
138: PETSC_EXTERN PetscErrorCode NEPConvergedDefault(NEP,PetscInt,PetscReal,PetscReal,PetscReal,NEPConvergedReason*,void*);
139: PETSC_EXTERN PetscErrorCode NEPSetDimensions(NEP,PetscInt,PetscInt,PetscInt);
140: PETSC_EXTERN PetscErrorCode NEPGetDimensions(NEP,PetscInt*,PetscInt*,PetscInt*);
141: PETSC_EXTERN PetscErrorCode NEPSetRefine(NEP,NEPRefine,PetscReal,PetscInt);
142: PETSC_EXTERN PetscErrorCode NEPGetRefine(NEP,NEPRefine*,PetscReal*,PetscInt*);
143: PETSC_EXTERN PetscErrorCode NEPSetLagPreconditioner(NEP,PetscInt);
144: PETSC_EXTERN PetscErrorCode NEPGetLagPreconditioner(NEP,PetscInt*);
145: PETSC_EXTERN PetscErrorCode NEPSetConstCorrectionTol(NEP,PetscBool);
146: PETSC_EXTERN PetscErrorCode NEPGetConstCorrectionTol(NEP,PetscBool*);

148: PETSC_EXTERN PetscErrorCode NEPGetConverged(NEP,PetscInt*);
149: PETSC_EXTERN PetscErrorCode NEPGetEigenpair(NEP,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec);

151: PETSC_EXTERN PetscErrorCode NEPComputeRelativeError(NEP,PetscInt,PetscReal*);
152: PETSC_EXTERN PetscErrorCode NEPComputeResidualNorm(NEP,PetscInt,PetscReal*);
153: PETSC_EXTERN PetscErrorCode NEPGetErrorEstimate(NEP,PetscInt,PetscReal*);

155: PETSC_EXTERN PetscErrorCode NEPComputeFunction(NEP,PetscScalar,Mat,Mat);
156: PETSC_EXTERN PetscErrorCode NEPComputeJacobian(NEP,PetscScalar,Mat);
157: PETSC_EXTERN PetscErrorCode NEPApplyFunction(NEP,PetscScalar,Vec,Vec,Vec,Mat,Mat);
158: PETSC_EXTERN PetscErrorCode NEPApplyJacobian(NEP,PetscScalar,Vec,Vec,Vec,Mat);
159: PETSC_EXTERN PetscErrorCode NEPProjectOperator(NEP,PetscInt,PetscInt);

161: PETSC_EXTERN PetscErrorCode NEPMonitor(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt);
162: PETSC_EXTERN PetscErrorCode NEPMonitorSet(NEP,PetscErrorCode (*)(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
163: PETSC_EXTERN PetscErrorCode NEPMonitorCancel(NEP);
164: PETSC_EXTERN PetscErrorCode NEPGetMonitorContext(NEP,void **);
165: PETSC_EXTERN PetscErrorCode NEPGetIterationNumber(NEP,PetscInt*);

167: PETSC_EXTERN PetscErrorCode NEPSetInitialSpace(NEP,PetscInt,Vec*);
168: PETSC_EXTERN PetscErrorCode NEPSetWhichEigenpairs(NEP,NEPWhich);
169: PETSC_EXTERN PetscErrorCode NEPGetWhichEigenpairs(NEP,NEPWhich*);
170: PETSC_EXTERN PetscErrorCode NEPSetEigenvalueComparison(NEP,PetscErrorCode (*func)(NEP,PetscScalar,PetscScalar,PetscInt*,void*),void*);

172: PETSC_EXTERN PetscErrorCode NEPMonitorAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
173: PETSC_EXTERN PetscErrorCode NEPMonitorFirst(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
174: PETSC_EXTERN PetscErrorCode NEPMonitorConverged(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
175: PETSC_EXTERN PetscErrorCode NEPMonitorLG(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);
176: PETSC_EXTERN PetscErrorCode NEPMonitorLGAll(NEP,PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscInt,void*);

178: PETSC_EXTERN PetscErrorCode NEPSetTrackAll(NEP,PetscBool);
179: PETSC_EXTERN PetscErrorCode NEPGetTrackAll(NEP,PetscBool*);

181: PETSC_EXTERN PetscErrorCode NEPSetOptionsPrefix(NEP,const char*);
182: PETSC_EXTERN PetscErrorCode NEPAppendOptionsPrefix(NEP,const char*);
183: PETSC_EXTERN PetscErrorCode NEPGetOptionsPrefix(NEP,const char*[]);

185: PETSC_EXTERN PetscErrorCode NEPGetConvergedReason(NEP,NEPConvergedReason *);

187: PETSC_EXTERN PetscFunctionList NEPList;
188: PETSC_EXTERN PetscBool         NEPRegisterAllCalled;
189: PETSC_EXTERN PetscErrorCode NEPRegisterAll(void);
190: PETSC_EXTERN PetscErrorCode NEPRegister(const char[],PetscErrorCode(*)(NEP));

192: PETSC_EXTERN PetscErrorCode NEPSetWorkVecs(NEP,PetscInt);
193: PETSC_EXTERN PetscErrorCode NEPAllocateSolution(NEP,PetscInt);

195: /* --------- options specific to particular eigensolvers -------- */

197: PETSC_EXTERN PetscErrorCode NEPSLPSetEPS(NEP,EPS);
198: PETSC_EXTERN PetscErrorCode NEPSLPGetEPS(NEP,EPS*);

200: PETSC_EXTERN PetscErrorCode NEPInterpolSetPEP(NEP,PEP);
201: PETSC_EXTERN PetscErrorCode NEPInterpolGetPEP(NEP,PEP*);
202: PETSC_EXTERN PetscErrorCode NEPInterpolSetDegree(NEP,PetscInt);
203: PETSC_EXTERN PetscErrorCode NEPInterpolGetDegree(NEP,PetscInt*);

205: #endif