47 #ifndef MUELU_SHIFTEDLAPLACIANOPERATOR_DEF_HPP
48 #define MUELU_SHIFTEDLAPLACIANOPERATOR_DEF_HPP
52 #ifdef HAVE_MUELU_TPETRA
54 #include <Xpetra_Matrix.hpp>
55 #include <Xpetra_CrsMatrixWrap.hpp>
56 #include <Xpetra_BlockedCrsMatrix.hpp>
57 #include <Xpetra_TpetraMultiVector.hpp>
58 #include <Xpetra_MultiVectorFactory.hpp>
61 #include "MueLu_Hierarchy.hpp"
62 #include "MueLu_Utilities.hpp"
69 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
74 typedef Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> XMatrix;
80 Teuchos::rcp_dynamic_cast<Xpetra::BlockedCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >(A);
81 if (tpbA != Teuchos::null) {
82 return Xpetra::toTpetraNonZero (tpbA->getDomainMap ());
87 return tpA->getDomainMap ();
92 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
97 typedef Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> XMatrix;
103 Teuchos::rcp_dynamic_cast<Xpetra::BlockedCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >(A);
104 if(tpbA != Teuchos::null)
105 return Xpetra::toTpetraNonZero(tpbA->getRangeMap());
109 return tpA->getRangeMap();
114 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
116 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y,
119 typedef Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TMV;
120 typedef Xpetra::TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> XTMV;
123 TMV & temp_x =
const_cast<TMV &
>(X);
124 const XTMV tX(rcpFromRef(temp_x));
125 XTMV tY(rcpFromRef(Y));
129 Hierarchy_->Iterate(tX, tY, cycles_,
true);
132 catch(std::exception& e) {
134 std::cerr <<
"Caught an exception in MueLu::ShiftedLaplacianOperator::ApplyInverse():" << std::endl
135 << e.what() << std::endl;
169 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
175 #endif //ifdef HAVE_MUELU_TPETRA
177 #endif //ifdef MUELU_SHIFTEDLAPLACIANOPERATOR_DEF_HPP
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level->Get< RCP<Matrix> >("A", factory) if factory == NULL => use default factory.
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
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. ...
bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
MueLu::DefaultScalar Scalar
static RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Op2NonConstTpetraCrs(RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Op)
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.