42 #ifndef TPETRA_CRSGRAPH_DECL_HPP 43 #define TPETRA_CRSGRAPH_DECL_HPP 56 #include "Tpetra_DistObject.hpp" 57 #include "Tpetra_Exceptions.hpp" 58 #include "Tpetra_RowGraph.hpp" 61 #include "KokkosSparse_findRelOffset.hpp" 62 #include "Kokkos_DualView.hpp" 63 #include "Kokkos_StaticCrsGraph.hpp" 65 #include "Teuchos_CommHelpers.hpp" 66 #include "Teuchos_Describable.hpp" 67 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp" 73 #ifndef DOXYGEN_SHOULD_SKIP_THIS 76 template<
class OutputCrsGraphType,
class InputCrsGraphType>
77 class CrsGraphCopier {
79 static Teuchos::RCP<OutputCrsGraphType>
80 clone (
const InputCrsGraphType& graphIn,
81 const Teuchos::RCP<typename OutputCrsGraphType::node_type> nodeOut,
82 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
88 template<
class ViewType>
89 struct UnmanagedView {
90 static_assert (Kokkos::is_view<ViewType>::value,
91 "ViewType must be a Kokkos::View specialization.");
95 typedef Kokkos::View<
typename ViewType::data_type,
96 typename ViewType::array_layout,
97 typename ViewType::device_type,
98 Kokkos::MemoryUnmanaged> type;
102 #endif // DOXYGEN_SHOULD_SKIP_THIS 183 virtual bool isLowerTriangularImpl ()
const = 0;
184 virtual bool isUpperTriangularImpl ()
const = 0;
185 virtual size_t getGlobalNumDiagsImpl ()
const = 0;
257 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
260 public RowGraph<LocalOrdinal, GlobalOrdinal, Node>,
265 public Teuchos::ParameterListAcceptorDefaultBase,
268 template <
class S,
class LO,
class GO,
class N>
270 template <
class LO2,
class GO2,
class N2>
290 typedef Kokkos::StaticCrsGraph<LocalOrdinal,
301 typedef typename local_graph_type::entries_type::non_const_type t_LocalOrdinal_1D
TPETRA_DEPRECATED;
331 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
332 size_t maxNumEntriesPerRow,
334 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
353 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
354 const Kokkos::DualView<const size_t*, execution_space>& numEntPerRow,
356 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
376 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
377 const Teuchos::ArrayRCP<const size_t>& numEntPerRow,
379 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
402 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
403 const Teuchos::RCP<const map_type>& colMap,
404 const size_t maxNumEntriesPerRow,
406 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
426 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
427 const Teuchos::RCP<const map_type>& colMap,
428 const Kokkos::DualView<const size_t*, execution_space>& numEntPerRow,
430 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
451 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
452 const Teuchos::RCP<const map_type>& colMap,
453 const Teuchos::ArrayRCP<const size_t>& numEntPerRow,
455 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
476 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
477 const Teuchos::RCP<const map_type>& colMap,
478 const typename local_graph_type::row_map_type& rowPointers,
479 const typename local_graph_type::entries_type::non_const_type& columnIndices,
480 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
501 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
502 const Teuchos::RCP<const map_type>& colMap,
503 const Teuchos::ArrayRCP<size_t> & rowPointers,
504 const Teuchos::ArrayRCP<LocalOrdinal> & columnIndices,
505 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
525 CrsGraph (
const Teuchos::RCP<const map_type>& rowMap,
526 const Teuchos::RCP<const map_type>& colMap,
528 const Teuchos::RCP<Teuchos::ParameterList>& params);
555 const Teuchos::RCP<const map_type>& rowMap,
556 const Teuchos::RCP<const map_type>& colMap,
557 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
558 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
559 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
588 template<
class Node2>
589 Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node2> >
590 clone (
const Teuchos::RCP<Node2>& node2,
591 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
const 595 typedef ::Tpetra::Details::CrsGraphCopier<output_crs_graph_type, input_crs_graph_type> copier_type;
596 return copier_type::clone (*
this, node2, params);
608 setParameterList (
const Teuchos::RCP<Teuchos::ParameterList>& params)
override;
611 Teuchos::RCP<const Teuchos::ParameterList>
641 const Teuchos::ArrayView<const GlobalOrdinal>& indices);
651 const LocalOrdinal numEnt,
652 const GlobalOrdinal inds[]);
671 const Teuchos::ArrayView<const LocalOrdinal> &indices);
681 const LocalOrdinal numEnt,
682 const LocalOrdinal inds[]);
727 void resumeFill (
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
767 fillComplete (
const Teuchos::RCP<const map_type> &domainMap,
768 const Teuchos::RCP<const map_type> &rangeMap,
769 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
799 fillComplete (
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
831 const Teuchos::RCP<const map_type> & rangeMap,
832 const Teuchos::RCP<const import_type> &importer=Teuchos::null,
833 const Teuchos::RCP<const export_type> &exporter=Teuchos::null,
834 const Teuchos::RCP<Teuchos::ParameterList> ¶ms=Teuchos::null);
840 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const override;
843 Teuchos::RCP<node_type>
getNode()
const override;
846 Teuchos::RCP<const map_type>
getRowMap ()
const override;
849 Teuchos::RCP<const map_type>
getColMap ()
const override;
852 Teuchos::RCP<const map_type>
getDomainMap ()
const override;
855 Teuchos::RCP<const map_type>
getRangeMap ()
const override;
858 Teuchos::RCP<const import_type>
getImporter ()
const override;
861 Teuchos::RCP<const export_type>
getExporter ()
const override;
1125 const Teuchos::ArrayView<GlobalOrdinal>& Indices,
1126 size_t& NumIndices)
const override;
1137 const Teuchos::ArrayView<LocalOrdinal>& indices,
1138 size_t& NumIndices)
const override;
1152 Teuchos::ArrayView<const GlobalOrdinal>& gblColInds)
const override;
1170 Teuchos::ArrayView<const LocalOrdinal>& lclColInds)
const override;
1182 describe (Teuchos::FancyOStream& out,
1183 const Teuchos::EVerbosityLevel verbLevel =
1184 Teuchos::Describable::verbLevel_default)
const override;
1196 const Teuchos::ArrayView<const LocalOrdinal> &permuteToLIDs,
1197 const Teuchos::ArrayView<const LocalOrdinal> &permuteFromLIDs)
override;
1201 const Teuchos::ArrayView<const LocalOrdinal> &exportLIDs,
1202 Teuchos::Array<GlobalOrdinal> &exports,
1203 const Teuchos::ArrayView<size_t> & numPacketsPerLID,
1204 size_t& constantNumPackets,
1208 pack (
const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
1209 Teuchos::Array<GlobalOrdinal>& exports,
1210 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1211 size_t& constantNumPackets,
1215 unpackAndCombine (
const Teuchos::ArrayView<const LocalOrdinal> &importLIDs,
1216 const Teuchos::ArrayView<const GlobalOrdinal> &imports,
1217 const Teuchos::ArrayView<size_t> &numPacketsPerLID,
1218 size_t constantNumPackets,
1268 getLocalDiagOffsets (
const Kokkos::View<size_t*, device_type, Kokkos::MemoryUnmanaged>& offsets)
const;
1306 size_t& boundForAllLocalRows,
1307 bool& boundSameForAllLocalRows)
const;
1318 setAllIndices (
const typename local_graph_type::row_map_type& rowPointers,
1319 const typename local_graph_type::entries_type::non_const_type& columnIndices);
1330 setAllIndices (
const Teuchos::ArrayRCP<size_t> & rowPointers,
1331 const Teuchos::ArrayRCP<LocalOrdinal> & columnIndices);
1357 void replaceColMap (
const Teuchos::RCP<const map_type>& newColMap);
1380 const Teuchos::RCP<const import_type>& newImport = Teuchos::null,
1381 const bool sortIndicesInEachRow =
true);
1398 const Teuchos::RCP<const import_type>& newImporter);
1432 template<
class ViewType,
class OffsetViewType >
1433 struct pack_functor {
1437 OffsetViewType src_offset;
1438 OffsetViewType dest_offset;
1439 typedef typename OffsetViewType::non_const_value_type ScalarIndx;
1441 pack_functor(ViewType dest_, ViewType src_, OffsetViewType dest_offset_, OffsetViewType src_offset_):
1442 src(src_),dest(dest_),src_offset(src_offset_),dest_offset(dest_offset_) {};
1444 KOKKOS_INLINE_FUNCTION
1445 void operator() (
size_t row)
const {
1446 ScalarIndx i = src_offset(row);
1447 ScalarIndx j = dest_offset(row);
1448 const ScalarIndx k = dest_offset(row+1);
1457 template<
class CrsGraphType>
1458 friend Teuchos::RCP<CrsGraphType>
1459 importAndFillCompleteCrsGraph (
const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1460 const Import<
typename CrsGraphType::local_ordinal_type,
1461 typename CrsGraphType::global_ordinal_type,
1462 typename CrsGraphType::node_type>& importer,
1463 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1464 typename CrsGraphType::global_ordinal_type,
1465 typename CrsGraphType::node_type> >& domainMap,
1466 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1467 typename CrsGraphType::global_ordinal_type,
1468 typename CrsGraphType::node_type> >& rangeMap,
1469 const Teuchos::RCP<Teuchos::ParameterList>& params);
1472 template<
class CrsGraphType>
1473 friend Teuchos::RCP<CrsGraphType>
1474 importAndFillCompleteCrsGraph (
const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1475 const Import<
typename CrsGraphType::local_ordinal_type,
1476 typename CrsGraphType::global_ordinal_type,
1477 typename CrsGraphType::node_type>& rowImporter,
1478 const Import<
typename CrsGraphType::local_ordinal_type,
1479 typename CrsGraphType::global_ordinal_type,
1480 typename CrsGraphType::node_type>& domainImporter,
1481 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1482 typename CrsGraphType::global_ordinal_type,
1483 typename CrsGraphType::node_type> >& domainMap,
1484 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1485 typename CrsGraphType::global_ordinal_type,
1486 typename CrsGraphType::node_type> >& rangeMap,
1487 const Teuchos::RCP<Teuchos::ParameterList>& params);
1491 template<
class CrsGraphType>
1492 friend Teuchos::RCP<CrsGraphType>
1493 exportAndFillCompleteCrsGraph (
const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1494 const Export<
typename CrsGraphType::local_ordinal_type,
1495 typename CrsGraphType::global_ordinal_type,
1496 typename CrsGraphType::node_type>& exporter,
1497 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1498 typename CrsGraphType::global_ordinal_type,
1499 typename CrsGraphType::node_type> >& domainMap,
1500 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1501 typename CrsGraphType::global_ordinal_type,
1502 typename CrsGraphType::node_type> >& rangeMap,
1503 const Teuchos::RCP<Teuchos::ParameterList>& params);
1506 template<
class CrsGraphType>
1507 friend Teuchos::RCP<CrsGraphType>
1508 exportAndFillCompleteCrsGraph (
const Teuchos::RCP<const CrsGraphType>& sourceGraph,
1509 const Export<
typename CrsGraphType::local_ordinal_type,
1510 typename CrsGraphType::global_ordinal_type,
1511 typename CrsGraphType::node_type>& rowExporter,
1512 const Export<
typename CrsGraphType::local_ordinal_type,
1513 typename CrsGraphType::global_ordinal_type,
1514 typename CrsGraphType::node_type>& domainExporter,
1515 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1516 typename CrsGraphType::global_ordinal_type,
1517 typename CrsGraphType::node_type> >& domainMap,
1518 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
1519 typename CrsGraphType::global_ordinal_type,
1520 typename CrsGraphType::node_type> >& rangeMap,
1521 const Teuchos::RCP<Teuchos::ParameterList>& params);
1542 const Teuchos::RCP<const map_type>& domainMap,
1543 const Teuchos::RCP<const map_type>& rangeMap,
1544 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
const;
1565 const Teuchos::RCP<const map_type>& domainMap,
1566 const Teuchos::RCP<const map_type>& rangeMap,
1567 const Teuchos::RCP<Teuchos::ParameterList>& params)
const;
1588 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1589 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1590 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
const;
1611 const Teuchos::RCP<const map_type>& domainMap,
1612 const Teuchos::RCP<const map_type>& rangeMap,
1613 const Teuchos::RCP<Teuchos::ParameterList>& params)
const;
1638 transferAndFillComplete (Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >& destGraph,
1639 const ::Tpetra::Details::Transfer<LocalOrdinal, GlobalOrdinal, Node>& rowTransfer,
1640 const Teuchos::RCP<const ::Tpetra::Details::Transfer<LocalOrdinal, GlobalOrdinal, Node> > & domainTransfer,
1641 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
1642 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
1643 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
const;
1648 struct SLocalGlobalViews {
1649 Teuchos::ArrayView<const GlobalOrdinal> ginds;
1650 Teuchos::ArrayView<const LocalOrdinal> linds;
1652 struct SLocalGlobalNCViews {
1653 Teuchos::ArrayView<GlobalOrdinal> ginds;
1654 Teuchos::ArrayView<LocalOrdinal> linds;
1657 bool indicesAreAllocated ()
const;
1658 void allocateIndices (
const ELocalGlobal lg);
1672 void makeColMap (Teuchos::Array<int>& remotePIDs);
1702 const bool useRemotePIDs);
1744 const SLocalGlobalViews& newInds,
1745 const ELocalGlobal lg,
1746 const ELocalGlobal I);
1759 const GlobalOrdinal inputGblColInds[],
1760 const size_t numInputInds);
1773 const GlobalOrdinal inputGblColInds[],
1774 const size_t numInputInds);
1777 insertLocalIndicesImpl (
const LocalOrdinal lclRow,
1778 const Teuchos::ArrayView<const LocalOrdinal>& gblColInds);
1793 const GlobalOrdinal gblColInds[],
1794 const LocalOrdinal numGblColInds);
1809 const GlobalOrdinal gblColInds[],
1810 const LocalOrdinal numGblColInds);
1817 #ifdef KOKKOS_ENABLE_SERIAL 1818 ! std::is_same<execution_space, Kokkos::Serial>::value;
1821 #endif // KOKKOS_ENABLE_SERIAL 1843 sortAndMergeAllIndices (
const bool sorted,
const bool merged);
1872 const Teuchos::RCP<const map_type>& rangeMap);
1874 void staticAssertions()
const;
1875 void clearGlobalConstants();
1969 Teuchos::ArrayView<const LocalOrdinal>
1975 Teuchos::ArrayView<LocalOrdinal>
1991 LocalOrdinal& capacity,
1992 const RowInfo& rowInfo)
const;
2002 Kokkos::View<const LocalOrdinal*, execution_space, Kokkos::MemoryUnmanaged>
2003 getLocalKokkosRowView (
const RowInfo& rowInfo)
const;
2011 Kokkos::View<LocalOrdinal*, execution_space, Kokkos::MemoryUnmanaged>
2012 getLocalKokkosRowViewNonConst (
const RowInfo& rowInfo);
2020 Kokkos::View<const GlobalOrdinal*, execution_space, Kokkos::MemoryUnmanaged>
2021 getGlobalKokkosRowView (
const RowInfo& rowInfo)
const;
2028 Teuchos::ArrayView<const GlobalOrdinal>
2034 Teuchos::ArrayView<GlobalOrdinal>
2051 LocalOrdinal& capacity,
2052 const RowInfo& rowInfo)
const;
2065 void fillLocalGraph (
const Teuchos::RCP<Teuchos::ParameterList>& params);
2150 typename Kokkos::View<const size_t*, execution_space>::HostMirror
2294 bool indicesAreAllocated_;
2295 bool indicesAreLocal_;
2296 bool indicesAreGlobal_;
2341 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2342 Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
2344 size_t maxNumEntriesPerRow = 0,
2345 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2349 return rcp (
new graph_type (map, maxNumEntriesPerRow,
DynamicProfile, params));
2400 template<
class CrsGraphType>
2401 Teuchos::RCP<CrsGraphType>
2403 const Import<
typename CrsGraphType::local_ordinal_type,
2404 typename CrsGraphType::global_ordinal_type,
2405 typename CrsGraphType::node_type>& importer,
2406 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2407 typename CrsGraphType::global_ordinal_type,
2408 typename CrsGraphType::node_type> >& domainMap = Teuchos::null,
2409 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2410 typename CrsGraphType::global_ordinal_type,
2411 typename CrsGraphType::node_type> >& rangeMap = Teuchos::null,
2412 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2414 Teuchos::RCP<CrsGraphType> destGraph;
2415 sourceGraph->importAndFillComplete (destGraph,importer,domainMap, rangeMap, params);
2469 template<
class CrsGraphType>
2470 Teuchos::RCP<CrsGraphType>
2472 const Import<
typename CrsGraphType::local_ordinal_type,
2473 typename CrsGraphType::global_ordinal_type,
2474 typename CrsGraphType::node_type>& rowImporter,
2475 const Import<
typename CrsGraphType::local_ordinal_type,
2476 typename CrsGraphType::global_ordinal_type,
2477 typename CrsGraphType::node_type>& domainImporter,
2478 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2479 typename CrsGraphType::global_ordinal_type,
2480 typename CrsGraphType::node_type> >& domainMap,
2481 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2482 typename CrsGraphType::global_ordinal_type,
2483 typename CrsGraphType::node_type> >& rangeMap,
2484 const Teuchos::RCP<Teuchos::ParameterList>& params)
2486 Teuchos::RCP<CrsGraphType> destGraph;
2487 sourceGraph->importAndFillComplete (destGraph,rowImporter,domainImporter, domainMap, rangeMap, params);
2524 template<
class CrsGraphType>
2525 Teuchos::RCP<CrsGraphType>
2527 const Export<
typename CrsGraphType::local_ordinal_type,
2528 typename CrsGraphType::global_ordinal_type,
2529 typename CrsGraphType::node_type>& exporter,
2530 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2531 typename CrsGraphType::global_ordinal_type,
2532 typename CrsGraphType::node_type> >& domainMap = Teuchos::null,
2533 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2534 typename CrsGraphType::global_ordinal_type,
2535 typename CrsGraphType::node_type> >& rangeMap = Teuchos::null,
2536 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2538 Teuchos::RCP<CrsGraphType> destGraph;
2539 sourceGraph->exportAndFillComplete (destGraph,exporter,domainMap, rangeMap, params);
2576 template<
class CrsGraphType>
2577 Teuchos::RCP<CrsGraphType>
2579 const Export<
typename CrsGraphType::local_ordinal_type,
2580 typename CrsGraphType::global_ordinal_type,
2581 typename CrsGraphType::node_type>& rowExporter,
2582 const Export<
typename CrsGraphType::local_ordinal_type,
2583 typename CrsGraphType::global_ordinal_type,
2584 typename CrsGraphType::node_type>& domainExporter,
2585 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2586 typename CrsGraphType::global_ordinal_type,
2587 typename CrsGraphType::node_type> >& domainMap,
2588 const Teuchos::RCP<
const Map<
typename CrsGraphType::local_ordinal_type,
2589 typename CrsGraphType::global_ordinal_type,
2590 typename CrsGraphType::node_type> >& rangeMap,
2591 const Teuchos::RCP<Teuchos::ParameterList>& params)
2593 Teuchos::RCP<CrsGraphType> destGraph;
2594 sourceGraph->exportAndFillComplete (destGraph,rowExporter,domainExporter,domainMap, rangeMap, params);
2600 template<
class LocalOrdinal,
2601 class GlobalOrdinal,
2602 class OutputNodeType,
2603 class InputNodeType>
2604 class CrsGraphCopier<
CrsGraph<LocalOrdinal, GlobalOrdinal, OutputNodeType>,
2605 CrsGraph<LocalOrdinal, GlobalOrdinal, InputNodeType> > {
2607 typedef CrsGraph<LocalOrdinal, GlobalOrdinal, InputNodeType> input_crs_graph_type;
2608 typedef CrsGraph<LocalOrdinal, GlobalOrdinal, OutputNodeType> output_crs_graph_type;
2610 static Teuchos::RCP<output_crs_graph_type>
2611 clone (
const input_crs_graph_type& graphIn,
2612 const Teuchos::RCP<OutputNodeType> &nodeOut,
2613 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
2615 using Teuchos::arcp;
2616 using Teuchos::Array;
2617 using Teuchos::ArrayRCP;
2618 using Teuchos::ArrayView;
2619 using Teuchos::null;
2620 using Teuchos::outArg;
2621 using Teuchos::ParameterList;
2622 using Teuchos::parameterList;
2625 using Teuchos::REDUCE_MIN;
2626 using Teuchos::reduceAll;
2627 using Teuchos::sublist;
2630 typedef LocalOrdinal LO;
2631 typedef GlobalOrdinal GO;
2632 typedef typename ArrayView<const GO>::size_type size_type;
2633 typedef ::Tpetra::Map<LO, GO, InputNodeType> input_map_type;
2634 typedef ::Tpetra::Map<LO, GO, OutputNodeType> output_map_type;
2635 const char prefix[] =
"Tpetra::Details::CrsGraphCopier::clone: ";
2639 bool fillCompleteClone =
true;
2640 bool useLocalIndices = graphIn.hasColMap ();
2643 if (! params.is_null ()) {
2644 fillCompleteClone = params->get (
"fillComplete clone", fillCompleteClone);
2645 useLocalIndices = params->get (
"Locally indexed clone", useLocalIndices);
2646 if (params->get (
"Static profile clone",
true) ==
false) {
2649 debug = params->get (
"Debug", debug);
2652 const Teuchos::Comm<int>& comm = * (graphIn.getRowMap ()->getComm ());
2653 const int myRank = comm.getRank ();
2655 TEUCHOS_TEST_FOR_EXCEPTION(
2656 ! graphIn.hasColMap () && useLocalIndices, std::runtime_error,
2657 prefix <<
"You asked clone() to use local indices (by setting the " 2658 "\"Locally indexed clone\" parameter to true), but the source graph " 2659 "does not yet have a column Map, so this is impossible.");
2662 std::ostringstream os;
2663 os <<
"Process " << myRank <<
": Cloning row Map" << endl;
2667 RCP<const output_map_type> clonedRowMap =
2668 graphIn.getRowMap ()->template clone<OutputNodeType> (nodeOut);
2672 RCP<output_crs_graph_type> clonedGraph;
2674 ArrayRCP<const size_t> numEntriesPerRow;
2675 size_t numEntriesForAll = 0;
2676 bool boundSameForAllLocalRows =
true;
2679 std::ostringstream os;
2680 os <<
"Process " << myRank <<
": Getting per-row bounds" << endl;
2683 graphIn.getNumEntriesPerLocalRowUpperBound (numEntriesPerRow,
2685 boundSameForAllLocalRows);
2687 std::ostringstream os;
2688 os <<
"Process " << myRank <<
": numEntriesForAll = " 2689 << numEntriesForAll << endl;
2694 std::ostringstream os;
2695 os <<
"Process " << myRank <<
": graphIn.getNodeMaxNumRowEntries() = " 2696 << graphIn.getNodeMaxNumRowEntries () << endl;
2700 RCP<ParameterList> graphparams;
2701 if (params.is_null ()) {
2702 graphparams = parameterList (
"CrsGraph");
2704 graphparams = sublist (params,
"CrsGraph");
2706 if (useLocalIndices) {
2707 RCP<const output_map_type> clonedColMap =
2708 graphIn.getColMap ()->template clone<OutputNodeType> (nodeOut);
2709 if (boundSameForAllLocalRows) {
2710 clonedGraph = rcp (
new output_crs_graph_type (clonedRowMap, clonedColMap,
2711 numEntriesForAll, pftype,
2714 clonedGraph = rcp (
new output_crs_graph_type (clonedRowMap, clonedColMap,
2715 numEntriesPerRow, pftype,
2719 if (boundSameForAllLocalRows) {
2720 clonedGraph = rcp (
new output_crs_graph_type (clonedRowMap,
2721 numEntriesForAll, pftype,
2724 clonedGraph = rcp (
new output_crs_graph_type (clonedRowMap,
2726 pftype, graphparams));
2731 std::ostringstream os;
2732 os <<
"Process " << myRank <<
": Invoked output graph's constructor" << endl;
2737 numEntriesPerRow = null;
2738 numEntriesForAll = 0;
2741 const input_map_type& inputRowMap = * (graphIn.getRowMap ());
2742 const size_type numRows =
2743 static_cast<size_type
> (inputRowMap.getNodeNumElements ());
2745 bool failed =
false;
2747 if (useLocalIndices) {
2748 const LO localMinLID = inputRowMap.getMinLocalIndex ();
2749 const LO localMaxLID = inputRowMap.getMaxLocalIndex ();
2751 if (graphIn.isLocallyIndexed ()) {
2754 ArrayView<const LO> linds;
2755 for (LO lrow = localMinLID; lrow <= localMaxLID; ++lrow) {
2756 graphIn.getLocalRowView (lrow, linds);
2757 if (linds.size () != 0) {
2758 clonedGraph->insertLocalIndices (lrow, linds);
2762 catch (std::exception& e) {
2763 std::ostringstream os;
2764 os <<
"Process " << myRank <<
": copying (reading local by view, " 2765 "writing local) indices into the output graph threw an " 2766 "exception: " << e.what () << endl;
2773 TEUCHOS_TEST_FOR_EXCEPTION(
2774 ! graphIn.hasColMap () && useLocalIndices, std::invalid_argument,
2775 prefix <<
"You asked clone() to use local indices (by setting the " 2776 "\"Locally indexed clone\" parameter to true), but the source graph " 2777 "does not yet have a column Map, so this is impossible.");
2792 size_t myMaxNumRowEntries =
2793 graphIn.isFillActive () ?
static_cast<size_t> (0) :
2794 graphIn.getNodeMaxNumRowEntries ();
2796 Array<LO> linds (myMaxNumRowEntries);
2799 for (LO lrow = localMinLID; lrow <= localMaxLID; ++lrow) {
2800 size_t theNumEntries = graphIn.getNumEntriesInLocalRow (lrow);
2801 if (theNumEntries > myMaxNumRowEntries) {
2802 myMaxNumRowEntries = theNumEntries;
2803 linds.resize (myMaxNumRowEntries);
2805 graphIn.getLocalRowCopy (lrow, linds (), theNumEntries);
2806 if (theNumEntries != 0) {
2807 clonedGraph->insertLocalIndices (lrow, linds (0, theNumEntries));
2811 catch (std::exception& e) {
2812 std::ostringstream os;
2813 os <<
"Process " << myRank <<
": copying (reading local by copy, " 2814 "writing local) indices into the output graph threw an exception: " 2815 << e.what () << endl;
2823 const GlobalOrdinal localMinGID = inputRowMap.getMinGlobalIndex ();
2824 const GlobalOrdinal localMaxGID = inputRowMap.getMaxGlobalIndex ();
2825 const bool inputRowMapIsContiguous = inputRowMap.isContiguous ();
2827 if (graphIn.isGloballyIndexed ()) {
2828 ArrayView<const GlobalOrdinal> ginds;
2830 if (inputRowMapIsContiguous) {
2832 for (GO grow = localMinGID; grow <= localMaxGID; ++grow) {
2833 graphIn.getGlobalRowView (grow, ginds);
2834 if (ginds.size () != 0) {
2835 clonedGraph->insertGlobalIndices (grow, ginds);
2839 catch (std::exception& e) {
2840 std::ostringstream os;
2841 os <<
"Process " << myRank <<
": copying (reading global by view, " 2842 "writing global) indices into the output graph threw an " 2843 "exception: " << e.what () << endl;
2850 ArrayView<const GO> inputRowMapGIDs = inputRowMap.getNodeElementList ();
2851 for (size_type k = 0; k < numRows; ++k) {
2852 const GO grow = inputRowMapGIDs[k];
2853 graphIn.getGlobalRowView (grow, ginds);
2854 if (ginds.size () != 0) {
2855 clonedGraph->insertGlobalIndices (grow, ginds);
2859 catch (std::exception& e) {
2860 std::ostringstream os;
2861 os <<
"Process " << myRank <<
": copying (reading global by view, " 2862 "writing global) indices into the output graph threw an " 2863 "exception: " << e.what () << endl;
2876 size_t myMaxNumRowEntries =
2877 graphIn.isFillActive () ?
static_cast<size_t> (0) :
2878 graphIn.getNodeMaxNumRowEntries ();
2880 Array<GO> ginds (myMaxNumRowEntries);
2882 if (inputRowMapIsContiguous) {
2884 for (GO grow = localMinGID; grow <= localMaxGID; ++grow) {
2885 size_t theNumEntries = graphIn.getNumEntriesInGlobalRow (grow);
2886 if (theNumEntries > myMaxNumRowEntries) {
2887 myMaxNumRowEntries = theNumEntries;
2888 ginds.resize (myMaxNumRowEntries);
2890 graphIn.getGlobalRowCopy (grow, ginds (), theNumEntries);
2891 if (theNumEntries != 0) {
2892 clonedGraph->insertGlobalIndices (grow, ginds (0, theNumEntries));
2896 catch (std::exception& e) {
2897 std::ostringstream os;
2898 os <<
"Process " << myRank <<
": copying (reading global by copy, " 2899 "writing global) indices into the output graph threw an " 2900 "exception: " << e.what () << endl;
2907 ArrayView<const GO> inputRowMapGIDs = inputRowMap.getNodeElementList ();
2908 for (size_type k = 0; k < numRows; ++k) {
2909 const GO grow = inputRowMapGIDs[k];
2911 size_t theNumEntries = graphIn.getNumEntriesInGlobalRow (grow);
2912 if (theNumEntries > myMaxNumRowEntries) {
2913 myMaxNumRowEntries = theNumEntries;
2914 ginds.resize (myMaxNumRowEntries);
2916 graphIn.getGlobalRowCopy (grow, ginds (), theNumEntries);
2917 if (theNumEntries != 0) {
2918 clonedGraph->insertGlobalIndices (grow, ginds (0, theNumEntries));
2922 catch (std::exception& e) {
2923 std::ostringstream os;
2924 os <<
"Process " << myRank <<
": copying (reading global by copy, " 2925 "writing global) indices into the output graph threw an " 2926 "exception: " << e.what () << endl;
2936 std::ostringstream os;
2937 os <<
"Process " << myRank <<
": copied entries" << endl;
2941 if (fillCompleteClone) {
2942 RCP<ParameterList> fillparams = params.is_null () ?
2943 parameterList (
"fillComplete") :
2944 sublist (params,
"fillComplete");
2946 RCP<const output_map_type> clonedRangeMap;
2947 RCP<const output_map_type> clonedDomainMap;
2948 if (! graphIn.getRangeMap ().is_null () &&
2949 graphIn.getRangeMap () != graphIn.getRowMap ()) {
2951 graphIn.getRangeMap ()->template clone<OutputNodeType> (nodeOut);
2954 clonedRangeMap = clonedRowMap;
2956 if (! graphIn.getDomainMap ().is_null ()
2957 && graphIn.getDomainMap () != graphIn.getRowMap ()) {
2959 graphIn.getDomainMap ()->template clone<OutputNodeType> (nodeOut);
2962 clonedDomainMap = clonedRowMap;
2966 std::ostringstream os;
2967 os <<
"Process " << myRank <<
": About to call fillComplete on " 2968 "cloned graph" << endl;
2971 clonedGraph->fillComplete (clonedDomainMap, clonedRangeMap, fillparams);
2973 catch (std::exception &e) {
2975 std::ostringstream os;
2976 os << prefix <<
"Process " << myRank <<
": Caught the following " 2977 "exception while calling fillComplete() on clone of type" 2978 << endl << Teuchos::typeName (*clonedGraph) << endl;
2983 int lclSuccess = failed ? 0 : 1;
2985 reduceAll<int, int> (comm, REDUCE_MIN, lclSuccess, outArg (gblSuccess));
2986 TEUCHOS_TEST_FOR_EXCEPTION(
2987 gblSuccess != 1, std::logic_error, prefix <<
2988 "Clone failed on at least one process.");
2991 std::ostringstream os;
2992 os <<
"Process " << myRank <<
": Done with CrsGraph::clone" << endl;
3002 #endif // TPETRA_CRSGRAPH_DECL_HPP size_t getNodeNumDiagsImpl() const override
DO NOT CALL THIS METHOD; THIS IS NOT FOR USERS.
Teuchos::ArrayView< const GlobalOrdinal > getGlobalView(const RowInfo &rowinfo) const
Get a const, nonowned, globally indexed view of the locally owned row myRow, such that rowinfo = getR...
Base class for distributed Tpetra objects that support data redistribution.
void reindexColumns(const Teuchos::RCP< const map_type > &newColMap, const Teuchos::RCP< const import_type > &newImport=Teuchos::null, const bool sortIndicesInEachRow=true)
Reindex the column indices in place, and replace the column Map. Optionally, replace the Import objec...
global_size_t getGlobalNumCols() const override
Returns the number of global columns in the graph.
void insertGlobalIndices(const GlobalOrdinal globalRow, const Teuchos::ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Node node_type
This class' Kokkos Node type.
Node::device_type device_type
This class' Kokkos device type.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
LocalOrdinal getLocalViewRawConst(const LocalOrdinal *&lclInds, LocalOrdinal &capacity, const RowInfo &rowInfo) const
Get a pointer to the local column indices of a locally owned row, using the result of getRowInfo...
void computeLocalConstants(const bool computeLocalTriangularConstants)
Compute local constants, if they have not yet been computed.
size_t nodeNumDiags_
Local number of (populated) diagonal entries.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Default parameter list suitable for validation.
void getGlobalRowView(const GlobalOrdinal gblRow, Teuchos::ArrayView< const GlobalOrdinal > &gblColInds) const override
Get a const, non-persisting view of the given global row's global column indices, as a Teuchos::Array...
bool isLowerTriangularImpl() const override
DO NOT CALL THIS METHOD; THIS IS NOT FOR USERS.
::Tpetra::Details::EStorageStatus storageStatus_
Status of the graph's storage, when not in a fill-complete state.
void makeImportExport(Teuchos::Array< int > &remotePIDs, const bool useRemotePIDs)
Make the Import and Export objects, if needed.
size_t insertGlobalIndicesImpl(const LocalOrdinal lclRow, const GlobalOrdinal inputGblColInds[], const size_t numInputInds)
Insert global indices, using an input local row index.
t_GlobalOrdinal_1D k_gblInds1D_
Global column indices for all rows.
Teuchos::RCP< const map_type > domainMap_
The Map describing the domain of the (matrix corresponding to the) graph.
virtual void pack(const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< GlobalOrdinal > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor) const override
Pack this object's data for Import or Export.
size_t getNodeNumRows() const override
Returns the number of graph rows owned on the calling node.
bool isUpperTriangularImpl() const override
DO NOT CALL THIS METHOD; THIS IS NOT FOR USERS.
bool noRedundancies_
Whether the graph's indices are non-redundant (merged) in each row, on this process.
local_graph_type getLocalGraph() const
Get the local graph.
void getLocalRowCopy(LocalOrdinal LocalRow, const Teuchos::ArrayView< LocalOrdinal > &indices, size_t &NumIndices) const override
Get a copy of the given row, using local indices.
Teuchos::RCP< const map_type > getRangeMap() const override
Returns the Map associated with the domain of this graph.
Teuchos::RCP< const import_type > importer_
The Import from the domain Map to the column Map.
Teuchos::RCP< const map_type > getDomainMap() const override
Returns the Map associated with the domain of this graph.
void fillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Tell the graph that you are done changing its structure.
Classes::Export< LocalOrdinal, GlobalOrdinal, Node > Export
Alias for Tpetra::Classes::Export.
static const bool useAtomicUpdatesByDefault
Whether transformLocalValues should use atomic updates by default.
Forward declaration of Tpetra::BlockCrsMatrix.
size_t getNodeNumEntries() const override
The local number of entries in the graph.
bool TPETRA_DEPRECATED isLowerTriangular() const override
Whether the graph is locally lower triangular.
Teuchos::ArrayView< const LocalOrdinal > getLocalView(const RowInfo rowinfo) const
Get a const, nonowned, locally indexed view of the locally owned row myRow, such that rowinfo = getRo...
Teuchos::RCP< CrsGraphType > exportAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Export< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &exporter, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Nonmember CrsGraph constructor that fuses Export and fillComplete().
Teuchos::ArrayRCP< const LocalOrdinal > getNodePackedIndices() const
Get an Teuchos::ArrayRCP of the packed column-indices.
void insertGlobalIndicesIntoNonownedRows(const GlobalOrdinal gblRow, const GlobalOrdinal gblColInds[], const LocalOrdinal numGblColInds)
Implementation of insertGlobalIndices for nonowned rows.
void setAllIndices(const typename local_graph_type::row_map_type &rowPointers, const typename local_graph_type::entries_type::non_const_type &columnIndices)
Set the graph's data directly, using 1-D storage.
virtual void removeEmptyProcessesInPlace(const Teuchos::RCP< const map_type > &newMap) override
Remove processes owning zero rows from the Maps and their communicator.
Classes::Import< LocalOrdinal, GlobalOrdinal, Node > Import
Alias for Tpetra::Classes::Import.
void insertGlobalIndicesFiltered(const LocalOrdinal lclRow, const GlobalOrdinal gblColInds[], const LocalOrdinal numGblColInds)
Like insertGlobalIndices(), but with column Map filtering.
A distributed graph accessed by rows (adjacency lists) and stored sparsely.
void exportAndFillComplete(Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &destGraph, const export_type &exporter, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) const
Export from this to the given destination graph, and make the result fill complete.
void setDomainRangeMaps(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap)
void checkInternalState() const
Throw an exception if the internal state is not consistent.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const override
Returns the current number of entries on this node in the specified global row.
Kokkos::View< const size_t *, execution_space >::HostMirror k_numAllocPerRow_
The maximum number of entries to allow in each locally owned row, per row.
Allocation information for a locally owned row in a CrsGraph or CrsMatrix.
int local_ordinal_type
Default value of Scalar template parameter.
Classes::Map< LocalOrdinal, GlobalOrdinal, Node > Map
Alias for Tpetra::Classes::Map.
void globalAssemble()
Communicate nonlocal contributions to other processes.
bool upperTriangular_
Whether the graph is locally upper triangular.
An abstract interface for graphs accessed by rows.
bool TPETRA_DEPRECATED isUpperTriangular() const override
Whether the graph is locally upper triangular.
void replaceDomainMapAndImporter(const Teuchos::RCP< const map_type > &newDomainMap, const Teuchos::RCP< const import_type > &newImporter)
Replace the current domain Map and Import with the given parameters.
bool hasColMap() const override
Whether the graph has a column Map.
void computeGlobalConstants(const bool computeLocalTriangularConstants)
Compute global constants, if they have not yet been computed.
Implementation details of Tpetra.
bool isFillActive() const
Returns true if resumeFill() has been called and the graph is in edit mode.
Teuchos::RCP< const export_type > exporter_
The Export from the row Map to the range Map.
global_size_t globalMaxNumRowEntries_
Global maximum of the number of entries in each row.
bool supportsRowViews() const override
Whether this class implements getLocalRowView() and getGlobalRowView() (it does). ...
Sparse matrix that presents a row-oriented interface that lets users read or modify entries...
size_t global_size_t
Global size_t object.
size_t getGlobalMaxNumRowEntries() const override
Maximum number of entries in any row of the graph, over all processes in the graph's communicator...
size_t numAllocForAllRows_
The maximum number of entries to allow in each locally owned row.
GlobalOrdinal getIndexBase() const override
Returns the index base for global indices for this graph.
Classes::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > CrsGraph
Alias for Tpetra::Classes::CrsGraph.
size_t getNodeNumCols() const override
Returns the number of columns connected to the locally owned rows of this graph.
RowInfo getRowInfo(const LocalOrdinal myRow) const
Get information about the locally owned row with local index myRow.
local_graph_type::row_map_type::non_const_type t_RowPtrsNC TPETRA_DEPRECATED
DEPRECATED; use local_graph_type::row_map_type::non_const_type instead.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > ¶ms) override
Set the given list of parameters (must be nonnull).
bool haveGlobalConstants_
Whether all processes have computed global constants.
std::string description() const override
Return a one-line human-readable description of this object.
std::map< GlobalOrdinal, std::vector< GlobalOrdinal > > nonlocals_
Nonlocal data given to insertGlobalIndices.
friend class CrsGraph
Alias for Tpetra::Classes::CrsGraph.
local_graph_type::row_map_type::const_type k_rowPtrs_
Row offsets for "1-D" storage.
void makeColMap(Teuchos::Array< int > &remotePIDs)
Make and set the graph's column Map.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Current number of allocated entries in the given row on the calling (MPI) process, using a global row index.
global_size_t getGlobalNumEntries() const override
Returns the global number of entries in the graph.
virtual bool checkSizes(const SrcDistObject &source) override
Compare the source and target (this) objects for compatibility.
bool isSorted() const
Whether graph indices in all rows are known to be sorted.
void getLocalDiagOffsets(const Kokkos::View< size_t *, device_type, Kokkos::MemoryUnmanaged > &offsets) const
Get offsets of the diagonal entries in the graph.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Current number of allocated entries in the given row on the calling (MPI) process, using a local row index.
Sets up and executes a communication plan for a Tpetra DistObject.
CombineMode
Rule for combining data in an Import or Export.
size_t nodeMaxNumRowEntries_
Local maximum of the number of entries in each row.
size_t getNodeAllocationSize() const
The local number of indices allocated for the graph, over all rows on the calling (MPI) process...
bool isGloballyIndexed() const override
If graph indices are in the global range, this function returns true. Otherwise, this function return...
bool lowerTriangular_
Whether the graph is locally lower triangular.
::Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > export_type
The Export specialization used by this class.
size_t sortAndMergeRowIndices(const RowInfo &rowInfo, const bool sorted, const bool merged)
Sort and merge duplicate column indices in the given row.
Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node2 > > clone(const Teuchos::RCP< Node2 > &node2, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) const
Create a cloned CrsGraph for a different Node type.
Forward declaration of Tpetra::CrsMatrix.
local_graph_type::row_map_type t_RowPtrs TPETRA_DEPRECATED
DEPRECATED; use local_graph_type::row_map_type instead.
Abstract base class for objects that can be the source of an Import or Export operation.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const import_type > &importer=Teuchos::null, const Teuchos::RCP< const export_type > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Perform a fillComplete on a graph that already has data, via setAllIndices().
local_graph_type::entries_type::non_const_type k_lclInds1D_
Local column indices for all rows.
void resumeFill(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Resume fill operations.
void getLocalRowView(const LocalOrdinal lclRow, Teuchos::ArrayView< const LocalOrdinal > &lclColInds) const override
Get a const, non-persisting view of the given local row's local column indices, as a Teuchos::ArrayVi...
num_row_entries_type k_numRowEntries_
The number of local entries in each locally owned row.
local_graph_type lclGraph_
Local graph; only initialized after first fillComplete() call.
::Kokkos::Compat::KokkosDeviceWrapperNode< execution_space > node_type
Default value of Node template parameter.
std::pair< size_t, std::string > makeIndicesLocal()
Convert column indices from global to local.
Teuchos::ArrayView< GlobalOrdinal > getGlobalViewNonConst(const RowInfo &rowinfo)
Get a nonconst, nonowned, globally indexed view of the locally owned row myRow, such that rowinfo = g...
Kokkos::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, execution_space > local_graph_type
The type of the part of the sparse graph on each MPI process.
global_size_t globalNumEntries_
Global number of entries in the graph.
Teuchos::RCP< node_type > getNode() const override
Returns the underlying node.
Teuchos::ArrayView< LocalOrdinal > getLocalViewNonConst(const RowInfo rowinfo)
Get a nonconst, nonowned, locally indexed view of the locally owned row myRow, such that rowinfo = ge...
::Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > import_type
The Import specialization used by this class.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const override
Returns the communicator.
Teuchos::RCP< const map_type > rangeMap_
The Map describing the range of the (matrix corresponding to the) graph.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const override
Get the number of entries in the given row (local index).
void replaceColMap(const Teuchos::RCP< const map_type > &newColMap)
Replace the graph's current column Map with the given Map.
bool isMerged() const
Whether duplicate column indices in each row have been merged.
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
Teuchos::ArrayRCP< const size_t > getNodeRowPtrs() const
Get a host view of the row offsets.
bool haveLocalConstants_
Whether this process has computed local constants.
void getNumEntriesPerLocalRowUpperBound(Teuchos::ArrayRCP< const size_t > &boundPerLocalRow, size_t &boundForAllLocalRows, bool &boundSameForAllLocalRows) const
Get an upper bound on the number of entries that can be stored in each row.
virtual void copyAndPermute(const SrcDistObject &source, size_t numSameIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteToLIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteFromLIDs) override
Perform copies and permutations that are local to this process.
Teuchos::RCP< const map_type > getColMap() const override
Returns the Map that describes the column distribution in this graph.
global_size_t globalNumDiags_
Global number of (populated) diagonal entries.
Kokkos::View< size_t *, Kokkos::LayoutLeft, device_type >::HostMirror num_row_entries_type
The type of k_numRowEntries_ (see below).
virtual ~CrsGraph()
Destructor.
LocalOrdinal local_ordinal_type
This class' first template parameter; the type of local indices.
void importAndFillComplete(Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &destGraph, const import_type &importer, const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) const
Import from this to the given destination graph, and make the result fill complete.
bool isLocallyIndexed() const override
If graph indices are in the local range, this function returns true. Otherwise, this function returns...
void setLocallyModified()
Report that we made a local modification to its structure.
Stand-alone utility functions and macros.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
size_t insertIndices(RowInfo &rowInfo, const SLocalGlobalViews &newInds, const ELocalGlobal lg, const ELocalGlobal I)
Insert indices into the given row.
bool isFillComplete() const override
Returns true if fillComplete() has been called and the graph is in compute mode.
global_size_t getGlobalNumRows() const override
Returns the number of global rows in the graph.
local_graph_type::entries_type::non_const_type t_LocalOrdinal_1D TPETRA_DEPRECATED
DEPRECATED; use local_graph_type::entries_type::non_const_type instead.
Teuchos::RCP< const map_type > rowMap_
The Map describing the distribution of rows of the graph.
ProfileType pftype_
Whether the graph was allocated with static or dynamic profile.
RowInfo getRowInfoFromGlobalRowIndex(const GlobalOrdinal gblRow) const
Get information about the locally owned row with global index gblRow.
void insertLocalIndices(const LocalOrdinal localRow, const Teuchos::ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
global_size_t getGlobalNumDiagsImpl() const override
DO NOT CALL THIS METHOD; THIS IS NOT FOR USERS.
device_type::execution_space execution_space
This class' Kokkos execution space.
local_graph_type LocalStaticCrsGraphType TPETRA_DEPRECATED
DEPRECATED; use local_graph_type (above) instead.
A parallel distribution of indices over processes.
bool indicesAreSorted_
Whether the graph's indices are sorted in each row, on this process.
Teuchos::ArrayRCP< Teuchos::Array< GlobalOrdinal > > gblInds2D_
Global column indices for all rows.
Teuchos::RCP< const export_type > getExporter() const override
Returns the exporter associated with this graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
Teuchos::RCP< const import_type > getImporter() const override
Returns the importer associated with this graph.
size_t getNodeMaxNumRowEntries() const override
Maximum number of entries in any row of the graph, on this process.
Teuchos::RCP< const map_type > getRowMap() const override
Returns the Map that describes the row distribution in this graph.
global_size_t TPETRA_DEPRECATED getGlobalNumDiags() const override
Number of diagonal entries over all processes in the graph's communicator.
GlobalOrdinal global_ordinal_type
This class' second template parameter; the type of global indices.
Teuchos::RCP< const map_type > colMap_
The Map describing the distribution of columns of the graph.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override
Print this object to the given output stream with the given verbosity level.
Mix-in to avoid spurious deprecation warnings due to #2630.
EStorageStatus
Status of the graph's or matrix's storage, when not in a fill-complete state.
Forward declaration of Tpetra::CrsGraph.
Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > createCrsGraph(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t maxNumEntriesPerRow=0, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Nonmember function to create an empty CrsGraph given a row Map and the max number of entries allowed ...
Kokkos::View< GlobalOrdinal *, execution_space > t_GlobalOrdinal_1D
Type of the k_gblInds1D_ array of global column indices.
size_t TPETRA_DEPRECATED getNodeNumDiags() const override
Number of diagonal entries on the calling process.
Teuchos::ArrayRCP< Teuchos::Array< LocalOrdinal > > lclInds2D_
Local column indices for all rows.
ProfileType getProfileType() const
Returns true if the graph was allocated with static data structures.
bool sortGhostsAssociatedWithEachProcessor_
Whether to require makeColMap() (and therefore fillComplete()) to order column Map GIDs associated wi...
Teuchos::RCP< CrsGraphType > importAndFillCompleteCrsGraph(const Teuchos::RCP< const CrsGraphType > &sourceGraph, const Import< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > &importer, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< typename CrsGraphType::local_ordinal_type, typename CrsGraphType::global_ordinal_type, typename CrsGraphType::node_type > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Nonmember CrsGraph constructor that fuses Import and fillComplete().
LocalOrdinal getGlobalViewRawConst(const GlobalOrdinal *&gblInds, LocalOrdinal &capacity, const RowInfo &rowInfo) const
Get a pointer to the global column indices of a locally owned row, using the result of getRowInfoFrom...
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const Teuchos::ArrayView< GlobalOrdinal > &Indices, size_t &NumIndices) const override
Get a copy of the given row, using global indices.