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 
00080 Teuchos::RCP<Partitioner>
00081 create_partitioner(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00082        const Teuchos::ParameterList& paramlist);
00083 
00105 Teuchos::RCP<Partitioner>
00106 create_partitioner(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00107        Teuchos::RCP<CostDescriber> costs,
00108        const Teuchos::ParameterList& paramlist);
00109 
00131 Teuchos::RCP<Partitioner>
00132 create_partitioner(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00133        const Teuchos::ParameterList& paramlist);
00134 
00156 Teuchos::RCP<Partitioner>
00157 create_partitioner(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00158        Teuchos::RCP<CostDescriber> costs,
00159        const Teuchos::ParameterList& paramlist);
00160 
00168 // Teuchos::RCP<Epetra_Map>
00169 // create_target_map(const Epetra_Comm& comm, Partitioner& partitioner);
00170 
00189 Teuchos::RCP<Epetra_CrsMatrix>
00190   create_balanced_copy(const Epetra_CrsMatrix& input_matrix);
00191 
00208 Teuchos::RCP<Epetra_CrsMatrix>
00209   create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
00210                        const Epetra_Vector &row_weights);
00211 
00237 Teuchos::RCP<Epetra_CrsMatrix>
00238   create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
00239                      const Teuchos::ParameterList& paramlist);
00240 
00241 
00242 
00273 Teuchos::RCP<Epetra_CrsMatrix>
00274   create_balanced_copy(const Epetra_CrsMatrix& input_matrix,
00275                      CostDescriber &costs,
00276                      const Teuchos::ParameterList& paramlist);
00277 
00296 Teuchos::RCP<Epetra_RowMatrix>
00297   create_balanced_copy(const Epetra_RowMatrix& input_matrix);
00298 
00315 Teuchos::RCP<Epetra_RowMatrix>
00316   create_balanced_copy(const Epetra_RowMatrix& input_matrix,
00317                        const Epetra_Vector &row_weights);
00318 
00345 Teuchos::RCP<Epetra_RowMatrix>
00346   create_balanced_copy(const Epetra_RowMatrix& input_matrix,
00347                      const Teuchos::ParameterList& paramlist);
00348 
00380 Teuchos::RCP<Epetra_RowMatrix>
00381   create_balanced_copy(const Epetra_RowMatrix& input_matrix,
00382                      CostDescriber &costs,
00383                      const Teuchos::ParameterList& paramlist);
00384 
00403 Teuchos::RCP<Epetra_CrsGraph>
00404   create_balanced_copy(const Epetra_CrsGraph& input_graph);
00405 
00423 Teuchos::RCP<Epetra_CrsGraph>
00424   create_balanced_copy(const Epetra_CrsGraph& input_matrix,
00425                        const Epetra_Vector &row_weights);
00426 
00452 Teuchos::RCP<Epetra_CrsGraph>
00453   create_balanced_copy(const Epetra_CrsGraph& input_graph,
00454                      const Teuchos::ParameterList& paramlist);
00455 
00486 Teuchos::RCP<Epetra_CrsGraph>
00487   create_balanced_copy(const Epetra_CrsGraph& input_graph,
00488                      CostDescriber &costs,
00489                      const Teuchos::ParameterList& paramlist);
00490 
00510 Teuchos::RCP<Epetra_LinearProblem>
00511   create_balanced_copy(const Epetra_LinearProblem & input_problem);
00512 
00529 Teuchos::RCP<Epetra_LinearProblem>
00530   create_balanced_copy(const Epetra_LinearProblem& input_matrix,
00531                        const Epetra_Vector &row_weights);
00532 
00559 Teuchos::RCP<Epetra_LinearProblem>
00560   create_balanced_copy(const Epetra_LinearProblem& input_problem,
00561                      const Teuchos::ParameterList& paramlist);
00562 
00593 Teuchos::RCP<Epetra_LinearProblem>
00594   create_balanced_copy(const Epetra_LinearProblem& input_problem,
00595                      CostDescriber &costs,
00596                      const Teuchos::ParameterList& paramlist);
00597 
00615 Teuchos::RCP<Epetra_CrsMatrix>
00616   redistribute_rows(const Epetra_CrsMatrix& input_matrix,
00617                     const Epetra_Map& target_rowmap,
00618                     Epetra_Import* importer=0);
00619 
00637 Teuchos::RCP<Epetra_CrsMatrix>
00638   redistribute_rows(const Epetra_RowMatrix& input_matrix,
00639                     const Epetra_Map& target_rowmap,
00640                     Epetra_Import* importer=0);
00641 
00654 Teuchos::RCP<Epetra_CrsGraph>
00655   redistribute_rows(const Epetra_CrsGraph& input_graph,
00656                     const Epetra_Map& target_rowmap,
00657                     Epetra_Import* importer=0);
00658 
00674 Teuchos::RCP<Epetra_MultiVector>
00675   redistribute(const Epetra_MultiVector& input,
00676                const Epetra_BlockMap& target_map,
00677                Epetra_Import* importer=0);
00678 
00694 Teuchos::RCP<Epetra_Vector>
00695   redistribute(const Epetra_Vector& input,
00696                const Epetra_Map& target_map,
00697                Epetra_Import* importer=0);
00698 
00699 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00700 
00708 Epetra_Vector* create_row_weights_nnz(const Epetra_RowMatrix& input_matrix);
00709 
00717 Epetra_Vector* create_row_weights_nnz(const Epetra_CrsGraph& input_graph);
00718 
00744 int
00745 repartition(const Epetra_BlockMap& input_map,
00746       const Epetra_Vector& weights,
00747       std::vector<int>& myNewElements,
00748       int& exportsSize,
00749       std::vector<int>& imports);
00750 //             std::vector<int>& myNewElements,
00751 //             std::map<int,int>& exports,
00752 //             std::map<int,int>& imports);
00753 
00762 void gather_all_proc_global_offsets(const Epetra_BlockMap& blkmap,
00763                                     std::vector<int>& all_proc_offsets);
00764 
00765 
00774 double compute_imbalance(int nprocs, std::vector<int> &offsets, 
00775                          double *wgts, double target);
00776 
00777 #endif //DOXYGEN_SHOULD_SKIP_THIS
00778 #endif //HAVE_EPETRA
00779 
00780 }//namespace Epetra
00781 }//namespace Isorropia
00782 
00783 #endif
00784