49 #include "Zoltan2_config.h" 50 #include "Tpetra_CrsGraph.hpp" 51 #include "Teuchos_ArrayView.hpp" 59 using Teuchos::ArrayView;
61 template <
typename lno_t,
typename gno_t>
63 ostream &os,
size_t maxSize,
string info)
65 size_t nrows = graph.getNodeNumRows();
69 const RCP<const typename Tpetra::Map<lno_t, gno_t> > &rowMap=
71 const RCP<const typename Tpetra::Map<lno_t, gno_t> > &colMap=
77 if (graph.isGloballyIndexed()){
78 ArrayView<const gno_t> indices;
79 for (
size_t i=0; i < nrows; i++){
80 gno_t gid = rowMap->getGlobalElement(i);
81 graph.getGlobalRowView(gid, indices);
82 os <<
"Row " << gid <<
": ";
83 for (
typename ArrayView<const gno_t>::size_type j=0; j < indices.size(); j++){
84 os << indices[j] <<
" ";
90 ArrayView<const lno_t> indices;
91 for (
size_t i=0; i < nrows; i++){
92 gno_t gid = rowMap->getGlobalElement(i);
93 graph.getLocalRowView(i, indices);
94 os <<
"Row " << gid <<
": ";
95 for (
typename ArrayView<const lno_t>::size_type j=0; j < indices.size(); j++){
96 os << colMap->getGlobalElement(indices[j]) <<
" ";
103 template <
typename lno_t,
typename gno_t>
105 const Tpetra::CrsGraph<lno_t, gno_t> &graph, ostream &os,
106 size_t maxSize,
string info)
108 int rank = comm->getRank();
109 std::ostringstream oss;
110 oss <<
"rank " << rank;
117 for (
int p=0; p < comm->getSize(); p++){
119 printTpetraGraph<lno_t, gno_t>(graph, os, maxSize, oss.str());
void printTpetraGraph(const Tpetra::CrsGraph< lno_t, gno_t > &graph, ostream &os, size_t maxSize, string info)