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-2010, Universidad 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 "petscksp.h"


 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: EXTERN PetscErrorCode STCreate(MPI_Comm,ST*);
 57: EXTERN PetscErrorCode STDestroy(ST);
 58: EXTERN PetscErrorCode STSetType(ST,const STType);
 59: EXTERN PetscErrorCode STGetType(ST,const STType*);
 60: EXTERN PetscErrorCode STSetOperators(ST,Mat,Mat);
 61: EXTERN PetscErrorCode STGetOperators(ST,Mat*,Mat*);
 62: EXTERN PetscErrorCode STSetUp(ST);
 63: EXTERN PetscErrorCode STSetFromOptions(ST);
 64: EXTERN PetscErrorCode STView(ST,PetscViewer);

 66: EXTERN PetscErrorCode STApply(ST,Vec,Vec);
 67: EXTERN PetscErrorCode STGetBilinearForm(ST,Mat*);
 68: EXTERN PetscErrorCode STApplyTranspose(ST,Vec,Vec);
 69: EXTERN PetscErrorCode STComputeExplicitOperator(ST,Mat*);
 70: EXTERN PetscErrorCode STPostSolve(ST);

 72: EXTERN PetscErrorCode STSetKSP(ST,KSP);
 73: EXTERN PetscErrorCode STGetKSP(ST,KSP*);
 74: EXTERN PetscErrorCode STSetShift(ST,PetscScalar);
 75: EXTERN PetscErrorCode STGetShift(ST,PetscScalar*);
 76: EXTERN PetscErrorCode STSetDefaultShift(ST,PetscScalar);
 77: EXTERN PetscErrorCode STSetBalanceMatrix(ST,Vec);
 78: EXTERN PetscErrorCode STGetBalanceMatrix(ST,Vec*);

 80: EXTERN PetscErrorCode STSetOptionsPrefix(ST,const char*);
 81: EXTERN PetscErrorCode STAppendOptionsPrefix(ST,const char*);
 82: EXTERN PetscErrorCode STGetOptionsPrefix(ST,const char*[]);

 84: EXTERN PetscErrorCode STBackTransform(ST,PetscInt,PetscScalar*,PetscScalar*);

 86: EXTERN PetscErrorCode STCheckNullSpace(ST,PetscInt,const Vec[]);

 88: EXTERN PetscErrorCode STGetOperationCounters(ST,PetscInt*,PetscInt*);
 89: EXTERN PetscErrorCode STResetOperationCounters(ST);

 91: /*E
 92:     STMatMode - determines how to handle the coefficient matrix associated
 93:     to the spectral transformation

 95:     Level: intermediate

 97: .seealso: STSetMatMode(), STGetMatMode()
 98: E*/
 99: typedef enum { ST_MATMODE_COPY,
100:                ST_MATMODE_INPLACE,
101:                ST_MATMODE_SHELL } STMatMode;
102: EXTERN PetscErrorCode STSetMatMode(ST,STMatMode);
103: EXTERN PetscErrorCode STGetMatMode(ST,STMatMode*);
104: EXTERN PetscErrorCode STSetMatStructure(ST,MatStructure);
105: EXTERN PetscErrorCode STGetMatStructure(ST,MatStructure*);

107: EXTERN PetscErrorCode STRegister(const char*,const char*,const char*,PetscErrorCode(*)(ST));
108: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
109: #define STRegisterDynamic(a,b,c,d) STRegister(a,b,c,0)
110: #else
111: #define STRegisterDynamic(a,b,c,d) STRegister(a,b,c,d)
112: #endif
113: EXTERN PetscErrorCode STRegisterDestroy(void);

115: /* --------- options specific to particular spectral transformations-------- */

117: EXTERN PetscErrorCode STShellGetContext(ST st,void **ctx);
118: EXTERN PetscErrorCode STShellSetContext(ST st,void *ctx);
119: EXTERN PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec));
120: EXTERN PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec));
121: EXTERN PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*));
122: EXTERN PetscErrorCode STShellSetName(ST,const char[]);
123: EXTERN PetscErrorCode STShellGetName(ST,char*[]);

125: EXTERN PetscErrorCode STCayleySetAntishift(ST,PetscScalar);

127: EXTERN PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat);
128: EXTERN PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat);
129: EXTERN PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscTruth *setmat);
130: EXTERN PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscTruth setmat);

133: #endif