10#ifndef MUELU_DROPPINGCOMMON_HPP
11#define MUELU_DROPPINGCOMMON_HPP
13#include "Kokkos_Core.hpp"
14#include "Kokkos_ArithTraits.hpp"
15#include "Xpetra_Access.hpp"
16#include "Xpetra_Matrix.hpp"
33template <
class local_ordinal_type>
38 KOKKOS_FORCEINLINE_FUNCTION
47template <
class local_matrix_type>
66 KOKKOS_FORCEINLINE_FUNCTION
68 auto row =
A.rowConst(rlid);
69 const size_t offset =
A.graph.row_map(rlid);
73 auto clid = row.colidx(k);
85template <
class local_matrix_type>
107 KOKKOS_FORCEINLINE_FUNCTION
109 auto row =
A.rowConst(rlid);
110 const size_t offset =
A.graph.row_map(rlid);
114 auto clid = row.colidx(k);
126template <
class local_matrix_type>
142 KOKKOS_FORCEINLINE_FUNCTION
144 auto row =
A.rowConst(rlid);
145 const size_t offset =
A.graph.row_map(rlid);
147 auto clid = row.colidx(k);
160template <
class local_matrix_type>
176 KOKKOS_FORCEINLINE_FUNCTION
178 auto row =
A.rowConst(rlid);
179 const size_t offset =
A.graph.row_map(rlid);
181 auto clid = row.colidx(k);
182 if (clid >=
A.numRows()) {
193template <
class local_matrix_type>
213 KOKKOS_FORCEINLINE_FUNCTION
215 auto row =
A.rowConst(rlid);
216 const size_t offset =
A.graph.row_map(rlid);
218 auto clid = row.colidx(k);
219 if ((
results(offset + k) ==
KEEP) && (rlid != clid))
224 auto clid = row.colidx(k);
237template <
class local_matrix_type>
260 KOKKOS_FORCEINLINE_FUNCTION
262 auto row =
A.rowConst(rlid);
263 const size_t offset =
A.graph.row_map(rlid);
265 auto clid = row.colidx(k);
266 if ((
results(offset + k) ==
KEEP) && (rlid != clid))
272 auto clid = row.colidx(k);
285template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
288 using matrix_type = Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
306 :
A(A_.getLocalMatrixDevice())
307 ,
point_to_block(point_to_block_.getDeviceLocalView(Xpetra::Access::ReadOnly))
311 KOKKOS_FORCEINLINE_FUNCTION
313 auto row =
A.rowConst(rlid);
314 const size_t offset =
A.graph.row_map(rlid);
316 auto clid = row.colidx(k);
330template <
class local_matrix_type>
348 KOKKOS_FORCEINLINE_FUNCTION
350 auto row =
A.rowConst(rlid);
351 const size_t offset =
A.graph.row_map(rlid);
354 Kokkos::printf(
"No dropping decision was taken for entry (%d, %d)\n", rlid, row.colidx(k));
365template <
class local_matrix_type>
381 KOKKOS_FORCEINLINE_FUNCTION
383 auto row =
A.rowConst(rlid);
384 const size_t offset =
A.graph.row_map(rlid);
387 auto clid = row.colidx(k);
388 if (clid >=
A.numRows())
390 auto row2 =
A.rowConst(clid);
391 const size_t offset2 =
A.graph.row_map(clid);
393 auto clid2 = row2.colidx(k2);
405template <
class view_type,
class comparator_type>
406KOKKOS_INLINE_FUNCTION
void serialHeapSort(view_type& v, comparator_type comparator) {
407 auto N = v.extent(0);
408 size_t start = N / 2;
420 while (2 * root + 1 < end) {
421 size_t child = 2 * root + 1;
422 if ((child + 1 < end) and (comparator(v(child), v(child + 1))))
425 if (comparator(v(root), v(child))) {
Xpetra::MultiVector< LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node > block_indices_type
typename local_matrix_type::value_type scalar_type
local_block_indices_view_type point_to_block
typename matrix_type::local_matrix_type local_matrix_type
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > matrix_type
local_block_indices_view_type ghosted_point_to_block
typename block_indices_type::dual_view_type_const::t_dev local_block_indices_view_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< DecisionType *, memory_space > results_view
BlockDiagonalizeFunctor(matrix_type &A_, block_indices_type &point_to_block_, block_indices_type &ghosted_point_to_block_, results_view &results_)
Kokkos::View< DecisionType *, memory_space > results_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
DebugFunctor(local_matrix_type &A_, results_view &results_)
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< bool *, memory_space > boundary_nodes_view
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::memory_space memory_space
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::value_type scalar_type
DropOffRankFunctor(local_matrix_type &A_, results_view &results_)
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::memory_space memory_space
KeepDiagonalFunctor(local_matrix_type &A_, results_view &results_)
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::value_type scalar_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
Kokkos::View< DecisionType *, memory_space > results_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::value_type scalar_type
MarkSingletonFunctor(local_matrix_type &A_, boundary_nodes_view boundaryNodes_, results_view &results_)
typename local_matrix_type::memory_space memory_space
boundary_nodes_view boundaryNodes
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< bool *, memory_space > boundary_nodes_view
MarkSingletonVectorFunctor(local_matrix_type &A_, block_indices_view_type point_to_block_, boundary_nodes_view boundaryNodes_, results_view &results_)
Kokkos::View< DecisionType *, memory_space > results_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::value_type scalar_type
Kokkos::View< local_ordinal_type *, memory_space > block_indices_view_type
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< bool *, memory_space > boundary_nodes_view
typename local_matrix_type::memory_space memory_space
block_indices_view_type point_to_block
boundary_nodes_view boundaryNodes
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::memory_space memory_space
Kokkos::View< const bool *, memory_space > boundary_nodes_view
boundary_nodes_view boundaryNodes
typename local_matrix_type::value_type scalar_type
Kokkos::View< DecisionType *, memory_space > results_view
PointwiseDropBoundaryFunctor(local_matrix_type &A_, boundary_nodes_view boundaryNodes_, results_view &results_)
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::value_type scalar_type
SymmetrizeFunctor(local_matrix_type &A_, results_view &results_)
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::ordinal_type local_ordinal_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
VectorDropBoundaryFunctor(local_matrix_type &A_, block_indices_view_type point_to_block_, boundary_nodes_view boundaryNodes_, results_view &results_)
block_indices_view_type point_to_block
Kokkos::View< local_ordinal_type *, memory_space > block_indices_view_type
Kokkos::View< const bool *, memory_space > boundary_nodes_view
typename local_matrix_type::memory_space memory_space
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< DecisionType *, memory_space > results_view
boundary_nodes_view boundaryNodes
typename local_matrix_type::value_type scalar_type
KOKKOS_INLINE_FUNCTION void serialHeapSort(view_type &v, comparator_type comparator)
Namespace for MueLu classes and methods.