|
IFPACK Development
|
00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack: Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2002) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 //@HEADER 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(_WIN32) ) 00036 # include "unistd.h" // Not a standard header file! 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
1.7.4