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
271 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
272 TEUCHOS_UNREACHABLE_RETURN((
typename local_graph_type::HostMirror()));
276 #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."
280 #ifdef HAVE_XPETRA_TPETRA
283 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
287 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
289 "Epetra does not support getLocalDiagOffsets!");
293 #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."
310 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
318 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
return Teuchos::null; }
343 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
355 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
358 :
public virtual CrsGraph<int, int, EpetraNode> {
366 #ifdef HAVE_XPETRA_TPETRA
381 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
const RCP<Teuchos::ParameterList> & = Teuchos::null)
395 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
396 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
404 const RCP<Teuchos::ParameterList> ¶ms = Teuchos::null) {
407 RCP<const Epetra_CrsGraph> eSourceGraph = tSourceGraph.getEpetra_CrsGraph();
410 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, eSourceGraph->RowMap(), 0,
false));
411 graph_->Import(*eSourceGraph, *tImporter.getEpetra_Import(), Insert);
413 const Epetra_BlockMap &myDomainMap = domainMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(domainMap) : eSourceGraph->ColMap();
414 const Epetra_BlockMap &myRangeMap = rangeMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(rangeMap) : toEpetra<LocalOrdinal, Node>(importer.
getTargetMap());
416 graph_->FillComplete(myDomainMap, myRangeMap);
419 #ifdef HAVE_XPETRA_TPETRA
423 const typename local_graph_type::row_map_type & ,
424 const typename local_graph_type::entries_type::non_const_type & ,
425 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
427 "Epetra does not support CrsGraph constructors using Kokkos Views!");
434 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
436 "Epetra does not support CrsGraph constructors using a local graph!");
443 const Teuchos::RCP<const map_type> & = Teuchos::null,
444 const Teuchos::RCP<const map_type> & = Teuchos::null,
445 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
447 "Epetra does not support CrsGraph constructors using a local graph!");
464 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
471 int *indices_rawPtr =
const_cast<int *
>(indices.getRawPtr());
472 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
478 graph_->RemoveMyIndices(localRow);
483 void allocateAllIndices(
size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {
494 bool ownMemory =
false;
498 Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
499 myColind.Resize(numNonZeros);
500 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
504 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {
509 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
510 if (colind.size() > 0) {
512 "An exception is thrown to let you know that you mismatched your pointers.");
519 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
520 myRowptr.Resize(N + 1);
521 for (
size_t i = 0; i < N + 1; i++)
522 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
526 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {
530 bool ownMemory =
false;
537 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
538 rowptr.resize(n + 1);
539 for (
size_t i = 0; i < n + 1; i++)
540 (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
543 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
555 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
556 bool doOptimizeStorage =
true;
557 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
558 if (doOptimizeStorage) graph_->OptimizeStorage();
565 graph_->FillComplete();
566 bool doOptimizeStorage =
true;
567 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
568 if (doOptimizeStorage) graph_->OptimizeStorage();
579 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
582 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
583 graph_->OptimizeStorage();
598 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
600 return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
604 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
606 return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
610 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getDomainMap()
const {
612 return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
616 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
618 return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
622 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
624 return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
628 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
630 return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
636 return graph_->NumGlobalRows64();
642 return graph_->NumGlobalCols64();
648 return graph_->NumMyRows();
654 return graph_->NumMyCols();
666 return graph_->NumGlobalEntries64();
672 return graph_->NumMyEntries();
678 return graph_->NumGlobalIndices(globalRow);
684 return graph_->NumMyIndices(localRow);
689 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
690 return graph_->NumAllocatedGlobalIndices(globalRow);
695 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
696 return graph_->NumAllocatedMyIndices(localRow);
702 return graph_->GlobalMaxNumIndices();
708 return graph_->MaxNumIndices();
714 return graph_->HaveColMap();
720 return graph_->IndicesAreLocal();
726 return graph_->IndicesAreGlobal();
732 return graph_->Filled();
738 return graph_->StorageOptimized();
748 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
749 if (numEntries == 0) {
753 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
764 if (numEntries == 0) {
768 indices = ArrayView<const int>(eIndices, numEntries);
771 #ifdef HAVE_XPETRA_TPETRA
773 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
775 using local_graph_type_host =
typename local_graph_type::HostMirror;
777 const int numRows = graph->NumMyRows();
778 const int nnz = graph->NumMyNonzeros();
780 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
781 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
782 int *colind = graph->ExpertExtractIndices().Values();
785 typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
786 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
787 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
790 typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
792 local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
798 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
800 const int numRows = graph->NumMyRows();
801 const int nnz = graph->NumMyNonzeros();
803 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
804 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
805 int *colind = graph->ExpertExtractIndices().Values();
808 typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
809 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
810 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
813 typename local_graph_type::entries_type kokkosColind(colind, nnz);
820 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
822 "Epetra does not support getLocalDiagOffsets!");
826 #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."
841 return "NotImplemented";
845 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel = Teuchos::Describable::verbLevel_default)
const {
848 out <<
"EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
849 const Epetra_BlockMap rowmap = graph_->RowMap();
850 if (rowmap.Comm().MyPID() == 0) out <<
"** EpetraCrsGraphT **\n\nrowmap" << std::endl;
861 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
863 return toXpetra<GlobalOrdinal, Node>(graph_->Map());
874 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
875 int err = graph_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
876 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
887 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
888 int err = graph_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
889 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
900 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
901 int err = graph_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
902 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
913 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
914 int err = graph_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
915 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
925 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
937 #endif // specialization on Node=EpetraNode and GO=int
940 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
943 :
public virtual CrsGraph<int, long long, EpetraNode> {
951 #ifdef HAVE_XPETRA_TPETRA
966 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
const RCP<Teuchos::ParameterList> & = Teuchos::null)
980 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
981 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
984 #ifdef HAVE_XPETRA_TPETRA
988 const typename local_graph_type::row_map_type & ,
989 const typename local_graph_type::entries_type::non_const_type & ,
990 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
992 "Epetra does not support CrsGraph constructors using Kokkos Views!");
999 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1001 "Epetra does not support CrsGraph constructors using a local graph!");
1008 const Teuchos::RCP<const map_type> & = Teuchos::null,
1009 const Teuchos::RCP<const map_type> & = Teuchos::null,
1010 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1012 "Epetra does not support CrsGraph constructors using a local graph!");
1029 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
1036 int *indices_rawPtr =
const_cast<int *
>(indices.getRawPtr());
1037 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
1043 graph_->RemoveMyIndices(localRow);
1058 int lowerOffset = 0;
1059 bool ownMemory =
false;
1063 Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
1064 myColind.Resize(numNonZeros);
1065 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1069 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {
1074 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1075 if (colind.size() > 0) {
1077 "An exception is thrown to let you know that you mismatched your pointers.");
1084 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1085 myRowptr.Resize(N + 1);
1086 for (
size_t i = 0; i < N + 1; i++)
1087 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1091 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {
1094 int lowerOffset = 0;
1095 bool ownMemory =
false;
1102 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1103 rowptr.resize(n + 1);
1104 for (
size_t i = 0; i < n + 1; i++)
1105 (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1108 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1120 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1121 bool doOptimizeStorage =
true;
1122 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1123 if (doOptimizeStorage) graph_->OptimizeStorage();
1130 graph_->FillComplete();
1131 bool doOptimizeStorage =
true;
1132 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1133 if (doOptimizeStorage) graph_->OptimizeStorage();
1144 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
1147 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1148 graph_->OptimizeStorage();
1163 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
1165 return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
1169 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
1171 return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
1177 return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
1181 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
1183 return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
1187 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
1189 return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
1193 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
1195 return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
1201 return graph_->NumGlobalRows64();
1207 return graph_->NumGlobalCols64();
1213 return graph_->NumMyRows();
1219 return graph_->NumMyCols();
1231 return graph_->NumGlobalEntries64();
1237 return graph_->NumMyEntries();
1243 return graph_->NumGlobalIndices(globalRow);
1249 return graph_->NumMyIndices(localRow);
1254 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
1255 return graph_->NumAllocatedGlobalIndices(globalRow);
1260 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
1261 return graph_->NumAllocatedMyIndices(localRow);
1267 return graph_->GlobalMaxNumIndices();
1273 return graph_->MaxNumIndices();
1279 return graph_->HaveColMap();
1285 return graph_->IndicesAreLocal();
1291 return graph_->IndicesAreGlobal();
1297 return graph_->Filled();
1303 return graph_->StorageOptimized();
1313 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
1314 if (numEntries == 0) {
1318 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1328 XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
1329 if (numEntries == 0) {
1333 indices = ArrayView<const int>(eIndices, numEntries);
1336 #ifdef HAVE_XPETRA_TPETRA
1338 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
1340 using local_graph_type_host =
typename local_graph_type::HostMirror;
1342 const int numRows = graph->NumMyRows();
1343 const int nnz = graph->NumMyNonzeros();
1345 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1346 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1347 int *colind = graph->ExpertExtractIndices().Values();
1350 typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
1351 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1352 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
1355 typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
1357 local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
1363 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
1365 const int numRows = graph->NumMyRows();
1366 const int nnz = graph->NumMyNonzeros();
1368 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1369 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1370 int *colind = graph->ExpertExtractIndices().Values();
1373 typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
1374 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1375 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
1378 typename local_graph_type::entries_type kokkosColind(colind, nnz);
1385 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
1387 "Epetra does not support getLocalDiagOffsets!");
1391 #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."
1406 return "NotImplemented";
1410 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel = Teuchos::Describable::verbLevel_default)
const {
1413 out <<
"EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
1414 const Epetra_BlockMap rowmap = graph_->RowMap();
1415 if (rowmap.Comm().MyPID() == 0) out <<
"** EpetraCrsGraphT **\n\nrowmap" << std::endl;
1426 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
1428 return toXpetra<GlobalOrdinal, Node>(graph_->Map());
1439 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1440 int err = graph_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1441 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1452 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1453 int err = graph_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1454 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1465 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1466 int err = graph_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1467 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1478 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1479 int err = graph_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1480 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1490 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
1501 #endif // specialization on Node=EpetraNode and GO=int
1505 #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.
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 > ¶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.