Ifpack_OverlappingPartitioner.h

Go to the documentation of this file.
00001 #ifndef IFPACK_OVERLAPPINGPARTITIONER_H
00002 #define IFPACK_OVERLAPPINGPARTITIONER_H
00003 
00004 #include "Ifpack_ConfigDefs.h"
00005 #ifdef HAVE_IFPACK_TEUCHOS
00006 #include "Ifpack_Partitioner.h"
00007 #include "Teuchos_ParameterList.hpp"
00008 class Epetra_Comm;
00009 class Ifpack_Graph;
00010 class Epetra_Map;
00011 class Epetra_BlockMap;
00012 class Epetra_Import;
00013 
00014 /* \brief Ifpack_OverlappingPartitioner: A class to create overlapping
00015     partitions of a local graph.
00016 
00017 Class Ifpack_OverlappingPartitioner enables the extension of 
00018 non-overlapping partitions to an arbitrary value of overlap.
00019 Note that overlap refers to the overlap among \e local parts,
00020 and not the overlap among the processes.
00021 
00022 Supported parameters are:
00023 - \c "partitioner: local parts": the required number of parts;
00024 - \c "partitioner: overlap": the required amount of overlap is set in 
00025   parameter. Default = 0 (integer).
00026 - \c "partitioner: verbose": if \c true, information are reported on
00027   cout. Nothing is reported otherwise.
00028 
00029 This class is a semi-virtual class, that contains the basic utilities
00030 for derived classes Ifpack_LinearPartitioner, Ifpack_GreedyPartitioner,
00031 Ifpack_METISPartitioner, and Ifpack_EquationPartitioner. Graphs in
00032 input to one of these classes are supposed to contain no singletons.
00033 Usually, this means that the graph is derived from an Epetra_RowMatrix,
00034 that has been filtered using Ifpack_SingletonFilter.
00035 
00036 \author Marzio Sala, SNL 9214.
00037 
00038 \date Last update: Oct-04.
00039 */  
00040 class Ifpack_OverlappingPartitioner : public Ifpack_Partitioner {
00041 
00042 public:
00043 
00045   Ifpack_OverlappingPartitioner(const Ifpack_Graph* Graph);
00046 
00048   virtual ~Ifpack_OverlappingPartitioner();
00049 
00051   int NumLocalParts() const 
00052   {
00053     return(NumLocalParts_);
00054   }
00055 
00057   int OverlappingLevel() const 
00058   {
00059     return(OverlappingLevel_);
00060   }
00061 
00063 
00070   int operator() (int MyRow) const
00071   {
00072     if ((MyRow < 0) || (MyRow > NumMyRows()))
00073       IFPACK_CHK_ERR(-1); // input value not valid
00074 
00075     return(Partition_[MyRow]);
00076   }
00077 
00079   int operator() (int i, int j) const
00080   {
00081     if ((i < 0) || (i >= NumLocalParts()))
00082       IFPACK_CHK_ERR(-1);
00083 
00084     if ((j < 0) || (j > (int)Parts_[i].size()))
00085       IFPACK_CHK_ERR(-2);
00086 
00087     return(Parts_[i][j]);
00088   }
00089 
00091   inline int NumRowsInPart(const int Part) const
00092   {
00093     return(Parts_[Part].size());
00094   }
00095     
00096   int RowsInPart(const int Part, int* List) const
00097   {
00098     for (int i = 0 ; i < NumRowsInPart(Part) ; ++i)
00099       List[i] = Parts_[Part][i];
00100 
00101     return(0);
00102   }
00103   
00104   const int* NonOverlappingPartition() const
00105   {
00106     return(&Partition_[0]);
00107   }
00108 
00110 
00115   virtual int SetParameters(Teuchos::ParameterList& List);
00116 
00118 
00122   virtual int SetPartitionParameters(Teuchos::ParameterList& List) = 0;
00123 
00125   virtual int Compute();
00126 
00128   virtual int ComputePartitions() = 0;
00129 
00131   virtual int ComputeOverlappingPartitions();
00132   
00134   bool IsComputed()
00135   {
00136     return(IsComputed_);
00137   }
00138 
00140   virtual ostream& Print(std::ostream& os) const;
00141 
00142 protected:
00143    
00145   int NumMyRows() const;
00147   int NumMyNonzeros() const;
00149   int NumGlobalRows() const;
00151   int MaxNumEntries() const;
00153   const Epetra_Comm& Comm() const;
00155   int NumLocalParts_;
00157   vector<int> Partition_; 
00159   // partition i
00160   vector<vector<int> > Parts_;
00162   const Ifpack_Graph* Graph_;
00164   int OverlappingLevel_;
00166   bool IsComputed_;
00168   bool verbose_;
00169 
00170 }; // class Ifpack_Partitioner
00171 
00172 #endif // HAVE_IFPACK_TEUCHOS
00173 #endif // IFPACK_OVERLAPPINGPARTITIONER_H

Generated on Thu Sep 18 12:37:22 2008 for Ifpack Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1