44 #ifndef TPETRA_DETAILS_GETGRAPHDIAGOFFSETS_DECL_HPP
45 #define TPETRA_DETAILS_GETGRAPHDIAGOFFSETS_DECL_HPP
52 #include "TpetraCore_config.h"
53 #include "Kokkos_Core.hpp"
54 #include "Kokkos_StaticCrsGraph.hpp"
56 #include <type_traits>
78 class DiagOffsetType =
size_t>
81 typedef typename DeviceType::device_type device_type;
82 typedef DiagOffsetType diag_offset_type;
83 typedef ::Kokkos::View<diag_offset_type*,
85 ::Kokkos::MemoryUnmanaged> diag_offsets_type;
86 typedef ::Kokkos::StaticCrsGraph<LO,
88 device_type> local_graph_type;
89 typedef ::Tpetra::Details::LocalMap<LO, GO, device_type>
local_map_type;
90 typedef ::Kokkos::View<
const typename local_graph_type::size_type*,
93 ::Kokkos::MemoryUnmanaged> row_offsets_type;
96 typedef ::Kokkos::View<
const LO*,
99 ::Kokkos::MemoryUnmanaged> lcl_col_inds_type;
105 const row_offsets_type& ptr,
106 const lcl_col_inds_type& ind,
107 const bool isSorted);
110 KOKKOS_FUNCTION
void operator() (
const LO& lclRowInd)
const;
113 diag_offsets_type diagOffsets_;
116 row_offsets_type ptr_;
117 lcl_col_inds_type ind_;
123 template<
class DiagOffsetsType,
125 class RowOffsetsType,
126 class LclColIndsType>
128 getGraphDiagOffsets (
const DiagOffsetsType& diagOffsets,
129 const LclMapType& lclRowMap,
130 const LclMapType& lclColMap,
131 const RowOffsetsType& ptr,
132 const LclColIndsType& ind,
135 static_assert (Kokkos::Impl::is_view<DiagOffsetsType>::value,
136 "DiagOffsetsType (the type of diagOffsets) must be a Kokkos::View.");
137 static_assert (Kokkos::Impl::is_view<RowOffsetsType>::value,
138 "RowOffsetsType (the type of ptr) must be a Kokkos::View.");
139 static_assert (Kokkos::Impl::is_view<LclColIndsType>::value,
140 "LclColIndsType (the type of ind) must be a Kokkos::View.");
141 static_assert (static_cast<int> (DiagOffsetsType::rank) == 1,
142 "DiagOffsetsType (the type of diagOffsets) must be a rank-1 Kokkos::View.");
143 static_assert (static_cast<int> (RowOffsetsType::rank) == 1,
144 "RowOffsetsType (the type of ptr) must be a rank-1 Kokkos::View.");
145 static_assert (static_cast<int> (LclColIndsType::rank) == 1,
146 "LclColIndsType (the type of ind) must be a rank-1 Kokkos::View.");
147 typedef typename DiagOffsetsType::non_const_value_type diag_offset_type;
148 static_assert (std::is_same<typename DiagOffsetsType::value_type, diag_offset_type>::value,
149 "DiagOffsetsType (the type of diagOffsets) must be a nonconst "
150 "Kokkos::View, since it is the output argument of this function.");
151 static_assert (std::is_integral<diag_offset_type>::value,
152 "The type of each entry of diagOffsets must be an integer.");
153 typedef typename LclColIndsType::non_const_value_type local_ordinal_type;
154 static_assert (std::is_integral<local_ordinal_type>::value,
155 "The type of each entry of ind (the array of column indices) "
156 "must be an integer.");
157 static_assert (
sizeof (diag_offset_type) >=
sizeof (local_ordinal_type),
158 "Diagonal offset type must be big enough to count the number "
159 "of column indices, since the diagonal entry (if it exists) "
160 "may be anywhere in a row.");
161 typedef typename RowOffsetsType::non_const_value_type row_offset_type;
162 static_assert (std::is_integral<row_offset_type>::value,
163 "The type of each entry of ptr must be an integer.");
165 typedef typename LclMapType::local_ordinal_type LO;
166 typedef typename LclMapType::global_ordinal_type GO;
167 typedef typename LclMapType::device_type DT;
171 impl_type impl (diagOffsets, lclRowMap, lclColMap, ptr, ind, isSorted);
177 #endif // TPETRA_DETAILS_GETGRAPHDIAGOFFSETS_DECL_HPP
KOKKOS_FUNCTION void operator()(const LO &lclRowInd) const
Kokkos::parallel_for loop body.
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
Implementation detail of Tpetra::Details::getGraphDiagOffsets, which in turn is an implementation det...
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.