MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_FacadeClassFactory_def.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 PACKAGES_MUELU_SRC_INTERFACE_FACADECLASSES_MUELU_FACADECLASSFACTORY_DEF_HPP_
11#define PACKAGES_MUELU_SRC_INTERFACE_FACADECLASSES_MUELU_FACADECLASSFACTORY_DEF_HPP_
12
13#include <Teuchos_XMLParameterListHelpers.hpp>
14#include <Teuchos_XMLParameterListCoreHelpers.hpp>
15
16#include "MueLu_Exceptions.hpp"
17
18#include "MueLu_FacadeClassBase.hpp"
21
23
24namespace MueLu {
25
26template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
31
32template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
33Teuchos::RCP<Teuchos::ParameterList> FacadeClassFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::SetParameterList(const ParameterList& paramList) {
34 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter("MueLu preconditioner") == false, MueLu::Exceptions::RuntimeError, "FacadeClassFactory: undefined MueLu preconditioner. Set the \"MueLu preconditioner\" parameter correctly in your input file.");
35 TEUCHOS_TEST_FOR_EXCEPTION(paramList.get<std::string>("MueLu preconditioner") == "undefined", MueLu::Exceptions::RuntimeError, "FacadeClassFactory: undefined MueLu preconditioner. Set the \"MueLu preconditioner\" parameter correctly in your input file.");
36
37 std::string precMueLu = paramList.get<std::string>("MueLu preconditioner");
38
39 // could not find requested facade class
40 if (facadeClasses_.find(precMueLu) == facadeClasses_.end()) {
41 GetOStream(Errors) << "FacadeClassFactory: Could not find facade class \"" << precMueLu << "\"!" << std::endl;
42 GetOStream(Errors) << "The available facade classes are:" << std::endl;
43 for (typename std::map<std::string, Teuchos::RCP<FacadeClassBase> >::const_iterator it = facadeClasses_.begin(); it != facadeClasses_.end(); it++) {
44 GetOStream(Errors) << " " << it->first << std::endl;
45 }
46 TEUCHOS_TEST_FOR_EXCEPTION(true, MueLu::Exceptions::RuntimeError, "FacadeClassFactory: Could not find facade class \"" << precMueLu << "\".");
47 }
48
49 return facadeClasses_[precMueLu]->SetParameterList(paramList);
50}
51
52} // end namespace MueLu
53
54#endif /* PACKAGES_MUELU_SRC_INTERFACE_FACADECLASSES_MUELU_FACADECLASSFACTORY_DEF_HPP_ */
Exception throws to report errors in the internal logical of the program.
Teuchos::RCP< Teuchos::ParameterList > SetParameterList(const Teuchos::ParameterList &paramList)
Set parameter list for FacadeClassFactory interpreter.
Namespace for MueLu classes and methods.