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,
89 void,
size_t> local_graph_device_type;
90 typedef ::Tpetra::Details::LocalMap<LO, GO, device_type>
local_map_type;
91 typedef ::Kokkos::View<
const typename local_graph_device_type::size_type*,
94 ::Kokkos::MemoryUnmanaged> row_offsets_type;
97 typedef ::Kokkos::View<
const LO*,
100 ::Kokkos::MemoryUnmanaged> lcl_col_inds_type;
106 const row_offsets_type& ptr,
107 const lcl_col_inds_type& ind,
108 const bool isSorted);
111 KOKKOS_FUNCTION
void operator() (
const LO& lclRowInd)
const;
114 diag_offsets_type diagOffsets_;
117 row_offsets_type ptr_;
118 lcl_col_inds_type ind_;
124 template<
class DiagOffsetsType,
126 class RowOffsetsType,
127 class LclColIndsType>
129 getGraphDiagOffsets (
const DiagOffsetsType& diagOffsets,
130 const LclMapType& lclRowMap,
131 const LclMapType& lclColMap,
132 const RowOffsetsType& ptr,
133 const LclColIndsType& ind,
136 static_assert (Kokkos::is_view<DiagOffsetsType>::value,
137 "DiagOffsetsType (the type of diagOffsets) must be a Kokkos::View.");
138 static_assert (Kokkos::is_view<RowOffsetsType>::value,
139 "RowOffsetsType (the type of ptr) must be a Kokkos::View.");
140 static_assert (Kokkos::is_view<LclColIndsType>::value,
141 "LclColIndsType (the type of ind) must be a Kokkos::View.");
142 static_assert (static_cast<int> (DiagOffsetsType::rank) == 1,
143 "DiagOffsetsType (the type of diagOffsets) must be a rank-1 Kokkos::View.");
144 static_assert (static_cast<int> (RowOffsetsType::rank) == 1,
145 "RowOffsetsType (the type of ptr) must be a rank-1 Kokkos::View.");
146 static_assert (static_cast<int> (LclColIndsType::rank) == 1,
147 "LclColIndsType (the type of ind) must be a rank-1 Kokkos::View.");
148 typedef typename DiagOffsetsType::non_const_value_type diag_offset_type;
149 static_assert (std::is_same<typename DiagOffsetsType::value_type, diag_offset_type>::value,
150 "DiagOffsetsType (the type of diagOffsets) must be a nonconst "
151 "Kokkos::View, since it is the output argument of this function.");
152 static_assert (std::is_integral<diag_offset_type>::value,
153 "The type of each entry of diagOffsets must be an integer.");
154 typedef typename LclColIndsType::non_const_value_type local_ordinal_type;
155 static_assert (std::is_integral<local_ordinal_type>::value,
156 "The type of each entry of ind (the array of column indices) "
157 "must be an integer.");
158 static_assert (
sizeof (diag_offset_type) >=
sizeof (local_ordinal_type),
159 "Diagonal offset type must be big enough to count the number "
160 "of column indices, since the diagonal entry (if it exists) "
161 "may be anywhere in a row.");
162 typedef typename RowOffsetsType::non_const_value_type row_offset_type;
163 static_assert (std::is_integral<row_offset_type>::value,
164 "The type of each entry of ptr must be an integer.");
166 typedef typename LclMapType::local_ordinal_type LO;
167 typedef typename LclMapType::global_ordinal_type GO;
168 typedef typename LclMapType::device_type DT;
172 impl_type impl (diagOffsets, lclRowMap, lclColMap, ptr, ind, isSorted);
178 #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.