46 #ifndef MUELU_XPETRAOPERATOR_DECL_HPP
47 #define MUELU_XPETRAOPERATOR_DECL_HPP
51 #include <Xpetra_Operator.hpp>
52 #include <Xpetra_MultiVector.hpp>
64 class XpetraOperator :
public Xpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> {
82 typedef Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> Matrix;
85 return A->getDomainMap();
90 typedef Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> Matrix;
93 return A->getRangeMap();
101 void apply(
const Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
102 Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y,
107 #ifdef HAVE_MUELU_DEBUG
108 typedef Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> Matrix;
113 Xpetra::MultiVectorFactory<Scalar,LocalOrdinal,GlobalOrdinal,Node>::Build(A->getRangeMap(),X.getNumVectors());
115 Xpetra::MultiVectorFactory<Scalar,LocalOrdinal,GlobalOrdinal,Node>::Build(A->getDomainMap(),Y.getNumVectors());
117 "MueLu::XpetraOperator::apply: map of X is incompatible with range map of A");
119 "MueLu::XpetraOperator::apply: map of Y is incompatible with domain map of A");
124 }
catch (std::exception& e) {
126 std::cerr <<
"Caught an exception in MueLu::XpetraOperator::apply():" << std::endl
127 << e.what() << std::endl;
135 void residual(
const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & X,
136 const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & B,
137 Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & R)
const {
139 R.update(STS::one(),B,STS::zero());
157 #endif // MUELU_XPETRAOPERATOR_DECL_HPP
void apply(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp=Teuchos::NO_TRANS, Scalar=Teuchos::ScalarTraits< Scalar >::one(), Scalar=Teuchos::ScalarTraits< Scalar >::one()) const
Returns in Y the result of a Xpetra::Operator applied to a Xpetra::MultiVector X. ...
MueLu::DefaultLocalOrdinal LocalOrdinal
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > GetHierarchy() const
Direct access to the underlying MueLu::Hierarchy.
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Hierarchy_
void residual(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
Compute a residual R = B - (*this) * X.
XpetraOperator(const RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &H)
Constructor.
Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
virtual ~XpetraOperator()
Destructor.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Wraps an existing MueLu::Hierarchy as a Xpetra::Operator.