47 #ifndef MUELU_TPETRAOPERATOR_DEF_HPP
48 #define MUELU_TPETRAOPERATOR_DEF_HPP
52 #ifdef HAVE_MUELU_TPETRA
54 #include <Xpetra_BlockedMap.hpp>
55 #include <Xpetra_Matrix.hpp>
56 #include <Xpetra_CrsMatrixWrap.hpp>
57 #include <Xpetra_BlockedCrsMatrix.hpp>
58 #include <Xpetra_Operator.hpp>
59 #include <Xpetra_TpetraMultiVector.hpp>
62 #include "MueLu_Hierarchy.hpp"
63 #include "MueLu_Utilities.hpp"
68 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 typedef Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> Matrix;
72 typedef Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> Map;
73 typedef Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node> BlockedMap;
76 if(!Hierarchy_.is_null()) domainMap = Hierarchy_->GetLevel(0)->template Get<RCP<Matrix> >(
"A")->getDomainMap();
77 else domainMap = Operator_->getDomainMap();
81 if(bDomainMap.
is_null() ==
false) {
82 return Xpetra::toTpetraNonZero(bDomainMap->getFullMap());
84 return Xpetra::toTpetraNonZero(domainMap);
87 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
89 typedef Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> Matrix;
90 typedef Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> Map;
91 typedef Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node> BlockedMap;
95 if(!Hierarchy_.is_null()) rangeMap = Hierarchy_->GetLevel(0)->template Get<RCP<Matrix> >(
"A")->getRangeMap();
96 else rangeMap = Operator_->getRangeMap();
99 if(bRangeMap.
is_null() ==
false) {
100 return Xpetra::toTpetraNonZero(bRangeMap->getFullMap());
102 return Xpetra::toTpetraNonZero(rangeMap);
105 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
107 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y,
109 typedef Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TMV;
110 typedef Xpetra::TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> XTMV;
113 TMV& temp_x =
const_cast<TMV &
>(X);
114 const XTMV tX(rcpFromRef(temp_x));
115 XTMV tY(rcpFromRef(Y));
118 if(!Hierarchy_.is_null())
119 Hierarchy_->Iterate(tX, tY, 1,
true);
121 Operator_->apply(tX, tY);
123 }
catch (std::exception& e) {
124 std::cerr <<
"MueLu::TpetraOperator::apply : detected an exception" << std::endl
125 << e.what() << std::endl;
130 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
135 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
141 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
148 #endif //ifdef HAVE_MUELU_TPETRA
150 #endif //ifdef MUELU_TPETRAOPERATOR_DEF_HPP
bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
MueLu::DefaultScalar Scalar
RCP< Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > GetOperator() const
Direct access to the underlying MueLu::Operator.
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > GetHierarchy() const
Direct access to the underlying MueLu::Hierarchy.
void apply(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::one()) const
Returns in Y the result of a Tpetra::Operator applied to a Tpetra::MultiVector X. ...