10 #ifndef TPETRA_DETAILS_GETGRAPHDIAGOFFSETS_DEF_HPP
11 #define TPETRA_DETAILS_GETGRAPHDIAGOFFSETS_DEF_HPP
19 #include "Tpetra_Map.hpp"
20 #include "KokkosSparse_findRelOffset.hpp"
47 const row_offsets_type& ptr,
48 const lcl_col_inds_type& ind,
50 : diagOffsets_(diagOffsets)
51 , lclRowMap_(lclRowMap)
52 , lclColMap_(lclColMap)
55 , isSorted_(isSorted) {
56 typedef typename device_type::execution_space execution_space;
57 typedef Kokkos::RangePolicy<execution_space, LO> policy_type;
60 policy_type range(0, lclNumRows);
61 Kokkos::parallel_for(range, *
this);
72 Tpetra::Details::OrdinalTraits<diag_offset_type>::invalid();
73 const GO gblRowInd = lclRowMap_.getGlobalElement(lclRowInd);
74 const GO gblColInd = gblRowInd;
75 const LO lclColInd = lclColMap_.getLocalElement(gblColInd);
77 if (lclColInd == Tpetra::Details::OrdinalTraits<LO>::invalid()) {
78 diagOffsets_[lclRowInd] = STINV;
81 const LO numEnt = ptr_[lclRowInd + 1] - ptr_[lclRowInd];
85 Kokkos::subview(ind_, Kokkos::make_pair(ptr_[lclRowInd],
86 ptr_[lclRowInd + 1]));
87 using ::KokkosSparse::findRelOffset;
89 findRelOffset<LO, lcl_col_inds_type>(lclColInds, numEnt,
90 lclColInd, 0, isSorted_);
91 diagOffsets_[lclRowInd] = (diagOffset == numEnt) ? STINV : static_cast<diag_offset_type>(diagOffset);
102 #define TPETRA_DETAILS_IMPL_GETGRAPHDIAGOFFSETS_INSTANT(LO, GO, NODE) \
103 template class Details::Impl::GetGraphDiagOffsets<LO, GO, NODE::device_type>;
105 #endif // TPETRA_DETAILS_GETGRAPHDIAGOFFSETS_DEF_HPP
KOKKOS_FUNCTION void operator()(const LO &lclRowInd) const
Kokkos::parallel_for loop body.
Import KokkosSparse::OrdinalTraits, a traits class for "invalid" (flag) values of integer types...
KOKKOS_INLINE_FUNCTION LocalOrdinal getLocalNumElements() const
The number of indices that live on the calling process.
GetGraphDiagOffsets(const diag_offsets_type &diagOffsets, const local_map_type &lclRowMap, const local_map_type &lclColMap, const row_offsets_type &ptr, const lcl_col_inds_type &ind, const bool isSorted)
Constructor; also runs the functor.