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"
33 template <
class local_ordinal_type>
38 KOKKOS_FORCEINLINE_FUNCTION
47 template <
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);
85 template <
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);
126 template <
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);
160 template <
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()) {
193 template <
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);
237 template <
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);
285 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class 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);
330 template <
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));
365 template <
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);
405 template <
class view_type,
class comparator_type>
406 KOKKOS_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))) {
Kokkos::View< local_ordinal_type *, memory_space > block_indices_view_type
typename local_matrix_type::value_type scalar_type
DebugFunctor(local_matrix_type &A_, results_view &results_)
block_indices_view_type point_to_block
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::memory_space memory_space
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
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::value_type scalar_type
Functor that drops boundary nodes for a blockSize > 1 problem.
boundary_nodes_view boundaryNodes
Kokkos::View< DecisionType *, memory_space > results_view
Functor that marks singletons (all off-diagonal entries in a row are dropped) as boundary.
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
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< DecisionType *, memory_space > results_view
local_block_indices_view_type point_to_block
Functor that checks that all entries have been marked.
typename local_matrix_type::memory_space memory_space
Kokkos::View< bool *, memory_space > boundary_nodes_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::memory_space memory_space
Functor that marks singletons (all off-diagonal entries in a row are dropped) as boundary.
typename local_matrix_type::value_type scalar_type
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::View< DecisionType *, memory_space > results_view
boundary_nodes_view boundaryNodes
typename local_matrix_type::ordinal_type local_ordinal_type
VectorDropBoundaryFunctor(local_matrix_type &A_, block_indices_view_type point_to_block_, boundary_nodes_view boundaryNodes_, results_view &results_)
DropOffRankFunctor(local_matrix_type &A_, results_view &results_)
typename block_indices_type::dual_view_type_const::t_dev local_block_indices_view_type
KOKKOS_INLINE_FUNCTION void serialHeapSort(view_type &v, comparator_type comparator)
Functor that symmetrizes the dropping decisions.
Functor that drops boundary nodes for a blockSize == 1 problem.
Functor that drops off-rank entries.
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::memory_space memory_space
Kokkos::View< const bool *, memory_space > boundary_nodes_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::ordinal_type local_ordinal_type
local_block_indices_view_type ghosted_point_to_block
Kokkos::View< bool *, memory_space > boundary_nodes_view
boundary_nodes_view boundaryNodes
typename matrix_type::local_matrix_type local_matrix_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
Functor that drops all entries that are not on the block diagonal.
Functor that marks diagonal as kept, unless the are already marked as boundary.
Kokkos::View< DecisionType *, memory_space > results_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
MarkSingletonFunctor(local_matrix_type &A_, boundary_nodes_view boundaryNodes_, results_view &results_)
typename local_matrix_type::value_type scalar_type
block_indices_view_type point_to_block
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
typename local_matrix_type::value_type scalar_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
Kokkos::View< bool *, memory_space > boundary_nodes_view
SymmetrizeFunctor(local_matrix_type &A_, results_view &results_)
MarkSingletonVectorFunctor(local_matrix_type &A_, block_indices_view_type point_to_block_, boundary_nodes_view boundaryNodes_, results_view &results_)
Kokkos::View< const bool *, memory_space > boundary_nodes_view
PointwiseDropBoundaryFunctor(local_matrix_type &A_, boundary_nodes_view boundaryNodes_, results_view &results_)
Kokkos::View< DecisionType *, memory_space > results_view
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< local_ordinal_type *, memory_space > block_indices_view_type
typename local_matrix_type::value_type scalar_type
KeepDiagonalFunctor(local_matrix_type &A_, results_view &results_)
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::value_type scalar_type
boundary_nodes_view boundaryNodes