42 #ifndef THYRA_TPETRA_EUCLIDEAN_SCALAR_PROD_DEF_HPP 43 #define THYRA_TPETRA_EUCLIDEAN_SCALAR_PROD_DEF_HPP 53 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
55 const MultiVectorBase<Scalar>& X,
56 const MultiVectorBase<Scalar>& Y,
57 const ArrayView<Scalar>& scalarProds_out
60 typedef Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TMV;
61 Teuchos::RCP<const TMV> X_tpetra = this->getConstTpetraMultiVector(Teuchos::rcpFromRef(X));
62 Teuchos::RCP<const TMV> Y_tpetra = this->getConstTpetraMultiVector(Teuchos::rcpFromRef(Y));
64 if (nonnull(X_tpetra) && nonnull(Y_tpetra)) {
71 X_tpetra->dot(*Y_tpetra, scalarProds_out);
74 if (nonnull(X_tpetra))
75 Teuchos::rcp_const_cast<TMV>(X_tpetra)->
template sync<Kokkos::HostSpace>();
76 if (nonnull(Y_tpetra))
77 Teuchos::rcp_const_cast<TMV>(Y_tpetra)->
template sync<Kokkos::HostSpace>();
79 EuclideanScalarProd<Scalar>::scalarProdsImpl(X, Y, scalarProds_out);
84 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
85 Teuchos::RCP<const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
89 using Teuchos::rcp_dynamic_cast;
93 RCP<const TMV> tmv = rcp_dynamic_cast<
const TMV>(mv);
98 RCP<const TV> tv = rcp_dynamic_cast<
const TV>(mv);
100 return tv->getConstTpetraVector();
103 return Teuchos::null;
110 #endif // THYRA_EUCLIDEAN_SCALAR_PROD_DEF_HPP Concrete implementation of Thyra::MultiVector in terms of Tpetra::MultiVector.
virtual void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds) const
If X and Y are both Tpetra wrappers, computes the pair-wise scalar products directly with Tpetra call...
RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getConstTpetraMultiVector(const RCP< const MultiVectorBase< Scalar > > &mv) const
Teuchos::RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getConstTpetraMultiVector(const RCP< const MultiVectorBase< Scalar > > &mv) const
Concrete Thyra::SpmdVectorBase using Tpetra::Vector.