43 #ifndef IFPACK2_UTILITIES_HPP 44 #define IFPACK2_UTILITIES_HPP 46 #include "Ifpack2_ConfigDefs.hpp" 48 #include "Teuchos_RefCountPtr.hpp" 51 #include "Tpetra_ConfigDefs.hpp" 52 #include "Tpetra_CrsGraph.hpp" 66 template <
class graph_type>
70 typedef typename graph_type::local_ordinal_type LO;
71 typedef typename graph_type::global_ordinal_type GO;
72 typedef typename graph_type::node_type NO;
73 typedef Tpetra::Map<LO, GO, NO> map_type;
74 typedef Tpetra::CrsGraph<LO, GO, NO> crs_graph_type;
76 const size_t maxDiagEntPerRow = 1;
82 diagonalGraph = Teuchos::rcp(
new crs_graph_type(graph.getRowMap(), maxDiagEntPerRow, Tpetra::StaticProfile));
83 const map_type& meshRowMap = *(graph.getRowMap());
87 for (LO lclRowInd = meshRowMap.getMinLocalIndex(); lclRowInd <= meshRowMap.getMaxLocalIndex(); ++lclRowInd) {
88 const GO gblRowInd = meshRowMap.getGlobalElement(lclRowInd);
89 diagGblColInds[0] = gblRowInd;
90 diagonalGraph->insertGlobalIndices(gblRowInd, diagGblColInds());
93 diagonalGraph->fillComplete(graph.getDomainMap(), graph.getRangeMap());
102 #endif //IFPACK2_UTILITIES_HPP 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:68
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72