Isorropia: Partitioning, Load Balancing and more Version 3.0
Isorropia_TpetraRedistributor.hpp
Go to the documentation of this file.
00001 //@HEADER
00002 /*
00003 ************************************************************************
00004 
00005               Isorropia: Partitioning and Load Balancing Package
00006                 Copyright (2006) Sandia Corporation
00007 
00008 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 license for use of this work by or on behalf of the U.S. Government.
00010 
00011 This library is free software; you can redistribute it and/or modify
00012 it under the terms of the GNU Lesser General Public License as
00013 published by the Free Software Foundation; either version 2.1 of the
00014 License, or (at your option) any later version.
00015 
00016 This library is distributed in the hope that it will be useful, but
00017 WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 Lesser General Public License for more details.
00020 
00021 You should have received a copy of the GNU Lesser General Public
00022 License along with this library; if not, write to the Free Software
00023 Foundation, Inc, 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 USA
00025 
00026 ************************************************************************
00027 */
00028 //@HEADER
00029 
00030 #ifndef _Isorropia_TpetraRedistributor_hpp_
00031 #define _Isorropia_TpetraRedistributor_hpp_
00032 
00033 #include <Isorropia_Redistributor.hpp>
00034 #include <Isorropia_ConfigDefs.hpp>
00035 #include <Teuchos_RCP.hpp>
00036 #include <Teuchos_ParameterList.hpp>
00037 
00038 #ifdef HAVE_ISORROPIA_TPETRA
00039 
00040 
00041 #include <Kokkos_DefaultNode.hpp>
00042 #include <Isorropia_TpetraPartitioner.hpp>
00043 
00044 //#include <Tpetra_CrsGraph_decl.hpp>
00045 //#include <Tpetra_RowMatrix.hpp>
00046 //#include <Tpetra_MultiVector_decl.hpp>
00047 
00048 
00049 namespace Isorropia {
00050 
00051 namespace Tpetra {
00052 
00053 
00060 template <class Node=Kokkos::DefaultNode::DefaultNodeType>
00061 class Redistributor : public Isorropia::Redistributor {
00062 public:
00063 
00071   Redistributor(Teuchos::RCP<Isorropia::Tpetra::Partitioner<Node> > partitioner);
00072 
00080   Redistributor(Isorropia::Tpetra::Partitioner<Node> *partitioner);
00081 
00085   virtual ~Redistributor();
00086 
00104   Teuchos::RCP< ::Tpetra::CrsGraph<int,int,Node> >
00105   redistribute(const ::Tpetra::CrsGraph<int,int,Node>& input_graph, bool callFillComplete= true);
00106 
00124   void redistribute(const ::Tpetra::CrsGraph<int,int,Node>& input_graph, 
00125                     ::Tpetra::CrsGraph<int,int,Node> * &outputGraphPtr, bool callFillComplete= true);
00126 
00143   Teuchos::RCP< ::Tpetra::CrsMatrix<double,int,int,Node> >
00144   redistribute(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix, bool callFillComplete= true);
00145 
00163   void redistribute(const ::Tpetra::CrsMatrix<double,int,int,Node>& inputMatrix, 
00164                     ::Tpetra::CrsMatrix<double,int,int,Node> * &outputMatrix, bool callFillComplete= true);
00165 
00176   Teuchos::RCP< ::Tpetra::Vector<double,int,int,Node> >
00177   redistribute(const ::Tpetra::Vector<double,int,int,Node>& input_vector);
00178 
00189   void
00190   redistribute(const ::Tpetra::Vector<double,int,int,Node>& inputVector, 
00191                ::Tpetra::Vector<double,int,int,Node> * &outputVector);
00192 
00204   Teuchos::RCP< ::Tpetra::MultiVector<double,int,int,Node> >  
00205   redistribute(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector);
00206 
00207 
00219   void redistribute(const ::Tpetra::MultiVector<double,int,int,Node>& inputVector, 
00220                           ::Tpetra::MultiVector<double,int,int,Node> * &outputVector);
00221 
00231   void
00232   redistribute_reverse(const ::Tpetra::Vector<double,int,int,Node> & input_vector, ::Tpetra::Vector<double,int,int,Node>& output_vector);
00233 
00242   void
00243   redistribute_reverse(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector, ::Tpetra::MultiVector<double,int,int,Node>& output_vector);
00244 private:
00249   void create_importer(const ::Tpetra::Map<int,int,Node>& src_map);
00250 
00251   Teuchos::RCP<Isorropia::Tpetra::Partitioner<Node> > partitioner_;
00252   Teuchos::RCP< ::Tpetra::Import<int,int,Node> > importer_;
00253   Teuchos::RCP< ::Tpetra::Map<int,int,Node> > target_map_;
00254 
00255   bool created_importer_;
00256 
00257 }; //class Redistributor
00258 
00259 }//namespace Tpetra
00260 
00261 }//namespace Isorropia
00262 
00263 #endif //HAVE_ISORROPIA_TPETRA
00264 
00265 #endif
00266