Ifpack2 Templated Preconditioning Package  Version 1.0
Ifpack2_OverlappingPartitioner_decl.hpp
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack2: Tempated Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 #ifndef IFPACK2_OVERLAPPINGPARTITIONER_DECL_HPP
44 #define IFPACK2_OVERLAPPINGPARTITIONER_DECL_HPP
45 
46 #include "Ifpack2_ConfigDefs.hpp"
47 #include "Ifpack2_Partitioner.hpp"
48 #include "Tpetra_RowGraph.hpp"
49 
50 /* \brief Ifpack2_OverlappingPartitioner: A class to create overlapping
51  partitions of a local graph.
52 
53 Class Ifpack2_OverlappingPartitioner enables the extension of
54 non-overlapping partitions to an arbitrary value of overlap.
55 Note that overlap refers to the overlap among \e local parts,
56 and not the overlap among the processes.
57 
58 Supported parameters are:
59 - \c "partitioner: local parts": the required number of parts;
60 - \c "partitioner: overlap": the required amount of overlap is set in
61  parameter. Default = 0 (integer).
62 - \c "partitioner: verbose": if \c true, information are reported on
63  cout. Nothing is reported otherwise.
64 
65 This class is a semi-virtual class, that contains the basic utilities
66 for derived classes Ifpack2_LinearPartitioner, Ifpack2_GreedyPartitioner,
67 Ifpack2_METISPartitioner, and Ifpack2_EquationPartitioner. Graphs in
68 input to one of these classes are supposed to contain no singletons.
69 Usually, this means that the graph is derived from an Tpetra_RowMatrix,
70 that has been filtered using Ifpack2_SingletonFilter.
71 
72 \date Last update: Aug-12.
73 */
74 
75 namespace Ifpack2 {
76 
77 template<class GraphType>
78 class OverlappingPartitioner : public Partitioner<GraphType> {
79 
80 public:
81  typedef typename GraphType::local_ordinal_type LocalOrdinal;
82  typedef typename GraphType::global_ordinal_type GlobalOrdinal;
83  typedef typename GraphType::node_type Node;
84 
86  OverlappingPartitioner(const Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> >& Graph);
87 
89  virtual ~OverlappingPartitioner();
90 
92  LocalOrdinal numLocalParts() const;
93 
95  size_t overlappingLevel() const;
96 
98 
105  LocalOrdinal operator() (LocalOrdinal MyRow) const;
106 
108  LocalOrdinal operator() (LocalOrdinal i, LocalOrdinal j) const;
109 
111  size_t numRowsInPart(const LocalOrdinal Part) const;
112 
114  void rowsInPart(const LocalOrdinal Part, Teuchos::ArrayRCP<LocalOrdinal> & List) const;
115 
117  virtual Teuchos::ArrayView<const LocalOrdinal> nonOverlappingPartition() const;
118 
120 
125  virtual void setParameters(Teuchos::ParameterList& List);
126 
128 
132  virtual void setPartitionParameters(Teuchos::ParameterList& List) = 0;
133 
135  virtual void compute();
136 
138  virtual void computePartitions() = 0;
139 
141  virtual void computeOverlappingPartitions();
142 
144  virtual bool isComputed() const;
145 
147  virtual std::ostream& print(std::ostream& os) const;
148 
149 
151 
152 
154  std::string description() const;
155 
157  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
158 
160 
161 protected:
162 
164  LocalOrdinal NumLocalParts_;
166  Teuchos::Array<LocalOrdinal> Partition_;
168  // partition i
169  Teuchos::Array<Teuchos::ArrayRCP<LocalOrdinal> > Parts_;
171  Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> > Graph_;
173  size_t OverlappingLevel_;
175  bool IsComputed_;
177  bool verbose_;
178 
179 }; // class Ifpack2::OverlappingPartitioner
180 
181 }// namespace Ifpack2
182 
183 #endif // IFPACK2_OVERLAPPINGPARTITIONER_DECL_HPP
Ifpack2::Container: a pure virtual class for creating and solving local linear problems.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:67