Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_TpetraCrsGraph_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Xpetra: A linear algebra interface package
4 //
5 // Copyright 2012 NTESS and the Xpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef XPETRA_TPETRACRSGRAPH_DEF_HPP
11 #define XPETRA_TPETRACRSGRAPH_DEF_HPP
13 #include "Xpetra_Exceptions.hpp"
14 
15 #include "Tpetra_CrsGraph.hpp"
16 
17 #include "Xpetra_CrsGraph.hpp"
19 #include "Xpetra_Utils.hpp"
20 #include "Xpetra_TpetraMap.hpp"
21 #include "Xpetra_TpetraImport.hpp"
22 #include "Xpetra_TpetraExport.hpp"
23 
24 namespace Xpetra {
25 
26 template <class LocalOrdinal, class GlobalOrdinal, class Node>
27 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params)
28  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), maxNumEntriesPerRow, params))) {}
29 
30 template <class LocalOrdinal, class GlobalOrdinal, class Node>
31 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const RCP<const Map> &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params)
32  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), NumEntriesPerRowToAlloc(), params))) {}
33 
34 template <class LocalOrdinal, class GlobalOrdinal, class Node>
35 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const RCP<const Map> &rowMap, const RCP<const Map> &colMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params)
36  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), maxNumEntriesPerRow, params))) {}
37 
38 template <class LocalOrdinal, class GlobalOrdinal, class Node>
39 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const RCP<const Map> &rowMap, const RCP<const Map> &colMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params)
40  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), NumEntriesPerRowToAlloc(), params))) {}
41 
42 template <class LocalOrdinal, class GlobalOrdinal, class Node>
44  TpetraCrsGraph(const Teuchos::RCP<const CrsGraph> &sourceGraph,
45  const Import &importer,
46  const Teuchos::RCP<const Map> &domainMap,
47  const Teuchos::RCP<const Map> &rangeMap,
48  const Teuchos::RCP<Teuchos::ParameterList> &params) {
49  typedef Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> MyTpetraCrsGraph;
50  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, *sourceGraph, tSourceGraph, "Xpetra::TpetraCrsMatrix constructor only accepts Xpetra::TpetraCrsMatrix as the input argument."); // TODO: remove and use toTpetra()
51  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSourceGraph.getTpetra_CrsGraph();
52 
53  RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > myDomainMap = domainMap != Teuchos::null ? toTpetra(domainMap) : Teuchos::null;
54  RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > myRangeMap = rangeMap != Teuchos::null ? toTpetra(rangeMap) : Teuchos::null;
55  graph_ = Tpetra::importAndFillCompleteCrsGraph<MyTpetraCrsGraph>(v, toTpetra(importer), myDomainMap, myRangeMap, params);
56  bool restrictComm = false;
57  if (!params.is_null()) restrictComm = params->get("Restrict Communicator", restrictComm);
58  if (restrictComm && graph_->getRowMap().is_null()) graph_ = Teuchos::null;
59 }
60 
61 template <class LocalOrdinal, class GlobalOrdinal, class Node>
63  TpetraCrsGraph(const Teuchos::RCP<const Map> &rowMap,
64  const Teuchos::RCP<const Map> &colMap,
65  const typename local_graph_type::row_map_type &rowPointers,
66  const typename local_graph_type::entries_type::non_const_type &columnIndices,
67  const Teuchos::RCP<Teuchos::ParameterList> &plist)
68  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), rowPointers, columnIndices, plist))) {}
69 
70 template <class LocalOrdinal, class GlobalOrdinal, class Node>
72  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
73  const Teuchos::RCP<const map_type> &colMap,
74  const local_graph_type &lclGraph,
75  const Teuchos::RCP<Teuchos::ParameterList> &params)
76  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), lclGraph, params))) {}
77 
78 template <class LocalOrdinal, class GlobalOrdinal, class Node>
81  const Teuchos::RCP<const map_type> &rowMap,
82  const Teuchos::RCP<const map_type> &colMap,
83  const Teuchos::RCP<const map_type> &domainMap,
84  const Teuchos::RCP<const map_type> &rangeMap,
85  const Teuchos::RCP<Teuchos::ParameterList> &params)
86  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(lclGraph, toTpetra(rowMap), toTpetra(colMap), toTpetra(domainMap), toTpetra(rangeMap), params))) {}
87 
88 template <class LocalOrdinal, class GlobalOrdinal, class Node>
90  TpetraCrsGraph(const Teuchos::RCP<const Map> &rowMap,
91  const Teuchos::RCP<const Map> &colMap,
92  const Teuchos::ArrayRCP<size_t> &rowPointers,
93  const Teuchos::ArrayRCP<LocalOrdinal> &columnIndices,
94  const Teuchos::RCP<Teuchos::ParameterList> &params)
95  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), rowPointers, columnIndices, params))) {}
96 
97 template <class LocalOrdinal, class GlobalOrdinal, class Node>
99 
100 template <class LocalOrdinal, class GlobalOrdinal, class Node>
101 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {
102  XPETRA_MONITOR("TpetraCrsGraph::insertGlobalIndices");
103  graph_->insertGlobalIndices(globalRow, indices);
104 }
105 
106 template <class LocalOrdinal, class GlobalOrdinal, class Node>
107 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {
108  XPETRA_MONITOR("TpetraCrsGraph::insertLocalIndices");
109  graph_->insertLocalIndices(localRow, indices);
110 }
111 
112 template <class LocalOrdinal, class GlobalOrdinal, class Node>
114  XPETRA_MONITOR("TpetraCrsGraph::removeLocalIndices");
115  graph_->removeLocalIndices(localRow);
116 }
117 
118 template <class LocalOrdinal, class GlobalOrdinal, class Node>
120  allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {
121  rowptr.resize(getLocalNumRows() + 1);
122  colind.resize(numNonZeros);
123 }
124 
125 template <class LocalOrdinal, class GlobalOrdinal, class Node>
127  setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {
128  graph_->setAllIndices(rowptr, colind);
129 }
130 
131 template <class LocalOrdinal, class GlobalOrdinal, class Node>
133  getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {
134  rowptr = Kokkos::Compat::persistingView(graph_->getLocalRowPtrsHost());
135  colind = Kokkos::Compat::persistingView(graph_->getLocalIndicesHost());
136 }
137 
138 template <class LocalOrdinal, class GlobalOrdinal, class Node>
139 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::fillComplete(const RCP<const Map> &domainMap, const RCP<const Map> &rangeMap, const RCP<ParameterList> &params) {
140  XPETRA_MONITOR("TpetraCrsGraph::fillComplete");
141  graph_->fillComplete(toTpetra(domainMap), toTpetra(rangeMap), params);
142 }
143 
144 template <class LocalOrdinal, class GlobalOrdinal, class Node>
146  XPETRA_MONITOR("TpetraCrsGraph::fillComplete");
147  graph_->fillComplete(params);
148 }
149 
150 template <class LocalOrdinal, class GlobalOrdinal, class Node>
152  expertStaticFillComplete(const Teuchos::RCP<const map_type> &domainMap,
153  const Teuchos::RCP<const map_type> &rangeMap,
154  const Teuchos::RCP<const Import> &importer,
155  const Teuchos::RCP<const Export> &exporter,
156  const Teuchos::RCP<Teuchos::ParameterList> &params) {
157  XPETRA_MONITOR("TpetraCrsGraph::expertStaticFillComplete");
158  RCP<const Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node> > myImport;
159  RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node> > myExport;
160 
161  if (importer != Teuchos::null) {
162  XPETRA_DYNAMIC_CAST(const TpetraImportClass, *importer, tImporter, "Xpetra::TpetraCrsGraph::expertStaticFillComplete only accepts Xpetra::TpetraImport.");
163  myImport = tImporter.getTpetra_Import();
164  }
165  if (exporter != Teuchos::null) {
166  XPETRA_DYNAMIC_CAST(const TpetraExportClass, *exporter, tExporter, "Xpetra::TpetraCrsGraph::expertStaticFillComplete only accepts Xpetra::TpetraExport.");
167  myExport = tExporter.getTpetra_Export();
168  }
169 
170  graph_->expertStaticFillComplete(toTpetra(domainMap), toTpetra(rangeMap), myImport, myExport, params);
171 }
172 
173 template <class LocalOrdinal, class GlobalOrdinal, class Node>
175  XPETRA_MONITOR("TpetraCrsGraph::getComm");
176  return graph_->getComm();
177 }
178 
179 template <class LocalOrdinal, class GlobalOrdinal, class Node>
180 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getRowMap() const {
181  XPETRA_MONITOR("TpetraCrsGraph::getRowMap");
182  return toXpetra(graph_->getRowMap());
183 }
184 
185 template <class LocalOrdinal, class GlobalOrdinal, class Node>
186 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getColMap() const {
187  XPETRA_MONITOR("TpetraCrsGraph::getColMap");
188  return toXpetra(graph_->getColMap());
189 }
190 
191 template <class LocalOrdinal, class GlobalOrdinal, class Node>
192 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getDomainMap() const {
193  XPETRA_MONITOR("TpetraCrsGraph::getDomainMap");
194  return toXpetra(graph_->getDomainMap());
195 }
196 
197 template <class LocalOrdinal, class GlobalOrdinal, class Node>
198 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getRangeMap() const {
199  XPETRA_MONITOR("TpetraCrsGraph::getRangeMap");
200  return toXpetra(graph_->getRangeMap());
201 }
202 
203 template <class LocalOrdinal, class GlobalOrdinal, class Node>
204 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getImporter() const {
205  XPETRA_MONITOR("TpetraCrsGraph::getImporter");
206  return toXpetra(graph_->getImporter());
207 }
208 
209 template <class LocalOrdinal, class GlobalOrdinal, class Node>
210 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getExporter() const {
211  XPETRA_MONITOR("TpetraCrsGraph::getExporter");
212  return toXpetra(graph_->getExporter());
213 }
214 
215 template <class LocalOrdinal, class GlobalOrdinal, class Node>
217  XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumRows");
218  return graph_->getGlobalNumRows();
219 }
220 
221 template <class LocalOrdinal, class GlobalOrdinal, class Node>
223  XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumCols");
224  return graph_->getGlobalNumCols();
225 }
226 
227 template <class LocalOrdinal, class GlobalOrdinal, class Node>
229  XPETRA_MONITOR("TpetraCrsGraph::getLocalNumRows");
230  return graph_->getLocalNumRows();
231 }
232 
233 template <class LocalOrdinal, class GlobalOrdinal, class Node>
235  XPETRA_MONITOR("TpetraCrsGraph::getLocalNumCols");
236  return graph_->getLocalNumCols();
237 }
238 
239 template <class LocalOrdinal, class GlobalOrdinal, class Node>
241  XPETRA_MONITOR("TpetraCrsGraph::getIndexBase");
242  return graph_->getIndexBase();
243 }
244 
245 template <class LocalOrdinal, class GlobalOrdinal, class Node>
247  XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumEntries");
248  return graph_->getGlobalNumEntries();
249 }
250 
251 template <class LocalOrdinal, class GlobalOrdinal, class Node>
253  XPETRA_MONITOR("TpetraCrsGraph::getLocalNumEntries");
254  return graph_->getLocalNumEntries();
255 }
256 
257 template <class LocalOrdinal, class GlobalOrdinal, class Node>
259  XPETRA_MONITOR("TpetraCrsGraph::getNumEntriesInGlobalRow");
260  return graph_->getNumEntriesInGlobalRow(globalRow);
261 }
262 
263 template <class LocalOrdinal, class GlobalOrdinal, class Node>
265  XPETRA_MONITOR("TpetraCrsGraph::getNumEntriesInLocalRow");
266  return graph_->getNumEntriesInLocalRow(localRow);
267 }
268 
269 template <class LocalOrdinal, class GlobalOrdinal, class Node>
271  XPETRA_MONITOR("TpetraCrsGraph::getNumAllocatedEntriesInGlobalRow");
272  return graph_->getNumAllocatedEntriesInGlobalRow(globalRow);
273 }
274 
275 template <class LocalOrdinal, class GlobalOrdinal, class Node>
277  XPETRA_MONITOR("TpetraCrsGraph::getNumAllocatedEntriesInLocalRow");
278  return graph_->getNumAllocatedEntriesInLocalRow(localRow);
279 }
280 
281 template <class LocalOrdinal, class GlobalOrdinal, class Node>
283  XPETRA_MONITOR("TpetraCrsGraph::getGlobalMaxNumRowEntries");
284  return graph_->getGlobalMaxNumRowEntries();
285 }
286 
287 template <class LocalOrdinal, class GlobalOrdinal, class Node>
289  XPETRA_MONITOR("TpetraCrsGraph::getLocalMaxNumRowEntries");
290  return graph_->getLocalMaxNumRowEntries();
291 }
292 
293 template <class LocalOrdinal, class GlobalOrdinal, class Node>
295  XPETRA_MONITOR("TpetraCrsGraph::hasColMap");
296  return graph_->hasColMap();
297 }
298 
299 template <class LocalOrdinal, class GlobalOrdinal, class Node>
301  XPETRA_MONITOR("TpetraCrsGraph::isLocallyIndexed");
302  return graph_->isLocallyIndexed();
303 }
304 
305 template <class LocalOrdinal, class GlobalOrdinal, class Node>
307  XPETRA_MONITOR("TpetraCrsGraph::isGloballyIndexed");
308  return graph_->isGloballyIndexed();
309 }
310 
311 template <class LocalOrdinal, class GlobalOrdinal, class Node>
313  XPETRA_MONITOR("TpetraCrsGraph::isFillComplete");
314  return graph_->isFillComplete();
315 }
316 
317 template <class LocalOrdinal, class GlobalOrdinal, class Node>
319  XPETRA_MONITOR("TpetraCrsGraph::isStorageOptimized");
320  return graph_->isStorageOptimized();
321 }
322 
323 template <class LocalOrdinal, class GlobalOrdinal, class Node>
324 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {
325  XPETRA_MONITOR("TpetraCrsGraph::getGlobalRowView");
326  typename Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>::global_inds_host_view_type indices;
327  graph_->getGlobalRowView(GlobalRow, indices);
328  Indices = ArrayView<const GlobalOrdinal>(indices.data(), indices.extent(0));
329 }
330 
331 template <class LocalOrdinal, class GlobalOrdinal, class Node>
332 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &Indices) const {
333  XPETRA_MONITOR("TpetraCrsGraph::getLocalRowView");
334  typename Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>::local_inds_host_view_type indices;
335  graph_->getLocalRowView(LocalRow, indices);
336  Indices = ArrayView<const LocalOrdinal>(indices.data(), indices.extent(0));
337 }
338 
339 template <class LocalOrdinal, class GlobalOrdinal, class Node>
340 #if KOKKOS_VERSION >= 40799
342 #else
344 #endif
345  return getTpetra_CrsGraph()->getLocalGraphHost();
346 }
347 
348 template <class LocalOrdinal, class GlobalOrdinal, class Node>
350  return getTpetra_CrsGraph()->getLocalGraphDevice();
351 }
352 
353 template <class LocalOrdinal, class GlobalOrdinal, class Node>
354 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getLocalDiagOffsets(const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const {
355  getTpetra_CrsGraph()->getLocalDiagOffsets(offsets);
356 }
357 
358 template <class LocalOrdinal, class GlobalOrdinal, class Node>
360  // mfh 07 May 2018: See GitHub Issue #2565.
361  graph_->computeGlobalConstants();
362 }
363 
364 template <class LocalOrdinal, class GlobalOrdinal, class Node>
366  XPETRA_MONITOR("TpetraCrsGraph::description");
367  return graph_->description();
368 }
369 
370 template <class LocalOrdinal, class GlobalOrdinal, class Node>
371 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const {
372  XPETRA_MONITOR("TpetraCrsGraph::describe");
373  graph_->describe(out, verbLevel);
374 }
375 
376 template <class LocalOrdinal, class GlobalOrdinal, class Node>
378  XPETRA_MONITOR("TpetraCrsGraph::getNodeRowPtrs");
379  return Kokkos::Compat::persistingView(graph_->getLocalRowPtrsHost());
380 }
381 
382 template <class LocalOrdinal, class GlobalOrdinal, class Node>
383 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getMap() const {
384  XPETRA_MONITOR("TpetraCrsGraph::getMap");
385  return rcp(new TpetraMap(graph_->getMap()));
386 }
387 
388 template <class LocalOrdinal, class GlobalOrdinal, class Node>
390  const Import &importer, CombineMode CM) {
391  XPETRA_MONITOR("TpetraCrsGraph::doImport");
392 
393  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
394  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsGraph();
395  // graph_->doImport(toTpetraCrsGraph(source), *tImporter.getTpetra_Import(), toTpetra(CM));
396 
397  graph_->doImport(*v, toTpetra(importer), toTpetra(CM));
398 }
399 
400 template <class LocalOrdinal, class GlobalOrdinal, class Node>
402  const Import &importer, CombineMode CM) {
403  XPETRA_MONITOR("TpetraCrsGraph::doExport");
404 
405  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
406  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsGraph();
407  graph_->doExport(*v, toTpetra(importer), toTpetra(CM));
408 }
409 
410 template <class LocalOrdinal, class GlobalOrdinal, class Node>
412  const Export &exporter, CombineMode CM) {
413  XPETRA_MONITOR("TpetraCrsGraph::doImport");
414 
415  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
416  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsGraph();
417 
418  graph_->doImport(*v, toTpetra(exporter), toTpetra(CM));
419 }
420 
421 template <class LocalOrdinal, class GlobalOrdinal, class Node>
423  const Export &exporter, CombineMode CM) {
424  XPETRA_MONITOR("TpetraCrsGraph::doExport");
425 
426  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
427  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsGraph();
428 
429  graph_->doExport(*v, toTpetra(exporter), toTpetra(CM));
430 }
431 
432 template <class LocalOrdinal, class GlobalOrdinal, class Node>
433 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph)
434  : graph_(graph) {}
435 
436 template <class LocalOrdinal, class GlobalOrdinal, class Node>
437 RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getTpetra_CrsGraph() const { return graph_; }
438 
439 #ifdef HAVE_XPETRA_EPETRA
440 
441 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
442  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
443 
444 // specialization of TpetraCrsGraph for GO=LO=int
445 template <>
446 class TpetraCrsGraph<int, int, EpetraNode>
447  : public CrsGraph<int, int, EpetraNode> {
448  typedef int LocalOrdinal;
449  typedef int GlobalOrdinal;
450  typedef EpetraNode Node;
451 
452  // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
455 
456  public:
458 
459 
461  TpetraCrsGraph(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params = null) {
463  }
464 
466  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params = null) {
468  }
469 
471  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params = null) {
473  }
474 
476  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params = null) {
478  }
479 
499  TpetraCrsGraph(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap,
500  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap,
501  const typename local_graph_type::row_map_type &rowPointers,
502  const typename local_graph_type::entries_type::non_const_type &columnIndices,
503  const Teuchos::RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
506  "int",
507  typeid(EpetraNode).name());
508  }
509 
528  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
529  const Teuchos::RCP<const map_type> &colMap,
530  const local_graph_type &lclGraph,
531  const Teuchos::RCP<Teuchos::ParameterList> &params) {
534  "int",
535  typeid(EpetraNode).name());
536  }
537 
563  const Teuchos::RCP<const map_type> &rowMap,
564  const Teuchos::RCP<const map_type> &colMap,
565  const Teuchos::RCP<const map_type> &domainMap = Teuchos::null,
566  const Teuchos::RCP<const map_type> &rangeMap = Teuchos::null,
567  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
570  "int",
571  typeid(EpetraNode).name());
572  }
573 
575  virtual ~TpetraCrsGraph() {}
576 
578 
580 
581 
583  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {}
584 
586  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {}
587 
590 
592  void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {}
593 
595  void setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {}
596 
598  void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {}
599 
601 
603 
604 
606  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rangeMap, const RCP<ParameterList> &params = null) {}
607 
609  void fillComplete(const RCP<ParameterList> &params = null) {}
610 
612  void expertStaticFillComplete(const Teuchos::RCP<const map_type> &domainMap,
613  const Teuchos::RCP<const map_type> &rangeMap,
614  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > &importer = null,
615  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > &exporter = null,
616  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {}
617 
619 
621 
622 
624  RCP<const Comm<int> > getComm() const { return Teuchos::null; }
625 
627  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRowMap() const { return Teuchos::null; }
628 
630  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getColMap() const { return Teuchos::null; }
631 
633  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getDomainMap() const { return Teuchos::null; }
634 
636  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRangeMap() const { return Teuchos::null; }
637 
639  RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > getImporter() const { return Teuchos::null; }
640 
642  RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > getExporter() const { return Teuchos::null; }
643 
645  global_size_t getGlobalNumRows() const { return 0; }
646 
648  global_size_t getGlobalNumCols() const { return 0; }
649 
651  size_t getLocalNumRows() const { return 0; }
652 
654  size_t getLocalNumCols() const { return 0; }
655 
657  GlobalOrdinal getIndexBase() const { return 0; }
658 
660  global_size_t getGlobalNumEntries() const { return 0; }
661 
663  size_t getLocalNumEntries() const { return 0; }
664 
666  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
667 
669  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
670 
672  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
673 
675  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
676 
678  size_t getGlobalMaxNumRowEntries() const { return 0; }
679 
681  size_t getLocalMaxNumRowEntries() const { return 0; }
682 
684  bool hasColMap() const { return false; }
685 
687  bool isLocallyIndexed() const { return false; }
688 
690  bool isGloballyIndexed() const { return false; }
691 
693  bool isFillComplete() const { return false; }
694 
696  bool isStorageOptimized() const { return false; }
697 
699  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {}
700 
702  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {}
703 
706  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
707  "Epetra does not support Kokkos::StaticCrsGraph!");
708  TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
709  }
710 
713 
715 
717 
718 
720  std::string description() const { return std::string(""); }
721 
723  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
724 
726 
728 
729 
731  ArrayRCP<const size_t> getNodeRowPtrs() const { return Teuchos::ArrayRCP<const size_t>(); }
732 
734 
736  //{@
737 
739  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getMap() const { return Teuchos::null; }
740 
744 
748 
752 
756 
757  // @}
758 
760 
761 
763  TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph) {
765  }
766 
768  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsGraph() const { return Teuchos::null; }
769 
771 }; // TpetraCrsGraph class (specialization for LO=GO=int and NO=EpetraNode)
772 #endif
773 
774 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
775  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
776 
777 // specialization of TpetraCrsGraph for GO=long long and NO=EpetraNode
778 template <>
779 class TpetraCrsGraph<int, long long, EpetraNode>
780  : public CrsGraph<int, long long, EpetraNode> {
781  typedef int LocalOrdinal;
782  typedef long long GlobalOrdinal;
783  typedef EpetraNode Node;
784 
785  // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
788 
789  public:
791 
792 
794  TpetraCrsGraph(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params = null) {
796  }
797 
799  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params = null) {
801  }
802 
804  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params = null) {
806  }
807 
809  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params = null) {
811  }
812 
832  TpetraCrsGraph(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap,
833  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap,
834  const typename local_graph_type::row_map_type &rowPointers,
835  const typename local_graph_type::entries_type::non_const_type &columnIndices,
836  const Teuchos::RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
839  "int",
840  typeid(EpetraNode).name());
841  }
842 
861  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
862  const Teuchos::RCP<const map_type> &colMap,
863  const local_graph_type &lclGraph,
864  const Teuchos::RCP<Teuchos::ParameterList> &params) {
867  "int",
868  typeid(EpetraNode).name());
869  }
870 
896  const Teuchos::RCP<const map_type> &rowMap,
897  const Teuchos::RCP<const map_type> &colMap,
898  const Teuchos::RCP<const map_type> &domainMap = Teuchos::null,
899  const Teuchos::RCP<const map_type> &rangeMap = Teuchos::null,
900  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
903  "int",
904  typeid(EpetraNode).name());
905  }
906 
926  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
927  const Teuchos::RCP<const map_type> &colMap,
928  const Teuchos::ArrayRCP<size_t> &rowPointers,
929  const Teuchos::ArrayRCP<LocalOrdinal> &columnIndices,
930  const Teuchos::RCP<Teuchos::ParameterList> &params) {
933  "int",
934  typeid(EpetraNode).name())
935  }
936 
938  virtual ~TpetraCrsGraph() {}
939 
941 
943 
944 
946  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {}
947 
949  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {}
950 
953 
955  void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {}
956 
958  void setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {}
959 
961  void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {}
962 
964 
966 
967 
969  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rangeMap, const RCP<ParameterList> &params = null) {}
970 
972  void fillComplete(const RCP<ParameterList> &params = null) {}
973 
975  void expertStaticFillComplete(const Teuchos::RCP<const map_type> &domainMap,
976  const Teuchos::RCP<const map_type> &rangeMap,
977  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > &importer = null,
978  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > &exporter = null,
979  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {}
980 
982 
984 
985 
987  RCP<const Comm<int> > getComm() const { return Teuchos::null; }
988 
990  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRowMap() const { return Teuchos::null; }
991 
993  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getColMap() const { return Teuchos::null; }
994 
996  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getDomainMap() const { return Teuchos::null; }
997 
999  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRangeMap() const { return Teuchos::null; }
1000 
1002  RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > getImporter() const { return Teuchos::null; }
1003 
1005  RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > getExporter() const { return Teuchos::null; }
1006 
1008  global_size_t getGlobalNumRows() const { return 0; }
1009 
1011  global_size_t getGlobalNumCols() const { return 0; }
1012 
1014  size_t getLocalNumRows() const { return 0; }
1015 
1017  size_t getLocalNumCols() const { return 0; }
1018 
1020  GlobalOrdinal getIndexBase() const { return 0; }
1021 
1023  global_size_t getGlobalNumEntries() const { return 0; }
1024 
1026  size_t getLocalNumEntries() const { return 0; }
1027 
1029  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1030 
1032  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1033 
1035  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1036 
1038  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1039 
1041  size_t getGlobalMaxNumRowEntries() const { return 0; }
1042 
1044  size_t getLocalMaxNumRowEntries() const { return 0; }
1045 
1047  bool hasColMap() const { return false; }
1048 
1050  bool isLocallyIndexed() const { return false; }
1051 
1053  bool isGloballyIndexed() const { return false; }
1054 
1056  bool isFillComplete() const { return false; }
1057 
1059  bool isStorageOptimized() const { return false; }
1060 
1062  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {}
1063 
1065  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {}
1066 
1068  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1069  "Epetra does not support Kokkos::StaticCrsGraph!");
1070  TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
1071  }
1072 
1073  void getLocalDiagOffsets(const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const {
1074  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1075  "Epetra does not support getLocalDiagOffsets!");
1076  }
1077 
1078 #if KOKKOS_VERSION >= 40799
1079  typename local_graph_type::host_mirror_type getLocalGraphHost() const {
1080  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1081  "Epetra does not support Kokkos::StaticCrsGraph!");
1082  TEUCHOS_UNREACHABLE_RETURN((local_graph_type::host_mirror_type()));
1083  }
1084 #else
1085  typename local_graph_type::HostMirror getLocalGraphHost() const {
1086  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1087  "Epetra does not support Kokkos::StaticCrsGraph!");
1088  TEUCHOS_UNREACHABLE_RETURN((local_graph_type::HostMirror()));
1089  }
1090 #endif
1091 
1094 
1096 
1098 
1099 
1101  std::string description() const { return std::string(""); }
1102 
1104  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
1105 
1107 
1109 
1110 
1112  ArrayRCP<const size_t> getNodeRowPtrs() const { return Teuchos::ArrayRCP<const size_t>(); }
1113 
1115 
1117  //{@
1118 
1120  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getMap() const { return Teuchos::null; }
1121 
1125 
1129 
1133 
1137 
1138  // @}
1139 
1141 
1142 
1144  TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph) {
1146  }
1147 
1149  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsGraph() const { return Teuchos::null; }
1150 
1152 }; // TpetraCrsGraph class (specialization for GO=long long and NO=EpetraNode)
1153 #endif
1154 
1155 #endif // HAVE_XPETRA_EPETRA
1156 
1157 } // namespace Xpetra
1158 #endif // XPETRA_TPETRACRSGRAPH_DEF_HPP
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying column Map and fixed number of entries for each row.
TpetraCrsGraph< LocalOrdinal, GlobalOrdinal, Node > TpetraCrsGraphClass
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra graph.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null)
Constructor specifying (possibly different) number of entries in each row.
TpetraCrsGraph(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const typename local_graph_type::row_map_type &rowPointers, const typename local_graph_type::entries_type::non_const_type &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import &importer, CombineMode CM)
Export.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
TpetraCrsGraph(const local_graph_type &lclGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column, domain and range maps, and a local (sorted) graph, which the resulting...
KokkosSparse::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_type
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra graph.
local_graph_type::HostMirror getLocalGraphHost() const
Access the local KokkosSparse::StaticCrsGraph data for host use.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
RCP< const Map > getDomainMap() const
Returns the Map associated with the domain of this graph.
TpetraCrsGraph(const local_graph_type &lclGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column, domain and range maps, and a local (sorted) graph, which the resulting...
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null)
Constructor specifying (possibly different) number of entries in each row.
TpetraCrsGraph< LocalOrdinal, GlobalOrdinal, Node > TpetraCrsGraphClass
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null)
Constructor specifying column Map and number of entries in each row.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const Import > &importer=Teuchos::null, const Teuchos::RCP< const Export > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
RCP< const Map > getColMap() const
Returns the Map that describes the column distribution in this graph.
local_graph_type::HostMirror getLocalGraphHost() const
Get the local graph.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
void computeGlobalConstants()
Force the computation of global constants if we don&#39;t have them.
Exception throws to report errors in the internal logical of the program.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
bool isStorageOptimized() const
Returns true if storage has been optimized.
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.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
RCP< const Import > getImporter() const
Returns the importer associated with this graph.
std::string description() const
Return a simple one-line description of this object.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
RCP< const Comm< int > > getComm() const
Returns the communicator.
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.
TpetraCrsGraph(const RCP< const Map > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
TpetraCrsGraph(const Teuchos::RCP< Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
TpetraCrsGraph constructor to wrap a Tpetra::CrsGraph object.
RCP< const Export > getExporter() const
Returns the exporter associated with this graph.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=null, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
Expert version of fillComplete.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import &importer, CombineMode CM)
Import.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
bool isStorageOptimized() const
Returns true if storage has been optimized.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
Teuchos::RCP< const Map > getMap() const
Implements DistObject interface.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=null, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
Expert version of fillComplete.
bool hasColMap() const
Whether the graph has a column Map.
local_graph_type getLocalGraph() const
Access the local KokkosSparse::StaticCrsGraph data.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
local_graph_type getLocalGraphDevice() const
Access the local KokkosSparse::StaticCrsGraph data for device use.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
TpetraCrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const local_graph_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views...
virtual ~TpetraCrsGraph()
Destructor.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
size_t global_size_t
Global size_t object.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
TpetraCrsGraph(const Teuchos::RCP< Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
TpetraCrsGraph constructor to wrap a Tpetra::CrsGraph object.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
bool hasColMap() const
Whether the graph has a column Map.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
void getLocalDiagOffsets(const Kokkos::View< size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged > &offsets) const
Get offsets of the diagonal entries in the matrix.
bool hasColMap() const
Whether the graph has a column Map.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
void fillComplete(const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying column Map and fixed number of entries for each row.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
void computeGlobalConstants()
Dummy implementation for computeGlobalConstants.
TpetraCrsGraph(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const typename local_graph_type::row_map_type &rowPointers, const typename local_graph_type::entries_type::non_const_type &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
CombineMode
Xpetra::Combine Mode enumerable type.
#define XPETRA_MONITOR(funcName)
RCP< const Comm< int > > getComm() const
Returns the communicator.
void getLocalDiagOffsets(const Kokkos::View< size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged > &offsets) const
TpetraCrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< LocalOrdinal > &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
std::string description() const
Return a simple one-line description of this object.
TpetraCrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const local_graph_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views...
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
std::string description() const
Return a simple one-line description of this object.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
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.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null)
Constructor specifying column Map and number of entries in each row.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
RCP< const Map > getRowMap() const
Returns the Map that describes the row distribution in this graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
RCP< const Map > getRangeMap() const
Returns the Map associated with the domain of this graph.
RCP< const Comm< int > > getComm() const
Returns the communicator.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
void computeGlobalConstants()
Dummy implementation for computeGlobalConstants.
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.