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
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef IFPACK_SUBDOMAINFILTER_H
00039 #define IFPACK_SUBDOMAINFILTER_H
00040
00041 #include "Ifpack_ConfigDefs.h"
00042
00043 #ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
00044
00045 #ifdef HAVE_MPI
00046 #include "Epetra_MpiComm.h"
00047 #else
00048 #include "Epetra_SerialComm.h"
00049 #endif
00050 #include "Epetra_RowMatrix.h"
00051 #include "Epetra_CrsMatrix.h"
00052 #include "Epetra_IntVector.h"
00053 #include "Teuchos_RCP.hpp"
00054 #include "Ifpack_OverlappingRowMatrix.h"
00055
00056 class Epetra_Map;
00057 class Epetra_MultiVector;
00058 class Epetra_Vector;
00059 class Epetra_Import;
00060 class Epetra_BlockMap;
00061
00063
00078 class Ifpack_SubdomainFilter : public virtual Epetra_RowMatrix {
00079
00080 public:
00082
00083 Ifpack_SubdomainFilter(const Teuchos::RCP<const Epetra_RowMatrix>& Matrix, int subdomainId);
00084
00086
00087
00088 ~Ifpack_SubdomainFilter();
00090
00092
00094
00102 virtual int NumMyRowEntries(int MyRow, int & NumEntries) const
00103 {
00104 NumEntries = NumEntries_[MyRow];
00105 return(0);
00106 }
00107
00109 virtual int MaxNumEntries() const
00110 {
00111 return(MaxNumEntries_);
00112 }
00113
00115
00129 virtual inline int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
00130
00132
00138 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
00140
00142
00144
00154 virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
00155 {
00156 if (TransA == true) {
00157 IFPACK_CHK_ERR(-1);
00158 }
00159
00160 IFPACK_CHK_ERR(Apply(X,Y));
00161 return(0);
00162 }
00163
00165 virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X,
00166 Epetra_MultiVector& Y) const
00167 {
00168 IFPACK_RETURN(-1);
00169 }
00170
00171 virtual int Apply(const Epetra_MultiVector& X,
00172 Epetra_MultiVector& Y) const;
00173
00174 virtual int ApplyInverse(const Epetra_MultiVector& X,
00175 Epetra_MultiVector& Y) const;
00177 virtual int InvRowSums(Epetra_Vector& x) const
00178 {
00179 IFPACK_RETURN(-1);
00180 }
00181
00183 virtual int LeftScale(const Epetra_Vector& x)
00184 {
00185 IFPACK_RETURN(-1);
00186 }
00187
00189 virtual int InvColSums(Epetra_Vector& x) const
00190 {
00191 IFPACK_RETURN(-1);
00192 }
00193
00194
00196 virtual int RightScale(const Epetra_Vector& x)
00197 {
00198 IFPACK_RETURN(-1);
00199 }
00200
00202
00204
00206 virtual bool Filled() const
00207 {
00208 return true;
00209 }
00210
00212
00213
00214
00215 virtual double NormInf() const
00216 {
00217 return(-1.0);
00218 }
00219
00221
00222
00223
00224 virtual double NormOne() const
00225 {
00226 IFPACK_RETURN(-1.0);
00227 }
00228
00229 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00230
00231 virtual int NumGlobalNonzeros() const
00232 {
00233 return(NumGlobalNonzeros_);
00234 }
00235
00237 virtual int NumGlobalRows() const
00238 {;
00239
00240 return(NumGlobalRows_);
00241 }
00242
00244 virtual int NumGlobalCols() const
00245 {
00246 return(NumGlobalCols_);
00247 }
00248
00250 virtual int NumGlobalDiagonals() const
00251 {
00252 return(NumGlobalRows_);
00253 }
00254 #endif
00255
00257 virtual long long NumGlobalNonzeros64() const
00258 {
00259 return(NumGlobalNonzeros_);
00260 }
00261
00263 virtual long long NumGlobalRows64() const
00264 {
00265 return(NumGlobalRows_);
00266 }
00267
00269 virtual long long NumGlobalCols64() const
00270 {
00271 return(NumGlobalRows_);
00272 }
00273
00275 virtual long long NumGlobalDiagonals64() const
00276 {
00277 return(NumGlobalRows_);
00278 }
00279
00281 virtual int NumMyNonzeros() const
00282 {
00283 return(NumMyNonzeros_);
00284 }
00285
00287 virtual int NumMyRows() const
00288 {
00289 return(NumMyRows_);
00290 }
00291
00293 virtual int NumMyCols() const
00294 {
00295 return(NumMyCols_);
00296 }
00297
00299 virtual int NumMyDiagonals() const
00300 {
00301 return(NumMyRows_);
00302 }
00303
00305 virtual bool LowerTriangular() const
00306 {
00307 return(Matrix_->LowerTriangular());
00308 }
00309
00311 virtual bool UpperTriangular() const
00312 {
00313 return(Matrix_->UpperTriangular());
00314 }
00315
00317 virtual const Epetra_Map & RowMatrixRowMap() const
00318 {
00319 return(*Map_);
00320 }
00321
00323 virtual const Epetra_Map & RowMatrixColMap() const
00324 {
00325 return(*colMap_);
00326 }
00327
00329 virtual const Epetra_Import * RowMatrixImporter() const
00330 {
00331 return(&*Importer_);
00332 }
00334
00335 virtual const Epetra_Import* Importer() const {return(&*Importer_);}
00336
00337 virtual const Epetra_Export* Exporter() const {return(&*Exporter_);}
00338
00339
00340
00342 int SetOwnership(bool ownership)
00343 {
00344 IFPACK_RETURN(-1);
00345 }
00346
00348 int SetUseTranspose(bool UseTranspose_in)
00349 {
00350 UseTranspose_ = UseTranspose_in;
00351 return(0);
00352 }
00353
00355 bool UseTranspose() const
00356 {
00357 return(UseTranspose_);
00358 }
00359
00361 bool HasNormInf() const
00362 {
00363 return(false);
00364 }
00365
00367 const Epetra_Comm & Comm() const
00368 {
00369 return(*SubComm_);
00370 }
00371
00373 const Epetra_Map & OperatorDomainMap() const
00374 {
00375 return(*Map_);
00376 }
00377
00379 const Epetra_Map & OperatorRangeMap() const
00380 {
00381 return(*Map_);
00382 }
00384
00385 const Epetra_BlockMap& Map() const;
00386
00387 const char* Label() const{
00388 return(Label_);
00389 };
00390
00391 private:
00392 void UpdateImportVector(int NumVectors) const;
00393 void UpdateExportVector(int NumVectors) const;
00394
00396 Teuchos::RCP<const Epetra_RowMatrix> Matrix_;
00397 const Ifpack_OverlappingRowMatrix* ovA_;
00398 #ifdef HAVE_MPI
00399
00400 Teuchos::RCP<Epetra_MpiComm> SubComm_;
00401 MPI_Comm subdomainMPIComm_;
00402 #else
00403
00404 Teuchos::RCP<Epetra_SerialComm> SubComm_;
00405 #endif
00406
00407 Teuchos::RCP<Epetra_Map> Map_;
00409 Teuchos::RCP<Epetra_Map> colMap_;
00411 int NumMyRows_;
00413 int NumMyCols_;
00415 int NumMyNonzeros_;
00417 int NumGlobalRows_;
00419 int NumGlobalCols_;
00421 int NumGlobalNonzeros_;
00423 int MaxNumEntries_;
00425 int MaxNumEntriesA_;
00427 std::vector<int> NumEntries_;
00429 mutable std::vector<int> Indices_;
00431 mutable std::vector<double> Values_;
00433 bool UseTranspose_;
00435 char Label_[80];
00436 Teuchos::RCP<Epetra_Vector> Diagonal_;
00437 double NormOne_;
00438 double NormInf_;
00439
00441 int* Ac_LIDMap_;
00442 int* Bc_LIDMap_;
00443 int* Ar_LIDMap_;
00444 int* Br_LIDMap_;
00445
00447 const Epetra_CrsMatrix* Acrs_;
00448
00449 int NumMyRowsA_;
00450 int NumMyColsA_;
00451 int NumMyRowsB_;
00452
00453
00454
00455 mutable Epetra_MultiVector* ExportVector_;
00456 mutable Epetra_MultiVector* ImportVector_;
00457 Teuchos::RCP<Epetra_Import> Importer_;
00458 Teuchos::RCP<Epetra_Export> Exporter_;
00459
00460 };
00461 #endif //ifdef HAVE_IFPACK_PARALLEL_SUBDOMAIN_SOLVERS
00462 #endif