10#ifndef IFPACK2_DETAILS_GETPARAMTRYINGTYPES_HPP
11#define IFPACK2_DETAILS_GETPARAMTRYINGTYPES_HPP
13#include "Ifpack2_config.h"
14#include "Teuchos_TypeNameTraits.hpp"
15#include "Teuchos_ParameterList.hpp"
20template<
class ... CandidateTypes>
21struct GetParamTryingTypes {
22 template<
class ResultType>
24 get (ResultType& result,
25 const Teuchos::ParameterEntry& ent,
26 const std::string& paramName,
31struct GetParamTryingTypes<> {
32 template<
class ResultType>
35 const Teuchos::ParameterEntry& ,
36 const std::string& paramName,
39 using Teuchos::TypeNameTraits;
40 TEUCHOS_TEST_FOR_EXCEPTION
41 (
true, std::invalid_argument, prefix <<
"\"" << paramName
42 <<
"\" parameter exists in input ParameterList, but does not "
43 "have the right type. The proper type is "
44 << TypeNameTraits<ResultType>::name () <<
".");
48template<
class First,
class ... Rest>
49struct GetParamTryingTypes<First, Rest...> {
50 template<
class ResultType>
52 get (ResultType& result,
53 const Teuchos::ParameterEntry& ent,
54 const std::string& paramName,
57 if (ent.template isType<First> ()) {
58 result =
static_cast<ResultType
> (Teuchos::getValue<First> (ent));
61 using rest_type = GetParamTryingTypes<Rest...>;
62 rest_type::template get<ResultType> (result, ent, paramName, prefix);
67template<
class ResultType,
class ... CandidateTypes>
69getParamTryingTypes (ResultType& result,
70 const Teuchos::ParameterList& params,
71 const std::string& paramName,
74 using Teuchos::ParameterEntry;
75 const ParameterEntry* ent = params.getEntryPtr (paramName);
77 using impl_type = GetParamTryingTypes<CandidateTypes...>;
78 impl_type::template get<ResultType> (result, *ent, paramName, prefix);
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:41