MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_ScalarDroppingClassical_def.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_SCALARDROPPINGCLASSICAL_DEF_HPP
11#define MUELU_SCALARDROPPINGCLASSICAL_DEF_HPP
12
14
15namespace MueLu {
16
17template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, Misc::StrengthMeasure SoC>
19 results_view& results,
20 rowptr_type& filtered_rowptr,
21 LocalOrdinal& nnz_filtered,
22 boundary_nodes_type& boundaryNodes,
23 const std::string& droppingMethod,
24 const magnitudeType threshold,
25 const bool aggregationMayCreateDirichlet,
26 const bool symmetrizeDroppedGraph,
27 const bool useBlocking,
28 Level& level,
29 const Factory& factory) {
30 auto lclA = A.getLocalMatrixDevice();
31 auto preserve_diagonals = Misc::KeepDiagonalFunctor(lclA, results);
32
33 if (droppingMethod == "point-wise") {
34 auto dropping = ClassicalDropping::make_drop_functor<SoC>(A, threshold, results);
35
36 if (aggregationMayCreateDirichlet) {
37 auto mark_singletons_as_boundary = Misc::MarkSingletonFunctor(lclA, boundaryNodes, results);
38
39 if (symmetrizeDroppedGraph) {
40 auto drop_boundaries = Misc::PointwiseSymmetricDropBoundaryFunctor(A, boundaryNodes, results);
41 ScalarDroppingClassical::runDroppingFunctors(A, results, filtered_rowptr, nnz_filtered, useBlocking, level, factory,
42 dropping,
43 drop_boundaries,
44 preserve_diagonals,
45 mark_singletons_as_boundary);
46 } else {
47 auto drop_boundaries = Misc::PointwiseDropBoundaryFunctor(lclA, boundaryNodes, results);
48 ScalarDroppingClassical::runDroppingFunctors(A, results, filtered_rowptr, nnz_filtered, useBlocking, level, factory,
49 dropping,
50 drop_boundaries,
51 preserve_diagonals,
52 mark_singletons_as_boundary);
53 }
54 } else {
55 if (symmetrizeDroppedGraph) {
56 auto drop_boundaries = Misc::PointwiseSymmetricDropBoundaryFunctor(A, boundaryNodes, results);
57 ScalarDroppingClassical::runDroppingFunctors(A, results, filtered_rowptr, nnz_filtered, useBlocking, level, factory,
58 dropping,
59 drop_boundaries,
60 preserve_diagonals);
61 } else {
62 auto drop_boundaries = Misc::PointwiseDropBoundaryFunctor(lclA, boundaryNodes, results);
63 ScalarDroppingClassical::runDroppingFunctors(A, results, filtered_rowptr, nnz_filtered, useBlocking, level, factory,
64 dropping,
65 drop_boundaries,
66 preserve_diagonals);
67 }
68 }
69 } else if (droppingMethod == "cut-drop") {
70 auto comparison = CutDrop::make_comparison_functor<SoC>(A, results);
71 auto cut_drop = CutDrop::CutDropFunctor(comparison, threshold);
72
73 if (symmetrizeDroppedGraph) {
74 auto drop_boundaries = Misc::PointwiseSymmetricDropBoundaryFunctor(A, boundaryNodes, results);
75 ScalarDroppingClassical::runDroppingFunctors(A, results, filtered_rowptr, nnz_filtered, useBlocking, level, factory,
76 drop_boundaries,
77 preserve_diagonals,
78 cut_drop);
79 } else {
80 auto drop_boundaries = Misc::PointwiseDropBoundaryFunctor(lclA, boundaryNodes, results);
81 ScalarDroppingClassical::runDroppingFunctors(A, results, filtered_rowptr, nnz_filtered, useBlocking, level, factory,
82 drop_boundaries,
83 preserve_diagonals,
84 cut_drop);
85 }
86 }
87}
88} // namespace MueLu
89
90#define MUELU_ETI_GROUP(SC, LO, GO, NO) \
91 MUELU_ETI_SLGN_SoC(MueLu::ScalarDroppingClassical, SC, LO, GO, NO)
92
93#endif
MueLu::DefaultLocalOrdinal LocalOrdinal
Order each row by a criterion, compare the ratio of values and drop all entries once the ratio is bel...
Class that holds all level-specific information.
Functor that marks diagonal as kept, unless the are already marked as boundary.
Functor that marks singletons (all off-diagonal entries in a row are dropped) as boundary.
Functor that drops boundary nodes for a blockSize == 1 problem.
Functor that drops boundary nodes for a blockSize == 1 problem.
static void runDroppingFunctors(matrix_type &A, results_view &results, rowptr_type &filtered_rowptr, LocalOrdinal &nnz_filtered, const bool useBlocking, Level &level, const Factory &factory, Functors &... functors)
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > matrix_type
typename Teuchos::ScalarTraits< Scalar >::magnitudeType magnitudeType
typename MueLu::LWGraph_kokkos< LocalOrdinal, GlobalOrdinal, Node >::boundary_nodes_type boundary_nodes_type
static void runDroppingFunctors_on_A(matrix_type &A, results_view &results, rowptr_type &filtered_rowptr, LocalOrdinal &nnz_filtered, boundary_nodes_type &boundaryNodes, const std::string &droppingMethod, const magnitudeType threshold, const bool aggregationMayCreateDirichlet, const bool symmetrizeDroppedGraph, const bool useBlocking, Level &level, const Factory &factory)
typename local_graph_type::row_map_type::non_const_type rowptr_type
Kokkos::View< DecisionType *, memory_space > results_view
Namespace for MueLu classes and methods.