Isorropia: Partitioning, Load Balancing and more
Isorropia_Tpetra.hpp
Go to the documentation of this file.
1 //@HEADER
2 //************************************************************************
3 //
4 // Isorropia: Partitioning and Load Balancing Package
5 // Copyright (2006) Sandia Corporation
6 //
7 //Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 //license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 //************************************************************************
38 //@HEADER
39 
40 #ifndef _Isorropia_Tpetra_hpp_
41 #define _Isorropia_Tpetra_hpp_
42 
43 #include <Isorropia_ConfigDefs.hpp>
44 #include <Teuchos_RCP.hpp>
45 #include <Teuchos_ParameterList.hpp>
46 
48 
49 #ifdef HAVE_ISORROPIA_TPETRA
50 #include <Tpetra_MultiVector_decl.hpp>
51 #include <Tpetra_CrsGraph_decl.hpp>
52 #include <Tpetra_CrsMatrix_decl.hpp>
53 #include <Kokkos_DefaultNode.hpp>
54 #endif
55 
56 namespace Isorropia {
57 
58 namespace Tpetra {
59 
60 
61 #ifdef HAVE_ISORROPIA_TPETRA
62 
67 template <typename Node>
68 ::Tpetra::MultiVector<double,int,int,Node> *
69 createBalancedCopy(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector);
70 
74 template <typename Node>
75 ::Tpetra::MultiVector<double,int,int,Node> *
76 createBalancedCopy(const ::Tpetra::MultiVector<double,int,int,Node>& input_vector,
77  const Teuchos::ParameterList& paramlist);
78 
82 template <typename Node>
83 ::Tpetra::CrsGraph<int,int,Node> *
84 createBalancedCopy(const ::Tpetra::CrsGraph<int,int,Node> & input_graph);
85 
89 template <typename Node>
90 ::Tpetra::CrsGraph<int,int,Node> *
91 createBalancedCopy(const ::Tpetra::CrsGraph<int,int,Node> & input_graph,
92  const Teuchos::ParameterList& paramlist);
93 
97 template <typename Node>
98 ::Tpetra::CrsMatrix<double,int,int,Node> *
99 createBalancedCopy(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix);
100 
104 template <typename Node>
105 ::Tpetra::CrsMatrix<double,int,int,Node> *
106 createBalancedCopy(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix,
107  const Teuchos::ParameterList& paramlist);
108 
126 template <typename Node>
127 Teuchos::RCP< ::Tpetra::CrsMatrix<double,int,int,Node> >
128  redistribute_rows(const ::Tpetra::CrsMatrix<double,int,int,Node>& input_matrix,
129  const ::Tpetra::Map<int,int,Node>& target_rowmap,
130  ::Tpetra::Import<int,int,Node> * importer=0);
131 
149 template <typename Node>
150 Teuchos::RCP< ::Tpetra::CrsMatrix<double,int,int,Node> >
151  redistribute_rows(const ::Tpetra::RowMatrix<int,int,Node> & input_matrix,
152  const ::Tpetra::Map<int,int,Node>& target_rowmap,
153  ::Tpetra::Import<int,int,Node> * importer=0);
154 
167 template <typename Node>
168 Teuchos::RCP< ::Tpetra::CrsGraph<int,int,Node> >
169  redistribute_rows(const ::Tpetra::CrsGraph<int,int,Node> & input_graph,
170  const ::Tpetra::Map<int,int,Node>& target_rowmap,
171  ::Tpetra::Import<int,int,Node> * importer=0);
172 
185 template <typename Node>
186 Teuchos::RCP< ::Tpetra::MultiVector<double,int,int,Node> >
187  redistribute(const ::Tpetra::MultiVector<double,int,int,Node>& input,
188  const ::Tpetra::Map<int,int,Node> & target_map,
189  ::Tpetra::Import<int,int,Node> * importer=0);
190 
203 template <typename Node>
204 Teuchos::RCP< ::Tpetra::Vector<double,int,int,Node> >
205  redistribute(const ::Tpetra::Vector<double,int,int,Node>& input,
206  const ::Tpetra::Map<int,int,Node>& target_map,
207  ::Tpetra::Import<int,int,Node> * importer=0);
208 
209 #ifndef DOXYGEN_SHOULD_SKIP_THIS
210 
215 template <typename Node>
216 ::Tpetra::MultiVector<double,int,int,Node>* create_row_weights_nnz(const ::Tpetra::RowMatrix<int,int,Node> & input_matrix);
217 
222 template <typename Node>
223 ::Tpetra::MultiVector<double,int,int,Node>* create_row_weights_nnz(const ::Tpetra::CrsGraph<int,int,Node> & input_graph);
224 
225 template <typename Node>
226 ::Tpetra::MultiVector<double,int,int,Node>* create_unit_weights(const ::Tpetra::MultiVector<double,int,int,Node>& input_coords);
227 
228 
253 template <typename Node>
254 int repartition(const ::Tpetra::Map<int,int,Node> & input_map,
255  const ::Tpetra::MultiVector<double,int,int,Node>& weights,
256  std::vector<int>& myNewElements,
257  int& exportsSize,
258  std::vector<int>& imports);
259 
268 template <typename Node>
269 void gather_all_proc_global_offsets(const ::Tpetra::Map<int,int,Node> & blkmap,
270  std::vector<int>& all_proc_offsets);
271 
272 
281 double compute_imbalance(int nprocs, std::vector<int> &offsets,
282  double *wgts, double target);
283 
284 #endif //DOXYGEN_SHOULD_SKIP_THIS
285 #endif //HAVE_ISORROPIA_TPETRA
286 
287 }//namespace Tpetra
288 }//namespace Isorropia
289 
290 #endif
291 
Isorropia is the namespace that contains general definitions that apply to all partitioners and that ...
Definition: Isorropia_Epetra.hpp:60
Teuchos::RCP< Epetra_CrsMatrix > redistribute_rows(const Epetra_CrsMatrix &input_matrix, const Epetra_Map &target_rowmap, Epetra_Import *importer=0)
redistribute_rows() is an internal Isorropia function, not part of the API.
Teuchos::RCP< Epetra_MultiVector > redistribute(const Epetra_MultiVector &input, const Epetra_BlockMap &target_map, Epetra_Import *importer=0)
Return a new Epetra_MultiVector object constructed with target_map, and with the contents of &#39;input&#39; ...
Epetra_MultiVector * createBalancedCopy(const Epetra_MultiVector &input_vector)
createBalancedCopy() creates a copy with a more balanced map.