43 #include "Ifpack_ConfigDefs.h"
44 #include "Ifpack_Partitioner.h"
45 #include "Ifpack_OverlappingPartitioner.h"
46 #include "Ifpack_Graph.h"
48 #include "Epetra_Comm.h"
49 #include "Epetra_BlockMap.h"
50 #include "Epetra_Map.h"
51 #include "Teuchos_ParameterList.hpp"
53 static const std::string PrintMsg_ =
"(Ifpack_OvPartitioner) ";
111 cout << PrintMsg_ <<
"Number of local parts = " <<
NumLocalParts_ << endl;
112 cout << PrintMsg_ <<
"Number of global parts = "
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]
167 <<
", NumLocalParts = " << NumLocalParts_ << endl;
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;
202 tmp.resize(NumLocalParts_);
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];
219 NumIndices, &Indices[0]);
220 IFPACK_CHK_ERR(ierr);
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)
265 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
272 long long Ifpack_OverlappingPartitioner::NumGlobalRows64()
const
274 return(
Graph_->NumGlobalRows64());
296 os <<
"================================================================================" << endl;
297 os <<
"Ifpack_OverlappingPartitioner" << endl;
299 os <<
"Number of global rows = " <<
Graph_->NumGlobalRows64() << endl;
303 os <<
"================================================================================" << endl;
virtual int SetParameters(Teuchos::ParameterList &List)
Sets all the parameters for the partitioner.
virtual ~Ifpack_OverlappingPartitioner()
Destructor.
virtual int Compute()
Computes the partitions. Returns 0 if successful.
virtual int ExtractMyRowCopy(int MyRow, int LenOfIndices, int &NumIndices, int *Indices) const =0
Extracts a copy of input local row.
virtual int NumMyRows() const =0
Returns the number of local rows.
virtual int SetPartitionParameters(Teuchos::ParameterList &List)=0
Sets all the parameters for the partitioner.
int MaxNumEntries() const
Returns the max number of local entries in a row.
Ifpack_OverlappingPartitioner(const Ifpack_Graph *Graph)
Constructor.
int NumMyNonzeros() const
Returns the number of local nonzero elements.
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.
int OverlappingLevel_
Overlapping level.
virtual int ComputeOverlappingPartitions()
Computes the partitions. Returns 0 if successful.
virtual int NumMyNonzeros() const =0
Returns the number of local nonzero entries.
virtual bool Filled() const =0
Returns true is graph is filled.
bool IsComputed_
If true, the graph has been successfully partitioned.
virtual int NumGlobalRows() const =0
Returns the number of global rows.
bool verbose_
If true, information are reported on cout.
virtual const Epetra_Comm & Comm() const =0
Returns the communicator object of the graph.
const Ifpack_Graph * Graph_
Reference to the graph to be partitioned.
int NumLocalParts_
Number of local subgraphs.
virtual int NumProc() const =0
virtual int MaxMyNumEntries() const =0
Returns the maximun number of entries for row.
virtual int ComputePartitions()=0
Computes the partitions. Returns 0 if successful.
int NumLocalParts() const
Returns the number of computed local partitions.
Ifpack_Graph: a pure virtual class that defines graphs for IFPACK.
virtual std::ostream & Print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
const Epetra_Comm & Comm() const
Returns the communicator object of Graph.
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.