Thyra_EpetraOperatorWrapper.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //              Meros: Segregated Preconditioning Package
00005 //                 Copyright (2004) 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 // @HEADER
00028 
00029 #ifndef THYRA_EPETRA_OPERATOR_H
00030 #define THYRA_EPETRA_OPERATOR_H
00031 
00032 #include "Thyra_LinearOpBase.hpp"
00033 #include "Thyra_VectorImpl.hpp" // need for LinOpDecl
00034 #include "Thyra_VectorSpaceImpl.hpp" // need for LinOpDecl
00035 #include "Thyra_LinearOperatorImpl.hpp"
00036 #include "Epetra_Map.h"
00037 #include "Epetra_Comm.h"
00038 #include "Epetra_MultiVector.h"
00039 #include "Epetra_Operator.h"
00040 
00041 
00042 namespace Thyra
00043 {
00044   using namespace Teuchos;
00045   using namespace Thyra;
00046 
00052   RefCountPtr<const LinearOpBase<double> > 
00053   makeEpetraWrapper(const ConstLinearOperator<double>& thyraOp);
00054 
00055 
00061   class EpetraOperatorWrapper : public Epetra_Operator
00062   {
00063   public:
00065     EpetraOperatorWrapper(const ConstLinearOperator<double>& thyraOp);
00066     
00068     virtual ~EpetraOperatorWrapper() {;}
00069 
00071     int SetUseTranspose(bool UseTranspose) {useTranspose_ = UseTranspose; return 0;}
00072 
00074     int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
00075 
00077     int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
00078 
00080     double NormInf() const ;
00081 
00083     const char* Label() const {return label_.c_str();}
00084 
00086     bool UseTranspose() const {return useTranspose_;}
00087 
00089     bool HasNormInf() const {return false;}
00090     
00092     const Epetra_Comm& Comm() const {return *comm_;}
00093 
00095     const Epetra_Map& OperatorDomainMap() const {return *domainMap_;}
00096 
00098     const Epetra_Map& OperatorRangeMap() const {return *rangeMap_;}
00099 
00100 
00102     void copyEpetraIntoThyra(const Epetra_MultiVector& x,
00103                              Vector<double> thyraVec) const ;
00104 
00106     void copyThyraIntoEpetra(const ConstVector<double>& thyraVec,
00107                              Epetra_MultiVector& v) const ;
00108 
00109   private:
00111     RefCountPtr<Epetra_Map> thyraVSToEpetraMap(const VectorSpace<double>& vs,
00112                                                const RefCountPtr<Epetra_Comm>& comm) const ;
00113 
00115     RefCountPtr<Epetra_Comm> getEpetraComm(const ConstLinearOperator<double>& thyraOp) const ;
00116 
00117 
00118     bool useTranspose_;
00119     ConstLinearOperator<double> thyraOp_;
00120     VectorSpace<double> domain_;
00121     VectorSpace<double> range_;
00122     RefCountPtr<Epetra_Comm> comm_;
00123     RefCountPtr<Epetra_Map> domainMap_;
00124     RefCountPtr<Epetra_Map> rangeMap_;
00125 
00126     std::string label_;
00127   };
00128 } 
00129 
00130 #endif 

Generated on Thu Sep 18 12:37:58 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1