00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef ANASAZI_BASIC_EIGENPROBLEM_H
00030 #define ANASAZI_BASIC_EIGENPROBLEM_H
00031
00036 #include "AnasaziEigenproblem.hpp"
00037 #include "AnasaziMultiVecTraits.hpp"
00038 #include "AnasaziOperatorTraits.hpp"
00039
00045 namespace Anasazi {
00046
00047 template<class ScalarType, class MV, class OP>
00048 class BasicEigenproblem : public virtual Eigenproblem<ScalarType, MV, OP> {
00049
00050 public:
00051
00053
00054
00056 BasicEigenproblem();
00057
00059 BasicEigenproblem( const Teuchos::RCP<const OP>& Op, const Teuchos::RCP<MV>& InitVec );
00060
00062 BasicEigenproblem( const Teuchos::RCP<const OP>& Op, const Teuchos::RCP<const OP>& B, const Teuchos::RCP<MV>& InitVec );
00063
00065 BasicEigenproblem( const BasicEigenproblem<ScalarType, MV, OP>& Problem );
00066
00068 virtual ~BasicEigenproblem() {};
00070
00072
00073
00080 void setOperator( const Teuchos::RCP<const OP>& Op ) { _Op = Op; _isSet=false; };
00081
00084 void setA( const Teuchos::RCP<const OP>& A ) { _AOp = A; _isSet=false; };
00085
00088 void setM( const Teuchos::RCP<const OP>& M ) { _MOp = M; _isSet=false; };
00089
00092 void setPrec( const Teuchos::RCP<const OP>& Prec ) { _Prec = Prec; _isSet=false; };
00093
00101 void setInitVec( const Teuchos::RCP<MV>& InitVec ) { _InitVec = InitVec; _isSet=false; };
00102
00108 void setAuxVecs( const Teuchos::RCP<const MV>& AuxVecs ) { _AuxVecs = AuxVecs; _isSet=false; };
00109
00111 void setNEV( int nev ){ _nev = nev; _isSet=false; };
00112
00114
00117 void setHermitian( bool isSym ){ _isSym = isSym; _isSet=false; };
00118
00134 bool setProblem();
00135
00142 void setSolution(const Eigensolution<ScalarType,MV> &sol) {_sol = sol;}
00143
00145
00147
00148
00150 Teuchos::RCP<const OP> getOperator() const { return( _Op ); };
00151
00153 Teuchos::RCP<const OP> getA() const { return( _AOp ); };
00154
00156 Teuchos::RCP<const OP> getM() const { return( _MOp ); };
00157
00159 Teuchos::RCP<const OP> getPrec() const { return( _Prec ); };
00160
00162 Teuchos::RCP<const MV> getInitVec() const { return( _InitVec ); };
00163
00165 Teuchos::RCP<const MV> getAuxVecs() const { return( _AuxVecs ); };
00166
00168 int getNEV() const { return( _nev ); }
00169
00171 bool isHermitian() const { return( _isSym ); }
00172
00174 bool isProblemSet() const { return( _isSet ); }
00175
00181 const Eigensolution<ScalarType,MV> & getSolution() const { return(_sol); }
00182
00184
00185 protected:
00186
00188 Teuchos::RCP<const OP> _AOp;
00189
00191 Teuchos::RCP<const OP> _MOp;
00192
00194 Teuchos::RCP<const OP> _Op;
00195
00197 Teuchos::RCP<const OP> _Prec;
00198
00200 Teuchos::RCP<MV> _InitVec;
00201
00203 Teuchos::RCP<const MV> _AuxVecs;
00204
00206 int _nev;
00207
00209
00212 bool _isSym;
00213
00215 bool _isSet;
00216
00218 typedef MultiVecTraits<ScalarType,MV> MVT;
00220 typedef OperatorTraits<ScalarType,MV,OP> OPT;
00221
00223 Eigensolution<ScalarType,MV> _sol;
00224 };
00225
00226
00227
00228
00229
00230 template <class ScalarType, class MV, class OP>
00231 BasicEigenproblem<ScalarType, MV, OP>::BasicEigenproblem() :
00232 _nev(0),
00233 _isSym(false),
00234 _isSet(false)
00235 {
00236 }
00237
00238
00239
00240 template <class ScalarType, class MV, class OP>
00241 BasicEigenproblem<ScalarType, MV, OP>::BasicEigenproblem( const Teuchos::RCP<const OP>& Op, const Teuchos::RCP<MV>& InitVec ) :
00242 _Op(Op),
00243 _InitVec(InitVec),
00244 _nev(0),
00245 _isSym(false),
00246 _isSet(false)
00247 {
00248 }
00249
00250
00251
00252 template <class ScalarType, class MV, class OP>
00253 BasicEigenproblem<ScalarType, MV, OP>::BasicEigenproblem( const Teuchos::RCP<const OP>& Op, const Teuchos::RCP<const OP>& M,
00254 const Teuchos::RCP<MV>& InitVec ) :
00255 _MOp(M),
00256 _Op(Op),
00257 _InitVec(InitVec),
00258 _nev(0),
00259 _isSym(false),
00260 _isSet(false)
00261 {
00262 }
00263
00264
00265
00266 template <class ScalarType, class MV, class OP>
00267 BasicEigenproblem<ScalarType, MV, OP>::BasicEigenproblem( const BasicEigenproblem<ScalarType,MV,OP>& Problem ) :
00268 _AOp(Problem._AOp),
00269 _MOp(Problem._MOp),
00270 _Op(Problem._Op),
00271 _Prec(Problem._Prec),
00272 _InitVec(Problem._InitVec),
00273 _nev(Problem._nev),
00274 _isSym(Problem._isSym),
00275 _isSet(Problem._isSet),
00276 _sol(Problem._sol)
00277 {
00278 }
00279
00280
00281
00282
00283
00284 template <class ScalarType, class MV, class OP>
00285 bool BasicEigenproblem<ScalarType, MV, OP>::setProblem()
00286 {
00287
00288
00289
00290
00291 if ( !_AOp.get() && !_Op.get() ) { return false; }
00292
00293
00294 if ( !_InitVec.get() ) { return false; }
00295
00296
00297 if (_nev == 0) { return false; }
00298
00299
00300 if (_AOp.get() && !_Op.get()) { _Op = _AOp; }
00301
00302
00303 Eigensolution<ScalarType,MV> emptysol;
00304 _sol = emptysol;
00305
00306
00307 _isSet=true;
00308 return true;
00309 }
00310
00311 }
00312 #endif
00313
00314