Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_EpetraCrsGraph.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_EPETRACRSGRAPH_HPP
47 #define XPETRA_EPETRACRSGRAPH_HPP
48 
49 /* this file is automatically generated - do not edit (see script/epetra.py) */
50 
52 #include "Xpetra_Exceptions.hpp"
53 
54 #include "Xpetra_CrsGraph.hpp"
55 
56 #include "Xpetra_EpetraExport.hpp"
57 #include "Xpetra_EpetraImport.hpp"
58 #include "Xpetra_EpetraMap.hpp"
59 #include "Xpetra_EpetraUtils.hpp"
60 
61 #include <Epetra_CrsGraph.h>
62 
63 #if defined(XPETRA_ENABLE_DEPRECATED_CODE)
64 #ifdef __GNUC__
65 #warning "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated."
66 #endif
67 #else
68 #error "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated."
69 #endif
70 
71 namespace Xpetra {
72 
73 // TODO: move that elsewhere
74 template <class GlobalOrdinal, class Node>
75 XPETRA_DEPRECATED RCP<const CrsGraph<int, GlobalOrdinal, Node>>
76 toXpetra(const Epetra_CrsGraph &graph);
77 
78 template <class GlobalOrdinal, class Node>
79 XPETRA_DEPRECATED const Epetra_CrsGraph &
80 toEpetra(const RCP<const CrsGraph<int, GlobalOrdinal, Node>> &graph);
81 
82 template <class GlobalOrdinal, class Node>
83 class XPETRA_DEPRECATED EpetraCrsGraphT
84  : public CrsGraph<int, GlobalOrdinal, Node> {
85  typedef int LocalOrdinal;
86 
89 
90 #ifdef HAVE_XPETRA_TPETRA
93  typedef typename node_type::execution_space execution_space;
94 #endif
95 
96  public:
98 
99  EpetraCrsGraphT(const RCP<const map_type> &rowMap, const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
101  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
102  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
103  }
104 
106  EpetraCrsGraphT(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
107  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
108  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
109  }
110 
112  EpetraCrsGraphT(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> &plist = null) {
113  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
114  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
115  }
116 
118  // Definition not in cpp, so comment out
119  EpetraCrsGraphT(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) {
120  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
121  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
122  }
123 
124  // Constructor for fused import
127  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
128  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
129  const RCP<Teuchos::ParameterList> &params = Teuchos::null) {
130  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
131  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
132  }
133 
134 #ifdef HAVE_XPETRA_TPETRA
137  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
138  const typename local_graph_type::row_map_type &rowPointers,
139  const typename local_graph_type::entries_type::non_const_type &columnIndices,
140  const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
141  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
142  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
143  }
144 
147  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
148  const local_graph_type &lclGraph,
149  const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
150  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
151  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
152  }
153 
156  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap,
157  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap,
158  const Teuchos::RCP<const map_type> &domainMap = Teuchos::null,
159  const Teuchos::RCP<const map_type> &rangeMap = Teuchos::null,
160  const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
161  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
162  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
163  }
164 #endif
165 
167  virtual ~EpetraCrsGraphT() {}
168 
170 
172 
173 
175  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {}
176 
178  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {}
179 
182 
184  void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {}
185 
187  void setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {}
188 
190  void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {}
191 
193 
195 
196 
198  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap, const RCP<ParameterList> &params = null) {}
199 
201  void fillComplete(const RCP<ParameterList> &params = null) {}
202 
204  void
206  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
207  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &importer =
208  Teuchos::null,
209  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> &exporter =
210  Teuchos::null,
211  const Teuchos::RCP<Teuchos::ParameterList> &params =
212  Teuchos::null) {}
213 
215 
217 
218 
220  RCP<const Comm<int>> getComm() const {
221  return Teuchos::null;
222  }
223 
225  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRowMap() const { return Teuchos::null; }
226 
228  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getColMap() const { return Teuchos::null; }
229 
231  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getDomainMap() const { return Teuchos::null; }
232 
234  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRangeMap() const { return Teuchos::null; }
235 
237  RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> getImporter() const { return Teuchos::null; }
238 
240  RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> getExporter() const { return Teuchos::null; }
241 
243  global_size_t getGlobalNumRows() const { return 0; }
244 
246  global_size_t getGlobalNumCols() const { return 0; }
247 
249  size_t getLocalNumRows() const { return 0; }
250 
252  size_t getLocalNumCols() const { return 0; }
253 
255  GlobalOrdinal getIndexBase() const { return 0; }
256 
258  global_size_t getGlobalNumEntries() const { return 0; }
259 
261  size_t getLocalNumEntries() const { return 0; }
262 
264  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
265 
267  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
268 
270  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
271 
273  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
274 
276  size_t getGlobalMaxNumRowEntries() const { return 0; }
277 
279  size_t getLocalMaxNumRowEntries() const { return 0; }
280 
282  bool hasColMap() const { return false; }
283 
285  bool isLocallyIndexed() const { return false; }
286 
288  bool isGloballyIndexed() const { return false; }
289 
291  bool isFillComplete() const { return false; }
292 
294  bool isStorageOptimized() const { return false; }
295 
297  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {}
298 
300  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {}
301 
302 #ifdef HAVE_XPETRA_TPETRA
303  typename local_graph_type::HostMirror getLocalGraphHost() const {
304  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
305  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
306  TEUCHOS_UNREACHABLE_RETURN((typename local_graph_type::HostMirror()));
307  }
308 #else
309 #ifdef __GNUC__
310 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
311 #endif
312 #endif
313 
314 #ifdef HAVE_XPETRA_TPETRA
316  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
317  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
318  TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
319  }
320 
321  void getLocalDiagOffsets(const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const {
322  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
323  "Epetra does not support getLocalDiagOffsets!");
324  }
325 #else
326 #ifdef __GNUC__
327 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
328 #endif
329 
330 #endif
331 
334 
336 
338 
339 
341  std::string description() const { return std::string(""); }
342 
344  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
345 
347 
349  //{@
350 
352  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getMap() const { return Teuchos::null; }
353 
357 
361 
365 
370 
372 
373 
375  EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph) {
376  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
377  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
378  }
379 
381  RCP<const Epetra_CrsGraph> getEpetra_CrsGraph() const { return Teuchos::null; }
382 
384 
385  private:
386 }; // EpetraCrsGraphT class
387 
388 // specialization on GO=int and Node=EpetraNode
389 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
390 template <>
392  : public virtual CrsGraph<int, int, EpetraNode> {
393  typedef int LocalOrdinal;
394  typedef int GlobalOrdinal;
395  typedef EpetraNode Node;
396 
399 
400 #ifdef HAVE_XPETRA_TPETRA
403  typedef typename node_type::execution_space execution_space;
404 #endif
405 
406  public:
408 
409 
411  EpetraCrsGraphT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap)
412  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), 0, false))) {}
413 
415  EpetraCrsGraphT(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null)
416  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), maxNumEntriesPerRow, true))) {}
417 
419  // Definition not in cpp, so comment out
420  // EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
421 
423  EpetraCrsGraphT(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> & /* plist */ = null)
424  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), maxNumEntriesPerRow, true))) {}
425 
427  // Definition not in cpp, so comment out
428  EpetraCrsGraphT(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) {
429  Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end()); // convert array of "size_t" to array of "int"
430  graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(), true));
431  }
432 
433  // Constructor for fused import
436  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap = Teuchos::null,
437  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap = Teuchos::null,
438  const RCP<Teuchos::ParameterList> &params = Teuchos::null) {
439  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, *sourceGraph, tSourceGraph, "Xpetra::EpetraCrsGraphT() only accepts Xpetra::EpetraCrsGraphT as input arguments.");
440  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
441  RCP<const Epetra_CrsGraph> eSourceGraph = tSourceGraph.getEpetra_CrsGraph();
442 
443  // NOTE: Unlike Tpetra, Epetra does not have a FusedTransfer for Graphs. So we do this the slow way
444  graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy, eSourceGraph->RowMap(), 0, false));
445  graph_->Import(*eSourceGraph, *tImporter.getEpetra_Import(), Insert);
446 
447  const Epetra_BlockMap &myDomainMap = domainMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(domainMap) : eSourceGraph->ColMap();
448  const Epetra_BlockMap &myRangeMap = rangeMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(rangeMap) : toEpetra<LocalOrdinal, Node>(importer.getTargetMap());
449 
450  graph_->FillComplete(myDomainMap, myRangeMap);
451  }
452 
453 #ifdef HAVE_XPETRA_TPETRA
454  EpetraCrsGraphT(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* rowMap */,
456  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* colMap */,
457  const typename local_graph_type::row_map_type & /* rowPointers */,
458  const typename local_graph_type::entries_type::non_const_type & /* columnIndices */,
459  const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null) {
460  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
461  "Epetra does not support CrsGraph constructors using Kokkos Views!");
462  }
463 
466  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* colMap */,
467  const local_graph_type & /* lclGraph */,
468  const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null) {
469  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
470  "Epetra does not support CrsGraph constructors using a local graph!");
471  }
472 
474  EpetraCrsGraphT(const local_graph_type & /* lclGraph */,
475  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* rowMap */,
476  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* colMap */,
477  const Teuchos::RCP<const map_type> & /* domainMap */ = Teuchos::null,
478  const Teuchos::RCP<const map_type> & /* rangeMap */ = Teuchos::null,
479  const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null) {
480  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
481  "Epetra does not support CrsGraph constructors using a local graph!");
482  }
483 #endif
484 
486  virtual ~EpetraCrsGraphT() {}
487 
489 
491 
492 
494  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {
495  XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
496 
497  GlobalOrdinal *indices_rawPtr = const_cast<GlobalOrdinal *>(indices.getRawPtr()); // there is no const in the Epetra interface :(
498  XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
499  }
500 
502  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {
503  XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
504 
505  int *indices_rawPtr = const_cast<int *>(indices.getRawPtr()); // there is no const in the Epetra interface :(
506  XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
507  }
508 
511  XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices");
512  graph_->RemoveMyIndices(localRow);
513  }
514 
516  //** \warning This is an expert-only routine and should not be called from user code. */
517  void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {
518  XPETRA_MONITOR("EpetraCrsGraphT::allocateAllIndies");
519 
520  // Row offsets
521  // Unfortunately, we cannot do this in the same manner as column indices
522  // and values (see below). The problem is that Tpetra insists on using
523  // size_t, and Epetra uses int internally. So we only resize here, and
524  // will need to copy in setAllValues
525  rowptr.resize(getLocalNumRows() + 1);
526 
527  int lowerOffset = 0;
528  bool ownMemory = false;
529 
530  // Column indices
531  // Extract, resize, set colind
532  Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
533  myColind.Resize(numNonZeros);
534  colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
535  }
536 
538  void setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {
539  XPETRA_MONITOR("EpetraCrsGraphT::setAllIndices");
540 
541  // Check sizes
542  TEUCHOS_TEST_FOR_EXCEPTION(Teuchos::as<size_t>(rowptr.size()) != getLocalNumRows() + 1, Xpetra::Exceptions::RuntimeError,
543  "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
544  if (colind.size() > 0) {
545  TEUCHOS_TEST_FOR_EXCEPTION(colind.getRawPtr() != graph_->ExpertExtractIndices().Values(), Xpetra::Exceptions::RuntimeError,
546  "An exception is thrown to let you know that you mismatched your pointers.");
547  }
548 
549  // We have to make a copy here, it is unavoidable
550  // See comments in allocateAllIndices
551  const size_t N = getLocalNumRows();
552 
553  Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
554  myRowptr.Resize(N + 1);
555  for (size_t i = 0; i < N + 1; i++)
556  myRowptr[i] = Teuchos::as<int>(rowptr[i]);
557  }
558 
560  void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {
561  XPETRA_MONITOR("EpetraCrsGraphT::getAllIndices");
562 
563  int lowerOffset = 0;
564  bool ownMemory = false;
565 
566  const size_t n = getLocalNumRows();
567  const size_t nnz = getLocalNumEntries();
568 
569  // Row offsets
570  // We have to make a copy here, it is unavoidable (see comments in allocateAllValues)
571  Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
572  rowptr.resize(n + 1);
573  for (size_t i = 0; i < n + 1; i++)
574  (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
575 
576  // Column indices
577  colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
578  }
579 
581 
583 
584 
586  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap, const RCP<ParameterList> &params = null) {
587  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
588 
589  graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
590  bool doOptimizeStorage = true;
591  if (params != null && params->get("Optimize Storage", true) == false) doOptimizeStorage = false;
592  if (doOptimizeStorage) graph_->OptimizeStorage();
593  }
594 
596  void fillComplete(const RCP<ParameterList> &params = null) {
597  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
598 
599  graph_->FillComplete();
600  bool doOptimizeStorage = true;
601  if (params != null && params->get("Optimize Storage", true) == false) doOptimizeStorage = false;
602  if (doOptimizeStorage) graph_->OptimizeStorage();
603  }
604 
606  void
608  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
609  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &importer =
610  Teuchos::null,
611  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> &exporter =
612  Teuchos::null,
613  const Teuchos::RCP<Teuchos::ParameterList> &params =
614  Teuchos::null) {
615  // Not optimized
616  graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
617  graph_->OptimizeStorage();
618  }
619 
621 
623 
624 
626  RCP<const Comm<int>> getComm() const {
627  XPETRA_MONITOR("EpetraCrsGraphT::getComm");
628  return toXpetra(graph_->Comm());
629  }
630 
632  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRowMap() const {
633  XPETRA_MONITOR("EpetraCrsGraphT::getRowMap");
634  return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
635  }
636 
638  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getColMap() const {
639  XPETRA_MONITOR("EpetraCrsGraphT::getColMap");
640  return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
641  }
642 
644  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getDomainMap() const {
645  XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap");
646  return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
647  }
648 
650  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRangeMap() const {
651  XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap");
652  return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
653  }
654 
656  RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> getImporter() const {
657  XPETRA_MONITOR("EpetraCrsGraphT::getImporter");
658  return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
659  }
660 
662  RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> getExporter() const {
663  XPETRA_MONITOR("EpetraCrsGraphT::getExporter");
664  return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
665  }
666 
669  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows");
670  return graph_->NumGlobalRows64();
671  }
672 
675  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols");
676  return graph_->NumGlobalCols64();
677  }
678 
680  size_t getLocalNumRows() const {
681  XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumRows");
682  return graph_->NumMyRows();
683  }
684 
686  size_t getLocalNumCols() const {
687  XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumCols");
688  return graph_->NumMyCols();
689  }
690 
693  XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase");
694  return (GlobalOrdinal)graph_->IndexBase64();
695  }
696 
699  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries");
700  return graph_->NumGlobalEntries64();
701  }
702 
704  size_t getLocalNumEntries() const {
705  XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumEntries");
706  return graph_->NumMyEntries();
707  }
708 
710  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const {
711  XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow");
712  return graph_->NumGlobalIndices(globalRow);
713  }
714 
716  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const {
717  XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow");
718  return graph_->NumMyIndices(localRow);
719  }
720 
723  XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
724  return graph_->NumAllocatedGlobalIndices(globalRow);
725  }
726 
729  XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
730  return graph_->NumAllocatedMyIndices(localRow);
731  }
732 
734  size_t getGlobalMaxNumRowEntries() const {
735  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries");
736  return graph_->GlobalMaxNumIndices();
737  }
738 
740  size_t getLocalMaxNumRowEntries() const {
741  XPETRA_MONITOR("EpetraCrsGraphT::getLocalMaxNumRowEntries");
742  return graph_->MaxNumIndices();
743  }
744 
746  bool hasColMap() const {
747  XPETRA_MONITOR("EpetraCrsGraphT::hasColMap");
748  return graph_->HaveColMap();
749  }
750 
752  bool isLocallyIndexed() const {
753  XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed");
754  return graph_->IndicesAreLocal();
755  }
756 
758  bool isGloballyIndexed() const {
759  XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed");
760  return graph_->IndicesAreGlobal();
761  }
762 
764  bool isFillComplete() const {
765  XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete");
766  return graph_->Filled();
767  }
768 
770  bool isStorageOptimized() const {
771  XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized");
772  return graph_->StorageOptimized();
773  }
774 
776  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {
777  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
778 
779  int numEntries;
780  GlobalOrdinal *eIndices;
781 
782  XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
783  if (numEntries == 0) {
784  eIndices = NULL;
785  } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
786 
787  Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
788  }
789 
791  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {
792  XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
793 
794  int numEntries;
795  int *eIndices;
796 
797  XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
798  if (numEntries == 0) {
799  eIndices = NULL;
800  } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
801 
802  indices = ArrayView<const int>(eIndices, numEntries);
803  }
804 
805 #ifdef HAVE_XPETRA_TPETRA
806  typename local_graph_type::HostMirror getLocalGraphHost() const {
807  RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(getEpetra_CrsGraph());
808 
809  using local_graph_type_host = typename local_graph_type::HostMirror;
810 
811  const int numRows = graph->NumMyRows();
812  const int nnz = graph->NumMyNonzeros();
813 
814  TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error, "Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
815  const int *rowptr = graph->ExpertExtractIndexOffset().Values();
816  int *colind = graph->ExpertExtractIndices().Values();
817 
818  // Transform int* rowptr array to size_type* array
819  typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing("local row map"), numRows + 1);
820  for (size_t i = 0; i < kokkosRowPtr.size(); i++)
821  kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
822 
823  // create Kokkos::Views
824  typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
825 
826  local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
827 
828  return localGraph;
829  }
830 
832  RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(getEpetra_CrsGraph());
833 
834  const int numRows = graph->NumMyRows();
835  const int nnz = graph->NumMyNonzeros();
836 
837  TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error, "Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
838  const int *rowptr = graph->ExpertExtractIndexOffset().Values();
839  int *colind = graph->ExpertExtractIndices().Values();
840 
841  // Transform int* rowptr array to size_type* array
842  typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing("local row map"), numRows + 1);
843  for (size_t i = 0; i < kokkosRowPtr.size(); i++)
844  kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
845 
846  // create Kokkos::Views
847  typename local_graph_type::entries_type kokkosColind(colind, nnz);
848 
849  local_graph_type localGraph = local_graph_type(kokkosColind, kokkosRowPtr);
850 
851  return localGraph;
852  }
853 
854  void getLocalDiagOffsets(const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const {
855  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
856  "Epetra does not support getLocalDiagOffsets!");
857  }
858 #else
859 #ifdef __GNUC__
860 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
861 #endif
862 #endif
863 
866 
868 
870 
871 
873  std::string description() const {
874  XPETRA_MONITOR("EpetraCrsGraphT::description");
875  return "NotImplemented";
876  }
877 
879  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel /* verbLevel */ = Teuchos::Describable::verbLevel_default) const {
880  XPETRA_MONITOR("EpetraCrsGraphT::describe");
881 
882  out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
883  const Epetra_BlockMap rowmap = graph_->RowMap();
884  if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
885  rowmap.Print(out);
886  graph_->Print(out);
887  }
888 
890 
892  //{@
893 
895  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getMap() const {
896  XPETRA_MONITOR("EpetraCrsGraphT::getMap");
897  return toXpetra<GlobalOrdinal, Node>(graph_->Map());
898  }
899 
903  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
904 
905  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
906  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
907 
908  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
909  int err = graph_->Import(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
910  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
911  }
912 
916  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
917 
918  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
919  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
920 
921  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
922  int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
923  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
924  }
925 
929  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
930 
931  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
932  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
933 
934  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
935  int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
936  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
937  }
938 
942  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
943 
944  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
945  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
946 
947  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
948  int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
949  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
950  }
952 
954 
955 
957  EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph)
958  : graph_(graph) {
959  TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
960  }
961 
963  RCP<const Epetra_CrsGraph> getEpetra_CrsGraph() const { return graph_; }
964 
966 
967  private:
968  RCP<Epetra_CrsGraph> graph_;
969 };
970 
971 #endif // specialization on Node=EpetraNode and GO=int
972 
973 // specialization on GO=long long and Node=EpetraNode
974 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
975 template <>
976 class EpetraCrsGraphT<long long, EpetraNode>
977  : public virtual CrsGraph<int, long long, EpetraNode> {
978  typedef int LocalOrdinal;
979  typedef long long GlobalOrdinal;
980  typedef EpetraNode Node;
981 
984 
985 #ifdef HAVE_XPETRA_TPETRA
988  typedef typename node_type::execution_space execution_space;
989 #endif
990 
991  public:
993 
994 
996  EpetraCrsGraphT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap)
997  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), 0, false))) {}
998 
1000  EpetraCrsGraphT(const RCP<const map_type> &rowMap, size_t maxNumEntriesPerRow, const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null)
1001  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), maxNumEntriesPerRow, true))) {}
1002 
1004  // Definition not in cpp, so comment out
1005  // EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
1006 
1008  EpetraCrsGraphT(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rowMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList> & /* plist */ = null)
1009  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), maxNumEntriesPerRow, true))) {}
1010 
1012  // Definition not in cpp, so comment out
1013  EpetraCrsGraphT(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) {
1014  Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end()); // convert array of "size_t" to array of "int"
1015  graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(), true));
1016  }
1017 
1018 #ifdef HAVE_XPETRA_TPETRA
1019  EpetraCrsGraphT(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* rowMap */,
1021  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* colMap */,
1022  const typename local_graph_type::row_map_type & /* rowPointers */,
1023  const typename local_graph_type::entries_type::non_const_type & /* columnIndices */,
1024  const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null) {
1025  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
1026  "Epetra does not support CrsGraph constructors using Kokkos Views!");
1027  }
1028 
1031  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* colMap */,
1032  const local_graph_type & /* lclGraph */,
1033  const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null) {
1034  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
1035  "Epetra does not support CrsGraph constructors using a local graph!");
1036  }
1037 
1039  EpetraCrsGraphT(const local_graph_type & /* lclGraph */,
1040  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* rowMap */,
1041  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> & /* colMap */,
1042  const Teuchos::RCP<const map_type> & /* domainMap */ = Teuchos::null,
1043  const Teuchos::RCP<const map_type> & /* rangeMap */ = Teuchos::null,
1044  const RCP<Teuchos::ParameterList> & /* plist */ = Teuchos::null) {
1045  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented,
1046  "Epetra does not support CrsGraph constructors using a local graph!");
1047  }
1048 #endif
1049 
1051  virtual ~EpetraCrsGraphT() {}
1052 
1054 
1056 
1057 
1059  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {
1060  XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
1061 
1062  GlobalOrdinal *indices_rawPtr = const_cast<GlobalOrdinal *>(indices.getRawPtr()); // there is no const in the Epetra interface :(
1063  XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
1064  }
1065 
1067  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView<const LocalOrdinal> &indices) {
1068  XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
1069 
1070  int *indices_rawPtr = const_cast<int *>(indices.getRawPtr()); // there is no const in the Epetra interface :(
1071  XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
1072  }
1073 
1076  XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices");
1077  graph_->RemoveMyIndices(localRow);
1078  }
1079 
1081  //** \warning This is an expert-only routine and should not be called from user code. */
1082  void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {
1083  XPETRA_MONITOR("EpetraCrsGraphT::allocateAllIndies");
1084 
1085  // Row offsets
1086  // Unfortunately, we cannot do this in the same manner as column indices
1087  // and values (see below). The problem is that Tpetra insists on using
1088  // size_t, and Epetra uses int internally. So we only resize here, and
1089  // will need to copy in setAllValues
1090  rowptr.resize(getLocalNumRows() + 1);
1091 
1092  int lowerOffset = 0;
1093  bool ownMemory = false;
1094 
1095  // Column indices
1096  // Extract, resize, set colind
1097  Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
1098  myColind.Resize(numNonZeros);
1099  colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1100  }
1101 
1103  void setAllIndices(const ArrayRCP<size_t> &rowptr, const ArrayRCP<LocalOrdinal> &colind) {
1104  XPETRA_MONITOR("EpetraCrsGraphT::setAllIndices");
1105 
1106  // Check sizes
1107  TEUCHOS_TEST_FOR_EXCEPTION(Teuchos::as<size_t>(rowptr.size()) != getLocalNumRows() + 1, Xpetra::Exceptions::RuntimeError,
1108  "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1109  if (colind.size() > 0) {
1110  TEUCHOS_TEST_FOR_EXCEPTION(colind.getRawPtr() != graph_->ExpertExtractIndices().Values(), Xpetra::Exceptions::RuntimeError,
1111  "An exception is thrown to let you know that you mismatched your pointers.");
1112  }
1113 
1114  // We have to make a copy here, it is unavoidable
1115  // See comments in allocateAllIndices
1116  const size_t N = getLocalNumRows();
1117 
1118  Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1119  myRowptr.Resize(N + 1);
1120  for (size_t i = 0; i < N + 1; i++)
1121  myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1122  }
1123 
1125  void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind) const {
1126  XPETRA_MONITOR("EpetraCrsGraphT::getAllIndices");
1127 
1128  int lowerOffset = 0;
1129  bool ownMemory = false;
1130 
1131  const size_t n = getLocalNumRows();
1132  const size_t nnz = getLocalNumEntries();
1133 
1134  // Row offsets
1135  // We have to make a copy here, it is unavoidable (see comments in allocateAllValues)
1136  Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1137  rowptr.resize(n + 1);
1138  for (size_t i = 0; i < n + 1; i++)
1139  (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1140 
1141  // Column indices
1142  colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1143  }
1144 
1146 
1148 
1149 
1151  void fillComplete(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &domainMap, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap, const RCP<ParameterList> &params = null) {
1152  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
1153 
1154  graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1155  bool doOptimizeStorage = true;
1156  if (params != null && params->get("Optimize Storage", true) == false) doOptimizeStorage = false;
1157  if (doOptimizeStorage) graph_->OptimizeStorage();
1158  }
1159 
1161  void fillComplete(const RCP<ParameterList> &params = null) {
1162  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
1163 
1164  graph_->FillComplete();
1165  bool doOptimizeStorage = true;
1166  if (params != null && params->get("Optimize Storage", true) == false) doOptimizeStorage = false;
1167  if (doOptimizeStorage) graph_->OptimizeStorage();
1168  }
1169 
1171  void
1173  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> &rangeMap,
1174  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> &importer =
1175  Teuchos::null,
1176  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> &exporter =
1177  Teuchos::null,
1178  const Teuchos::RCP<Teuchos::ParameterList> &params =
1179  Teuchos::null) {
1180  // Not optimized
1181  graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1182  graph_->OptimizeStorage();
1183  }
1184 
1186 
1188 
1189 
1191  RCP<const Comm<int>> getComm() const {
1192  XPETRA_MONITOR("EpetraCrsGraphT::getComm");
1193  return toXpetra(graph_->Comm());
1194  }
1195 
1197  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRowMap() const {
1198  XPETRA_MONITOR("EpetraCrsGraphT::getRowMap");
1199  return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
1200  }
1201 
1203  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getColMap() const {
1204  XPETRA_MONITOR("EpetraCrsGraphT::getColMap");
1205  return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
1206  }
1207 
1209  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getDomainMap() const {
1210  XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap");
1211  return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
1212  }
1213 
1215  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getRangeMap() const {
1216  XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap");
1217  return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
1218  }
1219 
1221  RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> getImporter() const {
1222  XPETRA_MONITOR("EpetraCrsGraphT::getImporter");
1223  return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
1224  }
1225 
1227  RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> getExporter() const {
1228  XPETRA_MONITOR("EpetraCrsGraphT::getExporter");
1229  return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
1230  }
1231 
1234  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows");
1235  return graph_->NumGlobalRows64();
1236  }
1237 
1240  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols");
1241  return graph_->NumGlobalCols64();
1242  }
1243 
1245  size_t getLocalNumRows() const {
1246  XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumRows");
1247  return graph_->NumMyRows();
1248  }
1249 
1251  size_t getLocalNumCols() const {
1252  XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumCols");
1253  return graph_->NumMyCols();
1254  }
1255 
1258  XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase");
1259  return (GlobalOrdinal)graph_->IndexBase64();
1260  }
1261 
1264  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries");
1265  return graph_->NumGlobalEntries64();
1266  }
1267 
1269  size_t getLocalNumEntries() const {
1270  XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumEntries");
1271  return graph_->NumMyEntries();
1272  }
1273 
1275  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const {
1276  XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow");
1277  return graph_->NumGlobalIndices(globalRow);
1278  }
1279 
1281  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const {
1282  XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow");
1283  return graph_->NumMyIndices(localRow);
1284  }
1285 
1288  XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
1289  return graph_->NumAllocatedGlobalIndices(globalRow);
1290  }
1291 
1294  XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
1295  return graph_->NumAllocatedMyIndices(localRow);
1296  }
1297 
1299  size_t getGlobalMaxNumRowEntries() const {
1300  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries");
1301  return graph_->GlobalMaxNumIndices();
1302  }
1303 
1305  size_t getLocalMaxNumRowEntries() const {
1306  XPETRA_MONITOR("EpetraCrsGraphT::getLocalMaxNumRowEntries");
1307  return graph_->MaxNumIndices();
1308  }
1309 
1311  bool hasColMap() const {
1312  XPETRA_MONITOR("EpetraCrsGraphT::hasColMap");
1313  return graph_->HaveColMap();
1314  }
1315 
1317  bool isLocallyIndexed() const {
1318  XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed");
1319  return graph_->IndicesAreLocal();
1320  }
1321 
1323  bool isGloballyIndexed() const {
1324  XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed");
1325  return graph_->IndicesAreGlobal();
1326  }
1327 
1329  bool isFillComplete() const {
1330  XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete");
1331  return graph_->Filled();
1332  }
1333 
1335  bool isStorageOptimized() const {
1336  XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized");
1337  return graph_->StorageOptimized();
1338  }
1339 
1341  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {
1342  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
1343 
1344  int numEntries;
1345  GlobalOrdinal *eIndices;
1346 
1347  XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
1348  if (numEntries == 0) {
1349  eIndices = NULL;
1350  } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
1351 
1352  Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1353  }
1354 
1356  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {
1357  XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
1358 
1359  int numEntries;
1360  int *eIndices;
1361 
1362  XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
1363  if (numEntries == 0) {
1364  eIndices = NULL;
1365  } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
1366 
1367  indices = ArrayView<const int>(eIndices, numEntries);
1368  }
1369 
1370 #ifdef HAVE_XPETRA_TPETRA
1371  typename local_graph_type::HostMirror getLocalGraphHost() const {
1372  RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(getEpetra_CrsGraph());
1373 
1374  using local_graph_type_host = typename local_graph_type::HostMirror;
1375 
1376  const int numRows = graph->NumMyRows();
1377  const int nnz = graph->NumMyNonzeros();
1378 
1379  TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error, "Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1380  const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1381  int *colind = graph->ExpertExtractIndices().Values();
1382 
1383  // Transform int* rowptr array to size_type* array
1384  typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing("local row map"), numRows + 1);
1385  for (size_t i = 0; i < kokkosRowPtr.size(); i++)
1386  kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
1387 
1388  // create Kokkos::Views
1389  typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
1390 
1391  local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
1392 
1393  return localGraph;
1394  }
1395 
1397  RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(getEpetra_CrsGraph());
1398 
1399  const int numRows = graph->NumMyRows();
1400  const int nnz = graph->NumMyNonzeros();
1401 
1402  TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error, "Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1403  const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1404  int *colind = graph->ExpertExtractIndices().Values();
1405 
1406  // Transform int* rowptr array to size_type* array
1407  typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing("local row map"), numRows + 1);
1408  for (size_t i = 0; i < kokkosRowPtr.size(); i++)
1409  kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
1410 
1411  // create Kokkos::Views
1412  typename local_graph_type::entries_type kokkosColind(colind, nnz);
1413 
1414  local_graph_type localGraph = local_graph_type(kokkosColind, kokkosRowPtr);
1415 
1416  return localGraph;
1417  }
1418 
1419  void getLocalDiagOffsets(const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets) const {
1420  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1421  "Epetra does not support getLocalDiagOffsets!");
1422  }
1423 #else
1424 #ifdef __GNUC__
1425 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
1426 #endif
1427 #endif
1428 
1431 
1433 
1435 
1436 
1438  std::string description() const {
1439  XPETRA_MONITOR("EpetraCrsGraphT::description");
1440  return "NotImplemented";
1441  }
1442 
1444  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel /* verbLevel */ = Teuchos::Describable::verbLevel_default) const {
1445  XPETRA_MONITOR("EpetraCrsGraphT::describe");
1446 
1447  out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
1448  const Epetra_BlockMap rowmap = graph_->RowMap();
1449  if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
1450  rowmap.Print(out);
1451  graph_->Print(out);
1452  }
1453 
1455 
1457  //{@
1458 
1460  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getMap() const {
1461  XPETRA_MONITOR("EpetraCrsGraphT::getMap");
1462  return toXpetra<GlobalOrdinal, Node>(graph_->Map());
1463  }
1464 
1468  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
1469 
1470  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1471  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1472 
1473  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1474  int err = graph_->Import(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
1475  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1476  }
1477 
1481  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
1482 
1483  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1484  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1485 
1486  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1487  int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
1488  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1489  }
1490 
1494  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
1495 
1496  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1497  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1498 
1499  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1500  int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
1501  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1502  }
1503 
1507  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
1508 
1509  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1510  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1511 
1512  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1513  int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
1514  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1515  }
1517 
1519 
1520 
1522  EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph)
1523  : graph_(graph) {
1524  TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
1525  }
1526 
1528  RCP<const Epetra_CrsGraph> getEpetra_CrsGraph() const { return graph_; }
1529 
1531 
1532  private:
1533  RCP<Epetra_CrsGraph> graph_;
1534 };
1535 #endif // specialization on Node=EpetraNode and GO=int
1536 
1537 } // namespace Xpetra
1538 
1539 #endif // XPETRA_EPETRACRSGRAPH_HPP
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
void expertStaticFillComplete(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer=Teuchos::null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
local_graph_type::HostMirror getLocalGraphHost() const
Get the local graph.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
void getLocalDiagOffsets(const Kokkos::View< size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged > &offsets) const
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::node_type node_type
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const local_graph_type &, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row...
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
Kokkos::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_type
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
EpetraCrsGraphT(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)
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=null)
Constructor specifying column Map and fixed number of entries for each row.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
EpetraCrsGraphT(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 > &=null)
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
EpetraCrsGraphT(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &sourceGraph, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const RCP< Teuchos::ParameterList > &params=Teuchos::null)
RCP< const Comm< int > > getComm() const
Returns the communicator.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
void computeGlobalConstants()
Force the computation of global constants if we don&#39;t have them.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
node_type::execution_space execution_space
bool hasColMap() const
Whether the graph has a column Map.
EpetraCrsGraphT(const local_graph_type &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const Teuchos::RCP< const map_type > &=Teuchos::null, const Teuchos::RCP< const map_type > &=Teuchos::null, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row...
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
Exception throws to report errors in the internal logical of the program.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void computeGlobalConstants()
Force the computation of global constants if we don&#39;t have them.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
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 expertStaticFillComplete(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer=Teuchos::null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
EpetraCrsGraphT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty DynamicProfile graph (no space is preallocated).
EpetraCrsGraphT(const local_graph_type &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const Teuchos::RCP< const map_type > &=Teuchos::null, const Teuchos::RCP< const map_type > &=Teuchos::null, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const local_graph_type &lclGraph, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row...
EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
local_graph_type::HostMirror getLocalGraphHost() const
Get the local graph.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
EpetraCrsGraphT(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 > &=null)
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
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.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
#define XPETRA_ERR_CHECK(arg)
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
void expertStaticFillComplete(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer=Teuchos::null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
EpetraCrsGraphT(const RCP< const map_type > &rowMap, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor for empty DynamicProfile graph (no space is preallocated).
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
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 getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
std::string description() const
Return a simple one-line description of this object.
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 getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::node_type node_type
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
EpetraCrsGraphT(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &sourceGraph, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const RCP< Teuchos::ParameterList > &params=Teuchos::null)
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this 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.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
Exception throws when you call an unimplemented method of Xpetra.
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 Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &, const local_graph_type &, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row...
size_t global_size_t
Global size_t object.
std::string description() const
Return a simple one-line description of this object.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
local_graph_type getLocalGraphDevice() const
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=null)
Constructor specifying column Map and fixed number of entries for each row.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of 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.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::node_type node_type
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
std::string description() const
Return a simple one-line description of this object.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const =0
The Target Map used to construct this Import object.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
void getLocalDiagOffsets(const Kokkos::View< size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged > &offsets) const
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
local_graph_type::HostMirror getLocalGraphHost() const
Get the local graph.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
virtual ~EpetraCrsGraphT()
Destructor.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
bool hasColMap() const
Whether the graph has a column Map.
EpetraCrsGraphT(const local_graph_type &lclGraph, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row...
CombineMode
Xpetra::Combine Mode enumerable type.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=null)
Constructor specifying column Map and fixed number of entries for each row.
#define XPETRA_MONITOR(funcName)
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
void computeGlobalConstants()
Force the computation of global constants if we don&#39;t have them.
void getLocalDiagOffsets(const Kokkos::View< size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged > &offsets) const
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
EpetraCrsGraphT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty DynamicProfile graph (no space is preallocated).
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
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.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
RCP< const Comm< int > > getComm() const
Returns the communicator.
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 Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.