Isorropia: Partitioning, Load Balancing and more Version 3.0
Isorropia_TpetraZoltanLib.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_TpetraZoltanLib_hpp_
00031 #define _Isorropia_TpetraZoltanLib_hpp_
00032 
00033 #include <Isorropia_ConfigDefs.hpp>
00034 #include <Teuchos_RCP.hpp>
00035 #include <Teuchos_ParameterList.hpp>
00036 
00037 
00038 #include <zoltan_cpp.h>
00039 
00040 #ifdef HAVE_ISORROPIA_TPETRA
00041 
00042 #include <Isorropia_TpetraCostDescriber.hpp>
00043 #include <Isorropia_TpetraLibrary.hpp>
00044 #include <Isorropia_TpetraQueryObject.hpp>
00045 
00046 #include <Tpetra_CrsGraph_decl.hpp>
00047 #include <Kokkos_DefaultNode.hpp>
00048 
00049 namespace Isorropia {
00050 
00051 namespace Tpetra {
00052 
00053 
00054 template <class Node=Kokkos::DefaultNode::DefaultNodeType>
00055 class ZoltanLibClass : public Library<Node> {
00056 public:
00057 
00058   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, int inputType=Library<Node>::unspecified_input_);
00059   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, 
00060      Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, int inputType=Library<Node>::unspecified_input_);
00061   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph,
00062            Teuchos::RCP<CostDescriber<Node> > costs, int inputType=Library<Node>::unspecified_input_);
00063   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, Teuchos::RCP<CostDescriber<Node> > costs, 
00064                  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights, 
00065                  int inputType=Library<Node>::unspecified_input_);
00066   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, int inputType=Library<Node>::unspecified_input_);
00067   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, 
00068                  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, int inputType=Library<Node>::unspecified_input_);
00069   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix,
00070            Teuchos::RCP<CostDescriber<Node> > costs, int inputType=Library<Node>::unspecified_input_);
00071   ZoltanLibClass(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 inputType=Library<Node>::unspecified_input_);
00074   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, int inputType=Library<Node>::unspecified_input_);
00075   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
00076      Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights, int inputType=Library<Node>::unspecified_input_);
00077   ZoltanLibClass(Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map, int inputType=Library<Node>::unspecified_input_);
00078 
00079 
00080 
00081 
00100   virtual int
00101   repartition(Teuchos::ParameterList& paramlist,
00102         std::vector<int>& newPartitions,
00103         int& exportsSize,
00104         std::vector<int>& imports);
00105 
00113   virtual int
00114   color(Teuchos::ParameterList& paramlist,
00115   std::vector<int>& colorAssignment);
00116 
00124   virtual int
00125   order(Teuchos::ParameterList& paramlist,
00126   std::vector<int>& orderAssignment);
00127 
00128 protected:
00129   virtual int precompute();
00130   virtual int postcompute();
00131   void computeCost();
00132   void preCheckPartition();
00133 
00134   void setParameterList(Teuchos::ParameterList& zoltanParamList);
00135 
00136 private:
00137   Teuchos::ParameterList zoltanParamList_;
00138   std::string partMethod_; // stores partitioning method used, perhaps should be in TpetraLibrary?
00139   Zoltan *zz_;
00140   Teuchos::RCP<ZoltanLib::QueryObject<Node> > queryObject_;
00141   int num_obj_;
00142 
00143 };//class ZoltanLibClass
00144 
00145 }//namespace Tpetra
00146 }//namespace Isorropia
00147 
00148 #endif //HAVE_ISORROPIA_TPETRA
00149 
00150 #endif
00151