MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_DroppingCommon.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 MUELU_DROPPINGCOMMON_HPP
11 #define MUELU_DROPPINGCOMMON_HPP
12 
13 // #define MUELU_COALESCE_DROP_DEBUG 1
14 
15 #include "Kokkos_Core.hpp"
16 #if KOKKOS_VERSION >= 40799
17 #include "KokkosKernels_ArithTraits.hpp"
18 #else
19 #include "Kokkos_ArithTraits.hpp"
20 #endif
21 #include "Xpetra_Access.hpp"
22 #include "Xpetra_Matrix.hpp"
23 #include "Xpetra_VectorFactory.hpp"
24 #include "MueLu_Utilities.hpp"
25 
26 namespace MueLu {
27 
32 enum DecisionType : char {
33  UNDECIDED = 0, // no decision has been taken yet, used for initialization
34  KEEP = 1, // keeep the entry
35  DROP = 2, // drop it
36  BOUNDARY = 3 // entry is a boundary
37 };
38 
39 namespace Misc {
40 
41 template <class local_ordinal_type>
42 class NoOpFunctor {
43  public:
45 
46  KOKKOS_FORCEINLINE_FUNCTION
47  void operator()(local_ordinal_type rlid) const {
48  }
49 };
50 
55 template <class local_matrix_type>
57  private:
58  using scalar_type = typename local_matrix_type::value_type;
59  using local_ordinal_type = typename local_matrix_type::ordinal_type;
60  using memory_space = typename local_matrix_type::memory_space;
61  using results_view = Kokkos::View<DecisionType*, memory_space>;
62  using boundary_nodes_view = Kokkos::View<const bool*, memory_space>;
63 
64  local_matrix_type A;
67 
68  public:
69  PointwiseDropBoundaryFunctor(local_matrix_type& A_, boundary_nodes_view boundaryNodes_, results_view& results_)
70  : A(A_)
71  , boundaryNodes(boundaryNodes_)
72  , results(results_) {}
73 
74  KOKKOS_FORCEINLINE_FUNCTION
75  void operator()(local_ordinal_type rlid) const {
76  auto row = A.rowConst(rlid);
77  const size_t offset = A.graph.row_map(rlid);
78  const bool isBoundaryRow = boundaryNodes(rlid);
79  if (isBoundaryRow) {
80  for (local_ordinal_type k = 0; k < row.length; ++k) {
81  auto clid = row.colidx(k);
82  results(offset + k) = Kokkos::max(rlid == clid ? KEEP : DROP,
83  results(offset + k));
84  }
85  }
86  }
87 };
88 
93 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
95  private:
97  using scalar_type = typename local_matrix_type::value_type;
98  using local_ordinal_type = typename local_matrix_type::ordinal_type;
99  using memory_space = typename local_matrix_type::memory_space;
100  using results_view = Kokkos::View<DecisionType*, memory_space>;
101  using boundary_nodes_view = Kokkos::View<bool*, memory_space>;
102 
107 
108  public:
110  : boundaryNodes(boundaryNodes_)
111  , results(results_) {
112  A = A_.getLocalMatrixDevice();
113  auto boundaryNodesColumn = typename boundary_nodes_view::non_const_type("boundaryNodesColumn", A_.getColMap()->getLocalNumElements());
114  auto boundaryNodesDomain = typename boundary_nodes_view::non_const_type("boundaryNodesDomain", A_.getDomainMap()->getLocalNumElements());
116  boundaryNodesCol = boundaryNodesColumn;
117  }
118 
119  KOKKOS_FORCEINLINE_FUNCTION
120  void operator()(local_ordinal_type rlid) const {
121  auto row = A.rowConst(rlid);
122  const size_t offset = A.graph.row_map(rlid);
123  const bool isBoundaryRow = boundaryNodes(rlid);
124  for (local_ordinal_type k = 0; k < row.length; ++k) {
125  auto clid = row.colidx(k);
126  if (isBoundaryRow || boundaryNodesCol(clid))
127  results(offset + k) = Kokkos::max(rlid == clid ? KEEP : DROP,
128  results(offset + k));
129  }
130  }
131 };
132 
137 template <class local_matrix_type>
139  private:
140  using scalar_type = typename local_matrix_type::value_type;
141  using local_ordinal_type = typename local_matrix_type::ordinal_type;
142  using memory_space = typename local_matrix_type::memory_space;
143  using results_view = Kokkos::View<DecisionType*, memory_space>;
144  using boundary_nodes_view = Kokkos::View<const bool*, memory_space>;
145  using block_indices_view_type = Kokkos::View<local_ordinal_type*, memory_space>;
146 
147  local_matrix_type A;
151 
152  public:
153  VectorDropBoundaryFunctor(local_matrix_type& A_, block_indices_view_type point_to_block_, boundary_nodes_view boundaryNodes_, results_view& results_)
154  : A(A_)
155  , point_to_block(point_to_block_)
156  , boundaryNodes(boundaryNodes_)
157  , results(results_) {}
158 
159  KOKKOS_FORCEINLINE_FUNCTION
160  void operator()(local_ordinal_type rlid) const {
161  auto row = A.rowConst(rlid);
162  const size_t offset = A.graph.row_map(rlid);
163  const bool isBoundaryRow = boundaryNodes(point_to_block(rlid));
164  if (isBoundaryRow) {
165  for (local_ordinal_type k = 0; k < row.length; ++k) {
166  auto clid = row.colidx(k);
167  results(offset + k) = Kokkos::max(rlid == clid ? KEEP : DROP,
168  results(offset + k));
169  }
170  }
171  }
172 };
173 
178 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
180  private:
182  using scalar_type = typename local_matrix_type::value_type;
183  using local_ordinal_type = typename local_matrix_type::ordinal_type;
184  using memory_space = typename local_matrix_type::memory_space;
185  using results_view = Kokkos::View<DecisionType*, memory_space>;
186  using boundary_nodes_view = Kokkos::View<bool*, memory_space>;
187  using block_indices_view_type = Kokkos::View<local_ordinal_type*, memory_space>;
188 
195 
196  public:
198  : point_to_block(point_to_block_)
199  , ghosted_point_to_block(ghosted_point_to_block_)
200  , boundaryNodes(boundaryNodes_)
201  , results(results_) {
202  A = A_.getLocalMatrixDevice();
203  auto boundaryNodesColumn = typename boundary_nodes_view::non_const_type("boundaryNodesColumn", A_.getColMap()->getLocalNumElements());
204  auto boundaryNodesDomain = typename boundary_nodes_view::non_const_type("boundaryNodesDomain", A_.getDomainMap()->getLocalNumElements());
206  boundaryNodesCol = boundaryNodesColumn;
207  }
208 
209  KOKKOS_FORCEINLINE_FUNCTION
210  void operator()(local_ordinal_type rlid) const {
211  auto row = A.rowConst(rlid);
212  const size_t offset = A.graph.row_map(rlid);
213  const bool isBoundaryRow = boundaryNodes(point_to_block(rlid));
214  for (local_ordinal_type k = 0; k < row.length; ++k) {
215  auto clid = row.colidx(k);
216  if (isBoundaryRow || boundaryNodesCol(ghosted_point_to_block(clid))) {
217  results(offset + k) = Kokkos::max(rlid == clid ? KEEP : DROP,
218  results(offset + k));
219  }
220  }
221  }
222 };
223 
228 template <class local_matrix_type>
230  private:
231  using scalar_type = typename local_matrix_type::value_type;
232  using local_ordinal_type = typename local_matrix_type::ordinal_type;
233  using memory_space = typename local_matrix_type::memory_space;
234  using results_view = Kokkos::View<DecisionType*, memory_space>;
235 
236  local_matrix_type A;
238 
239  public:
240  KeepDiagonalFunctor(local_matrix_type& A_, results_view& results_)
241  : A(A_)
242  , results(results_) {}
243 
244  KOKKOS_FORCEINLINE_FUNCTION
245  void operator()(local_ordinal_type rlid) const {
246  auto row = A.rowConst(rlid);
247  const size_t offset = A.graph.row_map(rlid);
248  for (local_ordinal_type k = 0; k < row.length; ++k) {
249  auto clid = row.colidx(k);
250  if ((rlid == clid) && (results(offset + k) != BOUNDARY)) {
251  results(offset + k) = KEEP;
252  break;
253  }
254  }
255  }
256 };
257 
262 template <class local_matrix_type>
264  private:
265  using scalar_type = typename local_matrix_type::value_type;
266  using local_ordinal_type = typename local_matrix_type::ordinal_type;
267  using memory_space = typename local_matrix_type::memory_space;
268  using results_view = Kokkos::View<DecisionType*, memory_space>;
269 
270  local_matrix_type A;
272 
273  public:
274  DropOffRankFunctor(local_matrix_type& A_, results_view& results_)
275  : A(A_)
276  , results(results_) {}
277 
278  KOKKOS_FORCEINLINE_FUNCTION
279  void operator()(local_ordinal_type rlid) const {
280  auto row = A.rowConst(rlid);
281  const size_t offset = A.graph.row_map(rlid);
282  for (local_ordinal_type k = 0; k < row.length; ++k) {
283  auto clid = row.colidx(k);
284  if (clid >= A.numRows()) {
285  results(offset + k) = Kokkos::max(DROP, results(offset + k));
286  }
287  }
288  }
289 };
290 
295 template <class local_matrix_type>
297  private:
298  using scalar_type = typename local_matrix_type::value_type;
299  using local_ordinal_type = typename local_matrix_type::ordinal_type;
300  using memory_space = typename local_matrix_type::memory_space;
301  using results_view = Kokkos::View<DecisionType*, memory_space>;
302 
303  using boundary_nodes_view = Kokkos::View<bool*, memory_space>;
304 
305  local_matrix_type A;
308 
309  public:
310  MarkSingletonFunctor(local_matrix_type& A_, boundary_nodes_view boundaryNodes_, results_view& results_)
311  : A(A_)
312  , boundaryNodes(boundaryNodes_)
313  , results(results_) {}
314 
315  KOKKOS_FORCEINLINE_FUNCTION
316  void operator()(local_ordinal_type rlid) const {
317  auto row = A.rowConst(rlid);
318  const size_t offset = A.graph.row_map(rlid);
319  for (local_ordinal_type k = 0; k < row.length; ++k) {
320  auto clid = row.colidx(k);
321  if ((results(offset + k) == KEEP) && (rlid != clid))
322  return;
323  }
324  boundaryNodes(rlid) = true;
325  for (local_ordinal_type k = 0; k < row.length; ++k) {
326  auto clid = row.colidx(k);
327  if (rlid == clid)
328  results(offset + k) = KEEP;
329  else
330  results(offset + k) = BOUNDARY;
331  }
332  }
333 };
334 
339 template <class local_matrix_type>
341  private:
342  using scalar_type = typename local_matrix_type::value_type;
343  using local_ordinal_type = typename local_matrix_type::ordinal_type;
344  using memory_space = typename local_matrix_type::memory_space;
345  using results_view = Kokkos::View<DecisionType*, memory_space>;
346  using block_indices_view_type = Kokkos::View<local_ordinal_type*, memory_space>;
347 
348  using boundary_nodes_view = Kokkos::View<bool*, memory_space>;
349 
350  local_matrix_type A;
354 
355  public:
356  MarkSingletonVectorFunctor(local_matrix_type& A_, block_indices_view_type point_to_block_, boundary_nodes_view boundaryNodes_, results_view& results_)
357  : A(A_)
358  , point_to_block(point_to_block_)
359  , boundaryNodes(boundaryNodes_)
360  , results(results_) {}
361 
362  KOKKOS_FORCEINLINE_FUNCTION
363  void operator()(local_ordinal_type rlid) const {
364  auto row = A.rowConst(rlid);
365  const size_t offset = A.graph.row_map(rlid);
366  for (local_ordinal_type k = 0; k < row.length; ++k) {
367  auto clid = row.colidx(k);
368  if ((results(offset + k) == KEEP) && (rlid != clid))
369  return;
370  }
371  auto brlid = point_to_block(rlid);
372  boundaryNodes(brlid) = true;
373  for (local_ordinal_type k = 0; k < row.length; ++k) {
374  auto clid = row.colidx(k);
375  if (rlid == clid)
376  results(offset + k) = KEEP;
377  else
378  results(offset + k) = BOUNDARY;
379  }
380  }
381 };
382 
387 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
389  private:
391  using local_matrix_type = typename matrix_type::local_matrix_type;
392 
393  using scalar_type = typename local_matrix_type::value_type;
394  using local_ordinal_type = typename local_matrix_type::ordinal_type;
395  using memory_space = typename local_matrix_type::memory_space;
396  using results_view = Kokkos::View<DecisionType*, memory_space>;
397 
399  using local_block_indices_view_type = typename block_indices_type::dual_view_type_const::t_dev;
400 
405 
406  public:
408  : A(A_.getLocalMatrixDevice())
409  , point_to_block(point_to_block_.getLocalViewDevice(Xpetra::Access::ReadOnly))
410  , results(results_) {
411  auto importer = A_.getCrsGraph()->getImporter();
412 
413  if (!importer.is_null()) {
414  auto ghosted_point_to_blockMV = Xpetra::VectorFactory<LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node>::Build(importer->getTargetMap());
415  ghosted_point_to_blockMV->doImport(point_to_block_, *importer, Xpetra::INSERT);
416  ghosted_point_to_block = ghosted_point_to_blockMV->getLocalViewDevice(Xpetra::Access::ReadOnly);
417  } else
419  }
420 
421  KOKKOS_FORCEINLINE_FUNCTION
422  void operator()(local_ordinal_type rlid) const {
423  auto row = A.rowConst(rlid);
424  const size_t offset = A.graph.row_map(rlid);
425  for (local_ordinal_type k = 0; k < row.length; ++k) {
426  auto clid = row.colidx(k);
427  if (point_to_block(rlid, 0) == ghosted_point_to_block(clid, 0)) {
428  results(offset + k) = Kokkos::max(KEEP, results(offset + k));
429  } else {
430  results(offset + k) = Kokkos::max(DROP, results(offset + k));
431  }
432  }
433  }
434 };
435 
440 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
442  private:
444  using local_matrix_type = typename matrix_type::local_matrix_type;
445 
446  using scalar_type = typename local_matrix_type::value_type;
447  using local_ordinal_type = typename local_matrix_type::ordinal_type;
448  using memory_space = typename local_matrix_type::memory_space;
449  using results_view = Kokkos::View<DecisionType*, memory_space>;
450 
452  using local_block_indices_view_type = typename block_indices_type::dual_view_type_const::t_dev;
453  using id_translation_type = Kokkos::View<local_ordinal_type*, memory_space>;
455 
463 
464  public:
465  BlockDiagonalizeVectorFunctor(matrix_type& A_, block_indices_type& point_to_block_, const RCP<const importer_type>& importer, results_view& results_, id_translation_type row_translation_, id_translation_type col_translation_)
466  : A(A_.getLocalMatrixDevice())
467  , point_to_block(point_to_block_.getLocalViewDevice(Xpetra::Access::ReadOnly))
468  , results(results_)
469  , row_translation(row_translation_)
470  , col_translation(col_translation_) {
471  if (!importer.is_null()) {
473  ghosted_point_to_blockMV->doImport(point_to_block_, *importer, Xpetra::INSERT);
474  ghosted_point_to_block = ghosted_point_to_blockMV->getLocalViewDevice(Xpetra::Access::ReadOnly);
475  } else
477  }
478 
479  KOKKOS_FORCEINLINE_FUNCTION
480  void operator()(local_ordinal_type rlid) const {
481  auto row = A.rowConst(rlid);
482  const size_t offset = A.graph.row_map(rlid);
483  auto brlid = row_translation(rlid);
484  for (local_ordinal_type k = 0; k < row.length; ++k) {
485  auto clid = row.colidx(k);
486  auto bclid = col_translation(clid);
487  if (point_to_block(brlid, 0) == ghosted_point_to_block(bclid, 0)) {
488  results(offset + k) = Kokkos::max(KEEP, results(offset + k));
489  } else {
490  results(offset + k) = Kokkos::max(DROP, results(offset + k));
491  }
492  }
493  }
494 };
495 
500 template <class local_matrix_type>
502  private:
503  using scalar_type = typename local_matrix_type::value_type;
504  using local_ordinal_type = typename local_matrix_type::ordinal_type;
505  using memory_space = typename local_matrix_type::memory_space;
506  using results_view = Kokkos::View<DecisionType*, memory_space>;
507 
508  using boundary_nodes_view = Kokkos::View<bool*, memory_space>;
509 
510  local_matrix_type A;
512 
513  public:
514  DebugFunctor(local_matrix_type& A_, results_view& results_)
515  : A(A_)
516  , results(results_) {}
517 
518  KOKKOS_FORCEINLINE_FUNCTION
519  void operator()(local_ordinal_type rlid) const {
520  auto row = A.rowConst(rlid);
521  const size_t offset = A.graph.row_map(rlid);
522  for (local_ordinal_type k = 0; k < row.length; ++k) {
523  if (results(offset + k) == UNDECIDED) {
524  Kokkos::printf("No dropping decision was taken for entry (%d, %d)\n", rlid, row.colidx(k));
525  assert(false);
526  }
527  }
528  }
529 };
530 
535 template <class local_matrix_type>
537  private:
538  using scalar_type = typename local_matrix_type::value_type;
539  using local_ordinal_type = typename local_matrix_type::ordinal_type;
540  using memory_space = typename local_matrix_type::memory_space;
541  using results_view = Kokkos::View<DecisionType*, memory_space>;
542 
543  local_matrix_type A;
545 
546  public:
547  SymmetrizeFunctor(local_matrix_type& A_, results_view& results_)
548  : A(A_)
549  , results(results_) {}
550 
551  KOKKOS_FORCEINLINE_FUNCTION
552  void operator()(local_ordinal_type rlid) const {
553  auto row = A.rowConst(rlid);
554  const size_t offset = A.graph.row_map(rlid);
555  for (local_ordinal_type k = 0; k < row.length; ++k) {
556  if (results(offset + k) == KEEP) {
557  auto clid = row.colidx(k);
558  if (clid >= A.numRows())
559  continue;
560  auto row2 = A.rowConst(clid);
561  const size_t offset2 = A.graph.row_map(clid);
562  for (local_ordinal_type k2 = 0; k2 < row2.length; ++k2) {
563  auto clid2 = row2.colidx(k2);
564  if (clid2 == rlid) {
565  if (results(offset2 + k2) == DROP)
566  results(offset2 + k2) = KEEP;
567  break;
568  }
569  }
570  }
571  }
572  }
573 };
574 
575 template <class view_type, class comparator_type>
576 KOKKOS_INLINE_FUNCTION void serialHeapSort(view_type& v, comparator_type comparator) {
577  auto N = v.extent(0);
578  size_t start = N / 2;
579  size_t end = N;
580  while (end > 1) {
581  if (start > 0)
582  start = start - 1;
583  else {
584  end = end - 1;
585  auto temp = v(0);
586  v(0) = v(end);
587  v(end) = temp;
588  }
589  size_t root = start;
590  while (2 * root + 1 < end) {
591  size_t child = 2 * root + 1;
592  if ((child + 1 < end) and (comparator(v(child), v(child + 1))))
593  ++child;
594 
595  if (comparator(v(root), v(child))) {
596  auto temp = v(root);
597  v(root) = v(child);
598  v(child) = temp;
599  root = child;
600  } else
601  break;
602  }
603  }
604 }
605 
608 enum StrengthMeasure : int {
609  /*
610  \f[
611  \frac{|A_{ij}|^2}{|A_{ii}| |A_{jj}|} \le \theta^2
612  \f]
613  */
615  /*
616  \f[
617  \frac{-\operatorname{Re}A_{ij}}{| max_j -A_{ij}|} \le \theta
618  \f]
619  */
621 
622  /*
623  \f[
624  \frac{-\operatorname{sign}(A_{ij}) |A_{ij}|^2}{|A_{ii}| |A_{jj}|} \le \theta^2
625  \f]
626  */
628 
629  /*
630  \f[
631  |A_{ij}| \le \theta
632  \f]
633  */
635 };
636 
637 } // namespace Misc
638 
639 } // namespace MueLu
640 
641 #define MUELU_ETI_SLGN_SoC(CLASSNAME, SC, LO, GO, NO) \
642  template class CLASSNAME<SC, LO, GO, NO, MueLu::Misc::SmoothedAggregationMeasure>; \
643  template class CLASSNAME<SC, LO, GO, NO, MueLu::Misc::SignedRugeStuebenMeasure>; \
644  template class CLASSNAME<SC, LO, GO, NO, MueLu::Misc::SignedSmoothedAggregationMeasure>; \
645  template class CLASSNAME<SC, LO, GO, NO, MueLu::Misc::UnscaledMeasure>;
646 
647 #endif
typename matrix_type::local_matrix_type local_matrix_type
PointwiseSymmetricDropBoundaryFunctor(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A_, boundary_nodes_view boundaryNodes_, results_view &results_)
typename Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type local_matrix_type
Kokkos::View< local_ordinal_type *, memory_space > block_indices_view_type
static void DetectDirichletColsAndDomains(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayRCP< bool > &dirichletRows, Teuchos::ArrayRCP< bool > dirichletCols, Teuchos::ArrayRCP< bool > dirichletDomain)
Detects Dirichlet columns &amp; domains from a list of Dirichlet rows.
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
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::value_type scalar_type
DebugFunctor(local_matrix_type &A_, results_view &results_)
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::memory_space memory_space
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::value_type scalar_type
Functor that drops boundary nodes for a blockSize &gt; 1 problem.
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::value_type scalar_type
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
BlockDiagonalizeFunctor(matrix_type &A_, block_indices_type &point_to_block_, results_view &results_)
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
local_block_indices_view_type ghosted_point_to_block
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
Functor that drops boundary nodes for a blockSize == 1 problem.
typename local_matrix_type::ordinal_type local_ordinal_type
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
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const =0
Functor that marks singletons (all off-diagonal entries in a row are dropped) as boundary.
typename local_matrix_type::value_type scalar_type
typename Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type local_matrix_type
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< DecisionType *, memory_space > results_view
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)
BlockDiagonalizeVectorFunctor(matrix_type &A_, block_indices_type &point_to_block_, const RCP< const importer_type > &importer, results_view &results_, id_translation_type row_translation_, id_translation_type col_translation_)
typename local_matrix_type::value_type scalar_type
Teuchos::RCP< block_indices_type > ghosted_point_to_blockMV
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
Kokkos::View< DecisionType *, memory_space > results_view
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
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
local_block_indices_view_type ghosted_point_to_block
Kokkos::View< bool *, memory_space > boundary_nodes_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename matrix_type::local_matrix_type local_matrix_type
typename local_matrix_type::memory_space memory_space
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
static RCP< Vector > Build(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
void start()
VectorSymmetricDropBoundaryFunctor(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A_, block_indices_view_type point_to_block_, block_indices_view_type ghosted_point_to_block_, boundary_nodes_view boundaryNodes_, results_view &results_)
MarkSingletonFunctor(local_matrix_type &A_, boundary_nodes_view boundaryNodes_, results_view &results_)
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::value_type scalar_type
virtual RCP< const CrsGraph > getCrsGraph() const =0
KOKKOS_FORCEINLINE_FUNCTION void operator()(local_ordinal_type rlid) const
typename local_matrix_type::memory_space memory_space
Kokkos::View< local_ordinal_type *, memory_space > id_translation_type
Functor that drops boundary nodes for a blockSize &gt; 1 problem.
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_)
Kokkos::View< DecisionType *, memory_space > results_view
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
Functor that drops all entries that are not on the block diagonal.
Kokkos::View< bool *, memory_space > boundary_nodes_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
TransListIter end
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
virtual Teuchos::RCP< const Map > getDomainMap() const =0
typename local_matrix_type::value_type scalar_type
bool is_null() const