Isorropia: Partitioning, Load Balancing and more
Isorropia_EpetraPartitioner2D.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_EpetraPartitioner2D_hpp_
41 #define _Isorropia_EpetraPartitioner2D_hpp_
42 
43 #include <Isorropia_ConfigDefs.hpp>
44 #include <Teuchos_RCP.hpp>
45 #include <Teuchos_ParameterList.hpp>
46 
49 
50 #ifdef HAVE_EPETRA
51 class Epetra_Map;
52 class Epetra_BlockMap;
53 class Epetra_Import;
54 class Epetra_Vector;
55 class Epetra_MultiVector;
56 class Epetra_CrsGraph;
57 class Epetra_CrsMatrix;
58 class Epetra_RowMatrix;
59 class Epetra_LinearProblem;
60 
61 namespace Isorropia {
62 
63 namespace Epetra {
64 
70 class Partitioner2D : virtual public Isorropia::Partitioner2D, virtual public Isorropia::Epetra::Operator {
71 public:
95  Partitioner2D(Teuchos::RCP<const Epetra_CrsGraph> input_graph,
96  const Teuchos::ParameterList& paramlist = Teuchos::ParameterList("EmptyParameterList"),
97  bool compute_partitioning_now=true);
98 
123  Partitioner2D(Teuchos::RCP<const Epetra_RowMatrix> input_matrix,
124  const Teuchos::ParameterList& paramlist = Teuchos::ParameterList("EmptyParameterList"),
125  bool compute_partitioning_now=true);
126 
127 
128 
130  virtual ~Partitioner2D();
131 
132 
133  // MMW: Missing functions that are in EpetraPartioner, might need to implement
134  //void setPartSizes(int len, int *global_part_id, float *part_size);
135  //void clearPartSizes();
136 
148  void partition(bool force_repartitioning=false);
149 
150  virtual void compute(bool forceRecomputing=false);
151 
152 
155  int numElemsInPart(int part) const;
156 
157 
160  int getNZIndx(int row, int column) const;
161 
162 
165  void elemsInPart(int part, int* elementList, int len) const;
166 
167 
168  // Should add RCP versions of the below
169 
170  int createDomainAndRangeMaps(Epetra_Map *domainMap,
171  Epetra_Map *rangeMap);
172 
173  // perhaps pass parameter lists to these?
174  int createColumnMap(Epetra_Map* colMap);
175  int createRowMap(Epetra_Map* rowMap);
176 
177 
178 
179 
180 };//class Partitioner2D
181 
182 }//namespace Epetra
183 }//namespace Isorropia
184 
185 #endif //HAVE_EPETRA
186 
187 #endif
188 
189 
int getNZIndx(int row, int column) const
void elemsInPart(int part, int *elementList, int len) const
global element ids to be located in the given partition.
An implementation of the Partitioner interface that operates on Epetra matrices and linear systems...
Definition: Isorropia_EpetraOperator.hpp:72
int createDomainAndRangeMaps(Epetra_Map *domainMap, Epetra_Map *rangeMap)
void partition(bool force_repartitioning=false)
partition is a method that computes a rebalanced partitioning for the data in the object that this cl...
int numElemsInPart(int part) const
Return the number of LOCAL elements in a given part.
Interface (abstract base class) for computing a new 2D partitioning and describing the layout of elem...
Definition: Isorropia_Partitioner2D.hpp:60
An implementation of the Partitioner interface that operates on Epetra matrices and linear systems...
Definition: Isorropia_EpetraPartitioner2D.hpp:70
int createColumnMap(Epetra_Map *colMap)
int createRowMap(Epetra_Map *rowMap)
virtual void compute(bool forceRecomputing=false)
Method which does the work of computing a new partitioning/coloring/ordering, depending on the child ...
virtual ~Partitioner2D()
Destructor.
Partitioner2D(Teuchos::RCP< const Epetra_CrsGraph > input_graph, const Teuchos::ParameterList &paramlist=Teuchos::ParameterList("EmptyParameterList"), bool compute_partitioning_now=true)
Constructor that accepts an Epetra_CrsGraph object, called by API function create_partitioner().