42 #ifndef TPETRA_CRSGRAPH_DECL_HPP
43 #define TPETRA_CRSGRAPH_DECL_HPP
45 #include <Teuchos_CompileTimeAssert.hpp>
46 #include <Teuchos_Describable.hpp>
47 #include <Teuchos_ParameterListAcceptorDefaultBase.hpp>
49 #include <Kokkos_DefaultNode.hpp>
50 #include <Kokkos_DefaultKernels.hpp>
52 #include "Tpetra_ConfigDefs.hpp"
53 #include "Tpetra_RowGraph.hpp"
54 #include "Tpetra_DistObject.hpp"
55 #include "Tpetra_Exceptions.hpp"
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 template <
class S,
class LO,
class GO,
class N,
class SpMatOps>
163 template <
class LocalOrdinal,
164 class GlobalOrdinal = LocalOrdinal,
165 class Node = Kokkos::DefaultNode::DefaultNodeType,
166 class LocalMatOps =
typename Kokkos::DefaultKernels<void,LocalOrdinal,Node>::SparseOps >
168 public RowGraph<LocalOrdinal,GlobalOrdinal,Node>,
169 public DistObject<GlobalOrdinal,LocalOrdinal,GlobalOrdinal,Node>,
170 public Teuchos::ParameterListAcceptorDefaultBase
172 template <
class S,
class LO,
class GO,
class N,
class SpMatOps>
174 template <
class LO2,
class GO2,
class N2,
class SpMatOps2>
178 typedef LocalOrdinal local_ordinal_type;
179 typedef GlobalOrdinal global_ordinal_type;
180 typedef Node node_type;
203 CrsGraph (
const RCP<const map_type>& rowMap,
204 size_t maxNumEntriesPerRow,
206 const RCP<ParameterList>& params = null);
226 const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc,
228 const RCP<ParameterList>& params = null);
251 size_t maxNumEntriesPerRow,
253 const RCP<ParameterList>& params = null);
276 const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc,
278 const RCP<ParameterList>& params = null);
301 const ArrayRCP<size_t> & rowPointers,
302 const ArrayRCP<LocalOrdinal> & columnIndices,
303 const RCP<ParameterList>& params = null);
333 template<
class Node2>
334 RCP<
CrsGraph<LocalOrdinal, GlobalOrdinal, Node2,
335 typename Kokkos::DefaultKernels<void, LocalOrdinal, Node2>::SparseOps> >
336 clone (
const Teuchos::RCP<Node2> &node2,
337 const Teuchos::RCP<Teuchos::ParameterList> ¶ms = null)
const
340 using Teuchos::ArrayRCP;
342 using Teuchos::ParameterList;
344 typedef CrsGraph<LocalOrdinal, GlobalOrdinal, Node2,
345 typename Kokkos::DefaultKernels<void,LocalOrdinal,Node2>::SparseOps> CrsGraph2;
347 const char tfecfFuncName[] =
"clone()";
349 bool fillCompleteClone =
true;
352 if (! params.is_null ()) {
353 fillCompleteClone = params->get (
"fillComplete clone", fillCompleteClone);
354 useLocalIndices = params->get (
"Locally indexed clone", useLocalIndices);
355 if (params->get (
"Static profile clone",
true) ==
false) {
360 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(
361 hasColMap() ==
false && useLocalIndices ==
true,
363 ": You asked clone() to use local indices (by setting the \"Locally "
364 "indexed clone\" parameter to true), but the source graph does not "
365 "yet have a column Map, so this is impossible.");
367 RCP<const Map2> clonedRowMap =
rowMap_->template clone<Node2> (node2);
368 RCP<CrsGraph2> clonedGraph;
369 ArrayRCP<const size_t> numEntries;
370 size_t numEntriesForAll = 0;
371 if (indicesAreAllocated() ==
false) {
382 else if (nodeNumAllocated_ == 0) {
383 numEntriesForAll = 0;
387 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(
389 "Internal logic error. Please report this to Tpetra team.");
391 numEntriesForAll = 0;
392 ArrayRCP<size_t> numEnt;
394 numEnt = arcp<size_t> (numRows);
396 for (
size_t i=0; i<numRows; ++i) {
397 numEnt[i] = rowPtrs_[i+1] - rowPtrs_[i];
402 RCP<ParameterList> graphparams = sublist(params,
"CrsGraph");
403 if (useLocalIndices) {
404 RCP<const Map2> clonedColMap =
colMap_->template clone<Node2>(node2);
405 if (numEntries == null) {
406 clonedGraph = rcp (
new CrsGraph2 (clonedRowMap, clonedColMap, numEntriesForAll, pftype, graphparams));
409 clonedGraph = rcp (
new CrsGraph2 (clonedRowMap, clonedColMap, numEntries, pftype, graphparams));
413 if (numEntries.is_null ()) {
414 clonedGraph = rcp (
new CrsGraph2 (clonedRowMap, numEntriesForAll, pftype, graphparams));
417 clonedGraph = rcp (
new CrsGraph2 (clonedRowMap, numEntries, pftype, graphparams));
422 numEntriesForAll = 0;
424 if (useLocalIndices) {
425 clonedGraph->allocateIndices(LocalIndices);
427 ArrayView<const LocalOrdinal> linds;
428 for (LocalOrdinal lrow =
rowMap_->getMinLocalIndex ();
429 lrow <=
rowMap_->getMaxLocalIndex ();
433 clonedGraph->insertLocalIndices (lrow, linds);
438 Array<LocalOrdinal> linds;
439 for (LocalOrdinal lrow =
rowMap_->getMinLocalIndex();
440 lrow <=
rowMap_->getMaxLocalIndex();
442 size_t theNumEntries;
446 clonedGraph->insertLocalIndices (lrow, linds (0, theNumEntries));
452 clonedGraph->allocateIndices (GlobalIndices);
454 ArrayView<const GlobalOrdinal> ginds;
455 for (GlobalOrdinal grow =
rowMap_->getMinGlobalIndex();
456 grow <=
rowMap_->getMaxGlobalIndex();
460 clonedGraph->insertGlobalIndices (grow, ginds);
465 Array<GlobalOrdinal> ginds;
466 for (GlobalOrdinal grow =
rowMap_->getMinGlobalIndex();
467 grow <=
rowMap_->getMaxGlobalIndex();
469 size_t theNumEntries;
473 clonedGraph->insertGlobalIndices (grow, ginds (0,theNumEntries));
479 if (fillCompleteClone) {
480 RCP<ParameterList> fillparams = sublist (params,
"fillComplete");
482 RCP<const Map2> clonedRangeMap;
483 RCP<const Map2> clonedDomainMap;
485 clonedRangeMap =
rangeMap_->template clone<Node2>(node2);
488 clonedRangeMap = clonedRowMap;
491 clonedDomainMap =
domainMap_->template clone<Node2>(node2);
494 clonedDomainMap = clonedRowMap;
496 clonedGraph->fillComplete (clonedDomainMap, clonedRangeMap, fillparams);
498 catch (std::exception &e) {
499 const bool caughtExceptionOnClone =
true;
500 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(
501 caughtExceptionOnClone, std::runtime_error,
502 ": Caught the following exception while calling fillComplete() on "
503 "clone of type" << endl << Teuchos::typeName (*clonedGraph)
504 << endl <<
":" << endl << e.what() << endl);
550 const ArrayView<const GlobalOrdinal>& indices);
569 const ArrayView<const LocalOrdinal> &indices);
607 void resumeFill (
const RCP<ParameterList> ¶ms = null);
629 const RCP<ParameterList> ¶ms = null);
637 void fillComplete (
const RCP<ParameterList> ¶ms = null);
654 const RCP<ParameterList> ¶ms=Teuchos::null);
660 const RCP<const Comm<int> > &
getComm()
const;
666 const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &
getRowMap()
const;
669 const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &
getColMap()
const;
672 const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &
getDomainMap()
const;
675 const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &
getRangeMap()
const;
678 RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> >
getImporter()
const;
681 RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> >
getExporter()
const;
843 const ArrayView<GlobalOrdinal> &Indices,
860 const ArrayView<LocalOrdinal> &indices,
873 void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices)
const;
884 void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices)
const;
894 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
906 const Teuchos::ArrayView<const LocalOrdinal> &permuteToLIDs,
907 const Teuchos::ArrayView<const LocalOrdinal> &permuteFromLIDs);
911 const Teuchos::ArrayView<const LocalOrdinal> &exportLIDs,
912 Teuchos::Array<GlobalOrdinal> &exports,
913 const Teuchos::ArrayView<size_t> & numPacketsPerLID,
914 size_t& constantNumPackets,
919 const Teuchos::ArrayView<const GlobalOrdinal> &imports,
920 const Teuchos::ArrayView<size_t> &numPacketsPerLID,
921 size_t constantNumPackets,
938 const ArrayRCP<LocalOrdinal> & columnIndices);
1009 typedef typename LocalMatOps::template graph<LocalOrdinal,Node>::graph_type local_graph_type;
1013 struct SLocalGlobalViews {
1014 ArrayView<const GlobalOrdinal> ginds;
1015 ArrayView<const LocalOrdinal> linds;
1017 struct SLocalGlobalNCViews {
1018 ArrayView<GlobalOrdinal> ginds;
1019 ArrayView<LocalOrdinal> linds;
1024 bool indicesAreAllocated()
const;
1026 void allocateIndices (ELocalGlobal lg);
1029 ArrayRCP<T> allocateValues1D ()
const;
1031 ArrayRCP<Array<T> > allocateValues2D ()
const;
1033 template <ELocalGlobal lg,
class T>
1034 RowInfo updateAllocAndValues (RowInfo rowinfo,
size_t allocSize, Array<T>& rowVals);
1049 void makeIndicesLocal ();
1050 void makeImportExport ();
1056 template<ELocalGlobal lg>
1057 size_t filterIndices (
const SLocalGlobalNCViews &inds)
const;
1061 filterGlobalIndicesAndValues (
const ArrayView<GlobalOrdinal>& ginds,
1062 const ArrayView<T>& vals)
const;
1065 filterLocalIndicesAndValues (
const ArrayView<LocalOrdinal>& linds,
1066 const ArrayView<T>& vals)
const;
1099 const SLocalGlobalViews& newInds,
1100 const ELocalGlobal lg,
1101 const ELocalGlobal I);
1142 template<
class Scalar>
1145 const SLocalGlobalViews& newInds,
1146 const ArrayView<Scalar>& oldRowVals,
1147 const ArrayView<const Scalar>& newRowVals,
1148 const ELocalGlobal lg,
1149 const ELocalGlobal I);
1151 insertGlobalIndicesImpl (
const LocalOrdinal myRow,
1152 const ArrayView<const GlobalOrdinal> &indices);
1154 insertLocalIndicesImpl (
const LocalOrdinal myRow,
1155 const ArrayView<const LocalOrdinal> &indices);
1159 const ArrayView<const LocalOrdinal> &indices);
1164 const ArrayView<const GlobalOrdinal> &indices);
1188 template<
class Scalar,
class BinaryFunction>
1191 const Teuchos::ArrayView<Scalar>& rowVals,
1192 const Teuchos::ArrayView<const LocalOrdinal>& inds,
1193 const Teuchos::ArrayView<const Scalar>& newVals,
1194 BinaryFunction f)
const;
1210 template<
class Scalar,
class BinaryFunction>
1213 const Teuchos::ArrayView<Scalar>& rowVals,
1214 const Teuchos::ArrayView<const GlobalOrdinal>& inds,
1215 const Teuchos::ArrayView<const Scalar>& newVals,
1216 BinaryFunction f)
const;
1252 template <
class Scalar>
1282 template<
class Scalar>
1285 const Teuchos::ArrayView<Scalar>& rowValues);
1298 setDomainRangeMaps (
const RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> > &domainMap,
1299 const RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> > &rangeMap);
1301 void staticAssertions()
const;
1303 void clearGlobalConstants();
1304 void computeGlobalConstants();
1306 RowInfo getRowInfo(
size_t myRow)
const;
1307 ArrayView<const LocalOrdinal> getLocalView(RowInfo rowinfo)
const;
1308 ArrayView<LocalOrdinal> getLocalViewNonConst(RowInfo rowinfo);
1309 ArrayView<const GlobalOrdinal> getGlobalView(RowInfo rowinfo)
const;
1310 ArrayView<GlobalOrdinal> getGlobalViewNonConst(RowInfo rowinfo);
1349 size_t hint = 0)
const;
1382 ArrayView<const LocalOrdinal> colInds,
1383 size_t hint = 0)
const;
1392 size_t findGlobalIndex (RowInfo rowinfo, GlobalOrdinal ind,
size_t hint = 0)
const;
1395 void fillLocalGraph(
const RCP<ParameterList> ¶ms);
1396 const RCP<const local_graph_type> getLocalGraph()
const;
1397 const RCP<local_graph_type> getLocalGraphNonConst();
1399 void checkInternalState()
const;
1402 RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
rowMap_;
1404 RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
colMap_;
1416 RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> >
importer_;
1423 RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> >
exporter_;
1426 RCP<local_graph_type> lclGraph_;
1431 global_size_t globalNumEntries_, globalNumDiags_, globalMaxNumRowEntries_;
1432 size_t nodeNumEntries_, nodeNumDiags_, nodeMaxNumRowEntries_, nodeNumAllocated_;
1475 ArrayRCP<size_t> rowPtrs_;
1495 bool indicesAreAllocated_;
1496 bool indicesAreLocal_;
1497 bool indicesAreGlobal_;
1518 inline bool hasRowInfo()
const {
1519 #ifdef HAVE_TPETRA_DEBUG
1520 bool actuallyHasRowInfo =
true;
1522 actuallyHasRowInfo =
false;
1524 TEUCHOS_TEST_FOR_EXCEPTION(
1525 actuallyHasRowInfo != haveRowInfo_,
1526 std::logic_error,
"Internal logic error. Please contact Tpetra team.");
1527 #endif // HAVE_TPETRA_DEBUG
1528 return haveRowInfo_;
1538 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1539 Teuchos::RCP<CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
1541 size_t maxNumEntriesPerRow = 0,
1542 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
1546 return rcp (
new graph_type (map, maxNumEntriesPerRow,
DynamicProfile, params));
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
RCP< const ParameterList > getValidParameters() const
Default parameter list suitable for validation.
size_t findLocalIndex(RowInfo rowinfo, LocalOrdinal ind, size_t hint=0) const
Find the column offset corresponding to the given (local) column index.
Sparse matrix that presents a compressed sparse row interface.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Extract a const, non-persisting view of global indices in a specified row of the graph.
bool isLowerTriangular() const
Whether the graph is locally lower triangular.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
ProfileType getProfileType() const
Returns true if the graph was allocated with static data structures.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
A pure virtual interface for row-partitioned graphs.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > rangeMap_
The Map describing the range of the (matrix corresponding to the) graph.
bool haveGlobalConstants_
Whether all processes have computed global constants.
bool hasColMap() const
Whether the graph has a column Map.
ArrayRCP< const size_t > numAllocPerRow_
The maximum number of entries to allow in each locally owned row, per row.
bool isUpperTriangular() const
Whether the graph is locally upper triangular.
virtual bool checkSizes(const SrcDistObject &source)
Compare the source and target (this) objects for compatibility.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &indices, size_t &NumIndices) const
Extract a list of elements in a specified local row of the graph. Put into storage allocated by calli...
void insertGlobalIndicesFiltered(const GlobalOrdinal localRow, const ArrayView< const GlobalOrdinal > &indices)
Like insertGlobalIndices(), but with column Map filtering.
void transformLocalValues(RowInfo rowInfo, const Teuchos::ArrayView< Scalar > &rowVals, const Teuchos::ArrayView< const LocalOrdinal > &inds, const Teuchos::ArrayView< const Scalar > &newVals, BinaryFunction f) const
Transform the given values using local indices.
void sortRowIndices(RowInfo rowinfo)
Sort the column indices in the given row.
void setParameterList(const RCP< ParameterList > ¶ms)
Set the given list of parameters (must be nonnull).
ArrayRCP< LocalOrdinal > lclInds1D_
lclInds1D_ are the indices for all rows
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > domainMap_
The Map describing the domain of the (matrix corresponding to the) graph.
void replaceDomainMapAndImporter(const Teuchos::RCP< const map_type > &newDomainMap, Teuchos::RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
Replace the current domain Map and Import with the given parameters.
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.
std::map< GlobalOrdinal, std::deque< GlobalOrdinal > > nonlocals_
Nonlocal data given to insertGlobalValues or sumIntoGlobalValues.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Extract a const, non-persisting view of local indices in a specified row of the graph.
ArrayRCP< size_t > numRowEntries_
The number of local entries in each locally owned row.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > exporter_
The Export from the row Map to the range Map.
bool isSorted() const
Indicates whether the graph indices in all rows are known to be sorted.
bool isStorageOptimized() const
Returns true if storage has been optimized.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
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)
Non-member function to create an empty CrsGraph given a row map and a non-zero profile.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > & getRowMap() const
Returns the Map that describes the row distribution in this graph.
Allocation information for a locally owned row in a CrsGraph or CrsMatrix.
ArrayRCP< const LocalOrdinal > getNodePackedIndices() const
Get an ArrayRCP of the packed column-indices.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
virtual void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
Remove processes owning zero rows from the Maps and their communicator.
void makeColMap()
Make the column Map.
void setDomainRangeMaps(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap)
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > colMap_
The Map describing the distribution of columns of the graph.
size_t getNodeAllocationSize() const
Returns the total number of indices allocated for the graph, across all rows on this node...
ArrayRCP< GlobalOrdinal > gblInds1D_
gblInds1D_ are the indices for all rows
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
void mergeRowIndicesAndValues(RowInfo rowinfo, const Teuchos::ArrayView< Scalar > &rowValues)
Merge duplicate row indices in the given row, along with their corresponding values.
virtual void packAndPrepare(const SrcDistObject &source, const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< GlobalOrdinal > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor)
Perform any packing or preparation required for communication.
const RCP< const Comm< int > > & getComm() const
Returns the communicator.
size_t global_size_t
Global size_t object.
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 Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
ProfileType pftype_
Whether the graph was allocated with static or dynamic profile.
bool noRedundancies_
Whether the graph's indices are non-redundant (merged) in each row, on this process.
virtual void unpackAndCombine(const Teuchos::ArrayView< const LocalOrdinal > &importLIDs, const Teuchos::ArrayView< const GlobalOrdinal > &imports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t constantNumPackets, Distributor &distor, CombineMode CM)
Perform any unpacking and combining after communication.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
void mergeAllIndices()
Merge duplicate row indices in all of the rows.
size_t findGlobalIndex(RowInfo rowinfo, GlobalOrdinal ind, size_t hint=0) const
Find the column offset corresponding to the given (global) column index.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &Indices, size_t &NumIndices) const
Extract a list of elements in a specified global row of the graph. Put into pre-allocated storage...
Sets up and executes a communication plan for a Tpetra DistObject.
CombineMode
Tpetra::Combine Mode enumerable type.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
void setLocallyModified()
Report that we made a local modification to its structure.
bool isMerged() const
Whether duplicate column indices in each row have been merged.
virtual void copyAndPermute(const SrcDistObject &source, size_t numSameIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteToLIDs, const Teuchos::ArrayView< const LocalOrdinal > &permuteFromLIDs)
Perform copies and permutations that are local to this process.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > rowMap_
The Map describing the distribution of rows of the graph.
Abstract base class for objects that can be the source of an Import or Export operation.
bool lowerTriangular_
Whether the graph is locally lower triangular.
ArrayRCP< Array< LocalOrdinal > > lclInds2D_
lclInds2D_[r] are the indices for row r.
size_t numAllocForAllRows_
The maximum number of entries to allow in each locally owned row.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > & getDomainMap() const
Returns the Map associated with the domain of this graph.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > importer_
The Import from the domain Map to the column Map.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > & getColMap() const
Returns the Map that describes the column distribution in this graph.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
void transformGlobalValues(RowInfo rowInfo, const Teuchos::ArrayView< Scalar > &rowVals, const Teuchos::ArrayView< const GlobalOrdinal > &inds, const Teuchos::ArrayView< const Scalar > &newVals, BinaryFunction f) const
Transform the given values using global indices.
RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node2, typename Kokkos::DefaultKernels< void, LocalOrdinal, Node2 >::SparseOps > > clone(const Teuchos::RCP< Node2 > &node2, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=null) const
Create a cloned CrsGraph for a different Node type.
std::string description() const
Return a simple one-line description of this object.
A distributed graph accessed by rows (adjacency lists) and stored sparsely.
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
void computeIndexState()
Set collectively whether the graph uses global or local indices.
Describes a parallel distribution of objects over processes.
void resumeFill(const RCP< ParameterList > ¶ms=null)
bool upperTriangular_
Whether the graph is locally upper triangular.
bool isGloballyIndexed() const
If graph indices are in the global range, this function returns true. Otherwise, this function return...
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
void mergeRowIndices(RowInfo rowinfo)
Merge duplicate row indices in the given row.
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > ¶ms=Teuchos::null)
Perform a fillComplete on a graph that already has data, via setAllIndices().
void insertLocalIndicesFiltered(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Like insertLocalIndices(), but with column Map filtering.
size_t insertIndices(const RowInfo &rowInfo, const SLocalGlobalViews &newInds, const ELocalGlobal lg, const ELocalGlobal I)
Insert indices into the given row.
bool isFillComplete() const
Returns true if fillComplete() has been called and the graph is in compute mode.
void sortRowIndicesAndValues(RowInfo rowinfo, ArrayView< Scalar > values)
Sort the column indices and their values in the given row.
RCP< Node > getNode() const
Returns the underlying node.
void sortAllIndices()
Sort the column indices in all the rows.
bool indicesAreSorted_
Whether the graph's indices are sorted in each row, on this process.
bool isLocallyIndexed() const
If graph indices are in the local range, this function returns true. Otherwise, this function returns...
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void globalAssemble()
Communicate non-local contributions to other processes.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > & getRangeMap() const
Returns the Map associated with the domain of this graph.
bool haveLocalConstants_
Whether this process has computed local constants.
virtual ~CrsGraph()
Destructor.
Base class for distributed Tpetra objects that support data redistribution.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
bool isFillActive() const
Returns true if resumeFill() has been called and the graph is in edit mode.
ArrayRCP< Array< GlobalOrdinal > > gblInds2D_
gblInds2D_[r] are the indices for row r.
void insertIndicesAndValues(const RowInfo &rowInfo, const SLocalGlobalViews &newInds, const ArrayView< Scalar > &oldRowVals, const ArrayView< const Scalar > &newRowVals, const ELocalGlobal lg, const ELocalGlobal I)
Insert indices and their values into the given row.
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
void setAllIndices(const ArrayRCP< size_t > &rowPointers, const ArrayRCP< LocalOrdinal > &columnIndices)
Set the graph's data directly, using 1-D storage.