Thyra Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_EpetraOperatorWrapper.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_EPETRA_OPERATOR_WRAPPER_HPP
43 #define THYRA_EPETRA_OPERATOR_WRAPPER_HPP
44 
45 #include "Thyra_LinearOpBase.hpp"
46 #include "Epetra_Map.h"
47 #include "Epetra_Comm.h"
48 #include "Epetra_MultiVector.h"
49 #include "Epetra_Operator.h"
50 
51 
52 namespace Thyra {
53 
54 
63 class EpetraOperatorWrapper : public Epetra_Operator
64 {
65 public:
66 
69 
71  EpetraOperatorWrapper(const RCP<const LinearOpBase<double> > &thyraOp);
72 
75  {
76  return thyraOp_;
77  }
78 
80  void copyEpetraIntoThyra(const Epetra_MultiVector &x,
81  const Ptr<VectorBase<double> > &thyraVec) const;
82 
84  void copyThyraIntoEpetra(const VectorBase<double> &thyraVec,
85  Epetra_MultiVector &x) const;
86 
88 
91 
93  int SetUseTranspose(bool UseTranspose_in)
94  {
95  useTranspose_ = UseTranspose_in;
96  return 0;
97  }
98 
100  int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
101 
103  int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
104 
106  double NormInf() const ;
107 
109  const char* Label() const {return label_.c_str();}
110 
112  bool UseTranspose() const {return useTranspose_;}
113 
115  bool HasNormInf() const {return false;}
116 
118  const Epetra_Comm& Comm() const {return *comm_;}
119 
121  const Epetra_Map& OperatorDomainMap() const {return *domainMap_;}
122 
124  const Epetra_Map& OperatorRangeMap() const {return *rangeMap_;}
125 
127 
128 private:
129 
137 
138  std::string label_;
139 
140  static RCP<const Epetra_Comm> getEpetraComm(const LinearOpBase<double>& thyraOp);
141 
142 };
143 
144 
154 makeEpetraWrapper(const RCP<const LinearOpBase<double> > &thyraOp);
155 
156 
157 } // namespace Thyra
158 
159 
160 #endif // THYRA_EPETRA_OPERATOR_WRAPPER_HPP
void copyEpetraIntoThyra(const Epetra_MultiVector &x, const Ptr< VectorBase< double > > &thyraVec) const
EpetraOperatorWrapper(const RCP< const LinearOpBase< double > > &thyraOp)
static RCP< const Epetra_Comm > getEpetraComm(const LinearOpBase< double > &thyraOp)
const Epetra_Map & OperatorDomainMap() const
int SetUseTranspose(bool UseTranspose_in)
RCP< const LinearOpBase< double > > getThyraOp() const
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
const Epetra_Map & OperatorRangeMap() const
Implements the Epetra_Operator interface with a Thyra LinearOperator.
RCP< const VectorSpaceBase< double > > range_
RCP< const VectorSpaceBase< double > > domain_
void copyThyraIntoEpetra(const VectorBase< double > &thyraVec, Epetra_MultiVector &x) const
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
RCP< const LinearOpBase< double > > thyraOp_