Ifpack2 Templated Preconditioning Package Version 1.0
Loading...
Searching...
No Matches
Ifpack2_OverlapGraph.hpp
1// @HEADER
2// *****************************************************************************
3// Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
4//
5// Copyright 2009 NTESS and the Ifpack2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef IFPACK2_OVERLAPGRAPH_HPP
11#define IFPACK2_OVERLAPGRAPH_HPP
12
13#include "Ifpack2_ConfigDefs.hpp"
14#include "Tpetra_CrsGraph.hpp"
15#include "Tpetra_Import.hpp"
16#include "Teuchos_RCP.hpp"
17#include "Ifpack2_CreateOverlapGraph.hpp"
18
19namespace Teuchos {
20 class ParameterList;
21}
22
23namespace Ifpack2 {
24
38
39template<class LocalOrdinal = typename Tpetra::CrsGraph<>::local_ordinal_type,
40 class GlobalOrdinal = typename Tpetra::CrsGraph<LocalOrdinal>::global_ordinal_type,
41 class Node = typename Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal>::node_type>
42class OverlapGraph : public Teuchos::Describable {
43public:
45 typedef Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> graph_type;
46
53 OverlapGraph (const Teuchos::RCP<const graph_type>& UserMatrixGraph_in,
54 int OverlapLevel_in);
55
58
60 virtual ~OverlapGraph () {}
61
63 const Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>&
64 getOverlapGraph () const { return *OverlapGraph_; }
65
67 const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>&
68 getOverlapRowMap () const {return *OverlapRowMap_; }
69
71 const Tpetra::Import<LocalOrdinal,GlobalOrdinal,Node>&
72 getOverlapImporter () const { return *OverlapImporter_; }
73
81 int OverlapLevel () const { return OverlapLevel_; }
83
84protected:
85 Teuchos::RCP<const Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> > OverlapGraph_;
86 Teuchos::RCP<const Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> > UserMatrixGraph_;
87 Teuchos::RCP<Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > OverlapRowMap_;
88 Teuchos::RCP<Tpetra::Import<LocalOrdinal,GlobalOrdinal,Node> > OverlapImporter_;
89 int OverlapLevel_;
90 bool IsOverlapped_;
91};
92
93template<class LocalOrdinal, class GlobalOrdinal, class Node>
95OverlapGraph (const Teuchos::RCP<const Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >& UserMatrixGraph_in,
96 int OverlapLevel_in)
97 : UserMatrixGraph_ (UserMatrixGraph_in),
98 OverlapLevel_ (OverlapLevel_in),
99 IsOverlapped_ (OverlapLevel_in > 0 && UserMatrixGraph_in->getDomainMap ()->isDistributed ())
100{
101 OverlapGraph_ = createOverlapGraph (UserMatrixGraph_, OverlapLevel_);
102}
103
104template<class LocalOrdinal, class GlobalOrdinal, class Node>
107 : UserMatrixGraph_ (Source.UserMatrixGraph_),
108 OverlapRowMap_ (Source.OverlapRowMap_),
109 OverlapLevel_ (Source.OverlapLevel_),
110 IsOverlapped_ (Source.IsOverlapped_)
111{
112 using Teuchos::rcp;
113 typedef Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> map_type;
114
115 if (IsOverlapped_) {
116 if (! OverlapGraph_.is_null ()) {
117 OverlapGraph_ = rcp (new graph_type (*OverlapGraph_));
118 }
119 if (! OverlapRowMap_.is_null ()) {
120 OverlapRowMap_ = rcp (new map_type (*OverlapRowMap_));
121 }
122 }
123}
124
125}//namespace Ifpack2
126
127#endif // IFPACK2_OVERLAPGRAPH_HPP
OverlapGraph(const Teuchos::RCP< const graph_type > &UserMatrixGraph_in, int OverlapLevel_in)
Constructor that takes a graph and the level of overlap.
Definition Ifpack2_OverlapGraph.hpp:95
const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > & getOverlapImporter() const
Return the Import object.
Definition Ifpack2_OverlapGraph.hpp:72
const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > & getOverlapRowMap() const
Return the overlap graph's row Map.
Definition Ifpack2_OverlapGraph.hpp:68
int OverlapLevel() const
Return the level of overlap used to create this graph.
Definition Ifpack2_OverlapGraph.hpp:81
virtual ~OverlapGraph()
Destructor (virtual for memory safety of derived classes).
Definition Ifpack2_OverlapGraph.hpp:60
const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > & getOverlapGraph() const
Return the overlap graph.
Definition Ifpack2_OverlapGraph.hpp:64
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > graph_type
The Tpetra::CrsGraph specialization that this class uses.
Definition Ifpack2_OverlapGraph.hpp:45
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:41
Teuchos::RCP< const GraphType > createOverlapGraph(const Teuchos::RCP< const GraphType > &inputGraph, const int overlapLevel)
Construct an overlapped graph for use with Ifpack2 preconditioners.
Definition Ifpack2_CreateOverlapGraph.hpp:40