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 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_TPETRACRSGRAPH_DEF_HPP
47 #define XPETRA_TPETRACRSGRAPH_DEF_HPP
49 #include "Xpetra_Exceptions.hpp"
50 
51 #include "Tpetra_CrsGraph.hpp"
52 
53 #include "Xpetra_CrsGraph.hpp"
55 #include "Xpetra_Utils.hpp"
56 #include "Xpetra_TpetraMap.hpp"
57 #include "Xpetra_TpetraImport.hpp"
58 #include "Xpetra_TpetraExport.hpp"
59 
60 namespace Xpetra {
61 
62 template <class LocalOrdinal, class GlobalOrdinal, class Node>
63 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params)
64  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), maxNumEntriesPerRow, params))) {}
65 
66 template <class LocalOrdinal, class GlobalOrdinal, class Node>
67 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const RCP<const Map> &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params)
68  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), NumEntriesPerRowToAlloc(), params))) {}
69 
70 template <class LocalOrdinal, class GlobalOrdinal, class Node>
71 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const RCP<const Map> &rowMap, const RCP<const Map> &colMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params)
72  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), maxNumEntriesPerRow, params))) {}
73 
74 template <class LocalOrdinal, class GlobalOrdinal, class Node>
75 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)
76  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), NumEntriesPerRowToAlloc(), params))) {}
77 
78 template <class LocalOrdinal, class GlobalOrdinal, class Node>
80  TpetraCrsGraph(const Teuchos::RCP<const CrsGraph> &sourceGraph,
81  const Import &importer,
82  const Teuchos::RCP<const Map> &domainMap,
83  const Teuchos::RCP<const Map> &rangeMap,
84  const Teuchos::RCP<Teuchos::ParameterList> &params) {
85  typedef Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> MyTpetraCrsGraph;
86  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, *sourceGraph, tSourceGraph, "Xpetra::TpetraCrsMatrix constructor only accepts Xpetra::TpetraCrsMatrix as the input argument."); // TODO: remove and use toTpetra()
87  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSourceGraph.getTpetra_CrsGraph();
88 
89  RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > myDomainMap = domainMap != Teuchos::null ? toTpetra(domainMap) : Teuchos::null;
90  RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > myRangeMap = rangeMap != Teuchos::null ? toTpetra(rangeMap) : Teuchos::null;
91  graph_ = Tpetra::importAndFillCompleteCrsGraph<MyTpetraCrsGraph>(v, toTpetra(importer), myDomainMap, myRangeMap, params);
92  bool restrictComm = false;
93  if (!params.is_null()) restrictComm = params->get("Restrict Communicator", restrictComm);
94  if (restrictComm && graph_->getRowMap().is_null()) graph_ = Teuchos::null;
95 }
96 
97 template <class LocalOrdinal, class GlobalOrdinal, class Node>
99  TpetraCrsGraph(const Teuchos::RCP<const Map> &rowMap,
100  const Teuchos::RCP<const Map> &colMap,
101  const typename local_graph_type::row_map_type &rowPointers,
102  const typename local_graph_type::entries_type::non_const_type &columnIndices,
103  const Teuchos::RCP<Teuchos::ParameterList> &plist)
104  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), rowPointers, columnIndices, plist))) {}
105 
106 template <class LocalOrdinal, class GlobalOrdinal, class Node>
108  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
109  const Teuchos::RCP<const map_type> &colMap,
110  const local_graph_type &lclGraph,
111  const Teuchos::RCP<Teuchos::ParameterList> &params)
112  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), lclGraph, params))) {}
113 
114 template <class LocalOrdinal, class GlobalOrdinal, class Node>
117  const Teuchos::RCP<const map_type> &rowMap,
118  const Teuchos::RCP<const map_type> &colMap,
119  const Teuchos::RCP<const map_type> &domainMap,
120  const Teuchos::RCP<const map_type> &rangeMap,
121  const Teuchos::RCP<Teuchos::ParameterList> &params)
122  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(lclGraph, toTpetra(rowMap), toTpetra(colMap), toTpetra(domainMap), toTpetra(rangeMap), params))) {}
123 
124 template <class LocalOrdinal, class GlobalOrdinal, class Node>
126  TpetraCrsGraph(const Teuchos::RCP<const Map> &rowMap,
127  const Teuchos::RCP<const Map> &colMap,
128  const Teuchos::ArrayRCP<size_t> &rowPointers,
129  const Teuchos::ArrayRCP<LocalOrdinal> &columnIndices,
130  const Teuchos::RCP<Teuchos::ParameterList> &params)
131  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), rowPointers, columnIndices, params))) {}
132 
133 template <class LocalOrdinal, class GlobalOrdinal, class Node>
135 
136 template <class LocalOrdinal, class GlobalOrdinal, class Node>
137 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {
138  XPETRA_MONITOR("TpetraCrsGraph::insertGlobalIndices");
139  graph_->insertGlobalIndices(globalRow, indices);
140 }
141 
142 template <class LocalOrdinal, class GlobalOrdinal, class Node>
143 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {
144  XPETRA_MONITOR("TpetraCrsGraph::insertLocalIndices");
145  graph_->insertLocalIndices(localRow, indices);
146 }
147 
148 template <class LocalOrdinal, class GlobalOrdinal, class Node>
150  XPETRA_MONITOR("TpetraCrsGraph::removeLocalIndices");
151  graph_->removeLocalIndices(localRow);
152 }
153 
154 template <class LocalOrdinal, class GlobalOrdinal, class Node>
156  allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {
157  rowptr.resize(getLocalNumRows() + 1);
158  colind.resize(numNonZeros);
159 }
160 
161 template <class LocalOrdinal, class GlobalOrdinal, class Node>
163  setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {
164  graph_->setAllIndices(rowptr, colind);
165 }
166 
167 template <class LocalOrdinal, class GlobalOrdinal, class Node>
169  getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {
170  rowptr = Kokkos::Compat::persistingView(graph_->getLocalRowPtrsHost());
171  colind = Kokkos::Compat::persistingView(graph_->getLocalIndicesHost());
172 }
173 
174 template <class LocalOrdinal, class GlobalOrdinal, class Node>
175 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::fillComplete(const RCP<const Map> &domainMap, const RCP<const Map> &rangeMap, const RCP<ParameterList> &params) {
176  XPETRA_MONITOR("TpetraCrsGraph::fillComplete");
177  graph_->fillComplete(toTpetra(domainMap), toTpetra(rangeMap), params);
178 }
179 
180 template <class LocalOrdinal, class GlobalOrdinal, class Node>
182  XPETRA_MONITOR("TpetraCrsGraph::fillComplete");
183  graph_->fillComplete(params);
184 }
185 
186 template <class LocalOrdinal, class GlobalOrdinal, class Node>
188  expertStaticFillComplete(const Teuchos::RCP<const map_type> &domainMap,
189  const Teuchos::RCP<const map_type> &rangeMap,
190  const Teuchos::RCP<const Import> &importer,
191  const Teuchos::RCP<const Export> &exporter,
192  const Teuchos::RCP<Teuchos::ParameterList> &params) {
193  XPETRA_MONITOR("TpetraCrsGraph::expertStaticFillComplete");
194  RCP<const Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node> > myImport;
195  RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node> > myExport;
196 
197  if (importer != Teuchos::null) {
198  XPETRA_DYNAMIC_CAST(const TpetraImportClass, *importer, tImporter, "Xpetra::TpetraCrsGraph::expertStaticFillComplete only accepts Xpetra::TpetraImport.");
199  myImport = tImporter.getTpetra_Import();
200  }
201  if (exporter != Teuchos::null) {
202  XPETRA_DYNAMIC_CAST(const TpetraExportClass, *exporter, tExporter, "Xpetra::TpetraCrsGraph::expertStaticFillComplete only accepts Xpetra::TpetraExport.");
203  myExport = tExporter.getTpetra_Export();
204  }
205 
206  graph_->expertStaticFillComplete(toTpetra(domainMap), toTpetra(rangeMap), myImport, myExport, params);
207 }
208 
209 template <class LocalOrdinal, class GlobalOrdinal, class Node>
211  XPETRA_MONITOR("TpetraCrsGraph::getComm");
212  return graph_->getComm();
213 }
214 
215 template <class LocalOrdinal, class GlobalOrdinal, class Node>
216 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getRowMap() const {
217  XPETRA_MONITOR("TpetraCrsGraph::getRowMap");
218  return toXpetra(graph_->getRowMap());
219 }
220 
221 template <class LocalOrdinal, class GlobalOrdinal, class Node>
222 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getColMap() const {
223  XPETRA_MONITOR("TpetraCrsGraph::getColMap");
224  return toXpetra(graph_->getColMap());
225 }
226 
227 template <class LocalOrdinal, class GlobalOrdinal, class Node>
228 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getDomainMap() const {
229  XPETRA_MONITOR("TpetraCrsGraph::getDomainMap");
230  return toXpetra(graph_->getDomainMap());
231 }
232 
233 template <class LocalOrdinal, class GlobalOrdinal, class Node>
234 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getRangeMap() const {
235  XPETRA_MONITOR("TpetraCrsGraph::getRangeMap");
236  return toXpetra(graph_->getRangeMap());
237 }
238 
239 template <class LocalOrdinal, class GlobalOrdinal, class Node>
240 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getImporter() const {
241  XPETRA_MONITOR("TpetraCrsGraph::getImporter");
242  return toXpetra(graph_->getImporter());
243 }
244 
245 template <class LocalOrdinal, class GlobalOrdinal, class Node>
246 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getExporter() const {
247  XPETRA_MONITOR("TpetraCrsGraph::getExporter");
248  return toXpetra(graph_->getExporter());
249 }
250 
251 template <class LocalOrdinal, class GlobalOrdinal, class Node>
253  XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumRows");
254  return graph_->getGlobalNumRows();
255 }
256 
257 template <class LocalOrdinal, class GlobalOrdinal, class Node>
259  XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumCols");
260  return graph_->getGlobalNumCols();
261 }
262 
263 template <class LocalOrdinal, class GlobalOrdinal, class Node>
265  XPETRA_MONITOR("TpetraCrsGraph::getLocalNumRows");
266  return graph_->getLocalNumRows();
267 }
268 
269 template <class LocalOrdinal, class GlobalOrdinal, class Node>
271  XPETRA_MONITOR("TpetraCrsGraph::getLocalNumCols");
272  return graph_->getLocalNumCols();
273 }
274 
275 template <class LocalOrdinal, class GlobalOrdinal, class Node>
277  XPETRA_MONITOR("TpetraCrsGraph::getIndexBase");
278  return graph_->getIndexBase();
279 }
280 
281 template <class LocalOrdinal, class GlobalOrdinal, class Node>
283  XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumEntries");
284  return graph_->getGlobalNumEntries();
285 }
286 
287 template <class LocalOrdinal, class GlobalOrdinal, class Node>
289  XPETRA_MONITOR("TpetraCrsGraph::getLocalNumEntries");
290  return graph_->getLocalNumEntries();
291 }
292 
293 template <class LocalOrdinal, class GlobalOrdinal, class Node>
295  XPETRA_MONITOR("TpetraCrsGraph::getNumEntriesInGlobalRow");
296  return graph_->getNumEntriesInGlobalRow(globalRow);
297 }
298 
299 template <class LocalOrdinal, class GlobalOrdinal, class Node>
301  XPETRA_MONITOR("TpetraCrsGraph::getNumEntriesInLocalRow");
302  return graph_->getNumEntriesInLocalRow(localRow);
303 }
304 
305 template <class LocalOrdinal, class GlobalOrdinal, class Node>
307  XPETRA_MONITOR("TpetraCrsGraph::getNumAllocatedEntriesInGlobalRow");
308  return graph_->getNumAllocatedEntriesInGlobalRow(globalRow);
309 }
310 
311 template <class LocalOrdinal, class GlobalOrdinal, class Node>
313  XPETRA_MONITOR("TpetraCrsGraph::getNumAllocatedEntriesInLocalRow");
314  return graph_->getNumAllocatedEntriesInLocalRow(localRow);
315 }
316 
317 template <class LocalOrdinal, class GlobalOrdinal, class Node>
319  XPETRA_MONITOR("TpetraCrsGraph::getGlobalMaxNumRowEntries");
320  return graph_->getGlobalMaxNumRowEntries();
321 }
322 
323 template <class LocalOrdinal, class GlobalOrdinal, class Node>
325  XPETRA_MONITOR("TpetraCrsGraph::getLocalMaxNumRowEntries");
326  return graph_->getLocalMaxNumRowEntries();
327 }
328 
329 template <class LocalOrdinal, class GlobalOrdinal, class Node>
331  XPETRA_MONITOR("TpetraCrsGraph::hasColMap");
332  return graph_->hasColMap();
333 }
334 
335 template <class LocalOrdinal, class GlobalOrdinal, class Node>
337  XPETRA_MONITOR("TpetraCrsGraph::isLocallyIndexed");
338  return graph_->isLocallyIndexed();
339 }
340 
341 template <class LocalOrdinal, class GlobalOrdinal, class Node>
343  XPETRA_MONITOR("TpetraCrsGraph::isGloballyIndexed");
344  return graph_->isGloballyIndexed();
345 }
346 
347 template <class LocalOrdinal, class GlobalOrdinal, class Node>
349  XPETRA_MONITOR("TpetraCrsGraph::isFillComplete");
350  return graph_->isFillComplete();
351 }
352 
353 template <class LocalOrdinal, class GlobalOrdinal, class Node>
355  XPETRA_MONITOR("TpetraCrsGraph::isStorageOptimized");
356  return graph_->isStorageOptimized();
357 }
358 
359 template <class LocalOrdinal, class GlobalOrdinal, class Node>
360 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {
361  XPETRA_MONITOR("TpetraCrsGraph::getGlobalRowView");
362  typename Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>::global_inds_host_view_type indices;
363  graph_->getGlobalRowView(GlobalRow, indices);
364  Indices = ArrayView<const GlobalOrdinal>(indices.data(), indices.extent(0));
365 }
366 
367 template <class LocalOrdinal, class GlobalOrdinal, class Node>
368 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &Indices) const {
369  XPETRA_MONITOR("TpetraCrsGraph::getLocalRowView");
370  typename Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>::local_inds_host_view_type indices;
371  graph_->getLocalRowView(LocalRow, indices);
372  Indices = ArrayView<const LocalOrdinal>(indices.data(), indices.extent(0));
373 }
374 
375 template <class LocalOrdinal, class GlobalOrdinal, class Node>
377  return getTpetra_CrsGraph()->getLocalGraphHost();
378 }
379 
380 template <class LocalOrdinal, class GlobalOrdinal, class Node>
382  return getTpetra_CrsGraph()->getLocalGraphDevice();
383 }
384 
385 template <class LocalOrdinal, class GlobalOrdinal, class Node>
386 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getLocalDiagOffsets(const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const {
387  getTpetra_CrsGraph()->getLocalDiagOffsets(offsets);
388 }
389 
390 template <class LocalOrdinal, class GlobalOrdinal, class Node>
392  // mfh 07 May 2018: See GitHub Issue #2565.
393  graph_->computeGlobalConstants();
394 }
395 
396 template <class LocalOrdinal, class GlobalOrdinal, class Node>
398  XPETRA_MONITOR("TpetraCrsGraph::description");
399  return graph_->description();
400 }
401 
402 template <class LocalOrdinal, class GlobalOrdinal, class Node>
403 void TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const {
404  XPETRA_MONITOR("TpetraCrsGraph::describe");
405  graph_->describe(out, verbLevel);
406 }
407 
408 template <class LocalOrdinal, class GlobalOrdinal, class Node>
410  XPETRA_MONITOR("TpetraCrsGraph::getNodeRowPtrs");
411  return Kokkos::Compat::persistingView(graph_->getLocalRowPtrsHost());
412 }
413 
414 template <class LocalOrdinal, class GlobalOrdinal, class Node>
415 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getMap() const {
416  XPETRA_MONITOR("TpetraCrsGraph::getMap");
417  return rcp(new TpetraMap(graph_->getMap()));
418 }
419 
420 template <class LocalOrdinal, class GlobalOrdinal, class Node>
422  const Import &importer, CombineMode CM) {
423  XPETRA_MONITOR("TpetraCrsGraph::doImport");
424 
425  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
426  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsGraph();
427  // graph_->doImport(toTpetraCrsGraph(source), *tImporter.getTpetra_Import(), toTpetra(CM));
428 
429  graph_->doImport(*v, toTpetra(importer), toTpetra(CM));
430 }
431 
432 template <class LocalOrdinal, class GlobalOrdinal, class Node>
434  const Import &importer, CombineMode CM) {
435  XPETRA_MONITOR("TpetraCrsGraph::doExport");
436 
437  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
438  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsGraph();
439  graph_->doExport(*v, toTpetra(importer), toTpetra(CM));
440 }
441 
442 template <class LocalOrdinal, class GlobalOrdinal, class Node>
444  const Export &exporter, CombineMode CM) {
445  XPETRA_MONITOR("TpetraCrsGraph::doImport");
446 
447  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
448  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsGraph();
449 
450  graph_->doImport(*v, toTpetra(exporter), toTpetra(CM));
451 }
452 
453 template <class LocalOrdinal, class GlobalOrdinal, class Node>
455  const Export &exporter, CombineMode CM) {
456  XPETRA_MONITOR("TpetraCrsGraph::doExport");
457 
458  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments."); // TODO: remove and use toTpetra()
459  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsGraph();
460 
461  graph_->doExport(*v, toTpetra(exporter), toTpetra(CM));
462 }
463 
464 template <class LocalOrdinal, class GlobalOrdinal, class Node>
465 TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph)
466  : graph_(graph) {}
467 
468 template <class LocalOrdinal, class GlobalOrdinal, class Node>
469 RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>::getTpetra_CrsGraph() const { return graph_; }
470 
471 #ifdef HAVE_XPETRA_EPETRA
472 
473 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
474  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
475 
476 // specialization of TpetraCrsGraph for GO=LO=int
477 template <>
478 class TpetraCrsGraph<int, int, EpetraNode>
479  : public CrsGraph<int, int, EpetraNode> {
480  typedef int LocalOrdinal;
481  typedef int GlobalOrdinal;
482  typedef EpetraNode Node;
483 
484  // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
487 
488  public:
490 
491 
493  TpetraCrsGraph(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params = null) {
495  }
496 
498  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params = null) {
500  }
501 
503  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) {
505  }
506 
508  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) {
510  }
511 
531  TpetraCrsGraph(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap,
532  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap,
533  const typename local_graph_type::row_map_type &rowPointers,
534  const typename local_graph_type::entries_type::non_const_type &columnIndices,
535  const Teuchos::RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
538  "int",
539  typeid(EpetraNode).name());
540  }
541 
560  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
561  const Teuchos::RCP<const map_type> &colMap,
562  const local_graph_type &lclGraph,
563  const Teuchos::RCP<Teuchos::ParameterList> &params) {
566  "int",
567  typeid(EpetraNode).name());
568  }
569 
595  const Teuchos::RCP<const map_type> &rowMap,
596  const Teuchos::RCP<const map_type> &colMap,
597  const Teuchos::RCP<const map_type> &domainMap = Teuchos::null,
598  const Teuchos::RCP<const map_type> &rangeMap = Teuchos::null,
599  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
602  "int",
603  typeid(EpetraNode).name());
604  }
605 
607  virtual ~TpetraCrsGraph() {}
608 
610 
612 
613 
615  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {}
616 
618  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {}
619 
622 
624  void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {}
625 
627  void setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {}
628 
630  void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {}
631 
633 
635 
636 
638  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rangeMap, const RCP<ParameterList> &params = null) {}
639 
641  void fillComplete(const RCP<ParameterList> &params = null) {}
642 
644  void expertStaticFillComplete(const Teuchos::RCP<const map_type> &domainMap,
645  const Teuchos::RCP<const map_type> &rangeMap,
646  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > &importer = null,
647  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > &exporter = null,
648  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {}
649 
651 
653 
654 
656  RCP<const Comm<int> > getComm() const { return Teuchos::null; }
657 
659  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRowMap() const { return Teuchos::null; }
660 
662  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getColMap() const { return Teuchos::null; }
663 
665  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getDomainMap() const { return Teuchos::null; }
666 
668  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRangeMap() const { return Teuchos::null; }
669 
671  RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > getImporter() const { return Teuchos::null; }
672 
674  RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > getExporter() const { return Teuchos::null; }
675 
677  global_size_t getGlobalNumRows() const { return 0; }
678 
680  global_size_t getGlobalNumCols() const { return 0; }
681 
683  size_t getLocalNumRows() const { return 0; }
684 
686  size_t getLocalNumCols() const { return 0; }
687 
689  GlobalOrdinal getIndexBase() const { return 0; }
690 
692  global_size_t getGlobalNumEntries() const { return 0; }
693 
695  size_t getLocalNumEntries() const { return 0; }
696 
698  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
699 
701  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
702 
704  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
705 
707  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
708 
710  size_t getGlobalMaxNumRowEntries() const { return 0; }
711 
713  size_t getLocalMaxNumRowEntries() const { return 0; }
714 
716  bool hasColMap() const { return false; }
717 
719  bool isLocallyIndexed() const { return false; }
720 
722  bool isGloballyIndexed() const { return false; }
723 
725  bool isFillComplete() const { return false; }
726 
728  bool isStorageOptimized() const { return false; }
729 
731  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {}
732 
734  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {}
735 
738  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
739  "Epetra does not support Kokkos::StaticCrsGraph!");
740  TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
741  }
742 
745 
747 
749 
750 
752  std::string description() const { return std::string(""); }
753 
755  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
756 
758 
760 
761 
763  ArrayRCP<const size_t> getNodeRowPtrs() const { return Teuchos::ArrayRCP<const size_t>(); }
764 
766 
768  //{@
769 
771  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getMap() const { return Teuchos::null; }
772 
776 
780 
784 
788 
789  // @}
790 
792 
793 
795  TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph) {
797  }
798 
800  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsGraph() const { return Teuchos::null; }
801 
803 }; // TpetraCrsGraph class (specialization for LO=GO=int and NO=EpetraNode)
804 #endif
805 
806 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
807  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
808 
809 // specialization of TpetraCrsGraph for GO=long long and NO=EpetraNode
810 template <>
811 class TpetraCrsGraph<int, long long, EpetraNode>
812  : public CrsGraph<int, long long, EpetraNode> {
813  typedef int LocalOrdinal;
814  typedef long long GlobalOrdinal;
815  typedef EpetraNode Node;
816 
817  // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
820 
821  public:
823 
824 
826  TpetraCrsGraph(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<ParameterList> &params = null) {
828  }
829 
831  TpetraCrsGraph(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, const RCP<ParameterList> &params = null) {
833  }
834 
836  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) {
838  }
839 
841  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) {
843  }
844 
864  TpetraCrsGraph(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rowMap,
865  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &colMap,
866  const typename local_graph_type::row_map_type &rowPointers,
867  const typename local_graph_type::entries_type::non_const_type &columnIndices,
868  const Teuchos::RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
871  "int",
872  typeid(EpetraNode).name());
873  }
874 
893  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
894  const Teuchos::RCP<const map_type> &colMap,
895  const local_graph_type &lclGraph,
896  const Teuchos::RCP<Teuchos::ParameterList> &params) {
899  "int",
900  typeid(EpetraNode).name());
901  }
902 
928  const Teuchos::RCP<const map_type> &rowMap,
929  const Teuchos::RCP<const map_type> &colMap,
930  const Teuchos::RCP<const map_type> &domainMap = Teuchos::null,
931  const Teuchos::RCP<const map_type> &rangeMap = Teuchos::null,
932  const Teuchos::RCP<Teuchos::ParameterList> &params = Teuchos::null) {
935  "int",
936  typeid(EpetraNode).name());
937  }
938 
958  TpetraCrsGraph(const Teuchos::RCP<const map_type> &rowMap,
959  const Teuchos::RCP<const map_type> &colMap,
960  const Teuchos::ArrayRCP<size_t> &rowPointers,
961  const Teuchos::ArrayRCP<LocalOrdinal> &columnIndices,
962  const Teuchos::RCP<Teuchos::ParameterList> &params) {
965  "int",
966  typeid(EpetraNode).name())
967  }
968 
970  virtual ~TpetraCrsGraph() {}
971 
973 
975 
976 
978  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {}
979 
981  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {}
982 
985 
987  void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {}
988 
990  void setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {}
991 
993  void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {}
994 
996 
998 
999 
1001  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &rangeMap, const RCP<ParameterList> &params = null) {}
1002 
1004  void fillComplete(const RCP<ParameterList> &params = null) {}
1005 
1007  void expertStaticFillComplete(const Teuchos::RCP<const map_type> &domainMap,
1008  const Teuchos::RCP<const map_type> &rangeMap,
1009  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > &importer = null,
1010  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > &exporter = null,
1011  const Teuchos::RCP<Teuchos::ParameterList> &params = null) {}
1012 
1014 
1016 
1017 
1019  RCP<const Comm<int> > getComm() const { return Teuchos::null; }
1020 
1022  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRowMap() const { return Teuchos::null; }
1023 
1025  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getColMap() const { return Teuchos::null; }
1026 
1028  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getDomainMap() const { return Teuchos::null; }
1029 
1031  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRangeMap() const { return Teuchos::null; }
1032 
1034  RCP<const Import<LocalOrdinal, GlobalOrdinal, Node> > getImporter() const { return Teuchos::null; }
1035 
1037  RCP<const Export<LocalOrdinal, GlobalOrdinal, Node> > getExporter() const { return Teuchos::null; }
1038 
1040  global_size_t getGlobalNumRows() const { return 0; }
1041 
1043  global_size_t getGlobalNumCols() const { return 0; }
1044 
1046  size_t getLocalNumRows() const { return 0; }
1047 
1049  size_t getLocalNumCols() const { return 0; }
1050 
1052  GlobalOrdinal getIndexBase() const { return 0; }
1053 
1055  global_size_t getGlobalNumEntries() const { return 0; }
1056 
1058  size_t getLocalNumEntries() const { return 0; }
1059 
1061  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1062 
1064  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1065 
1067  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1068 
1070  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1071 
1073  size_t getGlobalMaxNumRowEntries() const { return 0; }
1074 
1076  size_t getLocalMaxNumRowEntries() const { return 0; }
1077 
1079  bool hasColMap() const { return false; }
1080 
1082  bool isLocallyIndexed() const { return false; }
1083 
1085  bool isGloballyIndexed() const { return false; }
1086 
1088  bool isFillComplete() const { return false; }
1089 
1091  bool isStorageOptimized() const { return false; }
1092 
1094  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {}
1095 
1097  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {}
1098 
1100  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1101  "Epetra does not support Kokkos::StaticCrsGraph!");
1102  TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
1103  }
1104 
1105  void getLocalDiagOffsets(const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const {
1106  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1107  "Epetra does not support getLocalDiagOffsets!");
1108  }
1109 
1110  typename local_graph_type::HostMirror getLocalGraphHost() const {
1111  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1112  "Epetra does not support Kokkos::StaticCrsGraph!");
1113  TEUCHOS_UNREACHABLE_RETURN((local_graph_type::HostMirror()));
1114  }
1115 
1118 
1120 
1122 
1123 
1125  std::string description() const { return std::string(""); }
1126 
1128  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
1129 
1131 
1133 
1134 
1136  ArrayRCP<const size_t> getNodeRowPtrs() const { return Teuchos::ArrayRCP<const size_t>(); }
1137 
1139 
1141  //{@
1142 
1144  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getMap() const { return Teuchos::null; }
1145 
1149 
1153 
1157 
1161 
1162  // @}
1163 
1165 
1166 
1168  TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph) {
1170  }
1171 
1173  RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsGraph() const { return Teuchos::null; }
1174 
1176 }; // TpetraCrsGraph class (specialization for GO=long long and NO=EpetraNode)
1177 #endif
1178 
1179 #endif // HAVE_XPETRA_EPETRA
1180 
1181 } // namespace Xpetra
1182 #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.
Kokkos::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_type
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...
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.