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
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef IFPACK_SERIALTRIDISOLVER_H
00045 #define IFPACK_SERIALTRIDISOLVER_H
00046 class Ifpack_SerialTriDiMatrix;
00047
00048 class Epetra_SerialDenseMatrix;
00049
00050 #include "Epetra_Object.h"
00051 #include "Epetra_CompObject.h"
00052 #include "Epetra_BLAS.h"
00053 #include "Teuchos_LAPACK.hpp"
00054
00055
00057
00129
00130 class EPETRA_LIB_DLL_EXPORT Ifpack_SerialTriDiSolver :
00131 public Epetra_CompObject, public Epetra_BLAS,
00132 public Epetra_Object {
00133 public:
00134
00136
00137
00138 Ifpack_SerialTriDiSolver();
00139
00140
00142 virtual ~Ifpack_SerialTriDiSolver();
00144
00146
00147
00149 int SetMatrix(Ifpack_SerialTriDiMatrix & A);
00150
00152
00155 int SetVectors(Epetra_SerialDenseMatrix & X, Epetra_SerialDenseMatrix & B);
00157
00158
00160
00161
00163
00165
00166
00168 void SolveWithTranspose(bool Flag) {Transpose_ = Flag; if (Flag) TRANS_ = 'T'; else TRANS_ = 'N'; return;};
00169
00171 void SolveToRefinedSolution(bool Flag) {RefineSolution_ = Flag; return;};
00172
00174
00177 void EstimateSolutionErrors(bool Flag) ;
00179
00181
00182
00184
00187 virtual int Factor(void);
00188
00190
00193 virtual int Solve(void);
00194
00196
00199 virtual int Invert(void);
00200
00202
00205 virtual int ApplyRefinement(void);
00206
00208
00211
00212
00214
00220 virtual int ReciprocalConditionEstimate(double & Value);
00222
00224
00225
00227 bool Transpose() {return(Transpose_);};
00228
00230 bool Factored() {return(Factored_);};
00231
00233 bool SolutionErrorsEstimated() {return(SolutionErrorsEstimated_);};
00234
00236 bool Inverted() {return(Inverted_);};
00237
00239 bool ReciprocalConditionEstimated() {return(ReciprocalConditionEstimated_);};
00240
00242 bool Solved() {return(Solved_);};
00243
00245 bool SolutionRefined() {return(SolutionRefined_);};
00247
00249
00250
00252 Ifpack_SerialTriDiMatrix * Matrix() const {return(Matrix_);};
00253
00255 Ifpack_SerialTriDiMatrix * FactoredMatrix() const {return(Factor_);};
00256
00258 Epetra_SerialDenseMatrix * LHS() const {return(LHS_);};
00259
00261 Epetra_SerialDenseMatrix * RHS() const {return(RHS_);};
00262
00264 int N() const {return(N_);};
00265
00267 double * A() const {return(A_);};
00268
00270 int LDA() const {return(LDA_);};
00271
00273 double * B() const {return(B_);};
00274
00276 int LDB() const {return(LDB_);};
00277
00279 int NRHS() const {return(NRHS_);};
00280
00282 double * X() const {return(X_);};
00283
00285 int LDX() const {return(LDX_);};
00286
00288 double * AF() const {return(AF_);};
00289
00291 int LDAF() const {return(LDAF_);};
00292
00294 int * IPIV() const {return(IPIV_);};
00295
00297 double ANORM() const {return(ANORM_);};
00298
00300 double RCOND() const {return(RCOND_);};
00301
00303
00305 double ROWCND() const {return(ROWCND_);};
00306
00308
00310 double COLCND() const {return(COLCND_);};
00311
00313 double AMAX() const {return(AMAX_);};
00314
00316 double * FERR() const {return(FERR_);};
00317
00319 double * BERR() const {return(BERR_);};
00320
00322
00324
00325
00326 virtual void Print(std::ostream& os) const;
00328 protected:
00329
00330 void AllocateWORK() {if (WORK_==0) {LWORK_ = 4*N_; WORK_ = new double[LWORK_];} return;};
00331 void AllocateIWORK() {if (IWORK_==0) IWORK_ = new int[N_]; return;};
00332 void InitPointers();
00333 void DeleteArrays();
00334 void ResetMatrix();
00335 void ResetVectors();
00336
00337 bool Transpose_;
00338 bool Factored_;
00339 bool EstimateSolutionErrors_;
00340 bool SolutionErrorsEstimated_;
00341 bool Solved_;
00342 bool Inverted_;
00343 bool ReciprocalConditionEstimated_;
00344 bool RefineSolution_;
00345 bool SolutionRefined_;
00346
00347 char TRANS_;
00348
00349 int N_;
00350 int Min_MN_;
00351 int NRHS_;
00352 int LDA_;
00353 int LDAF_;
00354 int LDB_;
00355 int LDX_;
00356 int INFO_;
00357 int LWORK_;
00358
00359 int * IPIV_;
00360 int * IWORK_;
00361
00362 double ANORM_;
00363 double RCOND_;
00364 double ROWCND_;
00365 double COLCND_;
00366 double AMAX_;
00367
00368 Ifpack_SerialTriDiMatrix * Matrix_;
00369 Epetra_SerialDenseMatrix * LHS_;
00370 Epetra_SerialDenseMatrix * RHS_;
00371 Ifpack_SerialTriDiMatrix * Factor_;
00372
00373 double * A_;
00374 double * FERR_;
00375 double * BERR_;
00376 double * AF_;
00377 double * WORK_;
00378
00379 double * B_;
00380 double * X_;
00381
00382
00383 private:
00384 Teuchos::LAPACK<int,double> lapack;
00385
00386
00387 Ifpack_SerialTriDiSolver(const Ifpack_SerialTriDiSolver& Source);
00388 Ifpack_SerialTriDiSolver & operator=(const Ifpack_SerialTriDiSolver& Source);
00389 };
00390
00391 #endif