EpetraExt_PointToBlockDiagPermute.h

Go to the documentation of this file.
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 "Teuchos_ParameterList.hpp"
00040 
00041 class Epetra_Comm;
00042 class Epetra_Import;
00043 class Epetra_Export;
00044 class EpetraExt_BlockDiagMatrix;
00045 
00047 
00055 // NTS: Map() == RowMap is the convention
00056 
00057 //=========================================================================
00058 class EpetraExt_PointToBlockDiagPermute : public virtual Epetra_Operator, public Epetra_DistObject {
00059 public:
00060 
00062 
00063 
00064   EpetraExt_PointToBlockDiagPermute(const Epetra_CrsMatrix& MAT);
00066   
00068 
00069 
00070   virtual ~EpetraExt_PointToBlockDiagPermute();
00072 
00073   
00075 
00076 
00078   virtual int SetParameters(Teuchos::ParameterList & List);
00079   
00081   virtual int SetUseTranspose(bool UseTranspose){return -1;}
00082 
00084   virtual int Compute();
00085   
00087   
00089 
00090 
00092 
00100   virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00101 
00103 
00114   virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00115   
00117   virtual double NormInf() const {return -1;}
00119   
00121 
00122 
00124   virtual const char * Label() const{return "Fix Me";}
00125 
00127   virtual bool UseTranspose() const {return false;}
00128 
00130   virtual bool HasNormInf() const {return false;}
00131 
00133   virtual const Epetra_Comm & Comm() const {return Map().Comm();}
00134   
00136   //operator. 
00137   virtual const Epetra_Map & OperatorDomainMap() const {return Matrix_->OperatorDomainMap();}
00138 
00140   //operator.
00141   virtual const Epetra_Map & OperatorRangeMap() const {return Matrix_->OperatorRangeMap();}
00142 
00143   
00145   virtual const EpetraExt_BlockDiagMatrix & BlockMatrix(){return *BDMat_;}
00146   
00147 
00149 
00150 
00151   virtual void Print(ostream& os) const;
00153 
00154 
00156 
00157 
00159 
00171   int Import(const Epetra_SrcDistObject& A, const Epetra_Import& Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
00172 
00174 
00186   int Import(const Epetra_SrcDistObject& A, const Epetra_Export& Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
00187 
00189 
00201   int Export(const Epetra_SrcDistObject& A, const Epetra_Import & Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
00202 
00204 
00216   int Export(const Epetra_SrcDistObject& A, const Epetra_Export& Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex * Indexor = 0);
00218   
00219  protected:
00220 
00221 
00223 
00224 
00225   virtual int CheckSizes(const Epetra_SrcDistObject& Source);
00227   virtual int CopyAndPermute(const Epetra_SrcDistObject& Source,
00228                              int NumSameIDs, 
00229                              int NumPermuteIDs,
00230                              int * PermuteToLIDs,
00231                              int * PermuteFromLIDs,
00232                              const Epetra_OffsetIndex * Indexor);
00233 
00235   virtual int PackAndPrepare(const Epetra_SrcDistObject& Source,
00236                              int NumExportIDs,
00237                              int* ExportLIDs,
00238                              int& LenExports,
00239                              char*& Exports,
00240                              int& SizeOfPacket,
00241                              int* Sizes,
00242                              bool & VarSizes,
00243                              Epetra_Distributor& Distor);
00244   
00246   virtual int UnpackAndCombine(const Epetra_SrcDistObject& Source, 
00247                                int NumImportIDs,
00248                                int* ImportLIDs, 
00249                                int LenImports,
00250                                char* Imports,
00251                                int& SizeOfPacket, 
00252                                Epetra_Distributor& Distor,
00253                                Epetra_CombineMode CombineMode,
00254                                const Epetra_OffsetIndex * Indexor);
00255 
00257 
00258 private:
00260   int ExtractBlockDiagonal();
00261 
00262   // Copied from Epetra_CrsMatrix
00263   void UpdateImportVector(int NumVectors) const;
00264   void UpdateExportVector(int NumVectors) const;
00265 
00266   Teuchos::ParameterList List_;
00267   const Epetra_CrsMatrix* Matrix_;  
00268   bool PurelyLocalMode_;  
00269   int NumBlocks_;
00270   int *Blockstart_;
00271   int *Blockids_;
00272   Epetra_BlockMap *BDMap_;
00273   Epetra_Map *CompatibleMap_; //A map compatible with BD's block map - used for imports
00274   EpetraExt_BlockDiagMatrix* BDMat_;
00275   Epetra_Import *Importer_;
00276   Epetra_Export *Exporter_;
00277   mutable Epetra_MultiVector *ImportVector_;
00278   mutable Epetra_MultiVector *ExportVector_;
00279   
00280 
00281 };  /* EPETRAEXT_POINTTOBLOCKDIAGPERMUTE_H */
00282 
00283 #endif

Generated on Wed May 12 21:24:46 2010 for EpetraExt by  doxygen 1.4.7