Thyra Package Browser (Single Doxygen Collection) Version of the Day
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_WRAPPER_HPP
00030 #define THYRA_EPETRA_OPERATOR_WRAPPER_HPP
00031 
00032 #include "Thyra_LinearOpBase.hpp"
00033 #include "Epetra_Map.h"
00034 #include "Epetra_Comm.h"
00035 #include "Epetra_MultiVector.h"
00036 #include "Epetra_Operator.h"
00037 
00038 
00039 namespace Thyra {
00040 
00041 
00050 class EpetraOperatorWrapper : public Epetra_Operator
00051 {
00052 public:
00053 
00056 
00058   EpetraOperatorWrapper(const RCP<const LinearOpBase<double> > &thyraOp);
00059 
00061   void copyEpetraIntoThyra(const Epetra_MultiVector &x,
00062     const Ptr<VectorBase<double> > &thyraVec) const;
00063 
00065   void copyThyraIntoEpetra(const VectorBase<double> &thyraVec,
00066     Epetra_MultiVector &x) const;
00067 
00069 
00072 
00074   int SetUseTranspose(bool UseTranspose_in)
00075     {
00076       useTranspose_ = UseTranspose_in;
00077       return 0;
00078     }
00079 
00081   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
00082 
00084   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
00085 
00087   double NormInf() const ;
00088 
00090   const char* Label() const {return label_.c_str();}
00091 
00093   bool UseTranspose() const {return useTranspose_;}
00094 
00096   bool HasNormInf() const {return false;}
00097     
00099   const Epetra_Comm& Comm() const {return *comm_;}
00100 
00102   const Epetra_Map& OperatorDomainMap() const {return *domainMap_;}
00103 
00105   const Epetra_Map& OperatorRangeMap() const {return *rangeMap_;}
00106 
00108 
00109 private:
00110 
00111   bool useTranspose_;
00112   RCP<const LinearOpBase<double> > thyraOp_;
00113   RCP<const VectorSpaceBase<double> > range_;
00114   RCP<const VectorSpaceBase<double> > domain_;
00115   RCP<const Epetra_Comm> comm_;
00116   RCP<const Epetra_Map> rangeMap_;
00117   RCP<const Epetra_Map> domainMap_;
00118 
00119   std::string label_;
00120 
00121   static RCP<const Epetra_Comm> getEpetraComm(const LinearOpBase<double>& thyraOp);
00122 
00123 };
00124 
00125 
00134 RCP<const LinearOpBase<double> > 
00135 makeEpetraWrapper(const RCP<const LinearOpBase<double> > &thyraOp);
00136 
00137 
00138 }  // namespace Thyra
00139 
00140 
00141 #endif // THYRA_EPETRA_OPERATOR_WRAPPER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines