Ifpack2 Templated Preconditioning Package Version 1.0
Ifpack2_OverlappingPartitioner_decl.hpp
00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack2: Tempated Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2009) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #ifndef IFPACK2_OVERLAPPINGPARTITIONER_DECL_HPP
00031 #define IFPACK2_OVERLAPPINGPARTITIONER_DECL_HPP
00032 
00033 #include "Ifpack2_ConfigDefs.hpp"
00034 #include "Ifpack2_Partitioner.hpp"
00035 #include "Tpetra_RowGraph.hpp"
00036 
00037 /* \brief Ifpack2_OverlappingPartitioner: A class to create overlapping
00038     partitions of a local graph.
00039 
00040 Class Ifpack2_OverlappingPartitioner enables the extension of 
00041 non-overlapping partitions to an arbitrary value of overlap.
00042 Note that overlap refers to the overlap among \e local parts,
00043 and not the overlap among the processes.
00044 
00045 Supported parameters are:
00046 - \c "partitioner: local parts": the required number of parts;
00047 - \c "partitioner: overlap": the required amount of overlap is set in 
00048   parameter. Default = 0 (integer).
00049 - \c "partitioner: verbose": if \c true, information are reported on
00050   cout. Nothing is reported otherwise.
00051 
00052 This class is a semi-virtual class, that contains the basic utilities
00053 for derived classes Ifpack2_LinearPartitioner, Ifpack2_GreedyPartitioner,
00054 Ifpack2_METISPartitioner, and Ifpack2_EquationPartitioner. Graphs in
00055 input to one of these classes are supposed to contain no singletons.
00056 Usually, this means that the graph is derived from an Tpetra_RowMatrix,
00057 that has been filtered using Ifpack2_SingletonFilter.
00058 
00059 \date Last update: Aug-12.
00060 */  
00061 
00062 namespace Ifpack2 {
00063 
00064 template<class GraphType>
00065 class OverlappingPartitioner : public Partitioner<GraphType> {
00066 
00067 public:
00068   typedef typename GraphType::local_ordinal_type LocalOrdinal;
00069   typedef typename GraphType::global_ordinal_type GlobalOrdinal;
00070   typedef typename GraphType::node_type Node;
00071 
00073   OverlappingPartitioner(const Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> >& Graph);
00074 
00076   virtual ~OverlappingPartitioner();
00077 
00079   LocalOrdinal numLocalParts() const;
00080 
00082   size_t overlappingLevel() const;
00083 
00085 
00092   LocalOrdinal operator() (LocalOrdinal MyRow) const;
00093 
00095   LocalOrdinal operator() (LocalOrdinal i, LocalOrdinal j) const;
00096 
00098   size_t numRowsInPart(const LocalOrdinal Part) const;
00099 
00101   void rowsInPart(const LocalOrdinal Part,  Teuchos::ArrayRCP<LocalOrdinal> & List) const;
00102 
00104   virtual Teuchos::ArrayView<const LocalOrdinal>  nonOverlappingPartition() const;
00105 
00107 
00112   virtual void setParameters(Teuchos::ParameterList& List);
00113 
00115 
00119   virtual void setPartitionParameters(Teuchos::ParameterList& List) = 0;
00120 
00122   virtual void compute();
00123 
00125   virtual void computePartitions() = 0;
00126 
00128   virtual void computeOverlappingPartitions();
00129   
00131   virtual bool isComputed() const;
00132 
00134   virtual std::ostream& print(std::ostream& os) const;
00135 
00136 
00138 
00139 
00141   std::string description() const;
00142 
00144   void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00145 
00147  
00148 protected:
00149 
00151   LocalOrdinal NumLocalParts_;
00153   Teuchos::Array<LocalOrdinal> Partition_; 
00155   // partition i
00156   Teuchos::Array<Teuchos::ArrayRCP<LocalOrdinal> > Parts_;
00158   Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> > Graph_;
00160   size_t OverlappingLevel_;
00162   bool IsComputed_;
00164   bool verbose_;
00165 
00166 }; // class Ifpack2::OverlappingPartitioner
00167 
00168 }// namespace Ifpack2
00169 
00170 #endif // IFPACK2_OVERLAPPINGPARTITIONER_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends