49 #include "Epetra_Comm.h"
50 #include "Epetra_BlockMap.h"
51 #include "Epetra_Map.h"
52 #include "Epetra_CrsGraph.h"
53 #include "Teuchos_ParameterList.hpp"
69 ElementsPerPart[i] = div;
70 if (i < mod) ElementsPerPart[i]++;
81 int CurrentPartition = 0;
88 NumEntries, &Indices[0]);
90 if (NumEntries <= 1) {
99 std::vector<int> ThisLevel(1);
116 while (ThisLevel.size()) {
118 std::vector<int> NextLevel;
120 for (
unsigned int i = 0 ; i < ThisLevel.size() ; ++i) {
122 int CurrentNode = ThisLevel[i];
124 NumEntries, &Indices[0]);
130 for (
int j = 0 ; j < NumEntries ; ++j) {
132 int NextNode = Indices[j];
139 ++Count[CurrentPartition];
141 NextLevel.push_back(NextNode);
147 if (Count[CurrentPartition] >= ElementsPerPart[CurrentPartition])
152 for (
unsigned int i = 0 ; i < NextLevel.size() ; ++i)
153 ThisLevel.push_back(NextLevel[i]);
155 if (ThisLevel.size() == 0 && (TotalCount !=
NumMyRows())) {
157 for (
int i = 0 ; i <
NumMyRows() ; i++) {
159 ThisLevel.push_back(i);
virtual int ExtractMyRowCopy(int MyRow, int LenOfIndices, int &NumIndices, int *Indices) const =0
Extracts a copy of input local row.
int MaxNumEntries() const
Returns the max number of local entries in a row.
int ComputePartitions()
Computes the partitions. Returns 0 if successful.
int NumMyRows() const
Returns the number of local rows.
std::vector< int > Partition_
Partition_[i] contains the ID of non-overlapping part it belongs to.
const Ifpack_Graph * Graph_
Reference to the graph to be partitioned.
int NumLocalParts_
Number of local subgraphs.
int NumLocalParts() const
Returns the number of computed local partitions.
#define IFPACK_CHK_ERR(ifpack_err)