Isorropia: Partitioning, Load Balancing and more
Isorropia_TpetraLibrary.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_TpetraLibrary_hpp_
00031 #define _Isorropia_TpetraLibrary_hpp_
00032 
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <Teuchos_RCP.hpp>
00035 #include <Teuchos_ParameterList.hpp>
00036 
00037 
00038 #ifdef HAVE_ISORROPIA_TPETRA
00039 #include <Isorropia_TpetraCostDescriber.hpp>
00040 
00041 
00042 namespace Isorropia {
00043 
00044 namespace Tpetra {
00045 
00046 
00052 template <typename Node=Kokkos::DefaultNode::DefaultNodeType>
00053 class Library {
00054 public:
00055 
00056   Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, int itype = unspecified_input_);
00057   Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, 
00058           Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
00059           int itype = unspecified_input_);
00060   Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph,
00061     Teuchos::RCP<CostDescriber<Node> > costs, int itype = unspecified_input_);
00062   Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, Teuchos::RCP<CostDescriber<Node> > costs, 
00063     Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, 
00064           Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights,
00065           int itype = unspecified_input_);
00066   Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, int itype = unspecified_input_);
00067   Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
00068           int itype = unspecified_input_);
00069   Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix,
00070     Teuchos::RCP<CostDescriber<Node> > costs, int itype = unspecified_input_);
00071   Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, Teuchos::RCP<CostDescriber<Node> > costs, 
00072     Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights,
00073           int itype = unspecified_input_);
00074   Library(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, int itype = unspecified_input_);
00075   Library(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
00076           Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights, int itype = unspecified_input_);
00077   Library(Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map, int itype = unspecified_input_);
00078 
00079   virtual ~Library();
00080 
00081   virtual int
00082   repartition(Teuchos::ParameterList& paramlist,
00083         std::vector<int>& myNewElements,
00084         int& exportsSize,
00085         std::vector<int>& imports) = 0;
00086 
00087   virtual int
00088   color(Teuchos::ParameterList& paramlist,
00089   std::vector<int>& colorAssignment) = 0 ;
00090 
00091   virtual int
00092   order(Teuchos::ParameterList& paramlist,
00093   std::vector<int>& orderAssignment) = 0 ;
00094 
00100   static const int hgraph_input_ = 1;
00101 
00106   static const int hgraph2d_finegrain_input_ = 2;
00107 
00113   static const int graph_input_ = 3;
00114 
00121   static const int geometric_input_ = 4;
00122 
00128   static const int hgraph_graph_input_ = 5;
00129 
00135   static const int hgraph_geometric_input_ = 6;
00136 
00142   static const int graph_geometric_input_ = 7;
00143 
00149   static const int hgraph_graph_geometric_input_ = 8;
00150 
00151 
00156   static const int simple_input_ = 9;
00157 
00158 
00163   static const int unspecified_input_ = 10;
00164 
00165   int input_type_;
00166 
00167   int numPartSizes;
00168   int *partGIDs;
00169   float *partSizes;
00170 
00171 protected:
00172 
00173   Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map_;
00174   Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph_;
00175   Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix_;
00176   Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords_;
00177   Teuchos::RCP<Isorropia::Tpetra::CostDescriber<Node> > costs_;
00178   Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights_;
00179 
00180   virtual int precompute();
00181 
00182   virtual int postcompute() = 0;
00183 
00184 };//class Library
00185 
00186 }//namespace Tpetra
00187 }//namespace Isorropia
00188 
00189 #endif //HAVE_ISORROPIA_TPETRA
00190 
00191 #endif
00192