47 #ifndef PACKAGES_MUELU_SRC_MISC_MUELU_FINELEVELINPUTDATAFACTORY_DEF_HPP_
48 #define PACKAGES_MUELU_SRC_MISC_MUELU_FINELEVELINPUTDATAFACTORY_DEF_HPP_
58 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
63 validParamList->
set<std::string>(
"Variable", std::string(
"A"),
"Variable name on all coarse levels (except the finest level).");
66 validParamList->
set<
RCP<const FactoryBase> >(
"Fine level factory", Teuchos::null,
"Generating factory of the fine level variable");
67 validParamList->
set<
RCP<const FactoryBase> >(
"Coarse level factory", Teuchos::null,
"Generating factory for data on all coarse levels (except the finest)");
70 validParamList->
set<std::string>(
"Variable type", std::string(
"Matrix"),
"Type of variable");
72 return validParamList;
75 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
79 std::string variableName =
"";
81 variableName = pL.
get<std::string>(
"Variable");
83 std::string factoryName =
"NoFactory";
85 factoryName =
"Fine level factory";
87 factoryName =
"Coarse level factory";
97 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
103 std::string variableName =
"";
105 variableName = pL.
get<std::string>(
"Variable");
107 std::string variableType =
"";
109 variableType = pL.
get<std::string>(
"Variable type");
111 std::string factoryName =
"NoFactory";
113 factoryName =
"Fine level factory";
115 factoryName =
"Coarse level factory";
119 GetOStream(
Debug) <<
"Use " << variableName <<
" of type " << variableType <<
" from " << factoryName <<
"(" << fact.
get() <<
")" << std::endl;
123 if (variableType ==
"int") {
124 int data = currentLevel.
Get<
int>(variableName, fact.
get());
125 Set(currentLevel, variableName, data);
126 }
else if (variableType ==
"double") {
127 double data = currentLevel.
Get<
double>(variableName, fact.
get());
128 Set(currentLevel, variableName, data);
129 }
else if (variableType ==
"string") {
130 std::string data = currentLevel.
Get<std::string>(variableName, fact.
get());
131 Set(currentLevel, variableName, data);
133 size_t npos = std::string::npos;
135 if (variableType.find(
"Aggregates") != npos) {
137 Set(currentLevel, variableName, data);
138 }
else if (variableType.find(
"SmootherBase") != npos) {
140 Set(currentLevel, variableName, data);
141 }
else if (variableType.find(
"SmootherPrototype") != npos) {
143 Set(currentLevel, variableName, data);
144 }
else if (variableType.find(
"Export") != npos) {
146 Set(currentLevel, variableName, data);
147 }
else if (variableType.find(
"Import") != npos) {
149 Set(currentLevel, variableName, data);
150 }
else if (variableType.find(
"Map") != npos) {
152 Set(currentLevel, variableName, data);
153 }
else if (variableType.find(
"Matrix") != npos) {
155 Set(currentLevel, variableName, data);
156 }
else if (variableType.find(
"MultiVector") != npos) {
158 Set(currentLevel, variableName, data);
159 }
else if (variableType.find(
"Operator") != npos) {
161 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)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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.
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()