10 #ifndef XPETRA_EPETRAOPERATOR_HPP
11 #define XPETRA_EPETRAOPERATOR_HPP
15 #include <Epetra_Operator.h>
16 #include <Epetra_Map.h>
18 #include "Xpetra_Map.hpp"
20 #include "Xpetra_MultiVector.hpp"
26 #if defined(XPETRA_ENABLE_DEPRECATED_CODE)
28 #if defined(Xpetra_SHOW_DEPRECATED_WARNINGS)
29 #warning "The header file Trilinos/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp is deprecated."
33 #error "The header file Trilinos/packages/xpetra/src/Operator/Xpetra_EpetraOperator.hpp is deprecated."
38 template <
class EpetraGlobalOrdinal,
class Node>
48 virtual const Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getDomainMap()
const {
50 return toXpetra<GlobalOrdinal, Node>(op_->OperatorDomainMap());
54 virtual const Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getRangeMap()
const {
56 return toXpetra<GlobalOrdinal, Node>(op_->OperatorRangeMap());
68 Teuchos::ETransp mode = Teuchos::NO_TRANS,
69 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
70 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero())
const {
77 "Xpetra::EpetraOperator->apply(): can only accept mode == NO_TRANS or mode == TRANS");
79 "Xpetra::EpetraOperator->apply(): cannot apply transpose as underlying Epetra operator does not support it");
82 RCP<Epetra_MultiVector> epY = eY.getEpetra_MultiVector();
83 RCP<Epetra_MultiVector> tmp = Teuchos::rcp(
new Epetra_MultiVector(*epY));
86 op_->SetUseTranspose(mode == Teuchos::TRANS);
96 int err = op_->SetUseTranspose(
true);
97 op_->SetUseTranspose(
false);
109 return "Epetra_Operator";
113 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {
115 out <<
"Epetra_Operator" << std::endl;
131 using STS = Teuchos::ScalarTraits<Scalar>;
132 R.
update(STS::one(), B, STS::zero());
133 this->apply(X, R, Teuchos::NO_TRANS, -STS::one(), STS::one());
144 template <
class EpetraGlobalOrdinal,
class Node>
154 virtual Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
getDomainMap()
const {
156 return toXpetra<GlobalOrdinal, Node>(
op_->OperatorDomainMap());
160 virtual Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
getRangeMap()
const {
162 return toXpetra<GlobalOrdinal, Node>(
op_->OperatorRangeMap());
174 Teuchos::ETransp mode = Teuchos::NO_TRANS,
175 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
176 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero())
const {
183 "Xpetra::EpetraOperator->apply(): can only accept mode == NO_TRANS or mode == TRANS");
185 "Xpetra::EpetraOperator->apply(): cannot apply transpose as underlying Epetra operator does not support it");
188 RCP<Epetra_MultiVector> epY = eY.getEpetra_MultiVector();
189 RCP<Epetra_MultiVector> tmp = Teuchos::rcp(
new Epetra_MultiVector(*epY));
192 op_->SetUseTranspose(mode == Teuchos::TRANS);
202 int err =
op_->SetUseTranspose(
true);
203 op_->SetUseTranspose(
false);
215 return "Epetra_Operator";
219 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {
221 out <<
"Epetra_Operator" << std::endl;
237 using STS = Teuchos::ScalarTraits<Scalar>;
238 R.
update(STS::one(), B, STS::zero());
239 this->
apply(X, R, Teuchos::NO_TRANS, -STS::one(), STS::one());
251 #endif // XPETRA_EPETRAOPERATOR_HPP
std::string description() const
A simple one-line description of this object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
RCP< Epetra_Operator > op_
The Tpetra::Operator which this class wraps.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
The Map associated with the range of this operator, which must be compatible with Y...
Exception throws to report errors in the internal logical of the program.
EpetraInverseOperator(const Teuchos::RCP< Epetra_Operator > &op)
EpetraOperator constructor to wrap a Epetra_Operator object.
virtual void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)=0
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
RCP< Epetra_Operator > op_
The Tpetra::Operator which this class wraps.
#define XPETRA_ERR_CHECK(arg)
EpetraGlobalOrdinal GlobalOrdinal
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
Compute a residual R = B - (*this) * X.
EpetraOperator(const Teuchos::RCP< Epetra_Operator > &op)
EpetraOperator constructor to wrap a Epetra_Operator object.
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
Exception throws when you call an unimplemented method of Xpetra.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
The Map associated with the domain of this operator, which must be compatible with X...
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
virtual void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Computes the operator-multivector application.
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
EpetraGlobalOrdinal GlobalOrdinal
virtual const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
The Map associated with the domain of this operator, which must be compatible with X...
virtual const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
The Map associated with the range of this operator, which must be compatible with Y...
#define XPETRA_MONITOR(funcName)
std::string description() const
A simple one-line description of this object.
virtual void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Computes the operator-multivector application.
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
Compute a residual R = B - (*this) * X.