Ifpack2 Templated Preconditioning Package Version 1.0
Loading...
Searching...
No Matches
Ifpack2_OverlappingPartitioner_decl.hpp
1/*@HEADER
2// ***********************************************************************
3//
4// Ifpack2: Templated 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
50namespace Ifpack2 {
51
77template<class GraphType>
78class OverlappingPartitioner : public Partitioner<GraphType> {
79public:
80 typedef typename GraphType::local_ordinal_type local_ordinal_type;
81 typedef typename GraphType::global_ordinal_type global_ordinal_type;
82 typedef typename GraphType::node_type node_type;
83 typedef typename GraphType::nonconst_global_inds_host_view_type nonconst_global_inds_host_view_type;
84 typedef typename GraphType::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type;
85
86 typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type> row_graph_type;
87
89 OverlappingPartitioner (const Teuchos::RCP<const row_graph_type>& graph);
90
93
99 int numLocalParts () const;
100
102 int overlappingLevel() const;
103
107 local_ordinal_type operator () (const local_ordinal_type MyRow) const;
108
110 local_ordinal_type
111 operator () (const local_ordinal_type i, const local_ordinal_type j) const;
112
114 size_t numRowsInPart (const local_ordinal_type Part) const;
115
117 void rowsInPart (const local_ordinal_type Part, Teuchos::ArrayRCP<local_ordinal_type>& List) const;
118
120 virtual Teuchos::ArrayView<const local_ordinal_type>
122
124
129 virtual void setParameters (Teuchos::ParameterList& List);
130
132
136 virtual void setPartitionParameters (Teuchos::ParameterList& List) = 0;
137
139 virtual void compute();
140
142 virtual void computePartitions() = 0;
143
145 virtual void computeOverlappingPartitions();
146
148 virtual bool isComputed() const;
149
151 virtual std::ostream& print(std::ostream& os) const;
152
154
155
157 std::string description() const;
158
160 void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
161
163
164protected:
165
172
178 Teuchos::Array<local_ordinal_type> Partition_;
179
185 Teuchos::Array<Teuchos::ArrayRCP<local_ordinal_type> > Parts_;
186
188 Teuchos::RCP<const row_graph_type> Graph_;
189
192
195
198
204}; // class Ifpack2::OverlappingPartitioner
205
206}// namespace Ifpack2
207
208#endif // IFPACK2_OVERLAPPINGPARTITIONER_DECL_HPP
Create overlapping partitions of a local graph.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:78
Teuchos::Array< local_ordinal_type > Partition_
Mapping from local row to partition number.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:178
size_t numRowsInPart(const local_ordinal_type Part) const
the number of rows contained in the given partition.
Definition Ifpack2_OverlappingPartitioner_def.hpp:124
OverlappingPartitioner(const Teuchos::RCP< const row_graph_type > &graph)
Constructor.
Definition Ifpack2_OverlappingPartitioner_def.hpp:57
bool verbose_
If true, information are reported to stdout.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:197
virtual std::ostream & print(std::ostream &os) const
Prints basic information on iostream. This function is used by operator<<.
Definition Ifpack2_OverlappingPartitioner_def.hpp:449
virtual void compute()
Computes the partitions. Returns 0 if successful.
Definition Ifpack2_OverlappingPartitioner_def.hpp:200
virtual void setParameters(Teuchos::ParameterList &List)
Set all the parameters for the partitioner.
Definition Ifpack2_OverlappingPartitioner_def.hpp:160
virtual bool isComputed() const
Returns true if partitions have been computed successfully.
Definition Ifpack2_OverlappingPartitioner_def.hpp:441
int OverlappingLevel_
Level of overlap.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:191
virtual void computeOverlappingPartitions()
Computes the partitions. Returns 0 if successful.
Definition Ifpack2_OverlappingPartitioner_def.hpp:252
int numLocalParts() const
Number of computed local partitions.
Definition Ifpack2_OverlappingPartitioner_def.hpp:73
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Definition Ifpack2_OverlappingPartitioner_def.hpp:475
Teuchos::RCP< const row_graph_type > Graph_
The graph to be partitioned.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:188
virtual void setPartitionParameters(Teuchos::ParameterList &List)=0
Set all the parameters for the partitioner.
bool IsComputed_
If true, the graph has been successfully partitioned.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:194
Teuchos::Array< Teuchos::ArrayRCP< local_ordinal_type > > Parts_
Mapping from partition to all rows it contains.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:185
void rowsInPart(const local_ordinal_type Part, Teuchos::ArrayRCP< local_ordinal_type > &List) const
Fill List with the local indices of the rows in the (overlapping) partition Part.
Definition Ifpack2_OverlappingPartitioner_def.hpp:138
virtual void computePartitions()=0
Computes the partitions. Returns 0 if successful.
int overlappingLevel() const
The number of levels of overlap.
Definition Ifpack2_OverlappingPartitioner_def.hpp:80
int NumLocalParts_
Number of local subgraphs.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:171
bool maintainSparsity_
If true, only add row to partition (block) if doing so won't add new columns to the column map.
Definition Ifpack2_OverlappingPartitioner_decl.hpp:203
virtual ~OverlappingPartitioner()
Destructor.
Definition Ifpack2_OverlappingPartitioner_def.hpp:68
virtual Teuchos::ArrayView< const local_ordinal_type > nonOverlappingPartition() const
A view of the local indices of the nonoverlapping partitions of each local row.
Definition Ifpack2_OverlappingPartitioner_def.hpp:151
std::string description() const
Return a simple one-line description of this object.
Definition Ifpack2_OverlappingPartitioner_def.hpp:459
local_ordinal_type operator()(const local_ordinal_type MyRow) const
Local index of the nonoverlapping partition of the given row.
Definition Ifpack2_OverlappingPartitioner_def.hpp:89
Ifpack2::Partitioner:
Definition Ifpack2_Partitioner.hpp:179
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:74