10 #ifndef __Teko_TpetraOperatorWrapper_hpp__
11 #define __Teko_TpetraOperatorWrapper_hpp__
13 #include "Thyra_LinearOpBase.hpp"
14 #include "Tpetra_Map.hpp"
15 #include "Tpetra_MultiVector.hpp"
16 #include "Tpetra_Operator.hpp"
17 #include "Teko_ConfigDefs.hpp"
22 namespace TpetraHelpers {
25 class TpetraOperatorWrapper;
41 const Tpetra::MultiVector<ST, LO, GO, NT>& tpetraX,
42 const Teuchos::Ptr<Thyra::MultiVectorBase<ST> >& thyraX)
const = 0;
54 Tpetra::MultiVector<ST, LO, GO, NT>& tpetraX)
const = 0;
58 virtual const RCP<const Tpetra::Map<LO, GO, NT> >
domainMap()
const = 0;
61 virtual const RCP<const Tpetra::Map<LO, GO, NT> >
rangeMap()
const = 0;
64 virtual std::string
toString()
const = 0;
78 const Teuchos::Ptr<Thyra::MultiVectorBase<ST> >& thyraX) const
85 Tpetra::MultiVector<ST, LO, GO, NT>& tpetraX)
const
92 virtual const RCP<const Tpetra::Map<LO, GO, NT> >
domainMap()
const {
97 virtual const RCP<const Tpetra::Map<LO, GO, NT> >
rangeMap()
const {
103 return std::string(
"InverseMapping(") +
forwardStrategy_->toString() + std::string(
")");
120 const Teuchos::Comm<Thyra::Ordinal>& comm);
133 const Teuchos::Ptr<Thyra::MultiVectorBase<ST> >& thyraX)
const;
145 Tpetra::MultiVector<ST, LO, GO, NT>& tpetraX)
const;
155 virtual std::string
toString()
const {
return std::string(
"DefaultMappingStrategy"); }
176 const RCP<const MappingStrategy>& mapStrategy);
183 int SetUseTranspose(
bool useTranspose) {
184 useTranspose_ = useTranspose;
189 void apply(
const Tpetra::MultiVector<ST, LO, GO, NT>& X, Tpetra::MultiVector<ST, LO, GO, NT>& Y,
190 Teuchos::ETransp mode = Teuchos::NO_TRANS, ST alpha = Teuchos::ScalarTraits<ST>::one(),
191 ST beta = Teuchos::ScalarTraits<ST>::zero())
const;
194 void applyInverse(
const Tpetra::MultiVector<ST, LO, GO, NT>& X,
195 Tpetra::MultiVector<ST, LO, GO, NT>& Y,
196 Teuchos::ETransp mode = Teuchos::NO_TRANS,
197 ST alpha = Teuchos::ScalarTraits<ST>::one(),
198 ST beta = Teuchos::ScalarTraits<ST>::zero())
const;
201 double NormInf()
const;
204 const char* Label()
const {
return label_.c_str(); }
207 bool UseTranspose()
const {
return useTranspose_; }
210 bool HasNormInf()
const {
return false; }
213 const Teuchos::RCP<const Teuchos::Comm<Thyra::Ordinal> >& Comm()
const {
return comm_; }
216 Teuchos::RCP<const Tpetra::Map<LO, GO, NT> > getDomainMap()
const {
217 return mapStrategy_->domainMap();
221 Teuchos::RCP<const Tpetra::Map<LO, GO, NT> > getRangeMap()
const {
222 return mapStrategy_->rangeMap();
226 const RCP<const Thyra::LinearOpBase<ST> >
getThyraOp()
const {
return thyraOp_; }
238 Teuchos::RCP<const Tpetra::Operator<ST, LO, GO, NT> >
GetBlock(
int i,
int j)
const;
245 RCP<const Teuchos::Comm<Thyra::Ordinal> > getThyraComm(
const Thyra::LinearOpBase<ST>& inOp)
const;
248 void SetOperator(
const RCP<
const Thyra::LinearOpBase<ST> >& thyraOp,
bool buildMap =
true);
251 void SetMapStrategy(
const RCP<const MappingStrategy>& mapStrategy) { mapStrategy_ = mapStrategy; }
254 RCP<const MappingStrategy> mapStrategy_;
257 RCP<const Thyra::LinearOpBase<ST> > thyraOp_;
263 RCP<const Teuchos::Comm<Thyra::Ordinal> > comm_;
RCP< const Thyra::VectorSpaceBase< ST > > domainSpace_
Domain space object.
virtual const RCP< const Tpetra::Map< LO, GO, NT > > domainMap() const
Domain map for this strategy.
virtual void copyTpetraIntoThyra(const Tpetra::MultiVector< ST, LO, GO, NT > &tpetraX, const Teuchos::Ptr< Thyra::MultiVectorBase< ST > > &thyraX) const =0
Copy an Epetra_MultiVector into a Thyra::MultiVectorBase.
virtual std::string toString() const
Identifier string.
virtual void copyThyraIntoTpetra(const RCP< const Thyra::MultiVectorBase< ST > > &thyraX, Tpetra::MultiVector< ST, LO, GO, NT > &tpetraX) const
Copy an Thyra::MultiVectorBase into a Epetra_MultiVector.
virtual const RCP< const Tpetra::Map< LO, GO, NT > > domainMap() const
Domain map for this strategy.
InverseMappingStrategy(const RCP< const MappingStrategy > &forward)
Constructor to build a inverse MappingStrategy from a forward map.
default mapping strategy for the basic TpetraOperatorWrapper
virtual void copyThyraIntoTpetra(const RCP< const Thyra::MultiVectorBase< ST > > &thyraX, Tpetra::MultiVector< ST, LO, GO, NT > &tpetraX) const
Copy an Thyra::MultiVectorBase into a Epetra_MultiVector.
Abstract Mapping strategy for an TpetraOperatorWrapper.
RCP< const Thyra::VectorSpaceBase< ST > > rangeSpace_
Range space object.
const RCP< const Thyra::LinearOpBase< ST > > getThyraOp() const
Return the thyra operator associated with this wrapper.
virtual void copyThyraIntoTpetra(const RCP< const Thyra::MultiVectorBase< ST > > &thyraX, Tpetra::MultiVector< ST, LO, GO, NT > &tpetraX) const =0
Copy an Thyra::MultiVectorBase into a Epetra_MultiVector.
virtual const RCP< const Tpetra::Map< LO, GO, NT > > rangeMap() const =0
Range map for this strategy.
virtual std::string toString() const
Identifier string.
const RCP< const MappingStrategy > forwardStrategy_
Forward mapping strategy object.
Flip a mapping strategy object around to give the "inverse" mapping strategy.
virtual void copyTpetraIntoThyra(const Tpetra::MultiVector< ST, LO, GO, NT > &tpetraX, const Teuchos::Ptr< Thyra::MultiVectorBase< ST > > &thyraX) const
Copy an Epetra_MultiVector into a Thyra::MultiVectorBase.
virtual const RCP< const Tpetra::Map< LO, GO, NT > > rangeMap() const
Range map for this strategy.
virtual std::string toString() const =0
Identifier string.
Teuchos::RCP< const Tpetra::Operator< ST, LO, GO, NT > > GetBlock(int i, int j) const
Grab the i,j block.
virtual const RCP< const Tpetra::Map< LO, GO, NT > > rangeMap() const
Range map for this strategy.
const RCP< const MappingStrategy > getMapStrategy() const
Get the mapping strategy for this wrapper (translate between Thyra and Epetra)
virtual void copyTpetraIntoThyra(const Tpetra::MultiVector< ST, LO, GO, NT > &tpetraX, const Teuchos::Ptr< Thyra::MultiVectorBase< ST > > &thyraX) const
Copy an Epetra_MultiVector into a Thyra::MultiVectorBase.
virtual int GetBlockRowCount()
Get the number of block rows in this operator.
virtual int GetBlockColCount()
Get the number of block columns in this operator.
RCP< const Tpetra::Map< LO, GO, NT > > rangeMap_
Pointer to the constructed range map.
virtual const RCP< const Tpetra::Map< LO, GO, NT > > domainMap() const =0
Domain map for this strategy.
Implements the Epetra_Operator interface with a Thyra LinearOperator. This enables the use of absrtac...
RCP< const Tpetra::Map< LO, GO, NT > > domainMap_
Pointer to the constructed domain map.