00001 #ifndef IFPACK_UTILS_H
00002 #define IFPACK_UTILS_H
00003
00004 #include "Ifpack_ConfigDefs.h"
00005 #include "Epetra_Comm.h"
00006 #if !( defined(__INTEL_COMPILER) && defined(_WIN32) )
00007 # include "unistd.h"
00008 #endif
00009 class Epetra_RowMatrix;
00010 class Epetra_CrsMatrix;
00011 class Epetra_CrsGraph;
00012 class Epetra_RowMatrix;
00013 class Epetra_MultiVector;
00014 class Epetra_Vector;
00015
00019
00020 void Ifpack_PrintLine();
00021
00023 void Ifpack_BreakForDebugger(Epetra_Comm& Comm);
00024
00026 Epetra_CrsMatrix* Ifpack_CreateOverlappingCrsMatrix(const Epetra_RowMatrix* Matrix,
00027 const int OverlappingLevel);
00028
00030 Epetra_CrsGraph* Ifpack_CreateOverlappingCrsMatrix(const Epetra_CrsGraph* Graph,
00031 const int OverlappingLevel);
00032
00034 string Ifpack_toString(const int& x);
00035
00037 string Ifpack_toString(const double& x);
00038
00040 int Ifpack_PrintResidual(char* Label, const Epetra_RowMatrix& A,
00041 const Epetra_MultiVector& X, const Epetra_MultiVector&Y);
00042
00043 int Ifpack_PrintResidual(const int iter, const Epetra_RowMatrix& A,
00044 const Epetra_MultiVector& X, const Epetra_MultiVector&Y);
00045
00046 void Ifpack_PrintSparsity_Simple(const Epetra_RowMatrix& A);
00047
00049 int Ifpack_Analyze(const Epetra_RowMatrix& A, const bool Cheap = false,
00050 const int NumPDEEqns = 1);
00051
00053
00061 int Ifpack_AnalyzeMatrixElements(const Epetra_RowMatrix& A,
00062 const bool abs = false,
00063 const int steps = 10);
00064
00066
00074 int Ifpack_AnalyzeVectorElements(const Epetra_Vector& Diagonal,
00075 const bool abs = false,
00076 const int steps = 10);
00077
00079
00091 int Ifpack_PrintSparsity(const Epetra_RowMatrix& A, const char* FileName = 0,
00092 const int NumPDEEqns = 1);
00093
00094
00095 class Ifpack_Element {
00096
00097 public:
00098 Ifpack_Element() {};
00099
00100 Ifpack_Element(const Ifpack_Element& rhs) {
00101 i_ = rhs.Index();
00102 val_ = rhs.Value();
00103 aval_ = rhs.AbsValue();
00104 }
00105
00106 inline int Index() const {
00107 return(i_);
00108 }
00109
00110 inline double Value() const {
00111 return(val_);
00112 }
00113
00114 inline double AbsValue() const {
00115 return(aval_);
00116 }
00117
00118 inline void SetIndex(const int i)
00119 {
00120 i_ = i;
00121 }
00122
00123 inline void SetValue(const double val)
00124 {
00125 val_ = val;
00126 aval_ = IFPACK_ABS(val_);
00127 }
00128
00129 inline bool operator <(const Ifpack_Element& rhs) const
00130 {
00131 if (rhs.AbsValue() > AbsValue())
00132 return(false);
00133 else if (rhs.AbsValue() < AbsValue())
00134 return(true);
00135 else if (rhs.Index() < Index())
00136 return(true);
00137 return(false);
00138 }
00139
00140 private:
00141 int i_;
00142 double val_;
00143 double aval_;
00144
00145 };
00146
00147 #endif // IFPACK_UTILS_H