10 #ifndef PACKAGES_MUELU_SRC_MISC_MUELU_FINELEVELINPUTDATAFACTORY_DEF_HPP_
11 #define PACKAGES_MUELU_SRC_MISC_MUELU_FINELEVELINPUTDATAFACTORY_DEF_HPP_
21 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
26 validParamList->
set<std::string>(
"Variable", std::string(
"A"),
"Variable name on all coarse levels (except the finest level).");
29 validParamList->
set<
RCP<const FactoryBase> >(
"Fine level factory", Teuchos::null,
"Generating factory of the fine level variable");
30 validParamList->
set<
RCP<const FactoryBase> >(
"Coarse level factory", Teuchos::null,
"Generating factory for data on all coarse levels (except the finest)");
33 validParamList->
set<std::string>(
"Variable type", std::string(
"Matrix"),
"Type of variable");
35 return validParamList;
38 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
42 std::string variableName =
"";
44 variableName = pL.
get<std::string>(
"Variable");
46 std::string factoryName =
"NoFactory";
48 factoryName =
"Fine level factory";
50 factoryName =
"Coarse level factory";
60 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
66 std::string variableName =
"";
68 variableName = pL.
get<std::string>(
"Variable");
70 std::string variableType =
"";
72 variableType = pL.
get<std::string>(
"Variable type");
74 std::string factoryName =
"NoFactory";
76 factoryName =
"Fine level factory";
78 factoryName =
"Coarse level factory";
82 GetOStream(
Debug) <<
"Use " << variableName <<
" of type " << variableType <<
" from " << factoryName <<
"(" << fact.
get() <<
")" << std::endl;
86 if (variableType ==
"int") {
87 int data = currentLevel.
Get<
int>(variableName, fact.
get());
88 Set(currentLevel, variableName, data);
89 }
else if (variableType ==
"double") {
90 double data = currentLevel.
Get<
double>(variableName, fact.
get());
91 Set(currentLevel, variableName, data);
92 }
else if (variableType ==
"string") {
93 std::string data = currentLevel.
Get<std::string>(variableName, fact.
get());
94 Set(currentLevel, variableName, data);
96 size_t npos = std::string::npos;
98 if (variableType.find(
"Aggregates") != npos) {
100 Set(currentLevel, variableName, data);
101 }
else if (variableType.find(
"SmootherBase") != npos) {
103 Set(currentLevel, variableName, data);
104 }
else if (variableType.find(
"SmootherPrototype") != npos) {
106 Set(currentLevel, variableName, data);
107 }
else if (variableType.find(
"Export") != npos) {
109 Set(currentLevel, variableName, data);
110 }
else if (variableType.find(
"Import") != npos) {
112 Set(currentLevel, variableName, data);
113 }
else if (variableType.find(
"Map") != npos) {
115 Set(currentLevel, variableName, data);
116 }
else if (variableType.find(
"Matrix") != npos) {
118 Set(currentLevel, variableName, data);
119 }
else if (variableType.find(
"MultiVector") != npos) {
121 Set(currentLevel, variableName, data);
122 }
else if (variableType.find(
"Operator") != npos) {
124 Set(currentLevel, variableName, data);
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level->Get< RCP<Matrix> >("A", factory) if factory == NULL => use default factory.
T & get(const std::string &name, T def_value)
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Print additional debugging information.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
int GetLevelID() const
Return level number.
Exception throws to report errors in the internal logical of the program.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()