Ifpack2 Templated Preconditioning Package  Version 1.0
Ifpack2_Details_OverlappingRowGraph_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_DETAILS_OVERLAPPINGROWGRAPH_DECL_HPP
44 #define IFPACK2_DETAILS_OVERLAPPINGROWGRAPH_DECL_HPP
45 
46 #include <Ifpack2_ConfigDefs.hpp>
47 #include "Ifpack2_Details_RowGraph.hpp"
48 #include <Tpetra_Import_decl.hpp>
49 #include <Tpetra_Export_decl.hpp>
50 
51 namespace Ifpack2 {
52 namespace Details {
53 
64 template<class GraphType>
66  virtual public Ifpack2::Details::RowGraph<GraphType> {
67 public:
69 
70  typedef typename GraphType::local_ordinal_type local_ordinal_type;
71  typedef typename GraphType::global_ordinal_type global_ordinal_type;
72  typedef typename GraphType::node_type node_type;
73  typedef typename GraphType::local_inds_host_view_type local_inds_host_view_type;
74  typedef typename GraphType::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type;
75  typedef typename GraphType::global_inds_host_view_type global_inds_host_view_type;
76  typedef typename GraphType::nonconst_global_inds_host_view_type nonconst_global_inds_host_view_type;
77 
78  typedef Tpetra::Export<local_ordinal_type, global_ordinal_type, node_type> export_type;
79  typedef Tpetra::Import<local_ordinal_type, global_ordinal_type, node_type> import_type;
80  typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> map_type;
81  typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type> row_graph_type;
82 
84 
86 
106  OverlappingRowGraph (const Teuchos::RCP<const row_graph_type>& nonoverlappingGraph,
107  const Teuchos::RCP<const row_graph_type>& overlappingGraph,
108  const Teuchos::RCP<const map_type>& rowMap,
109  const Teuchos::RCP<const map_type>& colMap,
110  const Tpetra::global_size_t numGlobalRows,
111  const Tpetra::global_size_t numGlobalCols,
112  const Tpetra::global_size_t numGlobalNonzeros,
113  const size_t maxNumEntries,
114  const Teuchos::RCP<const import_type>& nonoverlappingImporter,
115  const Teuchos::RCP<const import_type>& overlappingImporter);
117  virtual ~OverlappingRowGraph ();
118 
120 
122 
124  virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm () const;
125 
126 
128  virtual Teuchos::RCP<const map_type> getRowMap () const;
129 
131  virtual Teuchos::RCP<const map_type> getColMap () const;
132 
137  virtual Teuchos::RCP<const map_type> getDomainMap () const;
138 
143  virtual Teuchos::RCP<const map_type> getRangeMap () const;
144 
146  virtual Teuchos::RCP<const import_type> getImporter () const;
147 
149  virtual Teuchos::RCP<const export_type> getExporter () const;
150 
152  virtual global_size_t getGlobalNumRows () const;
153 
155  virtual global_size_t getGlobalNumCols () const;
156 
158  virtual size_t getNodeNumRows () const;
159 
165  virtual size_t getNodeNumCols () const;
166 
168  virtual global_ordinal_type getIndexBase () const;
169 
171  virtual global_size_t getGlobalNumEntries () const;
172 
174  virtual size_t getNodeNumEntries () const;
175 
185  virtual size_t getNumEntriesInGlobalRow (global_ordinal_type globalRow) const;
186 
196  virtual size_t getNumEntriesInLocalRow (local_ordinal_type localRow) const;
197 
199  virtual size_t getGlobalMaxNumRowEntries () const;
200 
202  virtual size_t getNodeMaxNumRowEntries() const;
203 
205  virtual bool hasColMap() const;
206 
208  virtual bool isLocallyIndexed () const;
209 
211  virtual bool isGloballyIndexed () const;
212 
214  virtual bool isFillComplete() const;
215 
217 
219 
233  virtual void
234  getGlobalRowCopy (global_ordinal_type globalRow,
235  nonconst_global_inds_host_view_type& gblColInds,
236  size_t& numIndices) const;
237 
238 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
239  virtual void
240  getGlobalRowCopy (global_ordinal_type globalRow,
241  const Teuchos::ArrayView<global_ordinal_type>& indices,
242  size_t& numIndices) const;
243 #endif
244 
245 
263  virtual void
264  getLocalRowCopy (local_ordinal_type localRow,
265  nonconst_local_inds_host_view_type& gblColInds,
266  size_t& numIndices) const;
267 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
268  virtual void
269  getLocalRowCopy (local_ordinal_type localRow,
270  const Teuchos::ArrayView<local_ordinal_type>& indices,
271  size_t& numIndices) const;
272 #endif
273 
301  virtual void
302  getLocalRowView (const local_ordinal_type lclRow,
303  local_inds_host_view_type & lclColInds) const;
304 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
305  virtual void
306  getLocalRowView (const local_ordinal_type lclRow,
307  Teuchos::ArrayView<const local_ordinal_type>& lclColInds) const;
308 #endif // TPETRA_ENABLE_DEPRECATED_CODE
309 
325  virtual void
326  getGlobalRowView (const global_ordinal_type gblRow,
327  global_inds_host_view_type& gblColInds) const;
328 
329 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
330  virtual void
331  getGlobalRowView (const global_ordinal_type gblRow,
332  Teuchos::ArrayView<const global_ordinal_type>& gblColInds) const;
333 #endif
334 
335 
337 private:
339 
340  Teuchos::RCP<const row_graph_type> nonoverlappingGraph_;
341  Teuchos::RCP<const row_graph_type> overlappingGraph_;
342  Teuchos::RCP<const map_type> rowMap_;
343  Teuchos::RCP<const map_type> colMap_;
344  const Tpetra::global_size_t numGlobalRows_;
345  const Tpetra::global_size_t numGlobalCols_;
346  const Tpetra::global_size_t numGlobalNonzeros_;
347  const size_t maxNumEntries_;
348  Teuchos::RCP<const import_type> nonoverlappingImporter_;
349  Teuchos::RCP<const import_type> overlappingImporter_;
351 };
352 
353 } // namespace Details
354 } // namespace Ifpack2
355 
356 #endif // IFPACK2_DETAILS_OVERLAPPINGROWGRAPH_DECL_HPP
virtual size_t getNodeNumCols() const
The number of columns owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:164
virtual bool isGloballyIndexed() const
Whether this graph is globally indexed.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:251
virtual size_t getNodeNumEntries() const
The number of entries in this graph owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:186
virtual void getLocalRowCopy(local_ordinal_type localRow, nonconst_local_inds_host_view_type &gblColInds, size_t &numIndices) const
Copy out a list of local column indices in the given local row that are owned by the calling process...
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:306
OverlappingRowGraph(const Teuchos::RCP< const row_graph_type > &nonoverlappingGraph, const Teuchos::RCP< const row_graph_type > &overlappingGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Tpetra::global_size_t numGlobalRows, const Tpetra::global_size_t numGlobalCols, const Tpetra::global_size_t numGlobalNonzeros, const size_t maxNumEntries, const Teuchos::RCP< const import_type > &nonoverlappingImporter, const Teuchos::RCP< const import_type > &overlappingImporter)
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:56
virtual bool isLocallyIndexed() const
Whether this graph is locally indexed.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:244
virtual size_t getNodeNumRows() const
The number of rows owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:156
virtual global_ordinal_type getIndexBase() const
The index base for global indices for this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:172
virtual Teuchos::RCP< const map_type > getRangeMap() const
The Map that describes the range of this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:119
virtual Teuchos::RCP< const import_type > getImporter() const
Import object (from domain Map to column Map).
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:127
virtual bool hasColMap() const
Whether this graph has a column Map.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:237
Ifpack2 implementation details.
virtual bool isFillComplete() const
true if fillComplete() has been called, else false.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:258
virtual Teuchos::RCP< const map_type > getRowMap() const
The Map that describes the distribution of rows over processes.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:95
virtual size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const
The number of entries in the given local row that are owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:210
virtual Teuchos::RCP< const map_type > getColMap() const
The Map that describes the distribution of columns over processes.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:103
All Ifpack2 implementations of Tpetra::RowGraph must inherit from this class.
Definition: Ifpack2_Details_RowGraph.hpp:63
virtual void getGlobalRowCopy(global_ordinal_type globalRow, nonconst_global_inds_host_view_type &gblColInds, size_t &numIndices) const
Copy out a list of column indices in the given global row that are owned by the calling process...
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:266
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the graph is distributed.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:85
Sparse graph (Tpetra::RowGraph subclass) with ghost rows.
Definition: Ifpack2_Details_OverlappingRowGraph_decl.hpp:65
virtual global_size_t getGlobalNumEntries() const
The global number of entries in this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:179
virtual ~OverlappingRowGraph()
Destructor.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:80
virtual Teuchos::RCP< const export_type > getExporter() const
Export object (from row Map to range Map).
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:135
virtual void getGlobalRowView(const global_ordinal_type gblRow, global_inds_host_view_type &gblColInds) const
Get a const, non-persisting view of the given global row&#39;s global column indices, as a Teuchos::Array...
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:345
virtual global_size_t getGlobalNumCols() const
The global number of columns in this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:149
virtual Teuchos::RCP< const map_type > getDomainMap() const
The Map that describes the domain of this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:111
virtual global_size_t getGlobalNumRows() const
The global number of rows in this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:142
virtual size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow) const
The number of entries in the given global row that are owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:196
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:73
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries in any row on any process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:223
virtual void getLocalRowView(const local_ordinal_type lclRow, local_inds_host_view_type &lclColInds) const
Get a constant, nonpersisting, locally indexed view of the given row of the graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:383
virtual size_t getNodeMaxNumRowEntries() const
The maximum number of entries in any row on the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:230