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
00040 #ifndef AMESOS_UMFPACK_H
00041 #define AMESOS_UMFPACK_H
00042
00043 #include "Amesos_ConfigDefs.h"
00044 #include "Amesos_BaseSolver.h"
00045 #include "Amesos_BaseSolver.h"
00046 #include "Amesos_NoCopiable.h"
00047 #include "Amesos_Utils.h"
00048 #include "Amesos_Time.h"
00049 #include "Amesos_Status.h"
00050 #include "Amesos_Control.h"
00051 #include "Epetra_CrsMatrix.h"
00052 #include "Epetra_LinearProblem.h"
00053 #include "Epetra_Time.h"
00054 #include "Epetra_Import.h"
00055 #include "Teuchos_RCP.hpp"
00056 #ifdef EPETRA_MPI
00057 #include "Epetra_MpiComm.h"
00058 #else
00059 #include "Epetra_Comm.h"
00060 #endif
00061
00063
00070 class Amesos_Umfpack: public Amesos_BaseSolver,
00071 private Amesos_Time,
00072 private Amesos_NoCopiable,
00073 private Amesos_Utils,
00074 private Amesos_Control,
00075 private Amesos_Status
00076 {
00077 public:
00078
00080
00081
00088 Amesos_Umfpack( const Epetra_LinearProblem& LinearProblem );
00089
00091
00093 ~Amesos_Umfpack(void);
00094
00096
00097
00098 int SymbolicFactorization();
00099
00100 int NumericFactorization();
00101
00102 int Solve();
00103
00105
00106
00107 const Epetra_LinearProblem *GetProblem() const { return(Problem_); };
00108
00110
00113 bool MatrixShapeOK() const ;
00114
00115 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00116
00117 bool UseTranspose() const {return(UseTranspose_);};
00118
00119 const Epetra_Comm & Comm() const {return(GetProblem()->GetOperator()->Comm());};
00120
00122
00123
00124
00125
00126
00127 double GetRcond() const ;
00128
00129 int SetParameters( Teuchos::ParameterList &ParameterList ) ;
00130
00132 int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00133
00135 int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00136
00138 int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00139
00141 void PrintTiming() const;
00142
00144 void PrintStatus() const;
00145
00147 void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00148
00149 private:
00150
00152
00153
00155 Epetra_RowMatrix* Matrix()
00156 {
00157 return(dynamic_cast<Epetra_RowMatrix *>(Problem_->GetOperator()));
00158 }
00159
00161 int ConvertToSerial(const bool FirstTime);
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 int ConvertToUmfpackCRS();
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 int PerformSymbolicFactorization();
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 int PerformNumericFactorization();
00200
00201 inline const Epetra_Import& Importer() const
00202 {
00203 return(*(ImportToSerial_.get()));
00204 }
00205
00206 inline const Epetra_Map& SerialMap() const
00207 {
00208 return(*(SerialMap_.get()));
00209 }
00210
00211 inline const Epetra_CrsMatrix& SerialCrsMatrix() const
00212 {
00213 return(*(SerialCrsMatrixA_.get()));
00214 }
00215
00216 inline Epetra_CrsMatrix& SerialCrsMatrix()
00217 {
00218 return(*(SerialCrsMatrixA_.get()));
00219 }
00220
00221
00222
00224 void *Symbolic;
00226 void *Numeric;
00227
00229 std::vector <int> Ap;
00230 std::vector <int> Ai;
00231 std::vector <double> Aval;
00232
00234 int IsLocal_;
00236 int numentries_;
00238 int NumGlobalElements_;
00239
00241 Teuchos::RCP<Epetra_Map> SerialMap_;
00243
00244
00245
00246 Epetra_RowMatrix* SerialMatrix_;
00247
00248 Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrixA_;
00249
00251 bool UseTranspose_;
00253 const Epetra_LinearProblem * Problem_;
00255 mutable double Rcond_;
00256
00257 mutable bool RcondValidOnAllProcs_;
00259 Teuchos::RCP<Epetra_Import> ImportToSerial_;
00260
00262 int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
00263 int SymFactTime_, NumFactTime_, SolveTime_, OverheadTime_;
00264
00265 };
00266 #endif