Debian Codegraph @

packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_kokkos_decl.hpp

raw
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_SEMICOARSENPFACTORY_KOKKOS_DECL_HPP
11 #define MUELU_SEMICOARSENPFACTORY_KOKKOS_DECL_HPP
12
13 #include <Xpetra_Matrix_fwd.hpp>
14
15 #include "MueLu_ConfigDefs.hpp"
16 #include "MueLu_Level_fwd.hpp"
17 #include "MueLu_PFactory.hpp"
18 #include "MueLu_SemiCoarsenPFactory_kokkos_fwd.hpp"
19
20 namespace MueLu {
21
22 /*!
23 @class SemiCoarsenPFactory_kokkos
24 @ingroup MueLuTransferClasses
25 @brief Prolongator factory performing semi-coarsening.
26
27 The semi-coarsening is performed along user-provided "vertical lines" (in z-direction).
28 The line detection algorithm can be found in the LineDetectionFactory.
29 Usually, the SemiCoarsenPFactory_kokkos is used together with the TogglePFactory and a
30 second TentativePFactory_kokkos which allows to dynamically switch from semi-coarsening to
31 aggregation-based coarsening (or any other compatible coarsening algorithm).
32
33 ## Input/output of SemiCoarsenPFactory_kokkos ##
34
35 ### User parameters of SemiCoarsenPFactory_kokkos ###
36 Parameter | type | default | master.xml | validated | requested | description
37 ----------|------|---------|:----------:|:---------:|:---------:|------------
38 | A | Factory | null | | * | * | Generating factory of the matrix A used during the prolongator smoothing process |
39 | Nullspace | Factory | null | | * | * | Generating factory of the nullspace. The SemiCoarsenPFactory_kokkos provides a coarse version of the given Nullspace. |
40 | Coordinates | Factory | NoFactory | | * | * | Generating factory for coorindates. The coordinates are expected to be provided on the finest level using the NoFactory mechanism. The coordinates are used to determine the number of z-layers if not otherwise provided by the user. |
41 | LineDetection_VertLineIds | Factory | null | | * | * | Generating factory for LineDetection information. Usually provided by the LineDetectionFactory. Array with vertical line ids for all nodes on current processor. |
42 | LineDetection_Layers | Factory | null | | * | * | Generating factory for LineDetection information. Usually provided by the LineDetectionFactory. Array with layer id for all nodes on current processor. |
43 | CoarseNumZLayers | Factory | null | | * | * | Generating factory for LineDetection information. Usually provided by the LineDetectionFactory. Number of remaining z-layers after semi-coarsening. |
44 | semicoarsen: coarsen rate | int | null | | * | * | Coarsening rate along vertical lines (2 corresponds to classical semicoarsening. Values > 2 for more aggressive coarsening). |
45
46 The * in the @c master.xml column denotes that the parameter is defined in the @c master.xml file.<br>
47 The * in the @c validated column means that the parameter is declared in the list of valid input parameters (see SemiCoarsenPFactory_kokkos::GetValidParameters).<br>
48 The * in the @c requested column states that the data is requested as input with all dependencies (see SemiCoarsenPFactory_kokkos::DeclareInput).
49
50 ### Variables provided by SemiCoarsenPFactory_kokkos ###
51 After SemiCoarsenPFactory_kokkos::Build the following data is available (if requested)
52
53 Parameter | generated by | description
54 ----------|--------------|------------
55 | P | SemiCoarsenPFactory_kokkos | Prolongator
56 | Nullspace | SemiCoarsenPFactory_kokkos | Coarse nullspace (the fine level nullspace information is coarsened using P to generate a coarse version of the nullspace. No scaling is applied.
57 | NumZLayers | NoFactory | Number of z layers after coarsening. Necessary input for LineDetectionFactory. Useful input for TogglePFactory.
58 */
59
60 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
61 class SemiCoarsenPFactory_kokkos : public PFactory {
62 public:
63 typedef LocalOrdinal local_ordinal_type;
64 typedef GlobalOrdinal global_ordinal_type;
65 typedef typename Node::execution_space execution_space;
66 typedef typename Node::device_type DeviceType;
67 typedef Node node_type;
68
69 private:
70 #undef MUELU_SEMICOARSENPFACTORY_KOKKOS_SHORT
71 #include "MueLu_UseShortNames.hpp"
72
73 public:
74 //! @name Constructors/Destructors.
75 //@{
76
77 //! Constructor
78 SemiCoarsenPFactory_kokkos()
79 : bTransferCoordinates_(false) {}
80
81 //! Destructor.
82 virtual ~SemiCoarsenPFactory_kokkos() = default;
83 //@}
84
85 RCP<const ParameterList> GetValidParameterList() const;
86
87 //! Input
88 //@{
89
90 void DeclareInput(Level &fineLevel, Level &coarseLevel) const;
91
92 //@}
93
94 //! @name Build methods.
95 //@{
96
97 void Build(Level &fineLevel, Level &coarseLevel) const;
98 void BuildP(Level &fineLevel, Level &coarseLevel) const;
99
100 //@}
101
102 void BuildSemiCoarsenP(Level &coarseLevel, const LO NFRows, const LO NFNodes,
103 const LO DofsPerNode, const LO NFLayers,
104 const LO NCLayers, const ArrayRCP<LO> LayerId,
105 const ArrayRCP<LO> VertLineId, const RCP<Matrix> &Amat,
106 const RCP<MultiVector> fineNullspace, RCP<Matrix> &P,
107 RCP<MultiVector> &coarseNullspace) const;
108
109 // boolean which is true if coordinate information is available to be
110 // transferred to coarse coordinate information
111 mutable bool bTransferCoordinates_;
112 }; // class SemiCoarsenPFactory_kokkos
113
114 } // namespace MueLu
115
116 #define MUELU_SEMICOARSENPFACTORY_KOKKOS_SHORT
117 #endif // MUELU_SEMICOARSENPFACTORY_KOKKOS_DECL_HPP