|
Isorropia: Partitioning, Load Balancing and more
|
00001 //@HEADER 00002 //************************************************************************ 00003 // 00004 // Isorropia: Partitioning and Load Balancing Package 00005 // Copyright (2006) Sandia Corporation 00006 // 00007 //Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 //license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 //************************************************************************ 00038 //@HEADER 00039 00040 #ifndef _Isorropia_TpetraRedistributor_hpp_ 00041 #define _Isorropia_TpetraRedistributor_hpp_ 00042 00043 #include <Isorropia_Redistributor.hpp> 00044 #include <Isorropia_ConfigDefs.hpp> 00045 #include <Teuchos_RCP.hpp> 00046 #include <Teuchos_ParameterList.hpp> 00047 00048 #ifdef HAVE_ISORROPIA_TPETRA 00049 00050 00051 #include <Kokkos_DefaultNode.hpp> 00052 #include <Isorropia_TpetraPartitioner.hpp> 00053 00054 //#include <Tpetra_CrsGraph_decl.hpp> 00055 //#include <Tpetra_RowMatrix.hpp> 00056 //#include <Tpetra_MultiVector_decl.hpp> 00057 00058 00059 namespace Isorropia { 00060 00061 namespace Tpetra { 00062 00063 00070 template <class Node=KokkosClassic::DefaultNode::DefaultNodeType> 00071 class Redistributor : public Isorropia::Redistributor { 00072 public: 00073 00081 Redistributor(Teuchos::RCP<Isorropia::Tpetra::Partitioner<Node> > partitioner); 00082 00090 Redistributor(Isorropia::Tpetra::Partitioner<Node> *partitioner); 00091 00095 virtual ~Redistributor(); 00096 00114 Teuchos::RCP< ::Tpetra::CrsGraph<int,int,Node> > 00115 redistribute(const ::Tpetra::CrsGraph<int,int,Node>& input_graph, bool callFillComplete= true); 00116 00134 void redistribute(const ::Tpetra::CrsGraph<int,int,Node>& input_graph, 00135 ::Tpetra::CrsGraph<int,int,Node> * &outputGraphPtr, bool callFillComplete= true); 00136 00153 Teuchos::RCP< ::Tpetra::CrsMatrix<double,int,int,Node> > 00154 redistribute(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix, bool callFillComplete= true); 00155 00173 void redistribute(const ::Tpetra::CrsMatrix<double,int,int,Node>& inputMatrix, 00174 ::Tpetra::CrsMatrix<double,int,int,Node> * &outputMatrix, bool callFillComplete= true); 00175 00186 Teuchos::RCP< ::Tpetra::Vector<double,int,int,Node> > 00187 redistribute(const ::Tpetra::Vector<double,int,int,Node>& input_vector); 00188 00199 void 00200 redistribute(const ::Tpetra::Vector<double,int,int,Node>& inputVector, 00201 ::Tpetra::Vector<double,int,int,Node> * &outputVector); 00202 00214 Teuchos::RCP< ::Tpetra::MultiVector<double,int,int,Node> > 00215 redistribute(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector); 00216 00217 00229 void redistribute(const ::Tpetra::MultiVector<double,int,int,Node>& inputVector, 00230 ::Tpetra::MultiVector<double,int,int,Node> * &outputVector); 00231 00241 void 00242 redistribute_reverse(const ::Tpetra::Vector<double,int,int,Node> & input_vector, ::Tpetra::Vector<double,int,int,Node>& output_vector); 00243 00252 void 00253 redistribute_reverse(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector, ::Tpetra::MultiVector<double,int,int,Node>& output_vector); 00254 private: 00259 void create_importer(const ::Tpetra::Map<int,int,Node>& src_map); 00260 00261 Teuchos::RCP<Isorropia::Tpetra::Partitioner<Node> > partitioner_; 00262 Teuchos::RCP< ::Tpetra::Import<int,int,Node> > importer_; 00263 Teuchos::RCP< ::Tpetra::Map<int,int,Node> > target_map_; 00264 00265 bool created_importer_; 00266 00267 }; //class Redistributor 00268 00269 }//namespace Tpetra 00270 00271 }//namespace Isorropia 00272 00273 #endif //HAVE_ISORROPIA_TPETRA 00274 00275 #endif 00276