10 #ifndef XPETRA_EPETRACRSGRAPH_HPP
11 #define XPETRA_EPETRACRSGRAPH_HPP
25 #include <Epetra_CrsGraph.h>
27 #if defined(XPETRA_ENABLE_DEPRECATED_CODE)
29 #if defined(Xpetra_SHOW_DEPRECATED_WARNINGS)
30 #warning "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated."
34 #error "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated."
40 template <
class GlobalOrdinal,
class Node>
41 XPETRA_DEPRECATED RCP<const CrsGraph<int, GlobalOrdinal, Node>>
42 toXpetra(
const Epetra_CrsGraph &graph);
44 template <
class GlobalOrdinal,
class Node>
45 XPETRA_DEPRECATED
const Epetra_CrsGraph &
46 toEpetra(
const RCP<
const CrsGraph<int, GlobalOrdinal, Node>> &graph);
48 template <
class GlobalOrdinal,
class Node>
50 :
public CrsGraph<int, GlobalOrdinal, Node> {
56 #ifdef HAVE_XPETRA_TPETRA
65 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
68 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
72 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
74 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
80 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
87 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
95 const RCP<Teuchos::ParameterList> ¶ms = Teuchos::null) {
97 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
100 #ifdef HAVE_XPETRA_TPETRA
104 const typename local_graph_type::row_map_type &rowPointers,
105 const typename local_graph_type::entries_type::non_const_type &columnIndices,
106 const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
108 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
115 const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
117 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
124 const Teuchos::RCP<const map_type> &domainMap = Teuchos::null,
125 const Teuchos::RCP<const map_type> &rangeMap = Teuchos::null,
126 const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
128 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
150 void allocateAllIndices(
size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {}
153 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {}
156 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {}
177 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
187 return Teuchos::null;
191 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
return Teuchos::null; }
194 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
return Teuchos::null; }
197 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getDomainMap()
const {
return Teuchos::null; }
200 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
return Teuchos::null; }
203 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
return Teuchos::null; }
206 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
return Teuchos::null; }
263 void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices)
const {}
268 #ifdef HAVE_XPETRA_TPETRA
269 #if KOKKOS_VERSION >= 40799
270 typename local_graph_type::host_mirror_type getLocalGraphHost()
const {
272 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
273 TEUCHOS_UNREACHABLE_RETURN((
typename local_graph_type::host_mirror_type()));
278 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
279 TEUCHOS_UNREACHABLE_RETURN((
typename local_graph_type::HostMirror()));
284 #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."
288 #ifdef HAVE_XPETRA_TPETRA
291 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
295 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
297 "Epetra does not support getLocalDiagOffsets!");
301 #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."
318 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
326 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
return Teuchos::null; }
351 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
363 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
366 :
public virtual CrsGraph<int, int, EpetraNode> {
374 #ifdef HAVE_XPETRA_TPETRA
389 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
const RCP<Teuchos::ParameterList> & = Teuchos::null)
403 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
404 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
412 const RCP<Teuchos::ParameterList> ¶ms = Teuchos::null) {
415 RCP<const Epetra_CrsGraph> eSourceGraph = tSourceGraph.getEpetra_CrsGraph();
418 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, eSourceGraph->RowMap(), 0,
false));
419 graph_->Import(*eSourceGraph, *tImporter.getEpetra_Import(), Insert);
421 const Epetra_BlockMap &myDomainMap = domainMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(domainMap) : eSourceGraph->ColMap();
422 const Epetra_BlockMap &myRangeMap = rangeMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(rangeMap) : toEpetra<LocalOrdinal, Node>(importer.
getTargetMap());
424 graph_->FillComplete(myDomainMap, myRangeMap);
427 #ifdef HAVE_XPETRA_TPETRA
431 const typename local_graph_type::row_map_type & ,
432 const typename local_graph_type::entries_type::non_const_type & ,
433 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
435 "Epetra does not support CrsGraph constructors using Kokkos Views!");
442 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
444 "Epetra does not support CrsGraph constructors using a local graph!");
451 const Teuchos::RCP<const map_type> & = Teuchos::null,
452 const Teuchos::RCP<const map_type> & = Teuchos::null,
453 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
455 "Epetra does not support CrsGraph constructors using a local graph!");
472 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
479 int *indices_rawPtr =
const_cast<int *
>(indices.getRawPtr());
480 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
486 graph_->RemoveMyIndices(localRow);
491 void allocateAllIndices(
size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {
502 bool ownMemory =
false;
506 Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
507 myColind.Resize(numNonZeros);
508 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
512 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {
517 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
518 if (colind.size() > 0) {
520 "An exception is thrown to let you know that you mismatched your pointers.");
527 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
528 myRowptr.Resize(N + 1);
529 for (
size_t i = 0; i < N + 1; i++)
530 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
534 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {
538 bool ownMemory =
false;
545 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
546 rowptr.resize(n + 1);
547 for (
size_t i = 0; i < n + 1; i++)
548 (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
551 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
563 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
564 bool doOptimizeStorage =
true;
565 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
566 if (doOptimizeStorage) graph_->OptimizeStorage();
573 graph_->FillComplete();
574 bool doOptimizeStorage =
true;
575 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
576 if (doOptimizeStorage) graph_->OptimizeStorage();
587 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
590 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
591 graph_->OptimizeStorage();
606 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
608 return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
612 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
614 return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
618 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getDomainMap()
const {
620 return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
624 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
626 return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
630 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
632 return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
636 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
638 return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
644 return graph_->NumGlobalRows64();
650 return graph_->NumGlobalCols64();
656 return graph_->NumMyRows();
662 return graph_->NumMyCols();
674 return graph_->NumGlobalEntries64();
680 return graph_->NumMyEntries();
686 return graph_->NumGlobalIndices(globalRow);
692 return graph_->NumMyIndices(localRow);
697 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
698 return graph_->NumAllocatedGlobalIndices(globalRow);
703 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
704 return graph_->NumAllocatedMyIndices(localRow);
710 return graph_->GlobalMaxNumIndices();
716 return graph_->MaxNumIndices();
722 return graph_->HaveColMap();
728 return graph_->IndicesAreLocal();
734 return graph_->IndicesAreGlobal();
740 return graph_->Filled();
746 return graph_->StorageOptimized();
756 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
757 if (numEntries == 0) {
761 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
772 if (numEntries == 0) {
776 indices = ArrayView<const int>(eIndices, numEntries);
779 #ifdef HAVE_XPETRA_TPETRA
780 #if KOKKOS_VERSION >= 40799
785 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
787 #if KOKKOS_VERSION >= 40799
788 using local_graph_type_host =
typename local_graph_type::host_mirror_type;
790 using local_graph_type_host =
typename local_graph_type::HostMirror;
793 const int numRows = graph->NumMyRows();
794 const int nnz = graph->NumMyNonzeros();
796 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
797 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
798 int *colind = graph->ExpertExtractIndices().Values();
801 typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
802 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
803 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
806 typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
808 local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
814 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
816 const int numRows = graph->NumMyRows();
817 const int nnz = graph->NumMyNonzeros();
819 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
820 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
821 int *colind = graph->ExpertExtractIndices().Values();
824 typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
825 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
826 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
829 typename local_graph_type::entries_type kokkosColind(colind, nnz);
836 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
838 "Epetra does not support getLocalDiagOffsets!");
842 #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."
857 return "NotImplemented";
861 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel = Teuchos::Describable::verbLevel_default)
const {
864 out <<
"EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
865 const Epetra_BlockMap rowmap = graph_->RowMap();
866 if (rowmap.Comm().MyPID() == 0) out <<
"** EpetraCrsGraphT **\n\nrowmap" << std::endl;
877 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
879 return toXpetra<GlobalOrdinal, Node>(graph_->Map());
890 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
891 int err = graph_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
892 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
903 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
904 int err = graph_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
905 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
916 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
917 int err = graph_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
918 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
929 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
930 int err = graph_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
931 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
941 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
953 #endif // specialization on Node=EpetraNode and GO=int
956 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
959 :
public virtual CrsGraph<int, long long, EpetraNode> {
967 #ifdef HAVE_XPETRA_TPETRA
982 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
const RCP<Teuchos::ParameterList> & = Teuchos::null)
996 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
997 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
1000 #ifdef HAVE_XPETRA_TPETRA
1004 const typename local_graph_type::row_map_type & ,
1005 const typename local_graph_type::entries_type::non_const_type & ,
1006 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1008 "Epetra does not support CrsGraph constructors using Kokkos Views!");
1015 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1017 "Epetra does not support CrsGraph constructors using a local graph!");
1024 const Teuchos::RCP<const map_type> & = Teuchos::null,
1025 const Teuchos::RCP<const map_type> & = Teuchos::null,
1026 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1028 "Epetra does not support CrsGraph constructors using a local graph!");
1045 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
1052 int *indices_rawPtr =
const_cast<int *
>(indices.getRawPtr());
1053 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
1059 graph_->RemoveMyIndices(localRow);
1074 int lowerOffset = 0;
1075 bool ownMemory =
false;
1079 Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
1080 myColind.Resize(numNonZeros);
1081 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1085 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {
1090 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1091 if (colind.size() > 0) {
1093 "An exception is thrown to let you know that you mismatched your pointers.");
1100 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1101 myRowptr.Resize(N + 1);
1102 for (
size_t i = 0; i < N + 1; i++)
1103 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1107 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {
1110 int lowerOffset = 0;
1111 bool ownMemory =
false;
1118 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1119 rowptr.resize(n + 1);
1120 for (
size_t i = 0; i < n + 1; i++)
1121 (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1124 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1136 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1137 bool doOptimizeStorage =
true;
1138 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1139 if (doOptimizeStorage) graph_->OptimizeStorage();
1146 graph_->FillComplete();
1147 bool doOptimizeStorage =
true;
1148 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1149 if (doOptimizeStorage) graph_->OptimizeStorage();
1160 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
1163 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1164 graph_->OptimizeStorage();
1179 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
1181 return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
1185 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
1187 return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
1193 return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
1197 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
1199 return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
1203 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
1205 return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
1209 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
1211 return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
1217 return graph_->NumGlobalRows64();
1223 return graph_->NumGlobalCols64();
1229 return graph_->NumMyRows();
1235 return graph_->NumMyCols();
1247 return graph_->NumGlobalEntries64();
1253 return graph_->NumMyEntries();
1259 return graph_->NumGlobalIndices(globalRow);
1265 return graph_->NumMyIndices(localRow);
1270 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
1271 return graph_->NumAllocatedGlobalIndices(globalRow);
1276 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
1277 return graph_->NumAllocatedMyIndices(localRow);
1283 return graph_->GlobalMaxNumIndices();
1289 return graph_->MaxNumIndices();
1295 return graph_->HaveColMap();
1301 return graph_->IndicesAreLocal();
1307 return graph_->IndicesAreGlobal();
1313 return graph_->Filled();
1319 return graph_->StorageOptimized();
1329 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
1330 if (numEntries == 0) {
1334 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1344 XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
1345 if (numEntries == 0) {
1349 indices = ArrayView<const int>(eIndices, numEntries);
1352 #ifdef HAVE_XPETRA_TPETRA
1353 #if KOKKOS_VERSION >= 40799
1358 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
1360 #if KOKKOS_VERSION >= 40799
1361 using local_graph_type_host =
typename local_graph_type::host_mirror_type;
1363 using local_graph_type_host =
typename local_graph_type::HostMirror;
1366 const int numRows = graph->NumMyRows();
1367 const int nnz = graph->NumMyNonzeros();
1369 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1370 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1371 int *colind = graph->ExpertExtractIndices().Values();
1374 typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
1375 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1376 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
1379 typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
1381 local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
1387 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
1389 const int numRows = graph->NumMyRows();
1390 const int nnz = graph->NumMyNonzeros();
1392 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1393 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1394 int *colind = graph->ExpertExtractIndices().Values();
1397 typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
1398 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1399 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
1402 typename local_graph_type::entries_type kokkosColind(colind, nnz);
1409 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
1411 "Epetra does not support getLocalDiagOffsets!");
1415 #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."
1430 return "NotImplemented";
1434 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel = Teuchos::Describable::verbLevel_default)
const {
1437 out <<
"EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
1438 const Epetra_BlockMap rowmap = graph_->RowMap();
1439 if (rowmap.Comm().MyPID() == 0) out <<
"** EpetraCrsGraphT **\n\nrowmap" << std::endl;
1450 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
1452 return toXpetra<GlobalOrdinal, Node>(graph_->Map());
1463 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1464 int err = graph_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1465 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1476 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1477 int err = graph_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1478 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1489 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1490 int err = graph_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1491 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1502 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1503 int err = graph_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1504 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1514 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
1525 #endif // specialization on Node=EpetraNode and GO=int
1529 #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 > ¶ms=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 > ¶ms=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.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
KokkosSparse::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, device_type, void, size_t > 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 > ¶ms=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).
RCP< Epetra_CrsGraph > graph_
void fillComplete(const RCP< ParameterList > ¶ms=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 > ¶ms=Teuchos::null)
virtual ~EpetraCrsGraphT()
Destructor.
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'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'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 > ¶ms=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 > ¶ms=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.
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.
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 > ¶ms=Teuchos::null)
void fillComplete(const RCP< ParameterList > ¶ms=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 > ¶ms=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 > ¶ms=null)
Signal that data entry is complete, specifying domain and range maps.
local_graph_type getLocalGraphDevice() const
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.
RCP< Epetra_CrsGraph > 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.
virtual ~EpetraCrsGraphT()
Destructor.
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 > ¶ms=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.
node_type::execution_space execution_space
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'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.
node_type::execution_space execution_space
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.