43 #ifndef IFPACK2_DETAILS_MULTIVECTORLOCALGATHERSCATTER_HPP 44 #define IFPACK2_DETAILS_MULTIVECTORLOCALGATHERSCATTER_HPP 50 #include "Tpetra_MultiVector.hpp" 51 #include "Tpetra_Map.hpp" 84 template<
class MV_in,
class MV_out>
88 gather (MV_out& X_out,
90 const Teuchos::ArrayView<const typename MV_in::local_ordinal_type>& perm)
const 92 using Teuchos::ArrayRCP;
93 const size_t numRows = X_out.getLocalLength ();
94 const size_t numVecs = X_in.getNumVectors ();
96 for (
size_t j = 0; j < numVecs; ++j) {
97 ArrayRCP<const typename MV_in::scalar_type> X_in_j = X_in.getData (j);
98 ArrayRCP<typename MV_out::scalar_type> X_out_j = X_out.getDataNonConst (j);
100 for (
size_t i = 0; i < numRows; ++i) {
101 const size_t i_perm = perm[i];
102 X_out_j[i] = X_in_j[i_perm];
108 scatter (MV_in& X_in,
110 const Teuchos::ArrayView<const typename MV_in::local_ordinal_type>& perm)
const 112 using Teuchos::ArrayRCP;
113 const size_t numRows = X_out.getLocalLength ();
114 const size_t numVecs = X_in.getNumVectors ();
116 for (
size_t j = 0; j < numVecs; ++j) {
117 ArrayRCP<typename MV_in::scalar_type> X_in_j = X_in.getDataNonConst (j);
118 ArrayRCP<const typename MV_out::scalar_type> X_out_j = X_out.getData (j);
120 for (
size_t i = 0; i < numRows; ++i) {
121 const size_t i_perm = perm[i];
122 X_in_j[i_perm] = X_out_j[i];
131 #endif // IFPACK2_DETAILS_MULTIVECTORLOCALGATHERSCATTER_HPP Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
Implementation detail of Ifpack2::Container subclasses.
Definition: Ifpack2_Details_MultiVectorLocalGatherScatter.hpp:85