Debian Codegraph @

packages/isorropia/src/epetra/Isorropia_EpetraZoltanLib.hpp

raw
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
47 #include <Isorropia_EpetraCostDescriber.hpp>
48 #include <Isorropia_EpetraLibrary.hpp>
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
97 /** Method to partition the object that the ZoltanLibClass was contructed with.
98
99 \param[in] paramlist Parameters to govern partitioning.
100
101 \param[out] newPartitions The new partition for each of my objects, in
102 local ID order. The objects may be rows or
103 non-zeroes (for
104 CrsGraph and RowMatrix input) or coordinates (for
105 MultiVector input). Partition numbers can range from
106 zero to numProcs-1.
107 \param[out] exportsSize The number of my objects that will be exported to
108 another process under the new partitioning. This is
109 also the number of elements in newPartitions that are
110 not equal to my process rank.
111 \param[out] imports A list of the global IDs of the objects that will be
112 imported to my process under the new partitioning
113 */
114
115 virtual int
116 repartition(Teuchos::ParameterList& paramlist,
117 std::vector<int>& newPartitions,
118 int& exportsSize,
119 std::vector<int>& imports);
120
121 /** Method to color the object that the ZoltanLibClass was contructed with.
122
123 \param[in] paramlist Parameters to govern coloring.
124
125 \param[out] colorAssignment A list of integers indicating the coloring of
126 the object, in local ID order.
127 */
128 virtual int
129 color(Teuchos::ParameterList& paramlist,
130 std::vector<int>& colorAssignment);
131
132 /** Method to order the object that the ZoltanLibClass was contructed with.
133
134 \param[in] paramlist Parameters to govern ordering .
135
136 \param[out] orderAssignment A list of integers indicating the ordering of
137 the object, in local ID order.
138 */
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