Isorropia: Partitioning, Load Balancing and more
Isorropia_Epetra.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_Epetra_hpp_
00031 #define _Isorropia_Epetra_hpp_
00032 
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <Teuchos_RCP.hpp>
00035 #include <Teuchos_ParameterList.hpp>
00036 
00037 #ifdef HAVE_EPETRA
00038 class Epetra_Comm;
00039 class Epetra_Map;
00040 class Epetra_BlockMap;
00041 class Epetra_Import;
00042 class Epetra_Vector;
00043 class Epetra_MultiVector;
00044 class Epetra_RowMatrix;
00045 class Epetra_CrsGraph;
00046 class Epetra_CrsMatrix;
00047 class Epetra_LinearProblem;
00048 #endif
00049 
00050 namespace Isorropia {
00051 
00052 namespace Epetra {
00053 
00054   class Partitioner;
00055   class CostDescriber;
00056 
00057 #ifdef HAVE_EPETRA
00058 
00062 Epetra_MultiVector *
00063 createBalancedCopy(const Epetra_MultiVector& input_vector);
00064 
00068 Epetra_MultiVector *
00069 createBalancedCopy(const Epetra_MultiVector& input_vector,
00070                      const Teuchos::ParameterList& paramlist);
00071 
00075 Epetra_CrsGraph *
00076 createBalancedCopy(const Epetra_CrsGraph& input_graph);
00077 
00081 Epetra_CrsGraph *
00082 createBalancedCopy(const Epetra_CrsGraph& input_graph,
00083                      const Teuchos::ParameterList& paramlist);
00084 
00088 Epetra_CrsMatrix *
00089 createBalancedCopy(const Epetra_CrsMatrix& input_matrix);
00090 
00094 Epetra_CrsMatrix *
00095 createBalancedCopy(const Epetra_CrsMatrix& input_matrix,
00096                      const Teuchos::ParameterList& paramlist);
00097 
00102 Epetra_LinearProblem *
00103 createBalancedCopy(const Epetra_LinearProblem & input_problem);
00104 
00109 Epetra_LinearProblem *
00110 createBalancedCopy(const Epetra_LinearProblem & input_problem,
00111                      const Teuchos::ParameterList& paramlist);
00112 
00120 // Teuchos::RCP<Epetra_Map>
00121 // create_target_map(const Epetra_Comm& comm, Partitioner& partitioner);
00122 
00141 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
00142   create_balanced_copy(const Epetra_CrsMatrix& input_matrix);
00143 
00160 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
00161   create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
00162                        const Epetra_Vector &row_weights);
00163 
00189 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
00190   create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
00191                      const Teuchos::ParameterList& paramlist);
00192 
00193 
00194 
00225 __deprecated Teuchos::RCP<Epetra_CrsMatrix>
00226   create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
00227                      CostDescriber &costs,
00228                      const Teuchos::ParameterList& paramlist);
00229 
00248 __deprecated Teuchos::RCP<Epetra_RowMatrix>
00249   create_balanced_copy(const Epetra_RowMatrix& input_matrix);
00250 
00267 __deprecated Teuchos::RCP<Epetra_RowMatrix>
00268   create_balanced_copy(const Epetra_RowMatrix& input_matrix,
00269                        const Epetra_Vector &row_weights);
00270 
00297 __deprecated Teuchos::RCP<Epetra_RowMatrix>
00298   create_balanced_copy(const Epetra_RowMatrix& input_matrix,
00299                      const Teuchos::ParameterList& paramlist);
00300 
00332 __deprecated Teuchos::RCP<Epetra_RowMatrix>
00333   create_balanced_copy(const Epetra_RowMatrix& input_matrix,
00334                      CostDescriber &costs,
00335                      const Teuchos::ParameterList& paramlist);
00336 
00355 __deprecated Teuchos::RCP<Epetra_CrsGraph>
00356   create_balanced_copy(const Epetra_CrsGraph& input_graph);
00357 
00375 __deprecated Teuchos::RCP<Epetra_CrsGraph>
00376   create_balanced_copy(const Epetra_CrsGraph& input_matrix,
00377                        const Epetra_Vector &row_weights);
00378 
00404 __deprecated Teuchos::RCP<Epetra_CrsGraph>
00405   create_balanced_copy(const Epetra_CrsGraph& input_graph,
00406                      const Teuchos::ParameterList& paramlist);
00407 
00438 __deprecated Teuchos::RCP<Epetra_CrsGraph>
00439   create_balanced_copy(const Epetra_CrsGraph& input_graph,
00440                      CostDescriber &costs,
00441                      const Teuchos::ParameterList& paramlist);
00442 
00462 __deprecated Teuchos::RCP<Epetra_LinearProblem>
00463   create_balanced_copy(const Epetra_LinearProblem & input_problem);
00464 
00481 __deprecated Teuchos::RCP<Epetra_LinearProblem>
00482   create_balanced_copy(const Epetra_LinearProblem& input_matrix,
00483                        const Epetra_Vector &row_weights);
00484 
00511 __deprecated Teuchos::RCP<Epetra_LinearProblem>
00512   create_balanced_copy(const Epetra_LinearProblem& input_problem,
00513                      const Teuchos::ParameterList& paramlist);
00514 
00545 __deprecated Teuchos::RCP<Epetra_LinearProblem>
00546   create_balanced_copy(const Epetra_LinearProblem& input_problem,
00547                      CostDescriber &costs,
00548                      const Teuchos::ParameterList& paramlist);
00549 
00550 __deprecated Teuchos::RCP<Epetra_MultiVector>
00551 create_balanced_copy(const Epetra_MultiVector &coords,
00552                    const Teuchos::ParameterList& paramlist);
00553 
00554 __deprecated Teuchos::RCP<Epetra_MultiVector>
00555 create_balanced_copy(const Epetra_MultiVector &coords,
00556                      const Epetra_MultiVector &weights,
00557                    const Teuchos::ParameterList& paramlist);
00558 
00559 
00560 __deprecated Teuchos::RCP<Epetra_MultiVector>
00561 create_balanced_copy(const Epetra_MultiVector &coords);
00562 
00563 __deprecated Teuchos::RCP<Epetra_MultiVector>
00564 create_balanced_copy(const Epetra_MultiVector &coords,
00565                      const Epetra_MultiVector &weights);
00566 
00584 Teuchos::RCP<Epetra_CrsMatrix>
00585   redistribute_rows(const Epetra_CrsMatrix& input_matrix,
00586                     const Epetra_Map& target_rowmap,
00587                     Epetra_Import* importer=0);
00588 
00606 Teuchos::RCP<Epetra_CrsMatrix>
00607   redistribute_rows(const Epetra_RowMatrix& input_matrix,
00608                     const Epetra_Map& target_rowmap,
00609                     Epetra_Import* importer=0);
00610 
00623 Teuchos::RCP<Epetra_CrsGraph>
00624   redistribute_rows(const Epetra_CrsGraph& input_graph,
00625                     const Epetra_Map& target_rowmap,
00626                     Epetra_Import* importer=0);
00627 
00640 Teuchos::RCP<Epetra_MultiVector>
00641   redistribute(const Epetra_MultiVector& input,
00642                const Epetra_BlockMap& target_map,
00643                Epetra_Import* importer=0);
00644 
00657 Teuchos::RCP<Epetra_Vector>
00658   redistribute(const Epetra_Vector& input,
00659                const Epetra_Map& target_map,
00660                Epetra_Import* importer=0);
00661 
00662 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00663 
00668 Epetra_MultiVector* create_row_weights_nnz(const Epetra_RowMatrix& input_matrix);
00669 
00674 Epetra_MultiVector* create_row_weights_nnz(const Epetra_CrsGraph& input_graph);
00675 
00676 Epetra_MultiVector* create_unit_weights(const Epetra_MultiVector& input_coords);
00677 
00678 
00703 int
00704 repartition(const Epetra_BlockMap& input_map,
00705       const Epetra_MultiVector& weights,
00706       std::vector<int>& myNewElements,
00707       int& exportsSize,
00708       std::vector<int>& imports);
00709 
00718 void gather_all_proc_global_offsets(const Epetra_BlockMap& blkmap,
00719                                     std::vector<int>& all_proc_offsets);
00720 
00721 
00730 double compute_imbalance(int nprocs, std::vector<int> &offsets, 
00731                          double *wgts, double target);
00732 
00733 #endif //DOXYGEN_SHOULD_SKIP_THIS
00734 #endif //HAVE_EPETRA
00735 
00736 }//namespace Epetra
00737 }//namespace Isorropia
00738 
00739 #endif
00740