10 #ifndef IFPACK2_UTILITIES_HPP
11 #define IFPACK2_UTILITIES_HPP
13 #include "Ifpack2_ConfigDefs.hpp"
15 #include "Teuchos_RefCountPtr.hpp"
18 #include "Tpetra_ConfigDefs.hpp"
19 #include "Tpetra_CrsGraph.hpp"
32 template <
class graph_type>
34 computeDiagonalGraph(graph_type
const& graph) {
35 typedef typename graph_type::local_ordinal_type LO;
36 typedef typename graph_type::global_ordinal_type GO;
37 typedef typename graph_type::node_type NO;
38 typedef Tpetra::Map<LO, GO, NO> map_type;
39 typedef Tpetra::CrsGraph<LO, GO, NO> crs_graph_type;
41 const size_t maxDiagEntPerRow = 1;
47 diagonalGraph =
Teuchos::rcp(
new crs_graph_type(graph.getRowMap(), maxDiagEntPerRow));
48 const map_type& meshRowMap = *(graph.getRowMap());
52 for (LO lclRowInd = meshRowMap.getMinLocalIndex(); lclRowInd <= meshRowMap.getMaxLocalIndex(); ++lclRowInd) {
53 const GO gblRowInd = meshRowMap.getGlobalElement(lclRowInd);
54 diagGblColInds[0] = gblRowInd;
55 diagonalGraph->insertGlobalIndices(gblRowInd, diagGblColInds());
58 diagonalGraph->fillComplete(graph.getDomainMap(), graph.getRangeMap());
63 std::string canonicalize(
const std::string& precType);
69 #endif // IFPACK2_UTILITIES_HPP
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)