46 #ifndef XPETRA_EPETRACRSGRAPH_HPP
47 #define XPETRA_EPETRACRSGRAPH_HPP
61 #include <Epetra_CrsGraph.h>
63 #if defined(XPETRA_ENABLE_DEPRECATED_CODE)
65 #warning "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated."
68 #error "The header file Trilinos/packages/xpetra/src/CrsGraph/Xpetra_EpetraCrsGraph.hpp is deprecated."
74 template <
class GlobalOrdinal,
class Node>
75 XPETRA_DEPRECATED RCP<const CrsGraph<int, GlobalOrdinal, Node>>
76 toXpetra(
const Epetra_CrsGraph &graph);
78 template <
class GlobalOrdinal,
class Node>
79 XPETRA_DEPRECATED
const Epetra_CrsGraph &
80 toEpetra(
const RCP<
const CrsGraph<int, GlobalOrdinal, Node>> &graph);
82 template <
class GlobalOrdinal,
class Node>
84 :
public CrsGraph<int, GlobalOrdinal, Node> {
90 #ifdef HAVE_XPETRA_TPETRA
99 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
102 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
106 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
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)");
114 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
121 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
129 const RCP<Teuchos::ParameterList> ¶ms = Teuchos::null) {
131 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
134 #ifdef HAVE_XPETRA_TPETRA
138 const typename local_graph_type::row_map_type &rowPointers,
139 const typename local_graph_type::entries_type::non_const_type &columnIndices,
140 const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
142 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
149 const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
151 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
158 const Teuchos::RCP<const map_type> &domainMap = Teuchos::null,
159 const Teuchos::RCP<const map_type> &rangeMap = Teuchos::null,
160 const RCP<Teuchos::ParameterList> &plist = Teuchos::null) {
162 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
184 void allocateAllIndices(
size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {}
187 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {}
190 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {}
211 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
221 return Teuchos::null;
225 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
return Teuchos::null; }
228 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
return Teuchos::null; }
231 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getDomainMap()
const {
return Teuchos::null; }
234 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
return Teuchos::null; }
237 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
return Teuchos::null; }
240 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
return Teuchos::null; }
297 void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices)
const {}
302 #ifdef HAVE_XPETRA_TPETRA
305 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
306 TEUCHOS_UNREACHABLE_RETURN((
typename local_graph_type::HostMirror()));
310 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
314 #ifdef HAVE_XPETRA_TPETRA
317 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
321 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
323 "Epetra does not support getLocalDiagOffsets!");
327 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
344 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
352 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
return Teuchos::null; }
377 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
389 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
392 :
public virtual CrsGraph<int, int, EpetraNode> {
400 #ifdef HAVE_XPETRA_TPETRA
415 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
const RCP<Teuchos::ParameterList> & = Teuchos::null)
429 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
430 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
438 const RCP<Teuchos::ParameterList> ¶ms = Teuchos::null) {
441 RCP<const Epetra_CrsGraph> eSourceGraph = tSourceGraph.getEpetra_CrsGraph();
444 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, eSourceGraph->RowMap(), 0,
false));
445 graph_->Import(*eSourceGraph, *tImporter.getEpetra_Import(), Insert);
447 const Epetra_BlockMap &myDomainMap = domainMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(domainMap) : eSourceGraph->ColMap();
448 const Epetra_BlockMap &myRangeMap = rangeMap != Teuchos::null ? toEpetra<GlobalOrdinal, Node>(rangeMap) : toEpetra<LocalOrdinal, Node>(importer.
getTargetMap());
450 graph_->FillComplete(myDomainMap, myRangeMap);
453 #ifdef HAVE_XPETRA_TPETRA
457 const typename local_graph_type::row_map_type & ,
458 const typename local_graph_type::entries_type::non_const_type & ,
459 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
461 "Epetra does not support CrsGraph constructors using Kokkos Views!");
468 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
470 "Epetra does not support CrsGraph constructors using a local graph!");
477 const Teuchos::RCP<const map_type> & = Teuchos::null,
478 const Teuchos::RCP<const map_type> & = Teuchos::null,
479 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
481 "Epetra does not support CrsGraph constructors using a local graph!");
498 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
505 int *indices_rawPtr =
const_cast<int *
>(indices.getRawPtr());
506 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
512 graph_->RemoveMyIndices(localRow);
517 void allocateAllIndices(
size_t numNonZeros, ArrayRCP<size_t> &rowptr, ArrayRCP<LocalOrdinal> &colind) {
528 bool ownMemory =
false;
532 Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
533 myColind.Resize(numNonZeros);
534 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
538 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {
543 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
544 if (colind.size() > 0) {
546 "An exception is thrown to let you know that you mismatched your pointers.");
553 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
554 myRowptr.Resize(N + 1);
555 for (
size_t i = 0; i < N + 1; i++)
556 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
560 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {
564 bool ownMemory =
false;
571 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
572 rowptr.resize(n + 1);
573 for (
size_t i = 0; i < n + 1; i++)
574 (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
577 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
589 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
590 bool doOptimizeStorage =
true;
591 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
592 if (doOptimizeStorage) graph_->OptimizeStorage();
599 graph_->FillComplete();
600 bool doOptimizeStorage =
true;
601 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
602 if (doOptimizeStorage) graph_->OptimizeStorage();
613 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
616 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
617 graph_->OptimizeStorage();
632 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
634 return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
638 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
640 return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
644 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getDomainMap()
const {
646 return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
650 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
652 return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
656 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
658 return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
662 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
664 return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
670 return graph_->NumGlobalRows64();
676 return graph_->NumGlobalCols64();
682 return graph_->NumMyRows();
688 return graph_->NumMyCols();
700 return graph_->NumGlobalEntries64();
706 return graph_->NumMyEntries();
712 return graph_->NumGlobalIndices(globalRow);
718 return graph_->NumMyIndices(localRow);
723 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
724 return graph_->NumAllocatedGlobalIndices(globalRow);
729 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
730 return graph_->NumAllocatedMyIndices(localRow);
736 return graph_->GlobalMaxNumIndices();
742 return graph_->MaxNumIndices();
748 return graph_->HaveColMap();
754 return graph_->IndicesAreLocal();
760 return graph_->IndicesAreGlobal();
766 return graph_->Filled();
772 return graph_->StorageOptimized();
782 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
783 if (numEntries == 0) {
787 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
798 if (numEntries == 0) {
802 indices = ArrayView<const int>(eIndices, numEntries);
805 #ifdef HAVE_XPETRA_TPETRA
807 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
809 using local_graph_type_host =
typename local_graph_type::HostMirror;
811 const int numRows = graph->NumMyRows();
812 const int nnz = graph->NumMyNonzeros();
814 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
815 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
816 int *colind = graph->ExpertExtractIndices().Values();
819 typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
820 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
821 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
824 typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
826 local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
832 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
834 const int numRows = graph->NumMyRows();
835 const int nnz = graph->NumMyNonzeros();
837 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
838 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
839 int *colind = graph->ExpertExtractIndices().Values();
842 typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
843 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
844 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
847 typename local_graph_type::entries_type kokkosColind(colind, nnz);
854 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
856 "Epetra does not support getLocalDiagOffsets!");
860 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
875 return "NotImplemented";
879 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel = Teuchos::Describable::verbLevel_default)
const {
882 out <<
"EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
883 const Epetra_BlockMap rowmap = graph_->RowMap();
884 if (rowmap.Comm().MyPID() == 0) out <<
"** EpetraCrsGraphT **\n\nrowmap" << std::endl;
895 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
897 return toXpetra<GlobalOrdinal, Node>(graph_->Map());
908 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
909 int err = graph_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
910 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
921 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
922 int err = graph_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
923 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
934 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
935 int err = graph_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
936 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
947 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
948 int err = graph_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
949 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
959 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
971 #endif // specialization on Node=EpetraNode and GO=int
974 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
977 :
public virtual CrsGraph<int, long long, EpetraNode> {
985 #ifdef HAVE_XPETRA_TPETRA
1000 EpetraCrsGraphT(
const RCP<const map_type> &rowMap,
size_t maxNumEntriesPerRow,
const RCP<Teuchos::ParameterList> & = Teuchos::null)
1014 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1015 graph_ = Teuchos::rcp(
new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal, Node>(rowMap), toEpetra<GlobalOrdinal, Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
1018 #ifdef HAVE_XPETRA_TPETRA
1022 const typename local_graph_type::row_map_type & ,
1023 const typename local_graph_type::entries_type::non_const_type & ,
1024 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1026 "Epetra does not support CrsGraph constructors using Kokkos Views!");
1033 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1035 "Epetra does not support CrsGraph constructors using a local graph!");
1042 const Teuchos::RCP<const map_type> & = Teuchos::null,
1043 const Teuchos::RCP<const map_type> & = Teuchos::null,
1044 const RCP<Teuchos::ParameterList> & = Teuchos::null) {
1046 "Epetra does not support CrsGraph constructors using a local graph!");
1063 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
1070 int *indices_rawPtr =
const_cast<int *
>(indices.getRawPtr());
1071 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
1077 graph_->RemoveMyIndices(localRow);
1092 int lowerOffset = 0;
1093 bool ownMemory =
false;
1097 Epetra_IntSerialDenseVector &myColind = graph_->ExpertExtractIndices();
1098 myColind.Resize(numNonZeros);
1099 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1103 void setAllIndices(
const ArrayRCP<size_t> &rowptr,
const ArrayRCP<LocalOrdinal> &colind) {
1108 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1109 if (colind.size() > 0) {
1111 "An exception is thrown to let you know that you mismatched your pointers.");
1118 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1119 myRowptr.Resize(N + 1);
1120 for (
size_t i = 0; i < N + 1; i++)
1121 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1125 void getAllIndices(ArrayRCP<const size_t> &rowptr, ArrayRCP<const LocalOrdinal> &colind)
const {
1128 int lowerOffset = 0;
1129 bool ownMemory =
false;
1136 Epetra_IntSerialDenseVector &myRowptr = graph_->ExpertExtractIndexOffset();
1137 rowptr.resize(n + 1);
1138 for (
size_t i = 0; i < n + 1; i++)
1139 (*const_cast<size_t *>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1142 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1154 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1155 bool doOptimizeStorage =
true;
1156 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1157 if (doOptimizeStorage) graph_->OptimizeStorage();
1164 graph_->FillComplete();
1165 bool doOptimizeStorage =
true;
1166 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1167 if (doOptimizeStorage) graph_->OptimizeStorage();
1178 const Teuchos::RCP<Teuchos::ParameterList> ¶ms =
1181 graph_->FillComplete(toEpetra<GlobalOrdinal, Node>(domainMap), toEpetra<GlobalOrdinal, Node>(rangeMap));
1182 graph_->OptimizeStorage();
1197 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRowMap()
const {
1199 return toXpetra<GlobalOrdinal, Node>(graph_->RowMap());
1203 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getColMap()
const {
1205 return toXpetra<GlobalOrdinal, Node>(graph_->ColMap());
1211 return toXpetra<GlobalOrdinal, Node>(graph_->DomainMap());
1215 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getRangeMap()
const {
1217 return toXpetra<GlobalOrdinal, Node>(graph_->RangeMap());
1221 RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>
getImporter()
const {
1223 return toXpetra<GlobalOrdinal, Node>(graph_->Importer());
1227 RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>
getExporter()
const {
1229 return toXpetra<GlobalOrdinal, Node>(graph_->Exporter());
1235 return graph_->NumGlobalRows64();
1241 return graph_->NumGlobalCols64();
1247 return graph_->NumMyRows();
1253 return graph_->NumMyCols();
1265 return graph_->NumGlobalEntries64();
1271 return graph_->NumMyEntries();
1277 return graph_->NumGlobalIndices(globalRow);
1283 return graph_->NumMyIndices(localRow);
1288 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow");
1289 return graph_->NumAllocatedGlobalIndices(globalRow);
1294 XPETRA_MONITOR(
"EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow");
1295 return graph_->NumAllocatedMyIndices(localRow);
1301 return graph_->GlobalMaxNumIndices();
1307 return graph_->MaxNumIndices();
1313 return graph_->HaveColMap();
1319 return graph_->IndicesAreLocal();
1325 return graph_->IndicesAreGlobal();
1331 return graph_->Filled();
1337 return graph_->StorageOptimized();
1347 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
1348 if (numEntries == 0) {
1352 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1362 XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
1363 if (numEntries == 0) {
1367 indices = ArrayView<const int>(eIndices, numEntries);
1370 #ifdef HAVE_XPETRA_TPETRA
1372 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
1374 using local_graph_type_host =
typename local_graph_type::HostMirror;
1376 const int numRows = graph->NumMyRows();
1377 const int nnz = graph->NumMyNonzeros();
1379 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1380 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1381 int *colind = graph->ExpertExtractIndices().Values();
1384 typename local_graph_type_host::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
1385 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1386 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type_host::row_map_type::value_type>(rowptr[i]);
1389 typename local_graph_type_host::entries_type kokkosColind(colind, nnz);
1391 local_graph_type_host localGraph = local_graph_type_host(kokkosColind, kokkosRowPtr);
1397 RCP<Epetra_CrsGraph> graph = Teuchos::rcp_const_cast<Epetra_CrsGraph>(
getEpetra_CrsGraph());
1399 const int numRows = graph->NumMyRows();
1400 const int nnz = graph->NumMyNonzeros();
1402 TEUCHOS_TEST_FOR_EXCEPTION(!graph->StorageOptimized(), std::runtime_error,
"Xpetra::CrsGraph<>::getLocalGraph: Epetra_CrsGraph not StorageOptimized");
1403 const int *rowptr = graph->ExpertExtractIndexOffset().Values();
1404 int *colind = graph->ExpertExtractIndices().Values();
1407 typename local_graph_type::row_map_type::non_const_type kokkosRowPtr(Kokkos::ViewAllocateWithoutInitializing(
"local row map"), numRows + 1);
1408 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1409 kokkosRowPtr(i) = Teuchos::asSafe<typename local_graph_type::row_map_type::value_type>(rowptr[i]);
1412 typename local_graph_type::entries_type kokkosColind(colind, nnz);
1419 void getLocalDiagOffsets(
const Kokkos::View<size_t *, typename Node::device_type, Kokkos::MemoryUnmanaged> &offsets)
const {
1421 "Epetra does not support getLocalDiagOffsets!");
1425 #warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
1440 return "NotImplemented";
1444 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel = Teuchos::Describable::verbLevel_default)
const {
1447 out <<
"EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
1448 const Epetra_BlockMap rowmap = graph_->RowMap();
1449 if (rowmap.Comm().MyPID() == 0) out <<
"** EpetraCrsGraphT **\n\nrowmap" << std::endl;
1460 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
getMap()
const {
1462 return toXpetra<GlobalOrdinal, Node>(graph_->Map());
1473 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1474 int err = graph_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1475 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1486 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1487 int err = graph_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1488 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1499 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1500 int err = graph_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1501 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1512 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1513 int err = graph_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1514 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1524 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
1535 #endif // specialization on Node=EpetraNode and GO=int
1539 #endif // XPETRA_EPETRACRSGRAPH_HPP
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
void expertStaticFillComplete(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer=Teuchos::null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶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.