Actual source code: stimpl.h
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
6: This file is part of SLEPc.
7:
8: SLEPc is free software: you can redistribute it and/or modify it under the
9: terms of version 3 of the GNU Lesser General Public License as published by
10: the Free Software Foundation.
12: SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY
13: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14: FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15: more details.
17: You should have received a copy of the GNU Lesser General Public License
18: along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
19: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20: */
22: #ifndef _STIMPL
23: #define _STIMPL
25: #include <slepcst.h>
27: extern PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyB,ST_ApplyTranspose;
28: extern PetscFList STList;
30: typedef struct _STOps *STOps;
32: struct _STOps {
33: PetscErrorCode (*setup)(ST);
34: PetscErrorCode (*apply)(ST,Vec,Vec);
35: PetscErrorCode (*getbilinearform)(ST,Mat*);
36: PetscErrorCode (*applytrans)(ST,Vec,Vec);
37: PetscErrorCode (*setshift)(ST,PetscScalar);
38: PetscErrorCode (*setfromoptions)(ST);
39: PetscErrorCode (*postsolve)(ST);
40: PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*);
41: PetscErrorCode (*destroy)(ST);
42: PetscErrorCode (*reset)(ST);
43: PetscErrorCode (*view)(ST,PetscViewer);
44: PetscErrorCode (*checknullspace)(ST,PetscInt,const Vec[]);
45: };
47: struct _p_ST {
48: PETSCHEADER(struct _STOps);
49: /*------------------------- User parameters --------------------------*/
50: Mat A,B; /* Matrices which define the eigensystem */
51: PetscScalar sigma; /* Value of the shift */
52: PetscBool sigma_set; /* whether the user provided the shift or not */
53: PetscScalar defsigma; /* Default value of the shift */
54: STMatMode shift_matrix;
55: MatStructure str; /* whether matrices have the same pattern or not */
56: Mat mat;
58: /*------------------------- Misc data --------------------------*/
59: KSP ksp;
60: Vec w;
61: Vec D; /* diagonal matrix for balancing */
62: Vec wb; /* balancing requires an extra work vector */
63: void *data;
64: PetscInt setupcalled;
65: PetscInt lineariterations;
66: PetscInt applys;
67: };
69: extern PetscErrorCode STGetBilinearForm_Default(ST,Mat*);
70: extern PetscErrorCode STAssociatedKSPSolve(ST,Vec,Vec);
71: extern PetscErrorCode STAssociatedKSPSolveTranspose(ST,Vec,Vec);
72: extern PetscErrorCode STCheckNullSpace_Default(ST,PetscInt,const Vec[]);
73: extern PetscErrorCode STMatShellCreate(ST st,Mat *mat);
75: #endif