|
IFPACK Development
|
00001 00002 /*@HEADER 00003 // *********************************************************************** 00004 // 00005 // Ifpack: Object-Oriented Algebraic Preconditioner Package 00006 // Copyright (2002) Sandia Corporation 00007 // 00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00009 // license for use of this work by or on behalf of the U.S. Government. 00010 // 00011 // This library is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as 00013 // published by the Free Software Foundation; either version 2.1 of the 00014 // License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, but 00017 // WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with this library; if not, write to the Free Software 00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00024 // USA 00025 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00026 // 00027 // *********************************************************************** 00028 //@HEADER 00029 */ 00030 00031 #ifndef IFPACK_OVERLAPPINGROWMATRIX_H 00032 #define IFPACK_OVERLAPPINGROWMATRIX_H 00033 00034 #include "Ifpack_ConfigDefs.h" 00035 #include "Epetra_RowMatrix.h" 00036 #include "Epetra_CombineMode.h" 00037 #include "Teuchos_RefCountPtr.hpp" 00038 #include "Epetra_Import.h" 00039 #ifdef IFPACK_SUBCOMM_CODE 00040 #include "Epetra_IntVector.h" 00041 #else 00042 # ifdef IFPACK_NODE_AWARE_CODE 00043 # include "Epetra_IntVector.h" 00044 # endif 00045 #endif 00046 00047 class Epetra_Map; 00048 class Epetra_BlockMap; 00049 class Epetra_CrsMatrix; 00050 class Epetra_Comm; 00051 00053 // 00054 class Ifpack_OverlappingRowMatrix : public virtual Epetra_RowMatrix { 00055 00056 public: 00057 00059 #ifdef IFPACK_SUBCOMM_CODE 00060 Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix_in, 00061 int OverlapLevel_in, int subdomainID); 00062 #else 00063 # ifdef IFPACK_NODE_AWARE_CODE 00064 Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix_in, 00065 int OverlapLevel_in, int myNodeID); 00066 # endif 00067 #endif 00068 Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix_in, 00069 int OverlapLevel_in); 00070 00071 #ifdef IFPACK_SUBCOMM_CODE 00072 ~Ifpack_OverlappingRowMatrix() {}; 00073 #else 00074 # ifdef IFPACK_NODE_AWARE_CODE 00075 ~Ifpack_OverlappingRowMatrix(); 00076 # else 00077 ~Ifpack_OverlappingRowMatrix() {}; 00078 # endif 00079 #endif 00080 00081 00083 00085 00093 virtual int NumMyRowEntries(int MyRow, int & NumEntries) const; 00094 00096 virtual int MaxNumEntries() const 00097 { 00098 return(MaxNumEntries_); 00099 } 00100 00102 00116 virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const; 00117 #ifdef IFPACK_SUBCOMM_CODE 00118 virtual int ExtractGlobalRowCopy(int MyRow, int Length, int & NumEntries, double* Values, int* Indices) const; 00119 #else 00120 # ifdef IFPACK_NODE_AWARE_CODE 00121 virtual int ExtractGlobalRowCopy(int MyRow, int Length, int & NumEntries, double* Values, int* Indices) const; 00122 # endif 00123 #endif 00124 00126 00132 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const; 00134 00136 00138 00148 virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00149 00151 virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X, 00152 Epetra_MultiVector& Y) const 00153 { 00154 IFPACK_RETURN(-1); // not implemented 00155 } 00156 00157 virtual int Apply(const Epetra_MultiVector& X, 00158 Epetra_MultiVector& Y) const; 00159 00160 virtual int ApplyInverse(const Epetra_MultiVector& X, 00161 Epetra_MultiVector& Y) const; 00163 virtual int InvRowSums(Epetra_Vector& x) const 00164 { 00165 IFPACK_RETURN(-1); // not implemented 00166 } 00167 00169 virtual int LeftScale(const Epetra_Vector& x) 00170 { 00171 IFPACK_RETURN(-1); // not implemented 00172 } 00173 00175 virtual int InvColSums(Epetra_Vector& x) const 00176 { 00177 IFPACK_RETURN(-1); // not implemented 00178 } 00179 00180 00182 virtual int RightScale(const Epetra_Vector& x) 00183 { 00184 IFPACK_RETURN(-1); // not implemented 00185 } 00186 00188 00190 00192 virtual bool Filled() const 00193 { 00194 return(true); 00195 } 00196 00198 /* Returns the quantity \f$ \| A \|_\infty\f$ such that 00199 \f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f]. 00200 */ 00201 virtual double NormInf() const 00202 { 00203 return(A().NormInf()); 00204 } 00205 00207 /* Returns the quantity \f$ \| A \|_1\f$ such that 00208 \f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f]. 00209 */ 00210 virtual double NormOne() const 00211 { 00212 IFPACK_RETURN(A().NormOne()); 00213 } 00214 00216 virtual int NumGlobalNonzeros() const 00217 { 00218 return(NumGlobalNonzeros_); 00219 } 00220 00222 virtual int NumGlobalRows() const 00223 { 00224 return(A().NumGlobalRows()); 00225 } 00226 00228 virtual int NumGlobalCols() const 00229 { 00230 return(A().NumGlobalCols()); 00231 } 00232 00234 virtual int NumGlobalDiagonals() const 00235 { 00236 return(A().NumGlobalDiagonals()); 00237 } 00238 00240 virtual int NumMyNonzeros() const 00241 { 00242 return(NumMyNonzeros_); 00243 } 00244 00246 virtual int NumMyRows() const 00247 { 00248 return(NumMyRows_); 00249 } 00250 00252 virtual int NumMyCols() const 00253 { 00254 return(NumMyCols_); 00255 } 00256 00258 virtual int NumMyDiagonals() const 00259 { 00260 return(NumMyDiagonals_); 00261 } 00262 00264 virtual bool LowerTriangular() const 00265 { 00266 return(A().LowerTriangular()); 00267 } 00268 00270 virtual bool UpperTriangular() const 00271 { 00272 return(A().UpperTriangular()); 00273 } 00274 00276 virtual const Epetra_Map & RowMatrixRowMap() const 00277 { 00278 return(*Map_); 00279 } 00280 00282 virtual const Epetra_Map & RowMatrixColMap() const 00283 { 00284 #ifdef IFPACK_SUBCOMM_CODE 00285 return(*colMap_); 00286 #else 00287 # ifdef IFPACK_NODE_AWARE_CODE 00288 return(*colMap_); 00289 # else 00290 return(*Map_); 00291 # endif 00292 #endif 00293 } 00294 00296 virtual const Epetra_Import * RowMatrixImporter() const 00297 { 00298 return(&*Importer_); 00299 } 00301 00302 // following functions are required to derive Epetra_RowMatrix objects. 00303 00305 int SetOwnership(bool ownership) 00306 { 00307 IFPACK_RETURN(-1); 00308 } 00309 00311 int SetUseTranspose(bool UseTranspose_in) 00312 { 00313 UseTranspose_ = UseTranspose_in; 00314 return(0); 00315 } 00316 00318 bool UseTranspose() const 00319 { 00320 return(UseTranspose_); 00321 } 00322 00324 bool HasNormInf() const 00325 { 00326 return(A().HasNormInf()); 00327 } 00328 00330 const Epetra_Comm & Comm() const 00331 { 00332 return(A().Comm()); 00333 } 00334 00336 const Epetra_Map & OperatorDomainMap() const 00337 { 00338 return(*Map_); 00339 } 00340 00342 const Epetra_Map & OperatorRangeMap() const 00343 { 00344 return(*Map_); 00345 } 00347 00348 const Epetra_BlockMap& Map() const; 00349 00350 const char* Label() const{ 00351 return(Label_.c_str()); 00352 }; 00353 00354 int OverlapLevel() const 00355 { 00356 return(OverlapLevel_); 00357 } 00358 00359 int ImportMultiVector(const Epetra_MultiVector& X, 00360 Epetra_MultiVector& OvX, 00361 Epetra_CombineMode CM = Insert); 00362 00363 int ExportMultiVector(const Epetra_MultiVector& OvX, 00364 Epetra_MultiVector& X, 00365 Epetra_CombineMode CM = Add); 00366 #ifdef IFPACK_SUBCOMM_CODE 00367 inline const Epetra_RowMatrix& A() const 00368 { 00369 return(*Matrix_); 00370 } 00371 00372 inline Epetra_CrsMatrix& B() const 00373 { 00374 return(*ExtMatrix_); 00375 } 00376 #else 00377 # ifdef IFPACK_NODE_AWARE_CODE 00378 inline const Epetra_RowMatrix& A() const 00379 { 00380 return(*Matrix_); 00381 } 00382 00383 inline Epetra_CrsMatrix& B() const 00384 { 00385 return(*ExtMatrix_); 00386 } 00387 # endif 00388 #endif 00389 00390 private: 00391 #ifndef IFPACK_SUBCOMM_CODE 00392 # ifndef IFPACK_NODE_AWARE_CODE 00393 inline const Epetra_RowMatrix& A() const 00394 { 00395 return(*Matrix_); 00396 } 00397 00398 inline Epetra_RowMatrix& B() const; 00399 # endif 00400 #endif 00401 00402 int NumMyRows_; 00403 int NumMyCols_; 00404 int NumMyDiagonals_; 00405 int NumMyNonzeros_; 00406 00407 int NumGlobalNonzeros_; 00408 int MaxNumEntries_; 00409 00410 int NumMyRowsA_; 00411 int NumMyRowsB_; 00412 00413 bool UseTranspose_; 00414 00415 Teuchos::RefCountPtr<const Epetra_Map> Map_; 00416 #ifdef IFPACK_SUBCOMM_CODE 00417 const Epetra_Map *colMap_; 00418 #else 00419 # ifdef IFPACK_NODE_AWARE_CODE 00420 const Epetra_Map *colMap_; 00421 # endif 00422 #endif 00423 Teuchos::RefCountPtr<const Epetra_Import> Importer_; 00424 00425 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_; 00426 Teuchos::RefCountPtr<Epetra_CrsMatrix> ExtMatrix_; 00427 Teuchos::RefCountPtr<Epetra_Map> ExtMap_; 00428 Teuchos::RefCountPtr<Epetra_Import> ExtImporter_; 00429 00430 int OverlapLevel_; 00431 string Label_; 00432 00433 }; // class Ifpack_OverlappingRowMatrix 00434 00435 #endif // IFPACK_OVERLAPPINGROWMATRIX_H
1.7.4