|
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_SINGLETONFILTER_H 00031 #define IFPACK_SINGLETONFILTER_H 00032 00033 #include "Ifpack_ConfigDefs.h" 00034 #include "Epetra_RowMatrix.h" 00035 #include "Teuchos_RefCountPtr.hpp" 00036 00037 class Epetra_Comm; 00038 class Epetra_Map; 00039 class Epetra_MultiVector; 00040 class Epetra_Import; 00041 class Epetra_BlockMap; 00042 00044 // 00045 class Ifpack_SingletonFilter : public virtual Epetra_RowMatrix { 00046 00047 public: 00049 Ifpack_SingletonFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix); 00050 00052 virtual ~Ifpack_SingletonFilter() {}; 00053 00055 virtual inline int NumMyRowEntries(int MyRow, int & NumEntries) const 00056 { 00057 return(NumEntries_[MyRow]); 00058 } 00059 00061 virtual int MaxNumEntries() const 00062 { 00063 return(MaxNumEntries_); 00064 } 00065 00066 virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const; 00067 00068 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const; 00069 00070 virtual int Multiply(bool TransA, const Epetra_MultiVector& X, 00071 Epetra_MultiVector& Y) const; 00072 00073 virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, 00074 const Epetra_MultiVector& X, 00075 Epetra_MultiVector& Y) const; 00076 00077 virtual int Apply(const Epetra_MultiVector& X, 00078 Epetra_MultiVector& Y) const; 00079 00080 virtual int ApplyInverse(const Epetra_MultiVector& X, 00081 Epetra_MultiVector& Y) const; 00082 00083 virtual int InvRowSums(Epetra_Vector& x) const 00084 { 00085 return(-98); // NOT IMPLEMENTED 00086 } 00087 00088 virtual int LeftScale(const Epetra_Vector& x) 00089 { 00090 return(-98); // NOT IMPLEMENTED 00091 } 00092 00093 virtual int InvColSums(Epetra_Vector& x) const 00094 { 00095 return(-98); // NOT IMPLEMENTED 00096 } 00097 00098 virtual int RightScale(const Epetra_Vector& x) 00099 { 00100 return(-98); // NOT IMPLEMENTED 00101 } 00102 00103 virtual bool Filled() const 00104 { 00105 return(A_->Filled()); 00106 } 00107 00108 virtual double NormInf() const 00109 { 00110 return(-1.0); 00111 } 00112 00113 virtual double NormOne() const 00114 { 00115 return(-1.0); 00116 } 00117 00118 virtual int NumGlobalNonzeros() const 00119 { 00120 return(NumNonzeros_); 00121 } 00122 00123 virtual int NumGlobalRows() const 00124 { 00125 return(NumRows_); 00126 } 00127 00128 virtual int NumGlobalCols() const 00129 { 00130 return(NumRows_); 00131 } 00132 00133 virtual int NumGlobalDiagonals() const 00134 { 00135 return(NumRows_); 00136 } 00137 00138 virtual int NumMyNonzeros() const 00139 { 00140 return(NumNonzeros_); 00141 } 00142 00143 virtual int NumMyRows() const 00144 { 00145 return(NumRows_); 00146 } 00147 00148 virtual int NumMyCols() const 00149 { 00150 return(NumRows_); 00151 } 00152 00153 virtual int NumMyDiagonals() const 00154 { 00155 return(NumRows_); 00156 } 00157 00158 virtual bool LowerTriangular() const 00159 { 00160 return(false); 00161 } 00162 00163 virtual bool UpperTriangular() const 00164 { 00165 return(false); 00166 } 00167 00168 virtual const Epetra_Map & RowMatrixRowMap() const 00169 { 00170 return(*Map_); 00171 } 00172 00173 virtual const Epetra_Map & RowMatrixColMap() const 00174 { 00175 return(*Map_); 00176 } 00177 00178 virtual const Epetra_Import * RowMatrixImporter() const 00179 { 00180 return(A_->RowMatrixImporter()); 00181 } 00182 00183 int SetUseTranspose(bool UseTranspose_in) 00184 { 00185 return(A_->SetUseTranspose(UseTranspose_in)); 00186 } 00187 00188 bool UseTranspose() const 00189 { 00190 return(A_->UseTranspose()); 00191 } 00192 00193 bool HasNormInf() const 00194 { 00195 return(false); 00196 } 00197 00198 const Epetra_Comm & Comm() const 00199 { 00200 return(A_->Comm()); 00201 } 00202 00203 const Epetra_Map & OperatorDomainMap() const 00204 { 00205 return(*Map_); 00206 } 00207 00208 const Epetra_Map & OperatorRangeMap() const 00209 { 00210 return(*Map_); 00211 } 00212 00213 const Epetra_BlockMap& Map() const 00214 { 00215 return(*(const Epetra_BlockMap*)(&*Map_)); 00216 } 00217 00218 const char* Label() const{ 00219 return(Label_); 00220 } 00221 00222 int SolveSingletons(const Epetra_MultiVector& RHS, 00223 Epetra_MultiVector& LHS); 00224 00225 int CreateReducedRHS(const Epetra_MultiVector& LHS, 00226 const Epetra_MultiVector& RHS, 00227 Epetra_MultiVector& ReducedRHS); 00228 00229 int UpdateLHS(const Epetra_MultiVector& ReducedLHS, 00230 Epetra_MultiVector& LHS); 00231 00232 private: 00233 00235 Teuchos::RefCountPtr<Epetra_RowMatrix> A_; 00236 00238 mutable std::vector<int> Indices_; 00240 mutable std::vector<double> Values_; 00242 char Label_[80]; 00243 00244 int NumSingletons_; 00245 std::vector<int> SingletonIndex_; 00246 00247 std::vector<int> Reorder_; 00248 std::vector<int> InvReorder_; 00249 00250 std::vector<int> NumEntries_; 00251 00252 int NumRows_; 00253 int NumRowsA_; 00254 int MaxNumEntries_; 00255 int MaxNumEntriesA_; 00256 int NumNonzeros_; 00257 Teuchos::RefCountPtr<Epetra_Map> Map_; 00258 00259 Teuchos::RefCountPtr<Epetra_Vector> Diagonal_; 00260 00261 }; 00262 00263 #endif /* IFPACK_SINGLETONFILTER_H */
1.7.4