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_LOCALFILTER_H
00031 #define IFPACK_LOCALFILTER_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #ifdef HAVE_MPI
00035 #include "Epetra_MpiComm.h"
00036 #else
00037 #include "Epetra_SerialComm.h"
00038 #endif
00039 #include "Epetra_RowMatrix.h"
00040 #include "Teuchos_RefCountPtr.hpp"
00041
00042 class Epetra_Map;
00043 class Epetra_MultiVector;
00044 class Epetra_Vector;
00045 class Epetra_Import;
00046 class Epetra_BlockMap;
00047
00049
00085 class Ifpack_LocalFilter : public virtual Epetra_RowMatrix {
00086
00087 public:
00089
00090 Ifpack_LocalFilter(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix);
00091
00093
00094
00095 virtual ~Ifpack_LocalFilter() {};
00096
00098
00100
00102
00110 virtual int NumMyRowEntries(int MyRow, int & NumEntries) const
00111 {
00112 NumEntries = NumEntries_[MyRow];
00113 return(0);
00114 }
00115
00117 virtual int MaxNumEntries() const
00118 {
00119 return(MaxNumEntries_);
00120 }
00121
00123
00137 virtual inline int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
00138
00140
00146 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
00148
00150
00152
00162 virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
00163 {
00164 if (TransA == true) {
00165 IFPACK_CHK_ERR(-1);
00166 }
00167
00168 IFPACK_CHK_ERR(Apply(X,Y));
00169 return(0);
00170 }
00171
00173 virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X,
00174 Epetra_MultiVector& Y) const
00175 {
00176 IFPACK_RETURN(-1);
00177 }
00178
00179 virtual int Apply(const Epetra_MultiVector& X,
00180 Epetra_MultiVector& Y) const;
00181
00182 virtual int ApplyInverse(const Epetra_MultiVector& X,
00183 Epetra_MultiVector& Y) const;
00185 virtual int InvRowSums(Epetra_Vector& x) const
00186 {
00187 IFPACK_RETURN(-1);
00188 }
00189
00191 virtual int LeftScale(const Epetra_Vector& x)
00192 {
00193 IFPACK_RETURN(-1);
00194 }
00195
00197 virtual int InvColSums(Epetra_Vector& x) const
00198 {
00199 IFPACK_RETURN(-1);
00200 }
00201
00202
00204 virtual int RightScale(const Epetra_Vector& x)
00205 {
00206 IFPACK_RETURN(-1);
00207 }
00208
00210
00212
00214 virtual bool Filled() const
00215 {
00216 return true;
00217 }
00218
00220
00221
00222
00223 virtual double NormInf() const
00224 {
00225 return(-1.0);
00226 }
00227
00229
00230
00231
00232 virtual double NormOne() const
00233 {
00234 IFPACK_RETURN(-1.0);
00235 }
00236
00238 virtual int NumGlobalNonzeros() const
00239 {
00240 return(NumNonzeros_);
00241 }
00242
00244 virtual int NumGlobalRows() const
00245 {
00246 return(NumRows_);
00247 }
00248
00250 virtual int NumGlobalCols() const
00251 {
00252 return(NumRows_);
00253 }
00254
00256 virtual int NumGlobalDiagonals() const
00257 {
00258 return(NumRows_);
00259 }
00260
00262 virtual int NumMyNonzeros() const
00263 {
00264 return(NumNonzeros_);
00265 }
00266
00268 virtual int NumMyRows() const
00269 {
00270 return(NumRows_);
00271 }
00272
00274 virtual int NumMyCols() const
00275 {
00276 return(NumRows_);
00277 }
00278
00280 virtual int NumMyDiagonals() const
00281 {
00282 return(NumRows_);
00283 }
00284
00286 virtual bool LowerTriangular() const
00287 {
00288 return(Matrix_->LowerTriangular());
00289 }
00290
00292 virtual bool UpperTriangular() const
00293 {
00294 return(Matrix_->UpperTriangular());
00295 }
00296
00298 virtual const Epetra_Map & RowMatrixRowMap() const
00299 {
00300 return(*Map_);
00301 }
00302
00304 virtual const Epetra_Map & RowMatrixColMap() const
00305 {
00306 return(*Map_);
00307 }
00308
00310 virtual const Epetra_Import * RowMatrixImporter() const
00311 {
00312 return(0);
00313 }
00315
00316
00317
00319 int SetOwnership(bool ownership)
00320 {
00321 IFPACK_RETURN(-1);
00322 }
00323
00325 int SetUseTranspose(bool UseTranspose_in)
00326 {
00327 UseTranspose_ = UseTranspose_in;
00328 return(0);
00329 }
00330
00332 bool UseTranspose() const
00333 {
00334 return(UseTranspose_);
00335 }
00336
00338 bool HasNormInf() const
00339 {
00340 return(false);
00341 }
00342
00344 const Epetra_Comm & Comm() const
00345 {
00346 return(*SerialComm_);
00347 }
00348
00350 const Epetra_Map & OperatorDomainMap() const
00351 {
00352 return(*Map_);
00353 }
00354
00356 const Epetra_Map & OperatorRangeMap() const
00357 {
00358 return(*Map_);
00359 }
00361
00362 const Epetra_BlockMap& Map() const;
00363
00364 const char* Label() const{
00365 return(Label_);
00366 };
00367
00368 private:
00369
00371 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00372 #ifdef HAVE_MPI
00374 Teuchos::RefCountPtr<Epetra_MpiComm> SerialComm_;
00375 #else
00377 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00378 #endif
00380 Teuchos::RefCountPtr<Epetra_Map> Map_;
00382 int NumRows_;
00384 int NumNonzeros_;
00386 int MaxNumEntries_;
00388 int MaxNumEntriesA_;
00390 std::vector<int> NumEntries_;
00392 mutable std::vector<int> Indices_;
00394 mutable std::vector<double> Values_;
00396 bool UseTranspose_;
00398 char Label_[80];
00399 Teuchos::RefCountPtr<Epetra_Vector> Diagonal_;
00400 double NormOne_;
00401 double NormInf_;
00402
00403 };
00404
00405 #endif