34 Teuchos::RCP<Tpetra::CrsGraph<typename graph_type::local_ordinal_type, typename graph_type::global_ordinal_type, typename graph_type::node_type> >
37 typedef typename graph_type::local_ordinal_type LO;
38 typedef typename graph_type::global_ordinal_type GO;
39 typedef typename graph_type::node_type NO;
40 typedef Tpetra::Map<LO, GO, NO>
map_type;
41 typedef Tpetra::CrsGraph<LO, GO, NO> crs_graph_type;
43 const size_t maxDiagEntPerRow = 1;
48 Teuchos::RCP<graph_type> diagonalGraph;
49 diagonalGraph = Teuchos::rcp(
new crs_graph_type(graph.getRowMap(), maxDiagEntPerRow));
50 const map_type& meshRowMap = *(graph.getRowMap());
52 Teuchos::Array<GO> diagGblColInds(maxDiagEntPerRow);
54 for (LO lclRowInd = meshRowMap.getMinLocalIndex(); lclRowInd <= meshRowMap.getMaxLocalIndex(); ++lclRowInd) {
55 const GO gblRowInd = meshRowMap.getGlobalElement(lclRowInd);
56 diagGblColInds[0] = gblRowInd;
57 diagonalGraph->insertGlobalIndices(gblRowInd, diagGblColInds());
60 diagonalGraph->fillComplete(graph.getDomainMap(), graph.getRangeMap());
Teuchos::RCP< Tpetra::CrsGraph< typename graph_type::local_ordinal_type, typename graph_type::global_ordinal_type, typename graph_type::node_type > > computeDiagonalGraph(graph_type const &graph)
Compute and return the graph of the diagonal of the input graph.
Definition Ifpack2_Utilities.hpp:35