Isorropia: Partitioning, Load Balancing and more
Isorropia_Epetra.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_Epetra_hpp_
41 #define _Isorropia_Epetra_hpp_
42 
43 #include <Isorropia_ConfigDefs.hpp>
44 #include <Teuchos_RCP.hpp>
45 #include <Teuchos_ParameterList.hpp>
46 
47 #ifdef HAVE_EPETRA
48 class Epetra_Comm;
49 class Epetra_Map;
50 class Epetra_BlockMap;
51 class Epetra_Import;
52 class Epetra_Vector;
53 class Epetra_MultiVector;
54 class Epetra_RowMatrix;
55 class Epetra_CrsGraph;
56 class Epetra_CrsMatrix;
57 class Epetra_LinearProblem;
58 #endif
59 
60 namespace Isorropia {
61 
62 namespace Epetra {
63 
64  class Partitioner;
65  class CostDescriber;
66 
67 #ifdef HAVE_EPETRA
68 
72 Epetra_MultiVector *
73 createBalancedCopy(const Epetra_MultiVector& input_vector);
74 
78 Epetra_MultiVector *
79 createBalancedCopy(const Epetra_MultiVector& input_vector,
80  const Teuchos::ParameterList& paramlist);
81 
85 Epetra_CrsGraph *
86 createBalancedCopy(const Epetra_CrsGraph& input_graph);
87 
91 Epetra_CrsGraph *
92 createBalancedCopy(const Epetra_CrsGraph& input_graph,
93  const Teuchos::ParameterList& paramlist);
94 
98 Epetra_CrsMatrix *
99 createBalancedCopy(const Epetra_CrsMatrix& input_matrix);
100 
104 Epetra_CrsMatrix *
105 createBalancedCopy(const Epetra_CrsMatrix& input_matrix,
106  const Teuchos::ParameterList& paramlist);
107 
112 Epetra_LinearProblem *
113 createBalancedCopy(const Epetra_LinearProblem & input_problem);
114 
119 Epetra_LinearProblem *
120 createBalancedCopy(const Epetra_LinearProblem & input_problem,
121  const Teuchos::ParameterList& paramlist);
122 
130 // Teuchos::RCP<Epetra_Map>
131 // create_target_map(const Epetra_Comm& comm, Partitioner& partitioner);
132 
151 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
152  create_balanced_copy(const Epetra_CrsMatrix& input_matrix);
153 
170 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
171  create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
172  const Epetra_Vector &row_weights);
173 
199 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
200  create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
201  const Teuchos::ParameterList& paramlist);
202 
203 
204 
235 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
236  create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
237  CostDescriber &costs,
238  const Teuchos::ParameterList& paramlist);
239 
258 __deprecated Teuchos::RCP<Epetra_RowMatrix>
259  create_balanced_copy(const Epetra_RowMatrix& input_matrix);
260 
277 __deprecated Teuchos::RCP<Epetra_RowMatrix>
278  create_balanced_copy(const Epetra_RowMatrix& input_matrix,
279  const Epetra_Vector &row_weights);
280 
307 __deprecated Teuchos::RCP<Epetra_RowMatrix>
308  create_balanced_copy(const Epetra_RowMatrix& input_matrix,
309  const Teuchos::ParameterList& paramlist);
310 
342 __deprecated Teuchos::RCP<Epetra_RowMatrix>
343  create_balanced_copy(const Epetra_RowMatrix& input_matrix,
344  CostDescriber &costs,
345  const Teuchos::ParameterList& paramlist);
346 
365 __deprecated Teuchos::RCP<Epetra_CrsGraph>
366  create_balanced_copy(const Epetra_CrsGraph& input_graph);
367 
385 __deprecated Teuchos::RCP<Epetra_CrsGraph>
386  create_balanced_copy(const Epetra_CrsGraph& input_matrix,
387  const Epetra_Vector &row_weights);
388 
414 __deprecated Teuchos::RCP<Epetra_CrsGraph>
415  create_balanced_copy(const Epetra_CrsGraph& input_graph,
416  const Teuchos::ParameterList& paramlist);
417 
448 __deprecated Teuchos::RCP<Epetra_CrsGraph>
449  create_balanced_copy(const Epetra_CrsGraph& input_graph,
450  CostDescriber &costs,
451  const Teuchos::ParameterList& paramlist);
452 
472 __deprecated Teuchos::RCP<Epetra_LinearProblem>
473  create_balanced_copy(const Epetra_LinearProblem & input_problem);
474 
491 __deprecated Teuchos::RCP<Epetra_LinearProblem>
492  create_balanced_copy(const Epetra_LinearProblem& input_matrix,
493  const Epetra_Vector &row_weights);
494 
521 __deprecated Teuchos::RCP<Epetra_LinearProblem>
522  create_balanced_copy(const Epetra_LinearProblem& input_problem,
523  const Teuchos::ParameterList& paramlist);
524 
555 __deprecated Teuchos::RCP<Epetra_LinearProblem>
556  create_balanced_copy(const Epetra_LinearProblem& input_problem,
557  CostDescriber &costs,
558  const Teuchos::ParameterList& paramlist);
559 
560 __deprecated Teuchos::RCP<Epetra_MultiVector>
561 create_balanced_copy(const Epetra_MultiVector &coords,
562  const Teuchos::ParameterList& paramlist);
563 
564 __deprecated Teuchos::RCP<Epetra_MultiVector>
565 create_balanced_copy(const Epetra_MultiVector &coords,
566  const Epetra_MultiVector &weights,
567  const Teuchos::ParameterList& paramlist);
568 
569 
570 __deprecated Teuchos::RCP<Epetra_MultiVector>
571 create_balanced_copy(const Epetra_MultiVector &coords);
572 
573 __deprecated Teuchos::RCP<Epetra_MultiVector>
574 create_balanced_copy(const Epetra_MultiVector &coords,
575  const Epetra_MultiVector &weights);
576 
594 Teuchos::RCP<Epetra_CrsMatrix>
595  redistribute_rows(const Epetra_CrsMatrix& input_matrix,
596  const Epetra_Map& target_rowmap,
597  Epetra_Import* importer=0);
598 
616 Teuchos::RCP<Epetra_CrsMatrix>
617  redistribute_rows(const Epetra_RowMatrix& input_matrix,
618  const Epetra_Map& target_rowmap,
619  Epetra_Import* importer=0);
620 
633 Teuchos::RCP<Epetra_CrsGraph>
634  redistribute_rows(const Epetra_CrsGraph& input_graph,
635  const Epetra_Map& target_rowmap,
636  Epetra_Import* importer=0);
637 
650 Teuchos::RCP<Epetra_MultiVector>
651  redistribute(const Epetra_MultiVector& input,
652  const Epetra_BlockMap& target_map,
653  Epetra_Import* importer=0);
654 
667 Teuchos::RCP<Epetra_Vector>
668  redistribute(const Epetra_Vector& input,
669  const Epetra_Map& target_map,
670  Epetra_Import* importer=0);
671 
672 #ifndef DOXYGEN_SHOULD_SKIP_THIS
673 
678 Epetra_MultiVector* create_row_weights_nnz(const Epetra_RowMatrix& input_matrix);
679 
684 Epetra_MultiVector* create_row_weights_nnz(const Epetra_CrsGraph& input_graph);
685 
686 Epetra_MultiVector* create_unit_weights(const Epetra_MultiVector& input_coords);
687 
688 
713 int
714 repartition(const Epetra_BlockMap& input_map,
715  const Epetra_MultiVector& weights,
716  std::vector<int>& myNewElements,
717  int& exportsSize,
718  std::vector<int>& imports);
719 
728 void gather_all_proc_global_offsets(const Epetra_BlockMap& blkmap,
729  std::vector<int>& all_proc_offsets);
730 
731 
740 double compute_imbalance(int nprocs, std::vector<int> &offsets,
741  double *wgts, double target);
742 
743 #endif //DOXYGEN_SHOULD_SKIP_THIS
744 #endif //HAVE_EPETRA
745 
746 }//namespace Epetra
747 }//namespace Isorropia
748 
749 #endif
750 
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.
__deprecated Teuchos::RCP< Epetra_CrsMatrix > create_balanced_copy(const Epetra_CrsMatrix &input_matrix)
create_target_map() is an internal function used by Isorropia.
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.
Definition: Isorropia_EpetraCostDescriber.hpp:128
#define __deprecated
Definition: Isorropia_ConfigDefs.hpp:94
An implementation of the Partitioner interface that operates on Epetra matrices and linear systems...
Definition: Isorropia_EpetraPartitioner.hpp:122