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
00237 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00238
00239 virtual int NumGlobalNonzeros() const
00240 {
00241 return(NumNonzeros_);
00242 }
00243
00245 virtual int NumGlobalRows() const
00246 {
00247 return(NumRows_);
00248 }
00249
00251 virtual int NumGlobalCols() const
00252 {
00253 return(NumRows_);
00254 }
00255
00257 virtual int NumGlobalDiagonals() const
00258 {
00259 return(NumRows_);
00260 }
00261 #endif
00262
00264 virtual long long NumGlobalNonzeros64() const
00265 {
00266 return(NumNonzeros_);
00267 }
00268
00270 virtual long long NumGlobalRows64() const
00271 {
00272 return(NumRows_);
00273 }
00274
00276 virtual long long NumGlobalCols64() const
00277 {
00278 return(NumRows_);
00279 }
00280
00282 virtual long long NumGlobalDiagonals64() const
00283 {
00284 return(NumRows_);
00285 }
00286
00288 virtual int NumMyNonzeros() const
00289 {
00290 return(NumNonzeros_);
00291 }
00292
00294 virtual int NumMyRows() const
00295 {
00296 return(NumRows_);
00297 }
00298
00300 virtual int NumMyCols() const
00301 {
00302 return(NumRows_);
00303 }
00304
00306 virtual int NumMyDiagonals() const
00307 {
00308 return(NumRows_);
00309 }
00310
00312 virtual bool LowerTriangular() const
00313 {
00314 return(Matrix_->LowerTriangular());
00315 }
00316
00318 virtual bool UpperTriangular() const
00319 {
00320 return(Matrix_->UpperTriangular());
00321 }
00322
00324 virtual const Epetra_Map & RowMatrixRowMap() const
00325 {
00326 return(*Map_);
00327 }
00328
00330 virtual const Epetra_Map & RowMatrixColMap() const
00331 {
00332 return(*Map_);
00333 }
00334
00336 virtual const Epetra_Import * RowMatrixImporter() const
00337 {
00338 return(0);
00339 }
00341
00342
00343
00345 int SetOwnership(bool ownership)
00346 {
00347 IFPACK_RETURN(-1);
00348 }
00349
00351 int SetUseTranspose(bool UseTranspose_in)
00352 {
00353 UseTranspose_ = UseTranspose_in;
00354 return(0);
00355 }
00356
00358 bool UseTranspose() const
00359 {
00360 return(UseTranspose_);
00361 }
00362
00364 bool HasNormInf() const
00365 {
00366 return(false);
00367 }
00368
00370 const Epetra_Comm & Comm() const
00371 {
00372 return(*SerialComm_);
00373 }
00374
00376 const Epetra_Map & OperatorDomainMap() const
00377 {
00378 return(*Map_);
00379 }
00380
00382 const Epetra_Map & OperatorRangeMap() const
00383 {
00384 return(*Map_);
00385 }
00387
00388 const Epetra_BlockMap& Map() const;
00389
00390 const char* Label() const{
00391 return(Label_);
00392 };
00393
00394 private:
00395
00397 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00398 #ifdef HAVE_MPI
00399
00400 Teuchos::RefCountPtr<Epetra_MpiComm> SerialComm_;
00401 #else
00402
00403 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00404 #endif
00405
00406 Teuchos::RefCountPtr<Epetra_Map> Map_;
00408 int NumRows_;
00410 int NumNonzeros_;
00412 int MaxNumEntries_;
00414 int MaxNumEntriesA_;
00416 std::vector<int> NumEntries_;
00418 mutable std::vector<int> Indices_;
00420 mutable std::vector<double> Values_;
00422 bool UseTranspose_;
00424 char Label_[80];
00425 Teuchos::RefCountPtr<Epetra_Vector> Diagonal_;
00426 double NormOne_;
00427 double NormInf_;
00428
00429 };
00430
00431 #endif