104 std::string variableName =
"";
105 if (pL.isParameter(
"Variable"))
106 variableName = pL.get<std::string>(
"Variable");
108 std::string variableType =
"";
109 if(pL.isParameter(
"Variable type"))
110 variableType = pL.get<std::string>(
"Variable type");
112 std::string factoryName =
"NoFactory";
114 factoryName =
"Fine level factory";
116 factoryName =
"Coarse level factory";
118 RCP<const FactoryBase> fact =
GetFactory(factoryName);
120 GetOStream(
Debug) <<
"Use " << variableName <<
" of type " << variableType <<
" from " << factoryName <<
"(" << fact.get() <<
")" << std::endl;
124 if (variableType ==
"int") {
125 int data = currentLevel.
Get<
int>(variableName, fact.get());
126 Set(currentLevel, variableName, data);
127 }
else if (variableType ==
"double") {
128 double data = currentLevel.
Get<
double>(variableName, fact.get());
129 Set(currentLevel, variableName, data);
130 }
else if (variableType ==
"string") {
131 std::string data = currentLevel.
Get<std::string>(variableName, fact.get());
132 Set(currentLevel, variableName, data);
134 size_t npos = std::string::npos;
136 if (variableType.find(
"Aggregates") != npos) {
137 RCP<Aggregates> data = currentLevel.
Get<RCP<Aggregates> >(variableName, fact.get());
138 Set(currentLevel, variableName, data);
140 else if (variableType.find(
"Graph") != npos) {
141 RCP<Graph> data = currentLevel.
Get<RCP<Graph> >(variableName, fact.get());
142 Set(currentLevel, variableName, data);
144 else if (variableType.find(
"SmootherBase") != npos) {
145 RCP<SmootherBase> data = currentLevel.
Get<RCP<SmootherBase> >(variableName, fact.get());
146 Set(currentLevel, variableName, data);
148 else if (variableType.find(
"SmootherPrototype") != npos) {
149 RCP<SmootherPrototype> data = currentLevel.
Get<RCP<SmootherPrototype> >(variableName, fact.get());
150 Set(currentLevel, variableName, data);
152 else if (variableType.find(
"Export") != npos) {
153 RCP<Export> data = currentLevel.
Get<RCP<Export> >(variableName, fact.get());
154 Set(currentLevel, variableName, data);
156 else if (variableType.find(
"Import") != npos) {
157 RCP<Import> data = currentLevel.
Get<RCP<Import> >(variableName, fact.get());
158 Set(currentLevel, variableName, data);
160 else if (variableType.find(
"Map") != npos) {
161 RCP<Map> data = currentLevel.
Get<RCP<Map> >(variableName, fact.get());
162 Set(currentLevel, variableName, data);
164 else if (variableType.find(
"Matrix") != npos) {
165 RCP<Matrix> data = currentLevel.
Get<RCP<Matrix> >(variableName, fact.get());
166 Set(currentLevel, variableName, data);
168 else if (variableType.find(
"MultiVector") != npos) {
169 RCP<MultiVector> data = currentLevel.
Get<RCP<MultiVector> >(variableName, fact.get());
170 Set(currentLevel, variableName, data);
172 else if (variableType.find(
"Operator") != npos) {
173 RCP<Operator> data = currentLevel.
Get<RCP<Operator> >(variableName, fact.get());
174 Set(currentLevel, variableName, data);
178 TEUCHOS_TEST_FOR_EXCEPTION(
true,
MueLu::Exceptions::RuntimeError,
"FineLevelInputDataFactory: cannot detect type of variable " << variableName <<
" generated by " << fact.get() <<
". User provided type " << variableType );