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>
 
   87   typedef typename MV_in::scalar_type InScalar;
 
   88   typedef typename MV_out::scalar_type OutScalar;
 
   89   typedef typename MV_in::local_ordinal_type LO;
 
   90   typedef typename MV_in::global_ordinal_type GO;
 
   91   typedef typename MV_in::node_type NO;
 
   97   gather (MV_out& X_out,
 
  102     const size_t numRows = X_out.getLocalLength ();
 
  103     const size_t numVecs = X_in.getNumVectors ();
 
  104     for (
size_t j = 0; j < numVecs; ++j) {
 
  105       ArrayRCP<const InScalar> X_in_j = X_in.getData(j);
 
  106       ArrayRCP<OutScalar> X_out_j = X_out.getDataNonConst(j);
 
  107       for (
size_t i = 0; i < numRows; ++i) {
 
  108         const size_t i_perm = perm[i];
 
  109         X_out_j[i] = X_in_j[i_perm];
 
  125     const size_t numBlocks = X_out.getLocalLength() / blockSize;
 
  126     const size_t numVecs = X_in.getNumVectors ();
 
  127     for (
size_t j = 0; j < numVecs; ++j) {
 
  128       ArrayRCP<const InScalar> X_in_j = X_in.getData(j);
 
  129       ArrayRCP<OutScalar> X_out_j = X_out.getDataNonConst(j);
 
  130       for (
size_t i = 0; i < numBlocks; ++i) {
 
  131         const size_t i_perm = perm[i];
 
  132         for (LO k = 0; k < blockSize; k++) {
 
  133           X_out_j[i * blockSize + k] = X_in_j[i_perm * blockSize + k];
 
  140   scatter (MV_in& X_in,
 
  145     const size_t numRows = X_out.getLocalLength();
 
  146     const size_t numVecs = X_in.getNumVectors();
 
  147     for (
size_t j = 0; j < numVecs; ++j) {
 
  148       ArrayRCP<InScalar> X_in_j = X_in.getDataNonConst(j);
 
  149       ArrayRCP<const OutScalar> X_out_j = X_out.getData(j);
 
  150       for (
size_t i = 0; i < numRows; ++i) {
 
  151         const size_t i_perm = perm[i];
 
  152         X_in_j[i_perm] = X_out_j[i];
 
  165     const size_t numBlocks = X_out.getLocalLength() / blockSize;
 
  166     const size_t numVecs = X_in.getNumVectors ();
 
  167     for (
size_t j = 0; j < numVecs; ++j) {
 
  168       ArrayRCP<const InScalar> X_in_j = X_in.getData(j);
 
  169       ArrayRCP<OutScalar> X_out_j = X_out.getDataNonConst(j);
 
  170       for (
size_t i = 0; i < numBlocks; ++i) {
 
  171         const size_t i_perm = perm[i];
 
  172         for (LO k = 0; k < blockSize; k++) {
 
  173            X_in_j[i_perm * blockSize + k] = X_out_j[i * blockSize + k];
 
  182   template<
typename InView, 
typename OutView>
 
  183   void gatherViewToView(OutView X_out,
 
  188     for(
size_t j = 0; j < X_out.extent(1); ++j) {
 
  189       for(
size_t i = 0; i < X_out.extent(0); ++i) {
 
  190         const LO i_perm = perm[i];
 
  191         X_out(i, j) = X_in(i_perm, j);
 
  196   template<
typename InView, 
typename OutView>
 
  197   void scatterViewToView(InView X_in,
 
  201     for(
size_t j = 0; j < X_out.extent(1); ++j) {
 
  202       for(
size_t i = 0; i < X_out.extent(0); ++i) {
 
  203         const LO i_perm = perm[i];
 
  204         X_in(i_perm, j) = X_out(i, j);
 
  209   template<
typename InView, 
typename OutView>
 
  210   void gatherViewToViewBlock(OutView X_out,
 
  216     size_t numBlocks = X_out.extent(0) / blockSize;
 
  217     for(
size_t j = 0; j < X_out.extent(1); ++j) {
 
  218       for(
size_t i = 0; i < numBlocks; ++i) {
 
  219         const LO i_perm = perm[i];
 
  220         for(LO k = 0; k < blockSize; k++) {
 
  221           X_out(i * blockSize + k, j) = X_in(i_perm * blockSize + k, j);
 
  227   template<
typename InView, 
typename OutView>
 
  228   void scatterViewToViewBlock(InView X_in,
 
  234     size_t numBlocks = X_out.extent(0) / blockSize;
 
  235     for(
size_t j = 0; j < X_out.extent(1); ++j) {
 
  236       for(
size_t i = 0; i < numBlocks; ++i) {
 
  237         const LO i_perm = perm[i];
 
  238         for(LO k = 0; k < blockSize; k++) {
 
  239           X_in(i_perm * blockSize + k, j) = X_out(i * blockSize + k, j);
 
  248   template<
typename InView>
 
  249   void gatherMVtoView(MV_out X_out,
 
  254     size_t numRows = X_out.getLocalLength();
 
  255     for(
size_t j = 0; j < X_out.getNumVectors(); ++j) {
 
  257       for(
size_t i = 0; i < numRows; ++i) {
 
  258         const LO i_perm = perm[i];
 
  259         X_out_j[i] = X_in(i_perm, j);
 
  264   template<
typename InView>
 
  265   void scatterMVtoView(InView X_in,
 
  269     size_t numRows = X_out.getLocalLength(); 
 
  270     for(
size_t j = 0; j < X_in.extent(1); ++j) {
 
  272       for(
size_t i = 0; i < numRows; ++i) {
 
  273         const LO i_perm = perm[i];
 
  274         X_in(i_perm, j) = X_out_j[i];
 
  279   template<
typename InView>
 
  280   void gatherMVtoViewBlock(MV_out X_out,
 
  286     size_t numBlocks = X_out.getLocalLength() / blockSize;
 
  287     for(
size_t j = 0; j < X_out.getNumVectors(); ++j) {
 
  289       for(
size_t i = 0; i < numBlocks; ++i) {
 
  290         const LO i_perm = perm[i];
 
  291         for(LO k = 0; k < blockSize; k++) {
 
  292           X_out_j[i * blockSize + k] = X_in(i_perm * blockSize + k, j);
 
  298   template<
typename InView>
 
  299   void scatterMVtoViewBlock(InView X_in,
 
  304     size_t numBlocks = X_out.getLocalLength() / blockSize;
 
  305     for(
size_t j = 0; j < X_in.extent(1); ++j) {
 
  307       for(
size_t i = 0; i < numBlocks; ++i) {
 
  308         const LO i_perm = perm[i];
 
  309         for(LO k = 0; k < blockSize; k++) {
 
  310           X_in(i_perm * blockSize + k, j) = X_out_j[i * blockSize + k];
 
  320 #endif // IFPACK2_DETAILS_MULTIVECTORLOCALGATHERSCATTER_HPP 
Implementation detail of Ifpack2::Container subclasses. 
Definition: Ifpack2_Details_MultiVectorLocalGatherScatter.hpp:85