8 #ifndef PACKAGES_MUELU_SRC_MUECENTRAL_MUELU_TOPSMOOTHERFACTORY_DEF_HPP_
9 #define PACKAGES_MUELU_SRC_MUECENTRAL_MUELU_TOPSMOOTHERFACTORY_DEF_HPP_
16 #include "MueLu_TopSmootherFactory.hpp"
20 #include "MueLu_SmootherFactory.hpp"
21 #include "MueLu_SmootherPrototype.hpp"
26 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
28 TEUCHOS_TEST_FOR_EXCEPTION(varName !=
"CoarseSolver" && varName !=
"Smoother",
Exceptions::RuntimeError,
"varName should be either \"CoarseSolver\" or \"Smoother\"");
30 if (varName ==
"CoarseSolver") {
34 RCP<const FactoryBase> coarseSolverFactory = parentFactoryManager->GetFactory(
"CoarseSolver");
35 RCP<const SmootherFactory> coarseSmootherFactory = Teuchos::rcp_dynamic_cast<const SmootherFactory>(coarseSolverFactory);
36 if (coarseSmootherFactory != Teuchos::null) {
37 RCP<SmootherPrototype> preProto;
38 RCP<SmootherPrototype> postProto;
39 coarseSmootherFactory->GetSmootherPrototypes(preProto, postProto);
41 if (preProto == postProto)
42 preSmootherFact_ = parentFactoryManager->GetFactory(
"CoarseSolver");
45 if(preProto != Teuchos::null)
46 preSmootherFact_ = parentFactoryManager->GetFactory(
"CoarseSolver");
47 if(postProto != Teuchos::null)
48 postSmootherFact_ = parentFactoryManager->GetFactory(
"CoarseSolver");
52 preSmootherFact_ = parentFactoryManager->GetFactory(
"CoarseSolver");
55 preSmootherFact_ = parentFactoryManager->GetFactory(
"PreSmoother");
56 postSmootherFact_ = parentFactoryManager->GetFactory(
"PostSmoother");
60 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
63 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 if (preSmootherFact_ != Teuchos::null)
66 level.
DeclareInput(
"PreSmoother", preSmootherFact_.get());
67 if (postSmootherFact_ != Teuchos::null)
68 level.
DeclareInput(
"PostSmoother", postSmootherFact_.get());
71 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 if (preSmootherFact_.is_null() && postSmootherFact_.is_null())
84 if (!preSmootherFact_.is_null()) {
87 RCP<const SmootherFactory> s = rcp_dynamic_cast<const SmootherFactory>(preSmootherFact_);
89 RCP<SmootherPrototype> pre, post;
90 s->GetSmootherPrototypes(pre, post);
98 RCP<SmootherBase> Pre = level.
Get<RCP<SmootherBase> >(
"PreSmoother", preSmootherFact_.get());
107 if (!postSmootherFact_.is_null()) {
110 RCP<const SmootherFactory> s = rcp_dynamic_cast<const SmootherFactory>(postSmootherFact_);
112 RCP<SmootherPrototype> pre, post;
113 s->GetSmootherPrototypes(pre, post);
121 RCP<SmootherBase> Post = level.
Get<RCP<SmootherBase> >(
"PostSmoother", postSmootherFact_.get());