46 #ifndef MUELU_FACTORYFACTORY_DECL_HPP
47 #define MUELU_FACTORYFACTORY_DECL_HPP
61 #include "MueLu_FactoryManager.hpp"
70 #include "MueLu_AggregateQualityEstimateFactory.hpp"
71 #include "MueLu_AggregationExportFactory.hpp"
72 #include "MueLu_AmalgamationFactory.hpp"
73 #include "MueLu_BlackBoxPFactory.hpp"
74 #include "MueLu_BlockedCoarseMapFactory.hpp"
75 #include "MueLu_BlockedCoordinatesTransferFactory.hpp"
76 #include "MueLu_BlockedDirectSolver.hpp"
77 #include "MueLu_BlockedGaussSeidelSmoother.hpp"
78 #include "MueLu_BlockedJacobiSmoother.hpp"
79 #include "MueLu_BlockedPFactory.hpp"
80 #include "MueLu_BlockedRAPFactory.hpp"
81 #include "MueLu_BraessSarazinSmoother.hpp"
82 #include "MueLu_BrickAggregationFactory.hpp"
83 #include "MueLu_CloneRepartitionInterface.hpp"
84 #include "MueLu_CoalesceDropFactory.hpp"
85 #include "MueLu_SmooVecCoalesceDropFactory.hpp"
86 #include "MueLu_CoarseMapFactory.hpp"
87 #include "MueLu_CoarseningVisualizationFactory.hpp"
88 #include "MueLu_ConstraintFactory.hpp"
89 #include "MueLu_CoupledAggregationFactory.hpp"
90 #include "MueLu_CoordinatesTransferFactory.hpp"
91 #include "MueLu_DirectSolver.hpp"
92 #include "MueLu_DropNegativeEntriesFactory.hpp"
93 #include "MueLu_EminPFactory.hpp"
94 #include "MueLu_FilteredAFactory.hpp"
95 #include "MueLu_FineLevelInputDataFactory.hpp"
96 #include "MueLu_GeneralGeometricPFactory.hpp"
97 #include "MueLu_GenericRFactory.hpp"
98 #include "MueLu_GeometricInterpolationPFactory.hpp"
99 #include "MueLu_InterfaceAggregationFactory.hpp"
100 #include "MueLu_InterfaceMappingTransferFactory.hpp"
101 #include "MueLu_IndefBlockedDiagonalSmoother.hpp"
102 #include "MueLu_IsorropiaInterface.hpp"
103 #include "MueLu_LineDetectionFactory.hpp"
104 #include "MueLu_RepartitionInterface.hpp"
105 #include "MueLu_RepartitionBlockDiagonalFactory.hpp"
106 #include "MueLu_MapTransferFactory.hpp"
107 #include "MueLu_MatrixAnalysisFactory.hpp"
108 #include "MueLu_MultiVectorTransferFactory.hpp"
109 #include "MueLu_NotayAggregationFactory.hpp"
110 #include "MueLu_NullspaceFactory.hpp"
111 #include "MueLu_NullspacePresmoothFactory.hpp"
112 #include "MueLu_PatternFactory.hpp"
113 #include "MueLu_PgPFactory.hpp"
114 #include "MueLu_RebalanceBlockInterpolationFactory.hpp"
115 #include "MueLu_RebalanceBlockRestrictionFactory.hpp"
116 #include "MueLu_RebalanceBlockAcFactory.hpp"
117 #include "MueLu_RebalanceTransferFactory.hpp"
118 #include "MueLu_RepartitionFactory.hpp"
119 #include "MueLu_RepartitionHeuristicFactory.hpp"
120 #include "MueLu_RAPFactory.hpp"
121 #include "MueLu_RAPShiftFactory.hpp"
122 #include "MueLu_RebalanceAcFactory.hpp"
123 #include "MueLu_ReorderBlockAFactory.hpp"
124 #include "MueLu_SaPFactory.hpp"
125 #include "MueLu_ScaledNullspaceFactory.hpp"
126 #include "MueLu_SegregatedAFactory.hpp"
127 #include "MueLu_SemiCoarsenPFactory.hpp"
128 #include "MueLu_SchurComplementFactory.hpp"
129 #include "MueLu_SimpleSmoother.hpp"
130 #include "MueLu_SmootherFactory.hpp"
131 #include "MueLu_StructuredAggregationFactory.hpp"
132 #include "MueLu_StructuredLineDetectionFactory.hpp"
133 #include "MueLu_SubBlockAFactory.hpp"
134 #ifdef HAVE_MUELU_TEKO
135 #include "MueLu_TekoSmoother.hpp"
137 #include "MueLu_TentativePFactory.hpp"
138 #include "MueLu_ToggleCoordinatesTransferFactory.hpp"
139 #include "MueLu_TogglePFactory.hpp"
140 #include "MueLu_TrilinosSmoother.hpp"
141 #include "MueLu_TransPFactory.hpp"
142 #include "MueLu_UncoupledAggregationFactory.hpp"
143 #include "MueLu_HybridAggregationFactory.hpp"
144 #include "MueLu_UnsmooshFactory.hpp"
145 #include "MueLu_UserAggregationFactory.hpp"
146 #include "MueLu_UserPFactory.hpp"
147 #include "MueLu_UzawaSmoother.hpp"
148 #include "MueLu_VariableDofLaplacianFactory.hpp"
149 #include "MueLu_ZoltanInterface.hpp"
150 #include "MueLu_Zoltan2Interface.hpp"
151 #include "MueLu_NodePartitionInterface.hpp"
154 #ifdef HAVE_MUELU_KOKKOS_REFACTOR
155 #include "MueLu_AmalgamationFactory_kokkos.hpp"
156 #include "MueLu_CoalesceDropFactory_kokkos.hpp"
157 #include "MueLu_CoarseMapFactory_kokkos.hpp"
158 #include "MueLu_CoordinatesTransferFactory_kokkos.hpp"
159 #include "MueLu_GeometricInterpolationPFactory_kokkos.hpp"
160 #include "MueLu_NullspaceFactory_kokkos.hpp"
161 #include "MueLu_SaPFactory_kokkos.hpp"
162 #include "MueLu_StructuredAggregationFactory_kokkos.hpp"
163 #include "MueLu_TentativePFactory_kokkos.hpp"
164 #include "MueLu_UncoupledAggregationFactory_kokkos.hpp"
167 #ifdef HAVE_MUELU_MATLAB
169 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp"
170 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp"
171 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp"
172 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp"
173 #include "../matlab/src/MueLu_MatlabSmoother_decl.hpp"
174 #include "../matlab/src/MueLu_MatlabSmoother_def.hpp"
177 #ifdef HAVE_MUELU_INTREPID2
178 #include "MueLu_IntrepidPCoarsenFactory.hpp"
194 #undef MUELU_FACTORYFACTORY_SHORT
197 typedef std::map<std::string, RCP<const FactoryBase> >
FactoryMap;
221 std::string factoryName;
224 factoryName = Teuchos::getValue<std::string>(param);
226 paramList = Teuchos::getValue<Teuchos::ParameterList>(param);
227 factoryName = paramList.
get<std::string>(
"factory");
231 if (factoryName ==
"AggregateQualityEstimateFactory")
return Build2<AggregateQualityEstimateFactory> (paramList, factoryMapIn, factoryManagersIn);
232 if (factoryName ==
"AggregationExportFactory")
return Build2<AggregationExportFactory> (paramList, factoryMapIn, factoryManagersIn);
233 if (factoryName ==
"AmalgamationFactory")
return Build2<AmalgamationFactory> (paramList, factoryMapIn, factoryManagersIn);
234 if (factoryName ==
"BlockedCoarseMapFactory")
return Build2<BlockedCoarseMapFactory> (paramList, factoryMapIn, factoryManagersIn);
235 if (factoryName ==
"BlockedCoordinatesTransferFactory")
return Build2<BlockedCoordinatesTransferFactory> (paramList, factoryMapIn, factoryManagersIn);
236 if (factoryName ==
"BlockedRAPFactory")
return BuildRAPFactory<BlockedRAPFactory> (paramList, factoryMapIn, factoryManagersIn);
237 if (factoryName ==
"BrickAggregationFactory")
return Build2<BrickAggregationFactory> (paramList, factoryMapIn, factoryManagersIn);
238 if (factoryName ==
"CloneRepartitionInterface")
return Build2<CloneRepartitionInterface> (paramList, factoryMapIn, factoryManagersIn);
239 if (factoryName ==
"CoarseMapFactory")
return Build2<CoarseMapFactory> (paramList, factoryMapIn, factoryManagersIn);
240 if (factoryName ==
"CoarseningVisualizationFactory")
return Build2<CoarseningVisualizationFactory> (paramList, factoryMapIn, factoryManagersIn);
241 if (factoryName ==
"CoalesceDropFactory")
return Build2<CoalesceDropFactory> (paramList, factoryMapIn, factoryManagersIn);
242 if (factoryName ==
"SmooVecCoalesceDropFactory")
return Build2<SmooVecCoalesceDropFactory> (paramList, factoryMapIn, factoryManagersIn);
243 if (factoryName ==
"ConstraintFactory")
return Build2<ConstraintFactory> (paramList, factoryMapIn, factoryManagersIn);
245 if (factoryName ==
"CoordinatesTransferFactory")
return Build2<CoordinatesTransferFactory> (paramList, factoryMapIn, factoryManagersIn);
246 if (factoryName ==
"DirectSolver")
return BuildDirectSolver (paramList, factoryMapIn, factoryManagersIn);
247 if (factoryName ==
"DropNegativeEntriesFactory")
return Build2<DropNegativeEntriesFactory> (paramList, factoryMapIn, factoryManagersIn);
248 if (factoryName ==
"EminPFactory")
return Build2<EminPFactory> (paramList, factoryMapIn, factoryManagersIn);
249 if (factoryName ==
"FilteredAFactory")
return Build2<FilteredAFactory> (paramList, factoryMapIn, factoryManagersIn);
250 if (factoryName ==
"FineLevelInputDataFactory")
return Build2<FineLevelInputDataFactory> (paramList, factoryMapIn, factoryManagersIn);
251 if (factoryName ==
"GeneralGeometricPFactory")
return Build2<GeneralGeometricPFactory> (paramList, factoryMapIn, factoryManagersIn);
252 if (factoryName ==
"GenericRFactory")
return Build2<GenericRFactory> (paramList, factoryMapIn, factoryManagersIn);
253 if (factoryName ==
"GeometricInterpolationPFactory")
return Build2<GeometricInterpolationPFactory> (paramList, factoryMapIn, factoryManagersIn);
254 if (factoryName ==
"InterfaceAggregationFactory")
return Build2<InterfaceAggregationFactory> (paramList, factoryMapIn, factoryManagersIn);
255 if (factoryName ==
"InterfaceMappingTransferFactory")
return Build2<InterfaceMappingTransferFactory> (paramList, factoryMapIn, factoryManagersIn);
256 if (factoryName ==
"LineDetectionFactory")
return Build2<LineDetectionFactory> (paramList, factoryMapIn, factoryManagersIn);
257 if (factoryName ==
"MapTransferFactory")
return Build2<MapTransferFactory> (paramList, factoryMapIn, factoryManagersIn);
258 if (factoryName ==
"MatrixAnalysisFactory")
return Build2<MatrixAnalysisFactory> (paramList, factoryMapIn, factoryManagersIn);
259 if (factoryName ==
"MultiVectorTransferFactory")
return Build2<MultiVectorTransferFactory> (paramList, factoryMapIn, factoryManagersIn);
262 if (factoryName ==
"NotayAggregationFactory")
return Build2<NotayAggregationFactory> (paramList, factoryMapIn, factoryManagersIn);
263 if (factoryName ==
"NullspaceFactory")
return Build2<NullspaceFactory> (paramList, factoryMapIn, factoryManagersIn);
264 if (factoryName ==
"NullspacePresmoothFactory")
return Build2<NullspacePresmoothFactory> (paramList, factoryMapIn, factoryManagersIn);
265 if (factoryName ==
"PatternFactory")
return Build2<PatternFactory> (paramList, factoryMapIn, factoryManagersIn);
266 if (factoryName ==
"PgPFactory")
return Build2<PgPFactory> (paramList, factoryMapIn, factoryManagersIn);
267 if (factoryName ==
"SaPFactory")
return Build2<SaPFactory> (paramList, factoryMapIn, factoryManagersIn);
268 if (factoryName ==
"RAPFactory")
return BuildRAPFactory<RAPFactory> (paramList, factoryMapIn, factoryManagersIn);
269 if (factoryName ==
"RAPShiftFactory")
return BuildRAPFactory<RAPShiftFactory> (paramList, factoryMapIn, factoryManagersIn);
270 if (factoryName ==
"RebalanceAcFactory")
return Build2<RebalanceAcFactory> (paramList, factoryMapIn, factoryManagersIn);
271 if (factoryName ==
"RebalanceTransferFactory")
return Build2<RebalanceTransferFactory> (paramList, factoryMapIn, factoryManagersIn);
272 if (factoryName ==
"ReorderBlockAFactory")
return Build2<ReorderBlockAFactory> (paramList, factoryMapIn, factoryManagersIn);
273 if (factoryName ==
"RepartitionInterface")
return Build2<RepartitionInterface> (paramList, factoryMapIn, factoryManagersIn);
274 if (factoryName ==
"ScaledNullspaceFactory")
return Build2<ScaledNullspaceFactory> (paramList, factoryMapIn, factoryManagersIn);
275 if (factoryName ==
"SegregatedAFactory")
return Build2<SegregatedAFactory> (paramList, factoryMapIn, factoryManagersIn);
276 if (factoryName ==
"SemiCoarsenPFactory")
return Build2<SemiCoarsenPFactory> (paramList, factoryMapIn, factoryManagersIn);
277 if (factoryName ==
"StructuredAggregationFactory")
return Build2<StructuredAggregationFactory> (paramList, factoryMapIn, factoryManagersIn);
278 if (factoryName ==
"StructuredLineDetectionFactory")
return Build2<StructuredLineDetectionFactory> (paramList, factoryMapIn, factoryManagersIn);
279 if (factoryName ==
"SubBlockAFactory")
return Build2<SubBlockAFactory> (paramList, factoryMapIn, factoryManagersIn);
280 if (factoryName ==
"TentativePFactory")
return Build2<TentativePFactory> (paramList, factoryMapIn, factoryManagersIn);
282 if (factoryName ==
"TogglePFactory")
return BuildTogglePFactory<TogglePFactory> (paramList, factoryMapIn, factoryManagersIn);
283 if (factoryName ==
"TransPFactory")
return Build2<TransPFactory> (paramList, factoryMapIn, factoryManagersIn);
284 if (factoryName ==
"TrilinosSmoother")
return BuildTrilinosSmoother (paramList, factoryMapIn, factoryManagersIn);
285 if (factoryName ==
"UncoupledAggregationFactory")
return Build2<UncoupledAggregationFactory> (paramList, factoryMapIn, factoryManagersIn);
286 if (factoryName ==
"HybridAggregationFactory")
return Build2<HybridAggregationFactory> (paramList, factoryMapIn, factoryManagersIn);
287 if (factoryName ==
"UnsmooshFactory")
return Build2<UnsmooshFactory> (paramList, factoryMapIn, factoryManagersIn);
288 if (factoryName ==
"UserAggregationFactory")
return Build2<UserAggregationFactory> (paramList, factoryMapIn, factoryManagersIn);
289 if (factoryName ==
"UserPFactory")
return Build2<UserPFactory> (paramList, factoryMapIn, factoryManagersIn);
290 if (factoryName ==
"VariableDofLaplacianFactory")
return Build2<VariableDofLaplacianFactory> (paramList, factoryMapIn, factoryManagersIn);
291 #ifdef HAVE_MUELU_KOKKOS_REFACTOR
292 if (factoryName ==
"AmalgamationFactory_kokkos")
return Build2<AmalgamationFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
293 if (factoryName ==
"CoalesceDropFactory_kokkos")
return Build2<CoalesceDropFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
294 if (factoryName ==
"CoarseMapFactory_kokkos")
return Build2<CoarseMapFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
295 if (factoryName ==
"CoordinatesTransferFactory_kokkos")
return Build2<CoordinatesTransferFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
296 if (factoryName ==
"GeometricInterpolationPFactory_kokkos")
return Build2<GeometricInterpolationPFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
297 if (factoryName ==
"NullspaceFactory_kokkos")
return Build2<NullspaceFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
298 if (factoryName ==
"SaPFactory_kokkos")
return Build2<SaPFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
299 if (factoryName ==
"StructuredAggregationFactory_kokkos")
return Build2<StructuredAggregationFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
300 if (factoryName ==
"TentativePFactory_kokkos")
return Build2<TentativePFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
301 if (factoryName ==
"UncoupledAggregationFactory_kokkos")
return Build2<UncoupledAggregationFactory_kokkos> (paramList, factoryMapIn, factoryManagersIn);
304 if (factoryName ==
"ZoltanInterface") {
305 #if defined(HAVE_MUELU_ZOLTAN) && defined(HAVE_MPI)
306 return Build2<ZoltanInterface>(paramList, factoryMapIn, factoryManagersIn);
309 #endif // HAVE_MUELU_ZOLTAN && HAVE_MPI
311 if (factoryName ==
"Zoltan2Interface") {
312 #if defined(HAVE_MUELU_ZOLTAN2) && defined(HAVE_MPI)
313 return Build2<Zoltan2Interface>(paramList, factoryMapIn, factoryManagersIn);
316 #endif // HAVE_MUELU_ZOLTAN2 && HAVE_MPI
318 if (factoryName ==
"IsorropiaInterface") {
319 #if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI)
320 return Build2<IsorropiaInterface>(paramList, factoryMapIn, factoryManagersIn);
323 #endif // HAVE_MUELU_ZOLTAN2 && HAVE_MPI
326 if (factoryName ==
"NodePartitionInterface") {
327 #if defined(HAVE_MPI)
328 return Build2<NodePartitionInterface>(paramList, factoryMapIn, factoryManagersIn);
334 if (factoryName ==
"RepartitionFactory") {
336 return Build2<RepartitionFactory>(paramList, factoryMapIn, factoryManagersIn);
341 if (factoryName ==
"RepartitionHeuristicFactory") {
343 return Build2<RepartitionHeuristicFactory>(paramList, factoryMapIn, factoryManagersIn);
349 if (factoryName ==
"BlockedDirectSolver")
return BuildBlockedDirectSolver(paramList, factoryMapIn, factoryManagersIn);
350 if (factoryName ==
"BlockedGaussSeidelSmoother")
return BuildBlockedSmoother<BlockedGaussSeidelSmoother>(paramList, factoryMapIn, factoryManagersIn);
351 if (factoryName ==
"BlockedJacobiSmoother")
return BuildBlockedSmoother<BlockedJacobiSmoother>(paramList, factoryMapIn, factoryManagersIn);
352 if (factoryName ==
"BlockedPFactory")
return BuildBlockedFactory<BlockedPFactory>(paramList, factoryMapIn, factoryManagersIn);
353 if (factoryName ==
"BraessSarazinSmoother")
return BuildBlockedSmoother<BraessSarazinSmoother>(paramList, factoryMapIn, factoryManagersIn);
354 if (factoryName ==
"IndefiniteBlockDiagonalSmoother")
return BuildBlockedSmoother<IndefBlockedDiagonalSmoother>(paramList, factoryMapIn, factoryManagersIn);
355 if (factoryName ==
"SimpleSmoother")
return BuildBlockedSmoother<SimpleSmoother>(paramList, factoryMapIn, factoryManagersIn);
356 if (factoryName ==
"SchurComplementFactory")
return Build2<SchurComplementFactory> (paramList, factoryMapIn, factoryManagersIn);
357 if (factoryName ==
"RebalanceBlockRestrictionFactory")
return BuildBlockedFactory<RebalanceBlockRestrictionFactory>(paramList, factoryMapIn, factoryManagersIn);
358 if (factoryName ==
"RebalanceBlockAcFactory")
return BuildBlockedFactory<RebalanceBlockAcFactory>(paramList, factoryMapIn, factoryManagersIn);
359 if (factoryName ==
"RebalanceBlockInterpolationFactory")
return BuildBlockedFactory<RebalanceBlockInterpolationFactory>(paramList, factoryMapIn, factoryManagersIn);
361 if (factoryName ==
"RepartitionBlockDiagonalFactory")
return Build2<RepartitionBlockDiagonalFactory> (paramList, factoryMapIn, factoryManagersIn);
363 #ifdef HAVE_MUELU_TEKO
364 if (factoryName ==
"TekoSmoother")
return BuildTekoSmoother(paramList, factoryMapIn, factoryManagersIn);
366 if (factoryName ==
"UzawaSmoother")
return BuildBlockedSmoother<UzawaSmoother>(paramList, factoryMapIn, factoryManagersIn);
369 #ifdef HAVE_MUELU_MATLAB
370 if (factoryName ==
"TwoLevelMatlabFactory")
return Build2<TwoLevelMatlabFactory> (paramList, factoryMapIn, factoryManagersIn);
371 if (factoryName ==
"SingleLevelMatlabFactory")
return Build2<SingleLevelMatlabFactory> (paramList, factoryMapIn, factoryManagersIn);
372 if (factoryName ==
"MatlabSmoother")
return BuildMatlabSmoother (paramList, factoryMapIn, factoryManagersIn);
375 #ifdef HAVE_MUELU_INTREPID2
376 if (factoryName ==
"IntrepidPCoarsenFactory")
return Build2<IntrepidPCoarsenFactory> (paramList, factoryMapIn, factoryManagersIn);
380 if (factoryMapIn.find(factoryName) != factoryMapIn.end()) {
382 "MueLu::FactoryFactory: Error during the parsing of: " << std::endl << paramList << std::endl
383 <<
"'" << factoryName <<
"' is not a factory name but an existing instance of a factory." << std::endl
384 <<
"Extra parameters cannot be specified after the creation of the object." << std::endl << std::endl
385 <<
"Correct syntaxes includes:" << std::endl
386 <<
" <Parameter name=\"...\" type=\"string\" value=\"" << factoryName <<
"\"/>" << std::endl
388 <<
" <ParameterList name=\"...\"><Parameter name=\"factory\" type=\"string\" value=\"" << factoryName <<
"\"/></ParameterList>" << std::endl
391 return factoryMapIn.find(factoryName)->second;
409 #define arraysize(ar) (sizeof(ar) / sizeof(ar[0]))
415 const char* strarray[] = {
"A",
"P",
"R",
"Graph",
"UnAmalgamationInfo",
"Aggregates",
"Nullspace",
"TransferFactory",
"DofsPerNode"};
416 std::vector<std::string> v(strarray, strarray +
arraysize(strarray));
417 for (
size_t i = 0; i < v.size(); ++i)
419 factory->SetFactory(v[i],
BuildFactory(paramList.
getEntry(v[i]), factoryMapIn, factoryManagersIn));
434 const std::string& pName = validParamList->name(param);
444 paramListWithFactories.
set(pName, generatingFact);
446 if (pName ==
"ParameterList") {
452 paramListWithFactories.
set(pName, subList);
460 factory->SetParameterList(paramListWithFactories);
468 if (paramList.
isSublist(
"TransferFactories") ==
false) {
469 factory = Build2<T>(paramList, factoryMapIn, factoryManagersIn);
475 paramListNonConst->
remove(
"TransferFactories");
477 factory = Build2<T>(*paramListNonConst, factoryMapIn, factoryManagersIn);
481 factory->AddTransferFactory(p);
491 if (paramList.
isSublist(
"TransferFactories") ==
false) {
493 factory = Build2<T>(paramList, factoryMapIn, factoryManagersIn);
499 paramListNonConst->
remove(
"TransferFactories");
502 factory = Build2<T>(*paramListNonConst, factoryMapIn, factoryManagersIn);
506 int numProlongatorFactories = 0;
507 int numPtentFactories = 0;
508 int numCoarseNspFactories = 0;
510 size_t foundNsp = transferFactories->
name(param).find(
"Nullspace");
511 if (foundNsp != std::string::npos && foundNsp == 0 && transferFactories->
name(param).length()==10) {
512 numCoarseNspFactories++;
515 size_t foundPtent = transferFactories->
name(param).find(
"Ptent");
516 if (foundPtent != std::string::npos && foundPtent == 0 && transferFactories->
name(param).length()==6) {
520 size_t foundP = transferFactories->
name(param).find(
"P");
521 if (foundP != std::string::npos && foundP == 0 && transferFactories->
name(param).length()==2) {
522 numProlongatorFactories++;
528 TEUCHOS_TEST_FOR_EXCEPTION(numProlongatorFactories < 2,
Exceptions::RuntimeError,
"FactoryFactory::BuildToggleP: The TogglePFactory needs at least two different prolongation operators. The factories have to be provided using the names P%i and Nullspace %i, where %i denotes a number between 1 and 9.");
531 std::vector<Teuchos::ParameterEntry> prolongatorFactoryNames(numProlongatorFactories);
532 std::vector<Teuchos::ParameterEntry> coarseNspFactoryNames(numProlongatorFactories);
533 std::vector<Teuchos::ParameterEntry> ptentFactoryNames(numProlongatorFactories);
536 size_t foundNsp = transferFactories->
name(param).find(
"Nullspace");
537 if (foundNsp != std::string::npos && foundNsp == 0 && transferFactories->
name(param).length()==10) {
538 int number = atoi(&(transferFactories->
name(param).at(9)));
539 TEUCHOS_TEST_FOR_EXCEPTION(number < 1 || number > numProlongatorFactories,
Exceptions::RuntimeError,
"FactoryFactory::BuildToggleP: Please use the format Nullspace%i with %i an integer between 1 and the maximum number of prolongation operators in TogglePFactory!");
540 coarseNspFactoryNames[number-1] = transferFactories->
entry(param);
543 size_t foundPtent = transferFactories->
name(param).find(
"Ptent");
544 if (foundPtent != std::string::npos && foundPtent == 0 && transferFactories->
name(param).length()==6) {
545 int number = atoi(&(transferFactories->
name(param).at(5)));
546 TEUCHOS_TEST_FOR_EXCEPTION(number < 1 || number > numPtentFactories,
Exceptions::RuntimeError,
"FactoryFactory::BuildToggleP: Please use the format Ptent%i with %i an integer between 1 and the maximum number of prolongation operators in TogglePFactory!");
547 ptentFactoryNames[number-1] = transferFactories->
entry(param);
550 size_t foundP = transferFactories->
name(param).find(
"P");
551 if (foundP != std::string::npos && foundP == 0 && transferFactories->
name(param).length()==2) {
552 int number = atoi(&(transferFactories->
name(param).at(1)));
553 TEUCHOS_TEST_FOR_EXCEPTION(number < 1 || number > numProlongatorFactories,
Exceptions::RuntimeError,
"FactoryFactory::BuildToggleP: Please use the format P%i with %i an integer between 1 and the maximum number of prolongation operators in TogglePFactory!");
554 prolongatorFactoryNames[number-1] = transferFactories->
entry(param);
560 for (std::vector<Teuchos::ParameterEntry>::const_iterator it = prolongatorFactoryNames.begin(); it != prolongatorFactoryNames.end(); ++it) {
562 factory->AddProlongatorFactory(p);
566 for (std::vector<Teuchos::ParameterEntry>::const_iterator it = ptentFactoryNames.begin(); it != ptentFactoryNames.end(); ++it) {
568 factory->AddPtentFactory(p);
572 for (std::vector<Teuchos::ParameterEntry>::const_iterator it = coarseNspFactoryNames.begin(); it != coarseNspFactoryNames.end(); ++it) {
574 factory->AddCoarseNullspaceFactory(p);
582 TEUCHOS_TEST_FOR_EXCEPTION(paramList.
isSublist(
"TransferFactories") ==
false,
Exceptions::RuntimeError,
"FactoryFactory::BuildToggleCoordinatesTransferFactory: the ToggleCoordinatesTransferFactory needs a sublist 'TransferFactories' containing information about the subfactories for coordinate transfer!");
586 paramListNonConst->remove(
"TransferFactories");
589 factory = Build2<ToggleCoordinatesTransferFactory>(*paramListNonConst, factoryMapIn, factoryManagersIn);
593 int numCoordTransferFactories = 0;
595 size_t foundCoordinates = transferFactories->
name(param).find(
"Coordinates");
596 if (foundCoordinates != std::string::npos && foundCoordinates == 0 && transferFactories->
name(param).length()==12) {
597 numCoordTransferFactories++;
601 TEUCHOS_TEST_FOR_EXCEPTION(numCoordTransferFactories != 2,
Exceptions::RuntimeError,
"FactoryFactory::BuildToggleCoordinatesTransfer: The ToggleCoordinatesTransferFactory needs two (different) coordinate transfer factories. The factories have to be provided using the names Coordinates%i, where %i denotes a number between 1 and 9.");
604 std::vector<Teuchos::ParameterEntry> coarseCoordsFactoryNames(numCoordTransferFactories);
607 size_t foundCoords = transferFactories->
name(param).find(
"Coordinates");
608 if (foundCoords != std::string::npos && foundCoords == 0 && transferFactories->
name(param).length()==12) {
609 int number = atoi(&(transferFactories->
name(param).at(11)));
610 TEUCHOS_TEST_FOR_EXCEPTION(number < 1 || number > numCoordTransferFactories,
Exceptions::RuntimeError,
"FactoryFactory::BuildToggleCoordinatesTransfer: Please use the format Coordinates%i with %i an integer between 1 and the maximum number of coordinate transfer factories in ToggleCoordinatesTransferFactory!");
611 coarseCoordsFactoryNames[number-1] = transferFactories->
entry(param);
617 for (std::vector<Teuchos::ParameterEntry>::const_iterator it = coarseCoordsFactoryNames.begin(); it != coarseCoordsFactoryNames.end(); ++it) {
619 factory->AddCoordTransferFactory(p);
629 if (paramList.isParameter(
"aggregation: ordering"))
630 factory->SetOrdering(paramList.get<std::string>(
"aggregation: ordering"));
632 if (paramList.isParameter(
"aggregation: max selected neighbors"))
633 factory->SetMaxNeighAlreadySelected(paramList.get<
int>(
"aggregation: max selected neighbors"));
635 if (paramList.isParameter(
"Phase3AggCreation"))
636 factory->SetPhase3AggCreation(paramList.get<
double>(
"Phase3AggCreation"));
638 if(paramList.isParameter(
"aggregation: min agg size"))
639 factory->SetMinNodesPerAggregate(paramList.get<
int>(
"aggregation: min agg size"));
655 if (paramList.
begin() == paramList.
end())
663 std::string type=
"";
if(paramList.
isParameter(
"type")) type = paramList.
get<std::string>(
"type");
664 int overlap=0;
if(paramList.
isParameter(
"overlap")) overlap = paramList.
get<
int> (
"overlap");
677 if (paramList.
isParameter(
"LineDetection_Layers")) {
679 trilSmoo->SetFactory(
"LineDetection_Layers", generatingFact);
681 if (paramList.
isParameter(
"LineDetection_VertLineIds")) {
683 trilSmoo->SetFactory(
"LineDetection_Layers", generatingFact);
687 trilSmoo->SetFactory(
"CoarseNumZLayers", generatingFact);
693 smooFact->SetParameterList(smooFactParams);
694 smooFact->SetSmootherPrototypes(trilSmoo);
698 #ifdef HAVE_MUELU_MATLAB
711 if (paramList.
begin() == paramList.
end())
727 if (paramList.
begin() == paramList.
end())
732 std::string type;
if(paramList.
isParameter(
"type")) type = paramList.
get<std::string>(
"type");
745 std::vector<RCP<FactoryManager> > facManagers;
749 bool blockExists =
true;
750 while (blockExists ==
true) {
751 std::stringstream ss;
752 ss <<
"block" << blockid;
754 if(paramList.
isSublist(ss.str()) ==
true) {
760 if (b->isParameter(
"group")) {
762 std::string facManagerName = b->
get< std::string >(
"group");
772 M->SetFactory(b->name(param),p);
777 M->SetIgnoreUserData(
true);
778 facManagers.push_back(M);
779 paramListNonConst->remove(ss.str());
789 RCP<T> bs = Build2<T>(*paramListNonConst, factoryMapIn, factoryManagersIn);
797 for (
int i = 0; i<Teuchos::as<int>(facManagers.size()); i++) {
798 bs->AddFactoryManager(facManagers[i],i);
804 #ifdef HAVE_MUELU_TEKO
809 paramListNonConst->remove(
"Inverse Factory Library");
812 RCP<TekoSmoother> bs = Build2<TekoSmoother>(*paramListNonConst, factoryMapIn, factoryManagersIn);
821 bs->SetTekoParameters(tekoParams);
845 RCP<T> pfac = Teuchos::null;
851 std::vector<RCP<FactoryManager> > facManagers;
855 bool blockExists =
true;
856 while (blockExists ==
true) {
857 std::stringstream ss;
858 ss <<
"block" << blockid;
860 if(paramList.
isSublist(ss.str()) ==
true) {
866 if (b->isParameter(
"group")) {
868 std::string facManagerName = b->
get< std::string >(
"group");
878 M->SetFactory(b->name(param),p);
883 M->SetIgnoreUserData(
true);
884 facManagers.push_back(M);
885 paramListNonConst->remove(ss.str());
895 pfac = Build2<T>(*paramListNonConst, factoryMapIn, factoryManagersIn);
898 for(
size_t i = 0; i<facManagers.size(); i++) {
899 pfac->AddFactoryManager(facManagers[i]);
907 #define MUELU_FACTORYFACTORY_SHORT
908 #endif // MUELU_FACTORYFACTORY_DECL_HPP
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
RCP< FactoryBase > BuildDirectSolver(const Teuchos::ParameterList ¶mList, const FactoryMap &, const FactoryManagerMap &) const
const std::string & name() const
This class specifies the default factory that should generate some data on a Level if the data does n...
RCP< T > Build(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
ConstIterator end() const
RCP< FactoryBase > BuildTekoSmoother(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
MueLu::DefaultLocalOrdinal LocalOrdinal
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Factory that can generate other factories from.
T & get(const std::string &name, T def_value)
RCP< T > Build2(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
Class that encapsulates external library smoothers.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< ToggleCoordinatesTransferFactory > BuildToggleCoordinatesTransferFactory(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< FactoryBase > BuildBlockedSmoother(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
RCP< FactoryBase > BuildMatlabSmoother(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
MatlabSmoother.
virtual RCP< const FactoryBase > BuildFactory(const Teuchos::ParameterEntry ¶m, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
: Interpret Factory parameter list and build new factory
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
RCP< T > BuildTogglePFactory(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
bool isParameter(const std::string &name) const
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
bool remove(std::string const &name, bool throwIfNotExists=true)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
std::map< std::string, RCP< const FactoryBase > > FactoryMap
bool isSublist(const std::string &name) const
RCP< T > BuildBlockedFactory(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
params_t::ConstIterator ConstIterator
RCP< FactoryBase > BuildBlockedDirectSolver(const Teuchos::ParameterList &, const FactoryMap &, const FactoryManagerMap &) const
ConstIterator begin() const
RCP< FactoryBase > BuildTrilinosSmoother(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
TrilinosSmoother.
RCP< T > BuildRAPFactory(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
direct solver for nxn blocked matrices
const ParameterEntry & entry(ConstIterator i) const
Base class for MueLu classes.
Class that encapsulates Matlab smoothers.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Exception throws to report errors in the internal logical of the program.
ParameterEntry & getEntry(const std::string &name)
RCP< FactoryBase > BuildCoupledAggregationFactory(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, const FactoryManagerMap &factoryManagersIn) const
CoupledAggregationFactory.
static const RCP< const NoFactory > getRCP()
Static Get() functions.