Isorropia: Partitioning, Load Balancing and more
Isorropia_EpetraZoltanLib.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_EpetraZoltanLib_hpp_
41 #define _Isorropia_EpetraZoltanLib_hpp_
42 
43 #include <Isorropia_ConfigDefs.hpp>
44 #include <Teuchos_RCP.hpp>
45 #include <Teuchos_ParameterList.hpp>
46 
49 
50 #include <QueryObject.hpp>
51 #include <zoltan_cpp.h>
52 
53 #ifdef HAVE_EPETRA
54 class Epetra_Map;
55 class Epetra_BlockMap;
56 class Epetra_Import;
57 class Epetra_Vector;
58 class Epetra_MultiVector;
59 class Epetra_CrsGraph;
60 class Epetra_CrsMatrix;
61 class Epetra_RowMatrix;
62 class Epetra_LinearProblem;
63 
64 namespace Isorropia {
65 
66 namespace Epetra {
67  class CostDescriber;
68 
69 
70 class ZoltanLibClass : public Library {
71 public:
72 
73  ZoltanLibClass(Teuchos::RCP<const Epetra_CrsGraph> input_graph, int inputType=unspecified_input_);
74  ZoltanLibClass(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
75  Teuchos::RCP<const Epetra_MultiVector> input_coords, int inputType=unspecified_input_);
76  ZoltanLibClass(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
77  Teuchos::RCP<CostDescriber> costs, int inputType=unspecified_input_);
78  ZoltanLibClass(Teuchos::RCP<const Epetra_CrsGraph> input_graph, Teuchos::RCP<CostDescriber> costs,
79  Teuchos::RCP<const Epetra_MultiVector> input_coords, Teuchos::RCP<const Epetra_MultiVector> weights,
80  int inputType=unspecified_input_);
81  ZoltanLibClass(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, int inputType=unspecified_input_);
82  ZoltanLibClass(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
83  Teuchos::RCP<const Epetra_MultiVector> input_coords, int inputType=unspecified_input_);
84  ZoltanLibClass(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
85  Teuchos::RCP<CostDescriber> costs, int inputType=unspecified_input_);
86  ZoltanLibClass(Teuchos::RCP<const Epetra_RowMatrix> input_matrix, Teuchos::RCP<CostDescriber> costs,
87  Teuchos::RCP<const Epetra_MultiVector> input_coords, Teuchos::RCP<const Epetra_MultiVector> weights,
88  int inputType=unspecified_input_);
89  ZoltanLibClass(Teuchos::RCP<const Epetra_MultiVector> input_coords, int inputType=unspecified_input_);
90  ZoltanLibClass(Teuchos::RCP<const Epetra_MultiVector> input_coords,
91  Teuchos::RCP<const Epetra_MultiVector> weights, int inputType=unspecified_input_);
92  ZoltanLibClass(Teuchos::RCP<const Epetra_BlockMap> input_map, int inputType=unspecified_input_);
93 
94 
95 
96 
115  virtual int
116  repartition(Teuchos::ParameterList& paramlist,
117  std::vector<int>& newPartitions,
118  int& exportsSize,
119  std::vector<int>& imports);
120 
128  virtual int
129  color(Teuchos::ParameterList& paramlist,
130  std::vector<int>& colorAssignment);
131 
139  virtual int
140  order(Teuchos::ParameterList& paramlist,
141  std::vector<int>& orderAssignment);
142 
143 protected:
144  virtual int precompute();
145  virtual int postcompute();
146  void computeCost();
147  void preCheckPartition();
148 
149  void setParameterList(Teuchos::ParameterList& zoltanParamList);
150 
151 private:
152  Teuchos::ParameterList zoltanParamList_;
153  std::string partMethod_; // stores partitioning method used, perhaps should be in EpetraLibrary?
154  Zoltan *zz_;
155  Teuchos::RCP<ZoltanLib::QueryObject> queryObject_;
156  int num_obj_;
157 
158 };//class ZoltanLibClass
159 
160 }//namespace Epetra
161 }//namespace Isorropia
162 
163 #endif //HAVE_EPETRA
164 
165 #endif
166 
167 
168 #if defined(Isorropia_SHOW_DEPRECATED_WARNINGS)
169 #ifdef __GNUC__
170 #warning "The Isorropia package is deprecated"
171 #endif
172 #endif
173 
static const int unspecified_input_
input_type_ == unspecified_input_ This value is the &quot;unset&quot; state for the input_type_ instance variab...
Definition: Isorropia_EpetraLibrary.hpp:178
An implementation of the Partitioner interface that operates on Epetra matrices and linear systems...
Definition: Isorropia_EpetraLibrary.hpp:70
void setParameterList(Teuchos::ParameterList &zoltanParamList)
int num_obj_
Definition: Isorropia_EpetraZoltanLib.hpp:156
std::string partMethod_
Definition: Isorropia_EpetraZoltanLib.hpp:153
virtual int order(Teuchos::ParameterList &paramlist, std::vector< int > &orderAssignment)
Method to order the object that the ZoltanLibClass was contructed with.
Definition: Isorropia_EpetraZoltanLib.hpp:70
Teuchos::ParameterList zoltanParamList_
Definition: Isorropia_EpetraZoltanLib.hpp:152
Teuchos::RCP< ZoltanLib::QueryObject > queryObject_
Definition: Isorropia_EpetraZoltanLib.hpp:155
ZoltanLibClass(Teuchos::RCP< const Epetra_CrsGraph > input_graph, int inputType=unspecified_input_)
virtual int color(Teuchos::ParameterList &paramlist, std::vector< int > &colorAssignment)
Method to color the object that the ZoltanLibClass was contructed with.
virtual int repartition(Teuchos::ParameterList &paramlist, std::vector< int > &newPartitions, int &exportsSize, std::vector< int > &imports)
Method to partition the object that the ZoltanLibClass was contructed with.
Zoltan * zz_
Definition: Isorropia_EpetraZoltanLib.hpp:154