10#ifndef TPETRA_DETAILS_CRSMATRIXASSEMBLEELEMENT_HPP
11#define TPETRA_DETAILS_CRSMATRIXASSEMBLEELEMENT_HPP
13#include "KokkosSparse_CrsMatrix.hpp"
57template <
class SparseMatrixType,
60 typename SparseMatrixType::ordinal_type
62 const typename SparseMatrixType::ordinal_type
lclRow,
63 const typename SparseMatrixType::ordinal_type
lclColInds[],
64 const typename SparseMatrixType::ordinal_type
sortPerm[],
69 !std::is_same<typename SparseMatrixType::device_type::execution_space, Kokkos::Serial>::type,
74 typedef typename std::remove_const<typename SparseMatrixType::value_type>::type
76 static_assert(std::is_same<matrix_scalar_type,
77 typename SparseMatrixType::value_type>::value,
78 "The matrix's entries must have a nonconst type.");
83 typedef typename SparseMatrixType::ordinal_type LO;
84 static_assert(std::is_integral<LO>::value,
85 "SparseMatrixType::ordinal_type "
86 "must be a built-in integer type.");
181 typename SparseMatrixType::ordinal_type
183 const typename SparseMatrixType::ordinal_type
lclRow,
184 const typename SparseMatrixType::ordinal_type
lclColInds[],
185 const typename SparseMatrixType::ordinal_type
sortPerm[],
190 !std::is_same<typename SparseMatrixType::device_type::execution_space, Kokkos::Serial>::type,
195 typedef typename std::remove_const<typename SparseMatrixType::value_type>::type
197 static_assert(std::is_same<matrix_scalar_type,
198 typename SparseMatrixType::value_type>::value,
199 "The matrix's entries must have a nonconst type.");
200 static_assert(std::is_assignable<matrix_scalar_type,
201 typename std::decay<
decltype(
A.values[0] +
vals[0])>::type>::value,
202 "The result of adding a matrix entry and an entry of vals "
203 "MUST be assignable to a matrix entry.");
204 typedef typename SparseMatrixType::ordinal_type LO;
205 static_assert(std::is_integral<LO>::value,
206 "SparseMatrixType::ordinal_type "
207 "must be a built-in integer type.");
317 typename SparseMatrixType::ordinal_type
320 typename SparseMatrixType::ordinal_type lids[],
321 typename SparseMatrixType::ordinal_type
sortPerm[],
326 !std::is_same<typename SparseMatrixType::device_type::execution_space, Kokkos::Serial>::type,
331 typedef typename std::remove_const<typename SparseMatrixType::value_type>::type
333 typedef typename std::remove_const<typename VectorViewType::value_type>::type
335 static_assert(std::is_same<matrix_scalar_type,
336 typename SparseMatrixType::value_type>::value,
337 "The sparse output matrix A's entries must have a nonconst type.");
339 typename VectorViewType::value_type>::value,
340 "The dense output vector x's entries must have a nonconst type.");
351 typedef typename SparseMatrixType::ordinal_type LO;
352 static_assert(std::is_integral<LO>::value,
353 "SparseMatrixType::ordinal_type "
354 "must be a built-in integer type.");
366 const LO
lid = lids[
r];
368 auto lhs_r = Kokkos::subview(
lhs,
r, Kokkos::ALL());
Declaration and definition of functions for sorting "short" arrays of keys and corresponding values.
Struct that holds views of the contents of a CrsMatrix.
Implementation details of Tpetra.
KOKKOS_FUNCTION SparseMatrixType::ordinal_type crsMatrixReplaceValues_sortedSortedLinear(const SparseMatrixType &A, const typename SparseMatrixType::ordinal_type lclRow, const typename SparseMatrixType::ordinal_type lclColInds[], const typename SparseMatrixType::ordinal_type sortPerm[], const ValsViewType &vals, const typename SparseMatrixType::ordinal_type numEntInInput, const bool forceAtomic=false, const bool checkInputIndices=true)
A(lclRow, lclColsInds[sortPerm[j]]) = vals[sortPerm[j]], for all j in 0 .. eltDim-1.
KOKKOS_FUNCTION void shellSortKeysAndValues(KeyType keys[], ValueType values[], const IndexType n)
Shellsort (yes, it's one word) the input array keys, and apply the resulting permutation to the input...
KOKKOS_FUNCTION SparseMatrixType::ordinal_type crsMatrixSumIntoValues_sortedSortedLinear(const SparseMatrixType &A, const typename SparseMatrixType::ordinal_type lclRow, const typename SparseMatrixType::ordinal_type lclColInds[], const typename SparseMatrixType::ordinal_type sortPerm[], const ValsViewType &vals, const typename SparseMatrixType::ordinal_type numEntInInput, const bool forceAtomic=false, const bool checkInputIndices=true)
A(lclRow, lclColsInds[sortPerm[j]]) += vals[sortPerm[j]], for all j in 0 .. eltDim-1.
KOKKOS_FUNCTION SparseMatrixType::ordinal_type crsMatrixAssembleElement_sortedLinear(const SparseMatrixType &A, const VectorViewType &x, typename SparseMatrixType::ordinal_type lids[], typename SparseMatrixType::ordinal_type sortPerm[], const RhsViewType &rhs, const LhsViewType &lhs, const bool forceAtomic=false, const bool checkInputIndices=true)
A(lids[j], lids[j]) += lhs(j,j) and x(lids[j]) += rhs(j), for all j in 0 .. eltDim-1.
Namespace Tpetra contains the class and methods constituting the Tpetra library.