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_NODEFILTER_H
00031 #define IFPACK_NODEFILTER_H
00032
00033 #ifdef IFPACK_NODE_AWARE_CODE
00034
00035 #include "Ifpack_ConfigDefs.h"
00036 #ifdef HAVE_MPI
00037 #include "Epetra_MpiComm.h"
00038 #else
00039 #include "Epetra_SerialComm.h"
00040 #endif
00041 #include "Epetra_RowMatrix.h"
00042 #include "Epetra_CrsMatrix.h"
00043 #include "Epetra_IntVector.h"
00044 #include "Teuchos_RCP.hpp"
00045 #include "Ifpack_OverlappingRowMatrix.h"
00046 class Epetra_Map;
00047 class Epetra_MultiVector;
00048 class Epetra_Vector;
00049 class Epetra_Import;
00050 class Epetra_BlockMap;
00051
00053
00089 class Ifpack_NodeFilter : public virtual Epetra_RowMatrix {
00090
00091 public:
00093
00094 Ifpack_NodeFilter(const Teuchos::RCP<const Epetra_RowMatrix>& Matrix, int nodeID);
00095
00096
00098
00099
00100 ~Ifpack_NodeFilter(){
00101 if(Ac_LIDMap_) delete [] Ac_LIDMap_;
00102 if(Bc_LIDMap_) delete [] Bc_LIDMap_;
00103 if(Ar_LIDMap_) delete [] Ar_LIDMap_;
00104 if(Br_LIDMap_) delete [] Br_LIDMap_;
00105 if(tempX_) delete [] tempX_;
00106 if(tempY_) delete [] tempY_;
00107 if(ImportVector_) delete ImportVector_;
00108
00109 };
00111
00113
00115
00123 virtual int NumMyRowEntries(int MyRow, int & NumEntries) const
00124 {
00125 NumEntries = NumEntries_[MyRow];
00126 return(0);
00127 }
00128
00130 virtual int MaxNumEntries() const
00131 {
00132 return(MaxNumEntries_);
00133 }
00134
00136
00150 virtual inline int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
00151
00153
00159 virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
00161
00163
00165
00175 virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
00176 {
00177 if (TransA == true) {
00178 IFPACK_CHK_ERR(-1);
00179 }
00180
00181 IFPACK_CHK_ERR(Apply(X,Y));
00182 return(0);
00183 }
00184
00186 virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X,
00187 Epetra_MultiVector& Y) const
00188 {
00189 IFPACK_RETURN(-1);
00190 }
00191
00192 virtual int Apply(const Epetra_MultiVector& X,
00193 Epetra_MultiVector& Y) const;
00194
00195 virtual int ApplyInverse(const Epetra_MultiVector& X,
00196 Epetra_MultiVector& Y) const;
00198 virtual int InvRowSums(Epetra_Vector& x) const
00199 {
00200 IFPACK_RETURN(-1);
00201 }
00202
00204 virtual int LeftScale(const Epetra_Vector& x)
00205 {
00206 IFPACK_RETURN(-1);
00207 }
00208
00210 virtual int InvColSums(Epetra_Vector& x) const
00211 {
00212 IFPACK_RETURN(-1);
00213 }
00214
00215
00217 virtual int RightScale(const Epetra_Vector& x)
00218 {
00219 IFPACK_RETURN(-1);
00220 }
00221
00223
00225
00227 virtual bool Filled() const
00228 {
00229 return true;
00230 }
00231
00233
00234
00235
00236 virtual double NormInf() const
00237 {
00238 return(-1.0);
00239 }
00240
00242
00243
00244
00245 virtual double NormOne() const
00246 {
00247 IFPACK_RETURN(-1.0);
00248 }
00249
00251 virtual int NumGlobalNonzeros() const
00252 {
00253 return(NumGlobalNonzeros_);
00254 }
00255
00257 virtual int NumGlobalRows() const
00258 {
00259 return(NumGlobalRows_);
00260 }
00261
00263 virtual int NumGlobalCols() const
00264 {
00265 return(NumGlobalRows_);
00266 }
00267
00269 virtual int NumGlobalDiagonals() const
00270 {
00271 return(NumGlobalRows_);
00272 }
00273
00275 virtual int NumMyNonzeros() const
00276 {
00277 return(NumMyNonzeros_);
00278 }
00279
00281 virtual int NumMyRows() const
00282 {
00283 return(NumMyRows_);
00284 }
00285
00287 virtual int NumMyCols() const
00288 {
00289 return(NumMyCols_);
00290 }
00291
00293 virtual int NumMyDiagonals() const
00294 {
00295 return(NumMyRows_);
00296 }
00297
00299 virtual bool LowerTriangular() const
00300 {
00301 return(Matrix_->LowerTriangular());
00302 }
00303
00305 virtual bool UpperTriangular() const
00306 {
00307 return(Matrix_->UpperTriangular());
00308 }
00309
00311 virtual const Epetra_Map & RowMatrixRowMap() const
00312 {
00313 return(*Map_);
00314 }
00315
00317 virtual const Epetra_Map & RowMatrixColMap() const
00318 {
00319 return(*colMap_);
00320 }
00321
00323 virtual const Epetra_Import * RowMatrixImporter() const
00324 {
00325 return(&*Importer_);
00326 }
00328
00329 virtual const Epetra_Import* Importer() const {return(&*Importer_);}
00330
00331 virtual const Epetra_Export* Exporter() const {return(&*Exporter_);}
00332
00333
00334
00336 int SetOwnership(bool ownership)
00337 {
00338 IFPACK_RETURN(-1);
00339 }
00340
00342 int SetUseTranspose(bool UseTranspose_in)
00343 {
00344 UseTranspose_ = UseTranspose_in;
00345 return(0);
00346 }
00347
00349 bool UseTranspose() const
00350 {
00351 return(UseTranspose_);
00352 }
00353
00355 bool HasNormInf() const
00356 {
00357 return(false);
00358 }
00359
00361 const Epetra_Comm & Comm() const
00362 {
00363 return(*SubComm_);
00364 }
00365
00367 const Epetra_Map & OperatorDomainMap() const
00368 {
00369 return(*Map_);
00370 }
00371
00373 const Epetra_Map & OperatorRangeMap() const
00374 {
00375 return(*Map_);
00376 }
00378
00379 const Epetra_BlockMap& Map() const;
00380
00381 const char* Label() const{
00382 return(Label_);
00383 };
00384
00385 private:
00386 void UpdateImportVector(int NumVectors) const;
00387 void UpdateExportVector(int NumVectors) const;
00388
00390 Teuchos::RCP<const Epetra_RowMatrix> Matrix_;
00391 const Ifpack_OverlappingRowMatrix* ovA_;
00392 #ifdef HAVE_MPI
00394 Teuchos::RCP<Epetra_MpiComm> SubComm_;
00395 MPI_Comm nodeMPIComm_;
00396 #else
00398 Teuchos::RCP<Epetra_SerialComm> SubComm_;
00399 #endif
00401 Teuchos::RCP<Epetra_Map> Map_;
00403 Teuchos::RCP<Epetra_Map> colMap_;
00405 int NumMyRows_;
00407 int NumMyCols_;
00409 int NumMyNonzeros_;
00411 int NumGlobalRows_;
00413 int NumGlobalNonzeros_;
00415 int MaxNumEntries_;
00417 int MaxNumEntriesA_;
00419 std::vector<int> NumEntries_;
00421 mutable std::vector<int> Indices_;
00423 mutable std::vector<double> Values_;
00425 bool UseTranspose_;
00427 char Label_[80];
00428 Teuchos::RCP<Epetra_Vector> Diagonal_;
00429 double NormOne_;
00430 double NormInf_;
00431
00433 int* Ac_LIDMap_;
00434 int* Bc_LIDMap_;
00435 int* Ar_LIDMap_;
00436 int* Br_LIDMap_;
00437
00439 const Epetra_CrsMatrix* Acrs_;
00440
00441 int NumMyRowsA_;
00442 int NumMyColsA_;
00443 double *tempX_,*tempY_;
00444 int NumMyRowsB_;
00445
00446
00447
00448 mutable Epetra_MultiVector* ExportVector_;
00449 mutable Epetra_MultiVector* ImportVector_;
00450 Teuchos::RCP<Epetra_Import> Importer_;
00451 Teuchos::RCP<Epetra_Export> Exporter_;
00452
00453 };
00454 #endif //ifdef IFPACK_NODE_AWARE_CODE
00455 #endif