00001 //*****************************************************************// 00002 // Albany 2.0: Copyright 2012 Sandia Corporation // 00003 // This Software is released under the BSD license detailed // 00004 // in the file "license.txt" in the top-level Albany directory // 00005 //*****************************************************************// 00006 00007 #ifndef QCAD_COUPLEDPSPRECOND_H 00008 #define QCAD_COUPLEDPSPRECOND_H 00009 00010 #include <iostream> 00011 #include "Epetra_Comm.h" 00012 #include "Epetra_Map.h" 00013 #include "Epetra_Vector.h" 00014 #include "Epetra_Operator.h" 00015 #include "Epetra_CrsMatrix.h" 00016 #include "Epetra_Import.h" 00017 00018 00019 #include "Teuchos_RCP.hpp" 00020 00021 namespace QCAD { 00022 00027 class CoupledPSPreconditioner : public Epetra_Operator { 00028 public: 00029 CoupledPSPreconditioner(int nEigenvals, 00030 const Teuchos::RCP<const Epetra_Map>& discMap, 00031 const Teuchos::RCP<const Epetra_Map>& fullPSMap, 00032 const Teuchos::RCP<const Epetra_Comm>& comm); 00033 ~CoupledPSPreconditioner(); 00034 00036 void initialize(const Teuchos::RCP<Epetra_Operator>& poissonPrecond, const Teuchos::RCP<Epetra_Operator>& schrodingerPrecond); 00037 00039 virtual int SetUseTranspose(bool UseTranspose) { bUseTranspose = UseTranspose; return -1; }; //Note: return -1 if transpose isn't supported 00040 00042 virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00043 00045 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00046 00048 virtual double NormInf() const { return 0.0; } 00049 00051 virtual const char * Label() const { return "Coupled Poisson-Schrodinger Preconditioner"; } 00052 00054 virtual bool UseTranspose() const { return bUseTranspose; } 00055 00057 virtual bool HasNormInf() const { return false; } 00058 00060 virtual const Epetra_Comm & Comm() const { return *myComm; } 00061 00063 virtual const Epetra_Map & OperatorDomainMap() const { return *domainMap; } 00064 00066 virtual const Epetra_Map & OperatorRangeMap() const { return *rangeMap; } 00067 00068 private: 00069 00070 Teuchos::RCP<const Epetra_Map> discMap; 00071 Teuchos::RCP<const Epetra_Map> dist_evalMap; //, local_evalMap; 00072 Teuchos::RCP<const Epetra_Map> domainMap, rangeMap; 00073 Teuchos::RCP<const Epetra_Comm> myComm; 00074 //Teuchos::RCP<const Epetra_Import> eval_importer; 00075 bool bUseTranspose; 00076 bool bInitialized; 00077 int nEigenvalues; 00078 00079 Teuchos::RCP<Epetra_Operator> poissonPreconditioner, schrodingerPreconditioner; 00080 }; 00081 00082 } 00083 #endif