MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_Facade_Simple_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // MueLu: A package for multigrid based preconditioning
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 // Tobias Wiesner (tawiesn@sandia.gov)
43 //
44 // ***********************************************************************
45 //
46 // @HEADER
47 #ifndef PACKAGES_MUELU_SRC_INTERFACE_FACADECLASSES_Simple_DEF_HPP_
48 #define PACKAGES_MUELU_SRC_INTERFACE_FACADECLASSES_Simple_DEF_HPP_
49 
52 
53 
54 #include "MueLu_Exceptions.hpp"
55 
57 
58 namespace MueLu {
59 
60  template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
62  }
63 
64 
65  template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
67 
68  // obtain ParameterList with default input parameters for this facade class
69  // Note all parameters are of type string (we use it for string replacement)
70  std::string defaultString =
71 "<ParameterList name=\"Input\">"
72 "<Parameter name=\"MueLu preconditioner\" type=\"string\" value=\"undefined\"/>"
73 "<Parameter name=\"Block 1: dofs per node\" type=\"int\" value=\"1\"/>"
74  "<Parameter name=\"Block 2: dofs per node\" type=\"int\" value=\"1\"/>"
75  "<Parameter name=\"Block 1: smoother\" type=\"string\" value=\"Symmetric Gauss-Seidel\"/>"
76  "<Parameter name=\"Block 1: level-of-fill\" type=\"int\" value=\"0\"/>"
77  "<Parameter name=\"Block 1: relaxation: sweeps\" type=\"int\" value=\"1\"/>"
78  "<Parameter name=\"Block 1: relaxation: damping factor\" type=\"double\" value=\"1.0\"/>"
79  "<Parameter name=\"Block 1: transfer smoothing\" type=\"bool\" value=\"true\"/>"
80  "<Parameter name=\"Block 2: smoother\" type=\"string\" value=\"Symmetric Gauss-Seidel\"/>"
81  "<Parameter name=\"Block 2: level-of-fill\" type=\"int\" value=\"0\"/>"
82  "<Parameter name=\"Block 2: relaxation: sweeps\" type=\"int\" value=\"1\"/>"
83  "<Parameter name=\"Block 2: relaxation: damping factor\" type=\"double\" value=\"1.0\"/>"
84  "<Parameter name=\"Block 2: transfer smoothing\" type=\"bool\" value=\"true\"/>"
85  "<Parameter name=\"Simple: damping factor\" type=\"double\" value=\"1.0\"/>"
86  "<Parameter name=\"max levels\" type=\"int\" value=\"5\"/>"
87  "<Parameter name=\"coarse: max size\" type=\"int\" value=\"25000\"/>"
88  "<Parameter name=\"verbosity\" type=\"string\" value=\"High\"/>"
89  "</ParameterList>"
90 ;
91  Teuchos::RCP<ParameterList> defaultList = Teuchos::getParametersFromXmlString(defaultString);
92  // validate user input parameters (and set defaults if necessary)
93  Teuchos::ParameterList inputParameters = paramList;
94  inputParameters.validateParametersAndSetDefaults(*defaultList);
95  TEUCHOS_TEST_FOR_EXCEPTION(inputParameters.get<std::string>("MueLu preconditioner") == "undefined", MueLu::Exceptions::RuntimeError, "FacadeSimple: undefined MueLu preconditioner. Set the \"MueLu preconditioner\" parameter correctly in your input file.");
96 
97  // create copy of template string which is updated with in-place string replacements
98  // template string for preconditioner layout (factory based parameters)
99  std::string finalString =
100 
101 "<ParameterList name=\"MueLu\">"
102 " <ParameterList name=\"Factories\">"
103 " <ParameterList name=\"mySubBlockAFactory1\">"
104 " <Parameter name=\"factory\" type=\"string\" value=\"SubBlockAFactory\"/>"
105 " <Parameter name=\"block row\" type=\"int\" value=\"0\"/>"
106 " <Parameter name=\"block col\" type=\"int\" value=\"0\"/>"
107 " <Parameter name=\"Range map: Striding info\" type=\"string\" value=\"{ XXXBlock 1: dofs per nodeYYY }\"/>"
108 " <Parameter name=\"Domain map: Striding info\" type=\"string\" value=\"{ XXXBlock 1: dofs per nodeYYY }\"/>"
109 " </ParameterList>"
110 ""
111 " <ParameterList name=\"myAggFact1\">"
112 " <Parameter name=\"factory\" type=\"string\" value=\"UncoupledAggregationFactory\"/>"
113 " <Parameter name=\"aggregation: min agg size\" type=\"int\" value=\"5\"/>"
114 " <Parameter name=\"aggregation: max selected neighbors\" type=\"int\" value=\"1\"/>"
115 " </ParameterList>"
116 ""
117 " <!-- tell the tentative prolongator that we have 2 DOFs per node on the coarse levels -->"
118 " <ParameterList name=\"myCoarseMap1\">"
119 " <Parameter name=\"factory\" type=\"string\" value=\"CoarseMapFactory\"/>"
120 " <Parameter name=\"Striding info\" type=\"string\" value=\"{ XXXBlock 1: dofs per nodeYYY }\"/>"
121 " <Parameter name=\"Strided block id\" type=\"int\" value=\"-1\"/>"
122 " </ParameterList>"
123 ""
124 " <ParameterList name=\"myTentativePFact1\">"
125 " <Parameter name=\"factory\" type=\"string\" value=\"TentativePFactory\"/>"
126 " <Parameter name=\"A\" type=\"string\" value=\"mySubBlockAFactory1\"/>"
127 " <Parameter name=\"Aggregates\" type=\"string\" value=\"myAggFact1\"/>"
128 " <Parameter name=\"CoarseMap\" type=\"string\" value=\"myCoarseMap1\"/>"
129 " </ParameterList>"
130 ""
131 " <ParameterList name=\"myPFact1\">"
132 " <Parameter name=\"factory\" type=\"string\" value=\"PgPFactory\"/>"
133 " <Parameter name=\"A\" type=\"string\" value=\"mySubBlockAFactory1\"/>"
134 " <Parameter name=\"P\" type=\"string\" value=\"myTentativePFact1\"/>"
135 " </ParameterList>"
136 ""
137 " <ParameterList name=\"myRFact1\">"
138 " <Parameter name=\"factory\" type=\"string\" value=\"GenericRFactory\"/>"
139 " <Parameter name=\"P\" type=\"string\" value=\"myPFact1\"/>"
140 " </ParameterList>"
141 ""
142 " <!-- We have to use Nullspace1 here. If \"Nullspace1\" is not set the"
143 " Factory creates the default null space containing of constant"
144 " vectors -->"
145 " <ParameterList name=\"myNspFact1\">"
146 " <Parameter name=\"factory\" type=\"string\" value=\"NullspaceFactory\"/>"
147 " <Parameter name=\"Fine level nullspace\" type=\"string\" value=\"Nullspace1\"/>"
148 " <Parameter name=\"Nullspace1\" type=\"string\" value=\"myTentativePFact1\"/>"
149 " </ParameterList>"
150 ""
151 " <!-- BLOCK 2 (for submatrix A_{11}) PRESSURE PART -->"
152 " <ParameterList name=\"mySubBlockAFactory2\">"
153 " <Parameter name=\"factory\" type=\"string\" value=\"SubBlockAFactory\"/>"
154 " <Parameter name=\"block row\" type=\"int\" value=\"1\"/>"
155 " <Parameter name=\"block col\" type=\"int\" value=\"1\"/>"
156 " <Parameter name=\"Range map: Striding info\" type=\"string\" value=\"{ XXXBlock 2: dofs per nodeYYY }\"/>"
157 " <Parameter name=\"Domain map: Striding info\" type=\"string\" value=\"{ XXXBlock 2: dofs per nodeYYY }\"/>"
158 " </ParameterList>"
159 ""
160 " <!-- tell the tentative prolongator that we have 2 DOFs per node on the coarse levels -->"
161 " <ParameterList name=\"myCoarseMap2\">"
162 " <Parameter name=\"factory\" type=\"string\" value=\"CoarseMapFactory\"/>"
163 " <Parameter name=\"Striding info\" type=\"string\" value=\"{ XXXBlock 2: dofs per nodeYYY }\"/>"
164 " <Parameter name=\"Strided block id\" type=\"int\" value=\"-1\"/>"
165 " </ParameterList>"
166 ""
167 " <ParameterList name=\"myTentativePFact2\">"
168 " <Parameter name=\"factory\" type=\"string\" value=\"TentativePFactory\"/>"
169 " <Parameter name=\"A\" type=\"string\" value=\"mySubBlockAFactory2\"/>"
170 " <Parameter name=\"Aggregates\" type=\"string\" value=\"myAggFact1\"/>"
171 " <Parameter name=\"CoarseMap\" type=\"string\" value=\"myCoarseMap2\"/>"
172 " </ParameterList>"
173 ""
174 " <ParameterList name=\"myPFact2\">"
175 " <Parameter name=\"factory\" type=\"string\" value=\"SaPFactory\"/>"
176 " <Parameter name=\"A\" type=\"string\" value=\"mySubBlockAFactory2\"/>"
177 " <Parameter name=\"P\" type=\"string\" value=\"myTentativePFact2\"/>"
178 " </ParameterList>"
179 ""
180 " <ParameterList name=\"myRFact2\">"
181 " <Parameter name=\"factory\" type=\"string\" value=\"TransPFactory\"/>"
182 " <Parameter name=\"P\" type=\"string\" value=\"myPFact2\"/>"
183 " </ParameterList>"
184 ""
185 " <ParameterList name=\"myNspFact2\">"
186 " <Parameter name=\"factory\" type=\"string\" value=\"NullspaceFactory\"/>"
187 " <Parameter name=\"Fine level nullspace\" type=\"string\" value=\"Nullspace2\"/>"
188 " <Parameter name=\"Nullspace2\" type=\"string\" value=\"myTentativePFact2\"/>"
189 " </ParameterList>"
190 ""
191 " <!-- FACTORY MANAGERS -->"
192 ""
193 " <!-- Multigrid setup for velocity block (A_{00}) -->"
194 " <ParameterList name=\"myFirstGroup\">"
195 " <Parameter name=\"group\" type=\"string\" value=\"FactoryManager\"/>"
196 " <Parameter name=\"A\" type=\"string\" value=\"mySubBlockAFactory1\"/>"
197 " <Parameter name=\"P\" type=\"string\" value=\"myPFact1\"/>"
198 " <Parameter name=\"R\" type=\"string\" value=\"myRFact1\"/>"
199 " <Parameter name=\"Aggregates\" type=\"string\" value=\"myAggFact1\"/>"
200 " <Parameter name=\"Nullspace\" type=\"string\" value=\"myNspFact1\"/>"
201 " <Parameter name=\"CoarseMap\" type=\"string\" value=\"myCoarseMap1\"/>"
202 " </ParameterList>"
203 ""
204 " <!-- Multigrid setup for pressure block (A_{11}) -->"
205 " <ParameterList name=\"mySecondGroup\">"
206 " <Parameter name=\"group\" type=\"string\" value=\"FactoryManager\"/>"
207 " <Parameter name=\"A\" type=\"string\" value=\"mySubBlockAFactory2\"/>"
208 " <Parameter name=\"P\" type=\"string\" value=\"myPFact2\"/>"
209 " <Parameter name=\"R\" type=\"string\" value=\"myRFact2\"/>"
210 " <Parameter name=\"Aggregates\" type=\"string\" value=\"myAggFact1\"/><!-- reuse aggs from PRESSURE block! -->"
211 " <Parameter name=\"Nullspace\" type=\"string\" value=\"myNspFact2\"/>"
212 " <Parameter name=\"CoarseMap\" type=\"string\" value=\"myCoarseMap2\"/>"
213 " </ParameterList>"
214 ""
215 " <!-- BLOCK TRANSFER operators -->"
216 ""
217 " <ParameterList name=\"myBlockedPFact\">"
218 " <Parameter name=\"factory\" type=\"string\" value=\"BlockedPFactory\"/>"
219 " <!-- factory manager for block 1 -->"
220 " <ParameterList name=\"block1\">"
221 " <Parameter name=\"group\" type=\"string\" value=\"myFirstGroup\"/>"
222 " </ParameterList>"
223 " <!-- factory manager for block 2 -->"
224 " <ParameterList name=\"block2\">"
225 " <Parameter name=\"group\" type=\"string\" value=\"mySecondGroup\"/>"
226 " </ParameterList>"
227 " </ParameterList>"
228 ""
229 " <ParameterList name=\"myBlockedRFact\">"
230 " <Parameter name=\"factory\" type=\"string\" value=\"GenericRFactory\"/>"
231 " <Parameter name=\"P\" type=\"string\" value=\"myBlockedPFact\"/>"
232 " </ParameterList>"
233 ""
234 " <ParameterList name=\"myBlockedRAPFact\">"
235 " <Parameter name=\"factory\" type=\"string\" value=\"BlockedRAPFactory\"/>"
236 " <Parameter name=\"P\" type=\"string\" value=\"myBlockedPFact\"/>"
237 " <Parameter name=\"R\" type=\"string\" value=\"myBlockedRFact\"/>"
238 " </ParameterList>"
239 ""
240 " <!-- BLOCK SMOOTHERS -->"
241 " <ParameterList name=\"mySmooFact1\">"
242 " <Parameter name=\"factory\" type=\"string\" value=\"TrilinosSmoother\"/>"
243 " <Parameter name=\"type\" type=\"string\" value=\"RELAXATION\"/>"
244 " <ParameterList name=\"ParameterList\">"
245 " <Parameter name=\"relaxation: type\" type=\"string\" value=\"XXXBlock 1: relaxation: typeYYY\"/>"
246 " <Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"XXXBlock 1: relaxation: sweepsYYY\"/>"
247 " <Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"XXXBlock 1: relaxation: damping factorYYY\"/>"
248 " </ParameterList>"
249 " </ParameterList>"
250 ""
251 " <ParameterList name=\"mySmooILUFact1\">"
252 " <Parameter name=\"factory\" type=\"string\" value=\"TrilinosSmoother\"/>"
253 " <Parameter name=\"type\" type=\"string\" value=\"ILU\"/>"
254 " <ParameterList name=\"ParameterList\">"
255 " <Parameter name=\"fact: level-of-fill\" type=\"int\" value=\"XXXBlock 1: level-of-fillYYY\"/>"
256 " </ParameterList>"
257 " </ParameterList>"
258 ""
259 " <ParameterList name=\"mySmooDirectFact1\">"
260 " <Parameter name=\"factory\" type=\"string\" value=\"DirectSolver\"/>"
261 " </ParameterList>"
262 ""
263 " <ParameterList name=\"mySmooFact2\">"
264 " <Parameter name=\"factory\" type=\"string\" value=\"TrilinosSmoother\"/>"
265 " <Parameter name=\"type\" type=\"string\" value=\"RELAXATION\"/>"
266 " <ParameterList name=\"ParameterList\">"
267 " <Parameter name=\"relaxation: type\" type=\"string\" value=\"XXXBlock 2: relaxation: typeYYY\"/>"
268 " <Parameter name=\"relaxation: sweeps\" type=\"int\" value=\"XXXBlock 2: relaxation: sweepsYYY\"/>"
269 " <Parameter name=\"relaxation: damping factor\" type=\"double\" value=\"XXXBlock 2: relaxation: damping factorYYY\"/>"
270 " </ParameterList>"
271 " </ParameterList>"
272 ""
273 " <ParameterList name=\"mySmooILUFact2\">"
274 " <Parameter name=\"factory\" type=\"string\" value=\"TrilinosSmoother\"/>"
275 " <Parameter name=\"type\" type=\"string\" value=\"ILU\"/>"
276 " <ParameterList name=\"ParameterList\">"
277 " <Parameter name=\"fact: level-of-fill\" type=\"int\" value=\"XXXBlock 2: level-of-fillYYY\"/>"
278 " </ParameterList>"
279 " </ParameterList>"
280 ""
281 " <ParameterList name=\"mySmooDirectFact2\">"
282 " <Parameter name=\"factory\" type=\"string\" value=\"DirectSolver\"/>"
283 " </ParameterList>"
284 ""
285 " <ParameterList name=\"myNSSchurCompFact\">"
286 " <Parameter name=\"factory\" type=\"string\" value=\"SchurComplementFactory\"/>"
287 " <Parameter name=\"omega\" type=\"double\" value=\"1.0\"/>"
288 " <Parameter name=\"lumping\" type=\"bool\" value=\"false\"/>"
289 " </ParameterList>"
290 ""
291 " <ParameterList name=\"myBlockSmoother\">"
292 " <Parameter name=\"factory\" type=\"string\" value=\"SimpleSmoother\"/>"
293 " <Parameter name=\"Sweeps\" type=\"int\" value=\"1\"/>"
294 " <Parameter name=\"Damping factor\" type=\"double\" value=\"XXXSimple: damping factorYYY\"/>"
295 " <!-- factory manager for block 1 -->"
296 " <ParameterList name=\"block1\">"
297 " <Parameter name=\"A\" type=\"string\" value=\"mySubBlockAFactory1\"/>"
298 " <Parameter name=\"Smoother\" type=\"string\" value=\"XYZSmoother1XYZ\"/>"
299 " </ParameterList>"
300 " <!-- factory manager for block 2 -->"
301 " <ParameterList name=\"block2\">"
302 " <Parameter name=\"A\" type=\"string\" value=\"myNSSchurCompFact\"/>"
303 " <Parameter name=\"Smoother\" type=\"string\" value=\"XYZSmoother2XYZ\"/>"
304 " </ParameterList>"
305 " </ParameterList>"
306 ""
307 " </ParameterList>"
308 " <!-- end Factories -->"
309 ""
310 " <!-- Definition of the multigrid preconditioner -->"
311 " <ParameterList name=\"Hierarchy\">"
312 ""
313 " <Parameter name=\"max levels\" type=\"int\" value=\"XXXmax levelsYYY\"/>"
314 " <Parameter name=\"coarse: max size\" type=\"int\" value=\"XXXcoarse: max sizeYYY\"/>"
315 " <Parameter name=\"verbosity\" type=\"string\" value=\"XXXverbosityYYY\"/>"
316 ""
317 " <ParameterList name=\"AllLevel\">"
318 " <Parameter name=\"startLevel\" type=\"int\" value=\"0\"/>"
319 " <Parameter name=\"Smoother\" type=\"string\" value=\"myBlockSmoother\"/>"
320 " <Parameter name=\"CoarseSolver\" type=\"string\" value=\"myBlockSmoother\"/>"
321 " <Parameter name=\"P\" type=\"string\" value=\"myBlockedPFact\"/>"
322 " <Parameter name=\"R\" type=\"string\" value=\"myBlockedRFact\"/>"
323 " <Parameter name=\"A\" type=\"string\" value=\"myBlockedRAPFact\"/>"
324 " </ParameterList>"
325 ""
326 " </ParameterList>"
327 "</ParameterList>"
328  ;
329 
330  // logical code for more complicated distinctions
331 
332 
333  std::string smoother1 = inputParameters.get<std::string>("Block 1: smoother");
334  if(smoother1 == "ILU") {
335  this->ReplaceString(finalString, "XYZSmoother1XYZ", "mySmooILUFact1");
336  } else if (smoother1 == "Symmetric Gauss-Seidel" || smoother1 == "SGS") {
337  this->ReplaceString(finalString, "XXXBlock 1: relaxation: typeYYY", "Symmetric Gauss-Seidel");
338  this->ReplaceString(finalString, "XYZSmoother1XYZ", "mySmooFact1");
339  } else if (smoother1 == "Symmetric Gauss-Seidel" || smoother1 == "GS") {
340  this->ReplaceString(finalString, "XXXBlock 1: relaxation: typeYYY", "Gauss-Seidel");
341  this->ReplaceString(finalString, "XYZSmoother1XYZ", "mySmooFact1");
342  } else if (smoother1 == "Jacobi") {
343  this->ReplaceString(finalString, "XXXBlock 1: relaxation: typeYYY", "Jacobi");
344  this->ReplaceString(finalString, "XYZSmoother1XYZ", "mySmooFact1");
345  } else if (smoother1 == "Direct") {
346  this->ReplaceString(finalString, "XYZSmoother1XYZ", "mySmooDirectFact1");
347  } else {
348  this->GetOStream(Errors) << "Invalid smoother type for block 1: " << smoother1 << ". Valid options are: \"SGS\", \"GS\", \"Jacobi\", \"ILU\" or \"Direct\"." << std::endl;
349  }
350 
351  std::string smoother2 = inputParameters.get<std::string>("Block 2: smoother");
352  if(smoother2 == "ILU") {
353  this->ReplaceString(finalString, "XYZSmoother2XYZ", "mySmooILUFact2");
354  } else if (smoother2 == "Symmetric Gauss-Seidel" || smoother2 == "SGS") {
355  this->ReplaceString(finalString, "XXXBlock 2: relaxation: typeYYY", "Symmetric Gauss-Seidel");
356  this->ReplaceString(finalString, "XYZSmoother2XYZ", "mySmooFact2");
357  } else if (smoother2 == "Symmetric Gauss-Seidel" || smoother2 == "GS") {
358  this->ReplaceString(finalString, "XXXBlock 2: relaxation: typeYYY", "Gauss-Seidel");
359  this->ReplaceString(finalString, "XYZSmoother2XYZ", "mySmooFact2");
360  } else if (smoother2 == "Jacobi") {
361  this->ReplaceString(finalString, "XXXBlock 2: relaxation: typeYYY", "Jacobi");
362  this->ReplaceString(finalString, "XYZSmoother2XYZ", "mySmooFact2");
363  } else if (smoother2 == "Direct") {
364  this->ReplaceString(finalString, "XYZSmoother2XYZ", "mySmooDirectFact2");
365  } else {
366  this->GetOStream(Errors) << "Invalid smoother type for block 2: " << smoother2 << ". Valid options are: \"SGS\", \"GS\", \"Jacobi\", \"ILU\" or \"Direct\"." << std::endl;
367  }
368 
369  if(inputParameters.get<bool>("Block 1: transfer smoothing") == true) {
370  this->ReplaceString(finalString, "XXXBlock 1: prolongatorYYY", "myPFact1");
371  this->ReplaceString(finalString, "XXXBlock 1: restrictor YYY", "myRFact1");
372  } else {
373  this->ReplaceString(finalString, "XXXBlock 1: prolongatorYYY", "myTentativePFact1");
374  this->ReplaceString(finalString, "XXXBlock 1: restrictor YYY", "myTransPFact1");
375  }
376  if(inputParameters.get<bool>("Block 2: transfer smoothing") == true) {
377  this->ReplaceString(finalString, "XXXBlock 2: prolongatorYYY", "myPFact2");
378  this->ReplaceString(finalString, "XXXBlock 2: restrictor YYY", "myRFact2");
379  } else {
380  this->ReplaceString(finalString, "XXXBlock 2: prolongatorYYY", "myTentativePFact2");
381  this->ReplaceString(finalString, "XXXBlock 2: restrictor YYY", "myTransPFact2");
382  }
383 
384  // end logical code
385 
386  // loop over all input parameters
387  for(Teuchos::ParameterList::ConstIterator it = inputParameters.begin(); it != inputParameters.end(); it++) {
388  // form replacement string
389  std::string par_name = inputParameters.name(it);
390  std::stringstream ss;
391  ss << "XXX" << par_name << "YYY";
392 
393  // update final string with parameters
394  Teuchos::ParameterEntry par_entry = inputParameters.entry(it);
395  this->ReplaceString(finalString,
396  ss.str(), Teuchos::toString(par_entry.getAny()));
397  }
398 
399  Teuchos::RCP<ParameterList> ret = Teuchos::getParametersFromXmlString(finalString);
400  return ret;
401  }
402 
403 } // end namespace MueLu
404 #endif // PACKAGES_MUELU_SRC_INTERFACE_FACADECLASSES_Simple_DEF_HPP_
Teuchos::RCP< Teuchos::ParameterList > SetParameterList(const Teuchos::ParameterList &paramList)
Set parameter list for FacadeClass interpreter.
const std::string & name() const
ConstIterator end() const
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
params_t::ConstIterator ConstIterator
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
ConstIterator begin() const
const ParameterEntry & entry(ConstIterator i) const
any & getAny(bool activeQry=true)
Exception throws to report errors in the internal logical of the program.
std::string toString(const T &t)