Isorropia: Partitioning, Load Balancing and more
Isorropia_TpetraLibrary.hpp
Go to the documentation of this file.
1 //@HEADER
2 //************************************************************************
3 //
4 // Isorropia: Partitioning and Load Balancing Package
5 // Copyright (2006) Sandia Corporation
6 //
7 //Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 //license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 //************************************************************************
38 //@HEADER
39 
40 #ifndef _Isorropia_TpetraLibrary_hpp_
41 #define _Isorropia_TpetraLibrary_hpp_
42 
43 #include <Isorropia_ConfigDefs.hpp>
44 #include <Teuchos_RCP.hpp>
45 #include <Teuchos_ParameterList.hpp>
46 
47 
48 #ifdef HAVE_ISORROPIA_TPETRA
50 
51 
52 namespace Isorropia {
53 
54 namespace Tpetra {
55 
56 
62 template <typename Node = ::Tpetra::Map<int,int>::node_type>
63 class Library {
64 public:
65 
66  Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, int itype = unspecified_input_);
67  Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph,
68  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
69  int itype = unspecified_input_);
70  Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph,
71  Teuchos::RCP<CostDescriber<Node> > costs, int itype = unspecified_input_);
72  Library(Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph, Teuchos::RCP<CostDescriber<Node> > costs,
73  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
74  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights,
75  int itype = unspecified_input_);
76  Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, int itype = unspecified_input_);
77  Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
78  int itype = unspecified_input_);
79  Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix,
80  Teuchos::RCP<CostDescriber<Node> > costs, int itype = unspecified_input_);
81  Library(Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix, Teuchos::RCP<CostDescriber<Node> > costs,
82  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights,
83  int itype = unspecified_input_);
84  Library(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords, int itype = unspecified_input_);
85  Library(Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords,
86  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights, int itype = unspecified_input_);
87  Library(Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map, int itype = unspecified_input_);
88 
89  virtual ~Library();
90 
91  virtual int
92  repartition(Teuchos::ParameterList& paramlist,
93  std::vector<int>& myNewElements,
94  int& exportsSize,
95  std::vector<int>& imports) = 0;
96 
97  virtual int
98  color(Teuchos::ParameterList& paramlist,
99  std::vector<int>& colorAssignment) = 0 ;
100 
101  virtual int
102  order(Teuchos::ParameterList& paramlist,
103  std::vector<int>& orderAssignment) = 0 ;
104 
110  static const int hgraph_input_ = 1;
111 
116  static const int hgraph2d_finegrain_input_ = 2;
117 
123  static const int graph_input_ = 3;
124 
131  static const int geometric_input_ = 4;
132 
138  static const int hgraph_graph_input_ = 5;
139 
145  static const int hgraph_geometric_input_ = 6;
146 
152  static const int graph_geometric_input_ = 7;
153 
159  static const int hgraph_graph_geometric_input_ = 8;
160 
161 
166  static const int simple_input_ = 9;
167 
168 
173  static const int unspecified_input_ = 10;
174 
175  int input_type_;
176 
177  int numPartSizes;
178  int *partGIDs;
179  float *partSizes;
180 
181 protected:
182 
183  Teuchos::RCP<const ::Tpetra::Map<int,int,Node> > input_map_;
184  Teuchos::RCP<const ::Tpetra::CrsGraph<int,int,Node> > input_graph_;
185  Teuchos::RCP<const ::Tpetra::RowMatrix<double,int,int,Node> > input_matrix_;
186  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > input_coords_;
187  Teuchos::RCP<Isorropia::Tpetra::CostDescriber<Node> > costs_;
188  Teuchos::RCP<const ::Tpetra::MultiVector<double,int,int,Node> > weights_;
189 
190  virtual int precompute();
191 
192  virtual int postcompute() = 0;
193 
194 };//class Library
195 
196 }//namespace Tpetra
197 }//namespace Isorropia
198 
199 #endif //HAVE_ISORROPIA_TPETRA
200 
201 #endif
202 
Isorropia is the namespace that contains general definitions that apply to all partitioners and that ...
Definition: Isorropia_Epetra.hpp:60