|
EpetraExt Development
|
00001 /* 00002 ************************************************************************ 00003 00004 EpetraExt: Extended Linear Algebra Services Package 00005 Copyright (2001) Sandia Corporation 00006 00007 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 license for use of this work by or on behalf of the U.S. Government. 00009 00010 This library is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as 00012 published by the Free Software Foundation; either version 2.1 of the 00013 License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, but 00016 WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 USA 00024 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 00026 ************************************************************************ 00027 */ 00028 //@HEADER 00029 00030 #ifndef EPETRAEXT_POINTTOBLOCKDIAGPERMUTE_H 00031 #define EPETRAEXT_POINTTOBLOCKDIAGPERMUTE_H 00032 00033 #include "Epetra_DistObject.h" 00034 #include "Epetra_BlockMap.h" 00035 #include "Epetra_BlockMap.h" 00036 #include "Epetra_Map.h" 00037 #include "Epetra_Operator.h" 00038 #include "Epetra_CrsMatrix.h" 00039 #include "Epetra_FECrsMatrix.h" 00040 #include "Teuchos_ParameterList.hpp" 00041 00042 class Epetra_Comm; 00043 class Epetra_Import; 00044 class Epetra_Export; 00045 class EpetraExt_BlockDiagMatrix; 00046 00048 00056 // NTS: Map() == RowMap is the convention 00057 00058 //========================================================================= 00059 class EpetraExt_PointToBlockDiagPermute : public virtual Epetra_Operator, public Epetra_DistObject { 00060 public: 00061 00063 00064 00065 EpetraExt_PointToBlockDiagPermute(const Epetra_CrsMatrix& MAT); 00067 00069 00070 00071 virtual ~EpetraExt_PointToBlockDiagPermute(); 00073 00074 00076 00077 00079 virtual int SetParameters(Teuchos::ParameterList & List); 00080 00082 virtual int SetUseTranspose(bool UseTranspose){return -1;} 00083 00085 virtual int Compute(); 00086 00088 00090 00091 00093 00101 virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00102 00104 00115 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00116 00118 virtual double NormInf() const {return -1;} 00120 00122 00123 00125 virtual const char * Label() const{return "Fix Me";} 00126 00128 virtual bool UseTranspose() const {return false;} 00129 00131 virtual bool HasNormInf() const {return false;} 00132 00134 virtual const Epetra_Comm & Comm() const {return Map().Comm();} 00135 00137 //operator. 00138 virtual const Epetra_Map & OperatorDomainMap() const {return Matrix_->OperatorDomainMap();} 00139 00141 //operator. 00142 virtual const Epetra_Map & OperatorRangeMap() const {return Matrix_->OperatorRangeMap();} 00143 00144 00146 virtual const EpetraExt_BlockDiagMatrix & BlockMatrix(){return *BDMat_;} 00147 00148 00150 virtual Epetra_FECrsMatrix * CreateFECrsMatrix(); 00151 00153 00154 00155 virtual void Print(ostream& os) const; 00156 00158 00159 00161 00162 00164 00176 int Import(const Epetra_SrcDistObject& A, const Epetra_Import& Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0); 00177 00179 00191 int Import(const Epetra_SrcDistObject& A, const Epetra_Export& Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0); 00192 00194 00206 int Export(const Epetra_SrcDistObject& A, const Epetra_Import & Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0); 00207 00209 00221 int Export(const Epetra_SrcDistObject& A, const Epetra_Export& Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0); 00223 00224 protected: 00225 00226 00228 00229 00230 virtual int CheckSizes(const Epetra_SrcDistObject& Source); 00232 virtual int CopyAndPermute(const Epetra_SrcDistObject& Source, 00233 int NumSameIDs, 00234 int NumPermuteIDs, 00235 int * PermuteToLIDs, 00236 int * PermuteFromLIDs, 00237 const Epetra_OffsetIndex * Indexor); 00238 00240 virtual int PackAndPrepare(const Epetra_SrcDistObject& Source, 00241 int NumExportIDs, 00242 int* ExportLIDs, 00243 int& LenExports, 00244 char*& Exports, 00245 int& SizeOfPacket, 00246 int* Sizes, 00247 bool & VarSizes, 00248 Epetra_Distributor& Distor); 00249 00251 virtual int UnpackAndCombine(const Epetra_SrcDistObject& Source, 00252 int NumImportIDs, 00253 int* ImportLIDs, 00254 int LenImports, 00255 char* Imports, 00256 int& SizeOfPacket, 00257 Epetra_Distributor& Distor, 00258 Epetra_CombineMode CombineMode, 00259 const Epetra_OffsetIndex * Indexor); 00260 00262 00263 private: 00265 int ExtractBlockDiagonal(); 00266 00268 int SetupContiguousMode(); 00269 int CleanupContiguousMode(); 00270 00271 // Copied from Epetra_CrsMatrix 00272 void UpdateImportVector(int NumVectors) const; 00273 void UpdateExportVector(int NumVectors) const; 00274 00275 Teuchos::ParameterList List_; 00276 const Epetra_CrsMatrix* Matrix_; 00277 bool PurelyLocalMode_; 00278 00279 // For contiguous blocking only 00280 bool ContiguousBlockMode_; 00281 int ContiguousBlockSize_; 00282 00283 int NumBlocks_; 00284 int *Blockstart_; 00285 int *Blockids_; 00286 Epetra_BlockMap *BDMap_; 00287 Epetra_Map *CompatibleMap_; //A map compatible with BD's block map - used for imports 00288 EpetraExt_BlockDiagMatrix* BDMat_; 00289 Epetra_Import *Importer_; 00290 Epetra_Export *Exporter_; 00291 mutable Epetra_MultiVector *ImportVector_; 00292 mutable Epetra_MultiVector *ExportVector_; 00293 00294 00295 }; /* EPETRAEXT_POINTTOBLOCKDIAGPERMUTE_H */ 00296 00297 #endif
1.7.4