51#include "Teuchos_ParameterList.hpp"
53static const std::string
PrintMsg_ =
"(Ifpack_OvPartitioner) ";
112 cout <<
PrintMsg_ <<
"Number of global parts = "
124 if (
Graph_->Filled() ==
false)
127 if (
Graph_->NumGlobalRows64() !=
Graph_->NumGlobalCols64())
157 std::vector<int> sizes;
164 for (
int i = 0 ; i <
NumMyRows() ; ++i) {
166 cerr <<
"ERROR: Partition[" << i <<
"] = "<<
Partition_[i]
168 cerr <<
"(file = " << __FILE__ <<
", line = "
169 << __LINE__ <<
")" << endl;
181 Parts_[i].resize(sizes[i]);
188 for (
int i = 0 ; i <
NumMyRows() ; ++i) {
190 int count = sizes[part];
201 std::vector<std::vector<int> > tmp;
208 int MaxNumEntries_tmp =
Graph_->MaxMyNumEntries();
209 std::vector<int> Indices;
210 Indices.resize(MaxNumEntries_tmp);
214 for (
int i = 0; i < (int)
Parts_[part].size() ; ++i) {
216 int LRID =
Parts_[part][i];
218 int ierr =
Graph_->ExtractMyRowCopy(LRID, MaxNumEntries_tmp,
219 NumIndices, &Indices[0]);
222 for (
int j = 0 ; j < NumIndices ; ++j) {
225 int col = Indices[j];
230 std::vector<int>::iterator
231 where =
find(tmp[part].begin(), tmp[part].end(), col);
233 if (where == tmp[part].end()) {
234 tmp[part].push_back(col);
242 Parts_[i].resize(tmp[i].size());
243 for (
int j = 0 ; j < (int)tmp[i].size() ; ++j)
255 return(
Graph_->NumMyRows());
261 return(
Graph_->NumMyNonzeros());
265#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
268 return(
Graph_->NumGlobalRows());
274 return(
Graph_->NumGlobalRows64());
279 return(
Graph_->MaxMyNumEntries());
296 os <<
"================================================================================" << endl;
297 os <<
"Ifpack_OverlappingPartitioner" << endl;
298 os <<
"Number of local rows = " <<
Graph_->NumMyRows() << endl;
299 os <<
"Number of global rows = " <<
Graph_->NumGlobalRows64() << endl;
303 os <<
"================================================================================" << endl;
#define IFPACK_CHK_ERR(ifpack_err)
static const std::string PrintMsg_
adjacency_list< vecS, vecS, undirectedS, no_property, property< edge_weight_t, double > > Graph
static bool find(Parser_dh p, char *option, OptionsNode **ptr)
Ifpack_Graph: a pure virtual class that defines graphs for IFPACK.
std::vector< std::vector< int > > Parts_
Parts_[i][j] is the ID of the j-th row contained in the (overlapping)
int NumGlobalRows() const
Returns the number of global rows.
int NumLocalParts() const
Returns the number of computed local partitions.
long long NumGlobalRows64() const
int OverlappingLevel_
Overlapping level.
Ifpack_OverlappingPartitioner(const Ifpack_Graph *Graph)
Constructor.
int NumMyNonzeros() const
Returns the number of local nonzero elements.
int NumLocalParts_
Number of local subgraphs.
int NumMyRows() const
Returns the number of local rows.
int MaxNumEntries() const
Returns the max number of local entries in a row.
virtual std::ostream & Print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
virtual ~Ifpack_OverlappingPartitioner()
Destructor.
std::vector< int > Partition_
Partition_[i] contains the ID of non-overlapping part it belongs to.
virtual int SetPartitionParameters(Teuchos::ParameterList &List)=0
Sets all the parameters for the partitioner.
bool verbose_
If true, information are reported on cout.
virtual int Compute()
Computes the partitions. Returns 0 if successful.
bool IsComputed_
If true, the graph has been successfully partitioned.
virtual int SetParameters(Teuchos::ParameterList &List)
Sets all the parameters for the partitioner.
virtual int ComputeOverlappingPartitions()
Computes the partitions. Returns 0 if successful.
const Epetra_Comm & Comm() const
Returns the communicator object of Graph.
const Ifpack_Graph * Graph_
Reference to the graph to be partitioned.
virtual int ComputePartitions()=0
Computes the partitions. Returns 0 if successful.