Actual source code: slepcst.h
1: /*
2: Spectral transformation module for eigenvalue problems.
4: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5: SLEPc - Scalable Library for Eigenvalue Problem Computations
6: Copyright (c) 2002-2012, Universitat Politecnica de Valencia, Spain
8: This file is part of SLEPc.
9:
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 slepcsys.h
27: #include "petscksp.h"
29: PETSC_EXTERN PetscErrorCode STInitializePackage(const char[]);
31: /*S
32: ST - Abstract SLEPc object that manages spectral transformations.
33: This object is accessed only in advanced applications.
35: Level: beginner
37: .seealso: STCreate(), EPS
38: S*/
39: typedef struct _p_ST* ST;
41: /*E
42: STType - String with the name of a SLEPc spectral transformation
44: Level: beginner
46: .seealso: STSetType(), ST
47: E*/
48: #define STType char*
49: #define STSHELL "shell"
50: #define STSHIFT "shift"
51: #define STSINVERT "sinvert"
52: #define STCAYLEY "cayley"
53: #define STFOLD "fold"
54: #define STPRECOND "precond"
56: /* Logging support */
57: PETSC_EXTERN PetscClassId ST_CLASSID;
59: PETSC_EXTERN PetscErrorCode STCreate(MPI_Comm,ST*);
60: PETSC_EXTERN PetscErrorCode STDestroy(ST*);
61: PETSC_EXTERN PetscErrorCode STReset(ST);
62: PETSC_EXTERN PetscErrorCode STSetType(ST,const STType);
63: PETSC_EXTERN PetscErrorCode STGetType(ST,const STType*);
64: PETSC_EXTERN PetscErrorCode STSetOperators(ST,Mat,Mat);
65: PETSC_EXTERN PetscErrorCode STGetOperators(ST,Mat*,Mat*);
66: PETSC_EXTERN PetscErrorCode STSetUp(ST);
67: PETSC_EXTERN PetscErrorCode STSetFromOptions(ST);
68: PETSC_EXTERN PetscErrorCode STView(ST,PetscViewer);
70: PETSC_EXTERN PetscErrorCode STApply(ST,Vec,Vec);
71: PETSC_EXTERN PetscErrorCode STGetBilinearForm(ST,Mat*);
72: PETSC_EXTERN PetscErrorCode STApplyTranspose(ST,Vec,Vec);
73: PETSC_EXTERN PetscErrorCode STComputeExplicitOperator(ST,Mat*);
74: PETSC_EXTERN PetscErrorCode STPostSolve(ST);
76: PETSC_EXTERN PetscErrorCode STSetKSP(ST,KSP);
77: PETSC_EXTERN PetscErrorCode STGetKSP(ST,KSP*);
78: PETSC_EXTERN PetscErrorCode STSetShift(ST,PetscScalar);
79: PETSC_EXTERN PetscErrorCode STGetShift(ST,PetscScalar*);
80: PETSC_EXTERN PetscErrorCode STSetDefaultShift(ST,PetscScalar);
81: PETSC_EXTERN PetscErrorCode STSetBalanceMatrix(ST,Vec);
82: PETSC_EXTERN PetscErrorCode STGetBalanceMatrix(ST,Vec*);
84: PETSC_EXTERN PetscErrorCode STAssociatedKSPSolve(ST,Vec,Vec);
85: PETSC_EXTERN PetscErrorCode STAssociatedKSPSolveTranspose(ST,Vec,Vec);
87: PETSC_EXTERN PetscErrorCode STSetOptionsPrefix(ST,const char*);
88: PETSC_EXTERN PetscErrorCode STAppendOptionsPrefix(ST,const char*);
89: PETSC_EXTERN PetscErrorCode STGetOptionsPrefix(ST,const char*[]);
91: PETSC_EXTERN PetscErrorCode STBackTransform(ST,PetscInt,PetscScalar*,PetscScalar*);
93: PETSC_EXTERN PetscErrorCode STCheckNullSpace(ST,PetscInt,const Vec[]);
95: PETSC_EXTERN PetscErrorCode STGetOperationCounters(ST,PetscInt*,PetscInt*);
96: PETSC_EXTERN PetscErrorCode STResetOperationCounters(ST);
98: /*E
99: STMatMode - determines how to handle the coefficient matrix associated
100: to the spectral transformation
102: Level: intermediate
104: .seealso: STSetMatMode(), STGetMatMode()
105: E*/
106: typedef enum { ST_MATMODE_COPY,
107: ST_MATMODE_INPLACE,
108: ST_MATMODE_SHELL } STMatMode;
109: PETSC_EXTERN PetscErrorCode STSetMatMode(ST,STMatMode);
110: PETSC_EXTERN PetscErrorCode STGetMatMode(ST,STMatMode*);
111: PETSC_EXTERN PetscErrorCode STSetMatStructure(ST,MatStructure);
112: PETSC_EXTERN PetscErrorCode STGetMatStructure(ST,MatStructure*);
114: PETSC_EXTERN PetscFList STList;
115: PETSC_EXTERN PetscBool STRegisterAllCalled;
116: PETSC_EXTERN PetscErrorCode STRegisterAll(const char[]);
117: PETSC_EXTERN PetscErrorCode STRegisterDestroy(void);
118: PETSC_EXTERN PetscErrorCode STRegister(const char[],const char[],const char[],PetscErrorCode(*)(ST));
120: /*MC
121: STRegisterDynamic - Adds a method to the spectral transformation package.
123: Synopsis:
124: PetscErrorCode STRegisterDynamic(const char *name,const char *path,const char *name_create,PetscErrorCode (*routine_create)(ST))
126: Not collective
128: Input Parameters:
129: + name - name of a new user-defined transformation
130: . path - path (either absolute or relative) the library containing this solver
131: . name_create - name of routine to create method context
132: - routine_create - routine to create method context
134: Notes:
135: STRegisterDynamic() may be called multiple times to add several user-defined
136: spectral transformations.
138: If dynamic libraries are used, then the fourth input argument (routine_create)
139: is ignored.
141: Sample usage:
142: .vb
143: STRegisterDynamic("my_solver","/home/username/my_lib/lib/libO/solaris/mylib.a",
144: "MySolverCreate",MySolverCreate);
145: .ve
147: Then, your solver can be chosen with the procedural interface via
148: $ STSetType(st,"my_solver")
149: or at runtime via the option
150: $ -st_type my_solver
152: Level: advanced
154: .seealso: STRegisterDestroy(), STRegisterAll()
155: M*/
156: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
157: #define STRegisterDynamic(a,b,c,d) STRegister(a,b,c,0)
158: #else
159: #define STRegisterDynamic(a,b,c,d) STRegister(a,b,c,d)
160: #endif
162: /* --------- options specific to particular spectral transformations-------- */
164: PETSC_EXTERN PetscErrorCode STShellGetContext(ST st,void **ctx);
165: PETSC_EXTERN PetscErrorCode STShellSetContext(ST st,void *ctx);
166: PETSC_EXTERN PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec));
167: PETSC_EXTERN PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec));
168: PETSC_EXTERN PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*));
170: PETSC_EXTERN PetscErrorCode STCayleyGetAntishift(ST,PetscScalar*);
171: PETSC_EXTERN PetscErrorCode STCayleySetAntishift(ST,PetscScalar);
173: PETSC_EXTERN PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat);
174: PETSC_EXTERN PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat);
175: PETSC_EXTERN PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscBool *setmat);
176: PETSC_EXTERN PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscBool setmat);
178: #endif