Debian Codegraph @

packages/muelu/src/Transfers/SemiCoarsen/MueLu_TogglePFactory_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_TOGGLEPFACTORY_DECL_HPP
11 #define MUELU_TOGGLEPFACTORY_DECL_HPP
12
13 #include "MueLu_ConfigDefs.hpp"
14 #include "MueLu_TogglePFactory_fwd.hpp"
15
16 #include "MueLu_Level_fwd.hpp"
17 #include "MueLu_ParameterListAcceptor.hpp"
18 #include "MueLu_PFactory.hpp"
19
20 namespace MueLu {
21
22 /*!
23 @class TogglePFactory
24 @ingroup MueLuTransferClasses
25 @brief Prolongator factory which allows switching between two different prolongator strategies.
26
27 ## Input/output of TogglePFactory ##
28
29 ### User parameters of TogglePFactory ###
30 Parameter | type | default | master.xml | validated | requested | description
31 ----------|------|---------|:----------:|:---------:|:---------:|------------
32 | P | Factory | null | | * | * | Generating factories of prolongators. Note that the TogglePFactory needs at least two different prolongator subfactories.
33 | Ptent | Factory | null | | * | * | Generating factories of base prolongators. Note that the TogglePFactory needs at least two different base prolongator subfactories. Usually, the factory for Ptent is the same as for the coarse null space.
34 | Nullspace | Factory | null | | * | * | Generating factories for fine level null space information. Note, that you have to provide a null space information source factory for each prolongator factory.
35 | NumZLayers| Factory | NoFactory | | * | * | Factory which provides information about z layers. Usually it is stored with MueLu::NoFactory as generating factory. The data is generated by the SemiCoarsenPFactory.
36 | semicoarsen: number of levels | int | ? | * | * | | number of levels which are reserved for semi-coarsening. Note that the TogglePFactory stops the semi-coarsening process either when we have more levels than declared in this parameter or as soon as the number of remaining z-levels is 1.
37
38 The * in the @c master.xml column denotes that the parameter is defined in the @c master.xml file.<br>
39 The * in the @c validated column means that the parameter is declared in the list of valid input parameters (see TogglePFactory::GetValidParameters).<br>
40 The * in the @c requested column states that the data is requested as input with all dependencies (see TogglePFactory::DeclareInput).
41
42 ### Variables provided by TogglePFactory ###
43
44 After TogglePFactory::Build the following data is available (if requested)
45
46 Parameter | generated by | description
47 ----------|--------------|------------
48 | P | TogglePFactory | Prolongator
49 | Ptent | TogglePFactory | Base prolongator (e.g. tentative prolongator)
50 | Nullspace | TogglePFactory | associated coarse null space
51
52 */
53
54 template <class Scalar = DefaultScalar,
55 class LocalOrdinal = DefaultLocalOrdinal,
56 class GlobalOrdinal = DefaultGlobalOrdinal,
57 class Node = DefaultNode>
58 class TogglePFactory : public PFactory {
59 #undef MUELU_TOGGLEPFACTORY_SHORT
60 #include "MueLu_UseShortNames.hpp"
61
62 public:
63 //! @name Constructors/Destructors.
64 //@{
65
66 /*! @brief Constructor. */
67 TogglePFactory()
68 : hasDeclaredInput_(false) {}
69
70 //! Destructor.
71 virtual ~TogglePFactory() {}
72
73 RCP<const ParameterList> GetValidParameterList() const;
74
75 //@}
76
77 //! Input
78 //@{
79
80 void DeclareInput(Level &fineLevel, Level &coarseLevel) const;
81
82 //@}
83
84 //! @name Build methods.
85 //@{
86
87 /*! @brief Build method. */
88 void Build(Level &fineLevel, Level &coarseLevel) const;
89
90 void BuildP(Level & /* fineLevel */, Level & /* coarseLevel */) const {/* empty */};
91 //@}
92
93 //@{
94
95 /*! @brief Add a prolongator factory in the end of list of prolongator factories. */
96 void AddProlongatorFactory(const RCP<const FactoryBase> &factory);
97
98 //! Returns number of prolongator factories.
99 size_t NumProlongatorFactories() const { return prolongatorFacts_.size(); }
100
101 /*! @brief Add a tentative prolongator factory in the end of list of prolongator factories. */
102 void AddPtentFactory(const RCP<const FactoryBase> &factory);
103
104 //! Returns number of tentative prolongator factories.
105 size_t NumPtentFactories() const { return ptentFacts_.size(); }
106
107 /*! @brief Add a coarse nullspace factory in the end of list of coarse nullspace factories. */
108 void AddCoarseNullspaceFactory(const RCP<const FactoryBase> &factory);
109
110 //! Returns number of coarse null space factories.
111 size_t NumCoarseNullspaceFactories() const { return prolongatorFacts_.size(); }
112
113 RCP<const FactoryBase> getProlongatorFactory(size_t t) const { return prolongatorFacts_[t]; }
114 //@}
115 private:
116 //! list of user-defined prolongation operator factories
117 mutable std::vector<RCP<const FactoryBase> > prolongatorFacts_;
118
119 //! list of user-defined tentative prolongation operator factories
120 mutable std::vector<RCP<const FactoryBase> > ptentFacts_;
121
122 //! list of user-defined nullspace factories (i.e. the prolongator factories which also generate the coarse level nullspace)
123 mutable std::vector<RCP<const FactoryBase> > nspFacts_;
124
125 mutable bool hasDeclaredInput_;
126 }; // class TogglePFactory
127
128 } // namespace MueLu
129
130 #define MUELU_TOGGLEPFACTORY_SHORT
131 #endif // MUELU_TOGGLEPFACTORY_DECL_HPP