47 #ifndef PACKAGES_MUELU_SRC_MISC_MUELU_FINELEVELINPUTDATAFACTORY_DEF_HPP_
48 #define PACKAGES_MUELU_SRC_MISC_MUELU_FINELEVELINPUTDATAFACTORY_DEF_HPP_
59 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
64 validParamList->
set< std::string >(
"Variable", std::string(
"A"),
"Variable name on all coarse levels (except the finest level).");
67 validParamList->
set<
RCP<const FactoryBase> >(
"Fine level factory", Teuchos::null,
"Generating factory of the fine level variable");
68 validParamList->
set<
RCP<const FactoryBase> >(
"Coarse level factory", Teuchos::null,
"Generating factory for data on all coarse levels (except the finest)");
71 validParamList->
set<std::string> (
"Variable type", std::string(
"Matrix"),
"Type of variable");
73 return validParamList;
76 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
81 std::string variableName =
"";
83 variableName = pL.
get<std::string>(
"Variable");
85 std::string factoryName =
"NoFactory";
87 factoryName =
"Fine level factory";
89 factoryName =
"Coarse level factory";
99 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
105 std::string variableName =
"";
107 variableName = pL.
get<std::string>(
"Variable");
109 std::string variableType =
"";
111 variableType = pL.
get<std::string>(
"Variable type");
113 std::string factoryName =
"NoFactory";
115 factoryName =
"Fine level factory";
117 factoryName =
"Coarse level factory";
121 GetOStream(
Debug) <<
"Use " << variableName <<
" of type " << variableType <<
" from " << factoryName <<
"(" << fact.
get() <<
")" << std::endl;
125 if (variableType ==
"int") {
126 int data = currentLevel.
Get<
int>(variableName, fact.
get());
127 Set(currentLevel, variableName, data);
128 }
else if (variableType ==
"double") {
129 double data = currentLevel.
Get<
double>(variableName, fact.
get());
130 Set(currentLevel, variableName, data);
131 }
else if (variableType ==
"string") {
132 std::string data = currentLevel.
Get<std::string>(variableName, fact.
get());
133 Set(currentLevel, variableName, data);
135 size_t npos = std::string::npos;
137 if (variableType.find(
"Aggregates") != npos) {
139 Set(currentLevel, variableName, data);
141 else if (variableType.find(
"Graph") != npos) {
143 Set(currentLevel, variableName, data);
145 else if (variableType.find(
"SmootherBase") != npos) {
147 Set(currentLevel, variableName, data);
149 else if (variableType.find(
"SmootherPrototype") != npos) {
151 Set(currentLevel, variableName, data);
153 else if (variableType.find(
"Export") != npos) {
155 Set(currentLevel, variableName, data);
157 else if (variableType.find(
"Import") != npos) {
159 Set(currentLevel, variableName, data);
161 else if (variableType.find(
"Map") != npos) {
163 Set(currentLevel, variableName, data);
165 else if (variableType.find(
"Matrix") != npos) {
167 Set(currentLevel, variableName, data);
169 else if (variableType.find(
"MultiVector") != npos) {
171 Set(currentLevel, variableName, data);
173 else if (variableType.find(
"Operator") != npos) {
175 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()