|
Isorropia: Partitioning, Load Balancing and more
|
00001 //@HEADER 00002 //************************************************************************ 00003 // 00004 // Isorropia: Partitioning and Load Balancing Package 00005 // Copyright (2006) Sandia Corporation 00006 // 00007 //Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 //license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 //************************************************************************ 00038 //@HEADER 00039 00040 #ifndef _Isorropia_TpetraLibrary_hpp_ 00041 #define _Isorropia_TpetraLibrary_hpp_ 00042 00043 #include <Isorropia_ConfigDefs.hpp> 00044 #include <Teuchos_RCP.hpp> 00045 #include <Teuchos_ParameterList.hpp> 00046 00047 00048 #ifdef HAVE_ISORROPIA_TPETRA 00049 #include <Isorropia_TpetraCostDescriber.hpp> 00050 00051 00052 namespace Isorropia { 00053 00054 namespace Tpetra { 00055 00056 00062 template <typename Node=KokkosClassic::DefaultNode::DefaultNodeType> 00063 class Library { 00064 public: 00065 00066 Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, int itype = unspecified_input_); 00067 Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, 00068 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, 00069 int itype = unspecified_input_); 00070 Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, 00071 Teuchos::RCP<CostDescriber<Node> > costs, int itype = unspecified_input_); 00072 Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, Teuchos::RCP<CostDescriber<Node> > costs, 00073 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, 00074 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights, 00075 int itype = unspecified_input_); 00076 Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, int itype = unspecified_input_); 00077 Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, 00078 int itype = unspecified_input_); 00079 Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, 00080 Teuchos::RCP<CostDescriber<Node> > costs, int itype = unspecified_input_); 00081 Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, Teuchos::RCP<CostDescriber<Node> > costs, 00082 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights, 00083 int itype = unspecified_input_); 00084 Library(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, int itype = unspecified_input_); 00085 Library(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, 00086 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights, int itype = unspecified_input_); 00087 Library(Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map, int itype = unspecified_input_); 00088 00089 virtual ~Library(); 00090 00091 virtual int 00092 repartition(Teuchos::ParameterList& paramlist, 00093 std::vector<int>& myNewElements, 00094 int& exportsSize, 00095 std::vector<int>& imports) = 0; 00096 00097 virtual int 00098 color(Teuchos::ParameterList& paramlist, 00099 std::vector<int>& colorAssignment) = 0 ; 00100 00101 virtual int 00102 order(Teuchos::ParameterList& paramlist, 00103 std::vector<int>& orderAssignment) = 0 ; 00104 00110 static const int hgraph_input_ = 1; 00111 00116 static const int hgraph2d_finegrain_input_ = 2; 00117 00123 static const int graph_input_ = 3; 00124 00131 static const int geometric_input_ = 4; 00132 00138 static const int hgraph_graph_input_ = 5; 00139 00145 static const int hgraph_geometric_input_ = 6; 00146 00152 static const int graph_geometric_input_ = 7; 00153 00159 static const int hgraph_graph_geometric_input_ = 8; 00160 00161 00166 static const int simple_input_ = 9; 00167 00168 00173 static const int unspecified_input_ = 10; 00174 00175 int input_type_; 00176 00177 int numPartSizes; 00178 int *partGIDs; 00179 float *partSizes; 00180 00181 protected: 00182 00183 Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map_; 00184 Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph_; 00185 Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix_; 00186 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords_; 00187 Teuchos::RCP<Isorropia::Tpetra::CostDescriber<Node> > costs_; 00188 Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights_; 00189 00190 virtual int precompute(); 00191 00192 virtual int postcompute() = 0; 00193 00194 };//class Library 00195 00196 }//namespace Tpetra 00197 }//namespace Isorropia 00198 00199 #endif //HAVE_ISORROPIA_TPETRA 00200 00201 #endif 00202