MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_CrsMatrixUtils.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef PACKAGES_XPETRA_CRSMATRIX_UTILS_HPP_
11#define PACKAGES_XPETRA_CRSMATRIX_UTILS_HPP_
12
13#include "Xpetra_ConfigDefs.hpp"
14#include "Xpetra_Exceptions.hpp"
15#include "Xpetra_Map.hpp" // definition of UnderlyingLib
16
17#include "Tpetra_Import_Util2.hpp"
18
19namespace Xpetra {
20
28template <class Scalar,
29 class LocalOrdinal,
30 class GlobalOrdinal,
31 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
33#undef XPETRA_CRSMATRIXUTILS_SHORT
34
35 public:
38 static void sortCrsEntries(const Teuchos::ArrayView<size_t>& CRS_rowptr,
39 const Teuchos::ArrayView<LocalOrdinal>& CRS_colind,
40 const Teuchos::ArrayView<Scalar>& CRS_vals,
41 const UnderlyingLib lib) {
42 if (lib == Xpetra::UseTpetra) {
43 Tpetra::Import_Util::sortCrsEntries(CRS_rowptr, CRS_colind, CRS_vals,
44 ::KokkosSparse::SortAlgorithm::DEFAULT);
45 }
46
47 return;
48 }
49
52 static void sortAndMergeCrsEntries(const Teuchos::ArrayView<size_t>& CRS_rowptr,
53 const Teuchos::ArrayView<LocalOrdinal>& CRS_colind,
54 const Teuchos::ArrayView<Scalar>& CRS_vals,
55 const UnderlyingLib lib) {
56 if (lib == Xpetra::UseTpetra) {
57 Tpetra::Import_Util::sortAndMergeCrsEntries(CRS_rowptr, CRS_colind, CRS_vals);
58 }
59
60 return;
61 }
62
63}; // end class CrsMatrixUtils
64
65} // end namespace Xpetra
66
67#define XPETRA_CRSMATRIXUTILS_SHORT
68
69#endif // PACKAGES_XPETRA_CRSMATRIX_UTILS_HPP_
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Xpetra utility class for CrsMatrix-related routines.
static void sortCrsEntries(const Teuchos::ArrayView< size_t > &CRS_rowptr, const Teuchos::ArrayView< LocalOrdinal > &CRS_colind, const Teuchos::ArrayView< Scalar > &CRS_vals, const UnderlyingLib lib)
Sort the entries of the (raw CSR) matrix by column index within each row.
static void sortAndMergeCrsEntries(const Teuchos::ArrayView< size_t > &CRS_rowptr, const Teuchos::ArrayView< LocalOrdinal > &CRS_colind, const Teuchos::ArrayView< Scalar > &CRS_vals, const UnderlyingLib lib)
Sort and merge the entries of the (raw CSR) matrix by column index within each row.