MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_FactoryFactory_decl.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_FACTORYFACTORY_DECL_HPP
11 #define MUELU_FACTORYFACTORY_DECL_HPP
12 
13 #include <string>
14 #include <vector>
15 
17 #include <Teuchos_Array.hpp>
18 
19 #include "MueLu_ConfigDefs.hpp"
21 
23 
24 #include "MueLu_FactoryBase.hpp"
25 #include "MueLu_FactoryManager.hpp"
29 #include "MueLu_Hierarchy_fwd.hpp"
30 
31 #include "MueLu_Monitor.hpp"
32 #include "MueLu_Exceptions.hpp"
33 
83 #include "MueLu_PgPFactory_fwd.hpp"
91 #include "MueLu_RAPFactory_fwd.hpp"
95 #include "MueLu_SaPFactory_fwd.hpp"
105 #ifdef HAVE_MUELU_TEKO
107 #endif
125 
128 #ifdef HAVE_MUELU_DEPRECATED_CODE
131 #endif
137 
138 #ifdef HAVE_MUELU_INTREPID2
140 #endif
141 
142 namespace MueLu {
143 
150 template <class Scalar = DefaultScalar,
153  class Node = DefaultNode>
154 class FactoryFactory : public BaseClass {
155 #undef MUELU_FACTORYFACTORY_SHORT
156 #include "MueLu_UseShortNames.hpp"
157 
158  typedef std::map<std::string, RCP<const FactoryBase> > FactoryMap; // TODO: remove
159  typedef std::map<std::string, RCP<FactoryManagerBase> > FactoryManagerMap;
160 
161  public:
179  virtual RCP<const FactoryBase> BuildFactory(const Teuchos::ParameterEntry& param, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
180 
181  //
182  //
183  //
184 
185  // FOLLOWING FUNCTIONS SHOULD LIVE WITH THE CORRESPONDING CLASS
186 
187  //
188  //
189  //
190 
191  template <class T> // T must implement the Factory interface
192  RCP<T> Build(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
193 
194  template <class T> // T must implement the Factory interface
195  RCP<T> Build2(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
196 
197  template <class T> // T must implement the Factory interface
198  RCP<T> BuildRAPFactory(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
199 
200  template <class T> // T must implement the Factory interface
201  RCP<T> BuildTogglePFactory(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
202 
203  RCP<ToggleCoordinatesTransferFactory> BuildToggleCoordinatesTransferFactory(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
204 
206  // Parameter List Parsing:
207  // <ParameterList name="smootherFact1">
208  // <Parameter name="factory" type="string" value="TrilinosSmoother"/>
209  // <Parameter name="verbose" type="string" value="Warnings"/>
210  // <Parameter name="type" type="string" value="RELAXATION"/>
211  // <ParameterList name="ParameterList">
212  // ...
213  // </ParameterList>
214  // </ParameterList>
215  RCP<FactoryBase> BuildTrilinosSmoother(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
216 
217 #ifdef HAVE_MUELU_MATLAB
218  // Parameter List Parsing:
220  // <ParameterList name="smootherFact1">
221  // <Parameter name="factory" type="string" value="MatlabSmoother"/>
222  // <Parameter name="Setup Function" type="string" value="mySmootherSetup.m"/>
223  // <Parameter name="Solve Function" type="string" value="mySmootherSolve.m"/>
224  // <!--A is implicitly included in this list and nothing else is needed to get diagonal-->
225  // <Parameter name="Needs" type="string" value=""/>
226  // <!--A,x,b are also assumed inputs to the solver: only one additional arg then (diag)-->
227  // <Parameter name="Number of Solver Args" type="int" value="1"/>
228  // </ParameterList>
229  RCP<FactoryBase> BuildMatlabSmoother(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
230 #endif
231 
232  RCP<FactoryBase> BuildDirectSolver(const Teuchos::ParameterList& paramList, const FactoryMap& /* factoryMapIn */, const FactoryManagerMap& /* factoryManagersIn */) const;
233 
234  template <class T> // T must implement the Factory interface
235  RCP<FactoryBase> BuildBlockedSmoother(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
236 
237 #ifdef HAVE_MUELU_TEKO
238  RCP<FactoryBase> BuildTekoSmoother(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
239 #endif
240 
241  RCP<FactoryBase> BuildBlockedDirectSolver(const Teuchos::ParameterList& paramList, const FactoryMap& /* factoryMapIn */, const FactoryManagerMap& /* factoryManagersIn */) const;
242 
243  // RCP<FactoryBase> BuildBlockedPFactory(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const {
244  // RCP<BlockedPFactory> pfac = rcp(new BlockedPFactory());
245 
246  template <class T> // T must implement the Factory interface
247  RCP<T> BuildBlockedFactory(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
248 
249  template <class T> // T must implement the Factory interface
250  RCP<T> BuildBlockedCoordFactory(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, const FactoryManagerMap& factoryManagersIn) const;
251 
252 }; // class
253 } // namespace MueLu
254 
255 #define MUELU_FACTORYFACTORY_SHORT
256 #endif // MUELU_FACTORYFACTORY_DECL_HPP
257 
258 // TODO: handle factory parameters
259 // TODO: parameter validator
260 // TODO: static
261 // TODO: default parameters should not be duplicated here and on the Factory (ex: default for overlap (=0) is defined both here and on TrilinosSmoother constructors)
RCP< ToggleCoordinatesTransferFactory > BuildToggleCoordinatesTransferFactory(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
MueLu::DefaultLocalOrdinal LocalOrdinal
RCP< FactoryBase > BuildMatlabSmoother(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
MatlabSmoother.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
virtual RCP< const FactoryBase > BuildFactory(const Teuchos::ParameterEntry &param, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
: Interpret Factory parameter list and build new factory
Factory that can generate other factories from.
RCP< T > Build2(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< T > BuildTogglePFactory(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< T > BuildBlockedFactory(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< FactoryBase > BuildDirectSolver(const Teuchos::ParameterList &paramList, const FactoryMap &, const FactoryManagerMap &) const
MueLu::DefaultNode Node
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
RCP< FactoryBase > BuildTrilinosSmoother(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
TrilinosSmoother.
RCP< T > Build(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
MueLu::DefaultScalar Scalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
std::map< std::string, RCP< const FactoryBase > > FactoryMap
RCP< FactoryBase > BuildBlockedDirectSolver(const Teuchos::ParameterList &paramList, const FactoryMap &, const FactoryManagerMap &) const
Base class for MueLu classes.
RCP< FactoryBase > BuildBlockedSmoother(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< T > BuildRAPFactory(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< FactoryBase > BuildTekoSmoother(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< T > BuildBlockedCoordFactory(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const