10 #ifndef MUELU_MERGEDSMOOTHER_DEF_HPP
11 #define MUELU_MERGEDSMOOTHER_DEF_HPP
18 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
20 : smootherList_(smootherList)
21 , reverseOrder_(false)
28 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
30 : reverseOrder_(src.reverseOrder_)
31 , verbose_(src.verbose_) {
36 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
40 (*it)->SetFactory(varName, factory);
43 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
46 (*it)->DeclareInput(currentLevel);
49 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
52 this->GetOStream(
Warnings0) <<
"MueLu::MergedSmoother::Setup(): Setup() has already been called";
59 std::string msg =
"MueLu::MergedSmoother<>::Setup(): Runtime Error.\n One of the underlying smoother throwed the following exception: \n";
68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 sz_t n = smootherList_.
size(), c = (reverseOrder_ ? n - 1 : 0);
74 char d = (reverseOrder_ ? -1 : 1);
76 for (sz_t i = 0; i < n; i++)
79 smootherList_[c + d * Teuchos::as<char>(i)]->Apply(X, B, InitialGuessIsZero);
82 InitialGuessIsZero =
false;
85 std::string msg =
"MueLu::MergedSmoother<>::Apply(): Runtime Error. One of the underlying smoothers throws the following exception: \n";
91 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
96 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
106 "MueLu::MergedSmoother<>:CopyParameters(): thisSmootherList == Teuchos::null");
117 reuse = reuse && (thisSmootherList.
size() == srcSmootherList.
size());
125 "MueLu::MergedSmoother<>:CopyParameters(): internal logic error");
140 if (srcSmootherList[i] != Teuchos::null) {
144 isSetup = isSetup && thisSmootherList[i]->IsSetup();
151 smootherList_ = Teuchos::null;
152 smootherList_ = SmootherListDeepCopy(srcSmootherList);
158 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
165 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
172 newSmootherList[i] = srcSmootherList[i]->
Copy();
174 return newSmootherList;
177 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
186 #endif // MUELU_MERGEDSMOOTHER_DEF_HPP
Important warning messages (one line)
RCP< SmootherPrototype > Copy() const
Copy method (performs a deep copy of input object)
ArrayRCP< RCP< SmootherPrototype > > smootherList_
bool GetReverseOrder() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply.
void DeclareInput(Level ¤tLevel) const
Input.
void CopyParameters(RCP< SmootherPrototype > src)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Exception throws when you call an unimplemented method of MueLu.
ArrayRCP< RCP< SmootherPrototype > > SmootherListDeepCopy(const ArrayRCP< const RCP< SmootherPrototype > > &srcSmootherList)
bool IsSetup() const
Get the state of a smoother prototype.
const ArrayRCP< const RCP< SmootherPrototype > > GetSmootherList() const
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Custom SetFactory.
MergedSmoother(ArrayRCP< RCP< SmootherPrototype > > &smootherList, bool verbose=false)
Constructor.
Exception throws to report errors in the internal logical of the program.
void Setup(Level &level)
Set up.