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 #ifndef IFPACK_UTILS_H
00031 #define IFPACK_UTILS_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Epetra_Comm.h"
00035 #if !( defined(__INTEL_COMPILER) && defined(_WIN32) )
00036 # include "unistd.h"
00037 #endif
00038 class Epetra_RowMatrix;
00039 class Epetra_CrsMatrix;
00040 class Epetra_CrsGraph;
00041 class Epetra_RowMatrix;
00042 class Epetra_MultiVector;
00043 class Epetra_Vector;
00044
00048
00049 void Ifpack_PrintLine();
00050
00052 void Ifpack_BreakForDebugger(Epetra_Comm& Comm);
00053
00055 Epetra_CrsMatrix* Ifpack_CreateOverlappingCrsMatrix(const Epetra_RowMatrix* Matrix,
00056 const int OverlappingLevel);
00057
00059 Epetra_CrsGraph* Ifpack_CreateOverlappingCrsMatrix(const Epetra_CrsGraph* Graph,
00060 const int OverlappingLevel);
00061
00063 string Ifpack_toString(const int& x);
00064
00066 string Ifpack_toString(const double& x);
00067
00069 int Ifpack_PrintResidual(char* Label, const Epetra_RowMatrix& A,
00070 const Epetra_MultiVector& X, const Epetra_MultiVector&Y);
00071
00072 int Ifpack_PrintResidual(const int iter, const Epetra_RowMatrix& A,
00073 const Epetra_MultiVector& X, const Epetra_MultiVector&Y);
00074
00075 void Ifpack_PrintSparsity_Simple(const Epetra_RowMatrix& A);
00076
00078 int Ifpack_Analyze(const Epetra_RowMatrix& A, const bool Cheap = false,
00079 const int NumPDEEqns = 1);
00080
00082
00090 int Ifpack_AnalyzeMatrixElements(const Epetra_RowMatrix& A,
00091 const bool abs = false,
00092 const int steps = 10);
00093
00095
00103 int Ifpack_AnalyzeVectorElements(const Epetra_Vector& Diagonal,
00104 const bool abs = false,
00105 const int steps = 10);
00106
00108
00120 int Ifpack_PrintSparsity(const Epetra_RowMatrix& A, const char* FileName = 0,
00121 const int NumPDEEqns = 1);
00122
00123
00124 class Ifpack_Element {
00125
00126 public:
00127 Ifpack_Element() {};
00128
00129 Ifpack_Element(const Ifpack_Element& rhs) {
00130 i_ = rhs.Index();
00131 val_ = rhs.Value();
00132 aval_ = rhs.AbsValue();
00133 }
00134
00135 inline int Index() const {
00136 return(i_);
00137 }
00138
00139 inline double Value() const {
00140 return(val_);
00141 }
00142
00143 inline double AbsValue() const {
00144 return(aval_);
00145 }
00146
00147 inline void SetIndex(const int i)
00148 {
00149 i_ = i;
00150 }
00151
00152 inline void SetValue(const double val)
00153 {
00154 val_ = val;
00155 aval_ = IFPACK_ABS(val_);
00156 }
00157
00158 inline bool operator <(const Ifpack_Element& rhs) const
00159 {
00160 if (rhs.AbsValue() > AbsValue())
00161 return(false);
00162 else if (rhs.AbsValue() < AbsValue())
00163 return(true);
00164 else if (rhs.Index() < Index())
00165 return(true);
00166 return(false);
00167 }
00168
00169 private:
00170 int i_;
00171 double val_;
00172 double aval_;
00173
00174 };
00175
00176 #endif // IFPACK_UTILS_H