Isorropia: Partitioning, Load Balancing and more Version 3.0
Isorropia_Tpetra.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_Tpetra_hpp_
00031 #define _Isorropia_Tpetra_hpp_
00032 
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <Teuchos_RCP.hpp>
00035 #include <Teuchos_ParameterList.hpp>
00036 
00037 #include <Isorropia_TpetraRedistributor.hpp>
00038 
00039 #ifdef HAVE_ISORROPIA_TPETRA
00040 #include <Tpetra_MultiVector_decl.hpp>
00041 #include <Tpetra_CrsGraph_decl.hpp>
00042 #include <Tpetra_CrsMatrix_decl.hpp>
00043 #include <Kokkos_DefaultNode.hpp>
00044 #endif
00045 
00046 namespace Isorropia {
00047 
00048 namespace Tpetra {
00049 
00050 
00051 #ifdef HAVE_ISORROPIA_TPETRA
00052 
00057 template <typename Node>
00058 ::Tpetra::MultiVector<double,int,int,Node> *
00059 createBalancedCopy(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector);
00060 
00064 template <typename Node>
00065 ::Tpetra::MultiVector<double,int,int,Node> *
00066 createBalancedCopy(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector,
00067                      const Teuchos::ParameterList& paramlist);
00068 
00072 template <typename Node>
00073 ::Tpetra::CrsGraph<int,int,Node>  *
00074 createBalancedCopy(const ::Tpetra::CrsGraph<int,int,Node> & input_graph);
00075 
00079 template <typename Node>
00080 ::Tpetra::CrsGraph<int,int,Node>  *
00081 createBalancedCopy(const ::Tpetra::CrsGraph<int,int,Node> & input_graph,
00082                      const Teuchos::ParameterList& paramlist);
00083 
00087 template <typename Node>
00088 ::Tpetra::CrsMatrix<double,int,int,Node> *
00089 createBalancedCopy(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix);
00090 
00094 template <typename Node>
00095 ::Tpetra::CrsMatrix<double,int,int,Node> *
00096 createBalancedCopy(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix,
00097                      const Teuchos::ParameterList& paramlist);
00098 
00116 template <typename Node>
00117 Teuchos::RCP< ::Tpetra::CrsMatrix<double,int,int,Node> >
00118   redistribute_rows(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix,
00119                     const ::Tpetra::Map<int,int,Node>& target_rowmap,
00120                     ::Tpetra::Import<int,int,Node> * importer=0);
00121 
00139 template <typename Node>
00140 Teuchos::RCP< ::Tpetra::CrsMatrix<double,int,int,Node> >
00141   redistribute_rows(const ::Tpetra::RowMatrix<int,int,Node> & input_matrix,
00142                     const ::Tpetra::Map<int,int,Node>& target_rowmap,
00143                     ::Tpetra::Import<int,int,Node> * importer=0);
00144 
00157 template <typename Node>
00158 Teuchos::RCP< ::Tpetra::CrsGraph<int,int,Node> >
00159   redistribute_rows(const ::Tpetra::CrsGraph<int,int,Node> & input_graph,
00160                     const ::Tpetra::Map<int,int,Node>& target_rowmap,
00161                     ::Tpetra::Import<int,int,Node> * importer=0);
00162 
00175 template <typename Node>
00176 Teuchos::RCP< ::Tpetra::MultiVector<double,int,int,Node> >
00177   redistribute(const ::Tpetra::MultiVector<double,int,int,Node>& input,
00178                const ::Tpetra::Map<int,int,Node> & target_map,
00179                ::Tpetra::Import<int,int,Node> * importer=0);
00180 
00193 template <typename Node>
00194 Teuchos::RCP< ::Tpetra::Vector<double,int,int,Node> >
00195      redistribute(const ::Tpetra::Vector<double,int,int,Node>& input,
00196                   const ::Tpetra::Map<int,int,Node>& target_map,
00197                   ::Tpetra::Import<int,int,Node> * importer=0);
00198 
00199 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00200 
00205 template <typename Node>
00206 ::Tpetra::MultiVector<double,int,int,Node>* create_row_weights_nnz(const ::Tpetra::RowMatrix<int,int,Node> & input_matrix);
00207 
00212 template <typename Node>
00213 ::Tpetra::MultiVector<double,int,int,Node>* create_row_weights_nnz(const ::Tpetra::CrsGraph<int,int,Node> & input_graph);
00214 
00215 template <typename Node>
00216 ::Tpetra::MultiVector<double,int,int,Node>* create_unit_weights(const ::Tpetra::MultiVector<double,int,int,Node>& input_coords);
00217 
00218 
00243 template <typename Node>
00244 int repartition(const ::Tpetra::Map<int,int,Node> & input_map,
00245       const ::Tpetra::MultiVector<double,int,int,Node>& weights,
00246       std::vector<int>& myNewElements,
00247       int& exportsSize,
00248       std::vector<int>& imports);
00249 
00258 template <typename Node>
00259 void gather_all_proc_global_offsets(const ::Tpetra::Map<int,int,Node> & blkmap,
00260                                     std::vector<int>& all_proc_offsets);
00261 
00262 
00271 double compute_imbalance(int nprocs, std::vector<int> &offsets, 
00272                          double *wgts, double target);
00273 
00274 #endif //DOXYGEN_SHOULD_SKIP_THIS
00275 #endif //HAVE_ISORROPIA_TPETRA
00276 
00277 }//namespace Tpetra
00278 }//namespace Isorropia
00279 
00280 #endif
00281