Isorropia: Partitioning, Load Balancing and more Version 3.0
Isorropia_EpetraLibrary.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_EpetraLibrary_hpp_
00031 #define _Isorropia_EpetraLibrary_hpp_
00032 
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <Teuchos_RCP.hpp>
00035 #include <Teuchos_ParameterList.hpp>
00036 
00037 #include <Isorropia_EpetraCostDescriber.hpp>
00038 
00039 #ifdef HAVE_EPETRA
00040 class Epetra_Map;
00041 class Epetra_BlockMap;
00042 class Epetra_Import;
00043 class Epetra_Vector;
00044 class Epetra_MultiVector;
00045 class Epetra_CrsGraph;
00046 class Epetra_CrsMatrix;
00047 class Epetra_RowMatrix;
00048 class Epetra_LinearProblem;
00049 
00050 namespace Isorropia {
00051 
00052 namespace Epetra {
00053   class CostDescriber;
00054 
00060 class Library {
00061 public:
00062 
00063   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph, int itype = unspecified_input_);
00064   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph, Teuchos::RCP<const Epetra_MultiVector> input_coords,
00065           int itype = unspecified_input_);
00066   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
00067     Teuchos::RCP<CostDescriber> costs, int itype = unspecified_input_);
00068   Library(Teuchos::RCP<const Epetra_CrsGraph> input_graph, Teuchos::RCP<CostDescriber> costs, 
00069     Teuchos::RCP<const Epetra_MultiVector> input_coords, Teuchos::RCP<const Epetra_MultiVector> weights,
00070           int itype = unspecified_input_);
00071   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, int itype = unspecified_input_);
00072   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, Teuchos::RCP<const Epetra_MultiVector> input_coords,
00073           int itype = unspecified_input_);
00074   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
00075     Teuchos::RCP<CostDescriber> costs, int itype = unspecified_input_);
00076   Library(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, Teuchos::RCP<CostDescriber> costs, 
00077     Teuchos::RCP<const Epetra_MultiVector> input_coords, Teuchos::RCP<const Epetra_MultiVector> weights,
00078           int itype = unspecified_input_);
00079   Library(Teuchos::RCP<const Epetra_MultiVector> input_coords, int itype = unspecified_input_);
00080   Library(Teuchos::RCP<const Epetra_MultiVector> input_coords,
00081           Teuchos::RCP<const Epetra_MultiVector> weights, int itype = unspecified_input_);
00082   Library(Teuchos::RCP<const Epetra_BlockMap> input_map, int itype = unspecified_input_);
00083 
00084   virtual ~Library();
00085 
00086   virtual int
00087   repartition(Teuchos::ParameterList& paramlist,
00088         std::vector<int>& myNewElements,
00089         int& exportsSize,
00090         std::vector<int>& imports) = 0;
00091 
00092   virtual int
00093   color(Teuchos::ParameterList& paramlist,
00094   std::vector<int>& colorAssignment) = 0 ;
00095 
00096   virtual int
00097   order(Teuchos::ParameterList& paramlist,
00098   std::vector<int>& orderAssignment) = 0 ;
00099 
00105   static const int hgraph_input_ = 1;
00106 
00111   static const int hgraph2d_finegrain_input_ = 2;
00112 
00118   static const int graph_input_ = 3;
00119 
00126   static const int geometric_input_ = 4;
00127 
00133   static const int hgraph_graph_input_ = 5;
00134 
00140   static const int hgraph_geometric_input_ = 6;
00141 
00147   static const int graph_geometric_input_ = 7;
00148 
00154   static const int hgraph_graph_geometric_input_ = 8;
00155 
00156 
00161   static const int simple_input_ = 9;
00162 
00163 
00168   static const int unspecified_input_ = 10;
00169 
00170   int input_type_;
00171 
00172   int numPartSizes;
00173   int *partGIDs;
00174   float *partSizes;
00175 
00176 protected:
00177 
00178   Teuchos::RCP<const Epetra_BlockMap> input_map_;
00179   Teuchos::RCP<const Epetra_CrsGraph> input_graph_;
00180   Teuchos::RCP<const Epetra_RowMatrix> input_matrix_;
00181   Teuchos::RCP<const Epetra_MultiVector> input_coords_;
00182   Teuchos::RCP<Isorropia::Epetra::CostDescriber> costs_;
00183   Teuchos::RCP<const Epetra_MultiVector> weights_;
00184 
00185   virtual int precompute();
00186 
00187   virtual int postcompute() = 0;
00188 
00189 };//class Library
00190 
00191 }//namespace Epetra
00192 }//namespace Isorropia
00193 
00194 #endif //HAVE_EPETRA
00195 
00196 #endif
00197