Teko Version of the Day
Loading...
Searching...
No Matches
Teko_InverseLibrary.cpp
1/*
2// @HEADER
3//
4// ***********************************************************************
5//
6// Teko: A package for block and physics based preconditioning
7// Copyright 2010 Sandia Corporation
8//
9// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
10// the U.S. Government retains certain rights in this software.
11//
12// Redistribution and use in source and binary forms, with or without
13// modification, are permitted provided that the following conditions are
14// met:
15//
16// 1. Redistributions of source code must retain the above copyright
17// notice, this list of conditions and the following disclaimer.
18//
19// 2. Redistributions in binary form must reproduce the above copyright
20// notice, this list of conditions and the following disclaimer in the
21// documentation and/or other materials provided with the distribution.
22//
23// 3. Neither the name of the Corporation nor the names of the
24// contributors may be used to endorse or promote products derived from
25// this software without specific prior written permission.
26//
27// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
28// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
31// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38//
39// Questions? Contact Eric C. Cyr (eccyr@sandia.gov)
40//
41// ***********************************************************************
42//
43// @HEADER
44
45*/
46
47#include "Teko_InverseLibrary.hpp"
48
49#include "Teko_SolveInverseFactory.hpp"
50#include "Teko_PreconditionerInverseFactory.hpp"
51#include "Teko_BlockPreconditionerFactory.hpp"
52
53#include "Teko_NeumannSeriesPreconditionerFactory.hpp"
54#include "Teuchos_AbstractFactoryStd.hpp"
55#include "Teko_Utilities.hpp"
56
57#include <algorithm>
58
59using Teuchos::RCP;
60using Teuchos::rcp;
61
62namespace Teko {
63
67void addToStratimikosBuilder(const RCP<Stratimikos::DefaultLinearSolverBuilder> & builder)
68{
69 typedef Thyra::PreconditionerFactoryBase<double> PrecFactory;
70
71 RCP<const Teuchos::ParameterList> parameters = builder->getValidParameters();
72
73 if(!parameters->sublist("Preconditioner Types").isSublist("Neumann Series")) {
74 RCP<const Teuchos::AbstractFactory<Thyra::PreconditionerFactoryBase<double> > > factory;
75
76 factory = Teuchos::abstractFactoryStd<PrecFactory,Teko::NeumannSeriesPreconditionerFactory<double> >();
77 builder->setPreconditioningStrategyFactory(factory,"Neumann Series");
78 }
79
80}
81
82InverseLibrary::InverseLibrary()
83{
84 Teko_DEBUG_SCOPE("InverseLibrary::InverseLibrary", 10);
85
86 defaultBuilder_ = Teuchos::rcp(new Stratimikos::DefaultLinearSolverBuilder());
87 addToStratimikosBuilder(defaultBuilder_);
88
89 // setup some valid Stratimikos parameters
91
92 // set valid solve factory names
93 stratValidSolver_.push_back("Belos");
94 stratValidSolver_.push_back("Amesos");
95 stratValidSolver_.push_back("Amesos2");
96 stratValidSolver_.push_back("AztecOO");
97
98 // set valid preconditioner factory name
99 stratValidPrecond_.push_back("ML");
100 stratValidPrecond_.push_back("Ifpack");
101 stratValidPrecond_.push_back("Neumann Series");
102 stratValidPrecond_.push_back("MueLu");
103 stratValidPrecond_.push_back("Ifpack2");
104
105 // set valid Teko preconditioner factory names
107
108 Teko_DEBUG_MSG_BEGIN(10)
109 DEBUG_STREAM << "Loaded \"block\" preconditioners = ";
110 for(std::size_t i=0;i<blockValidPrecond_.size();i++)
111 DEBUG_STREAM << blockValidPrecond_[i] << ", ";
112 DEBUG_STREAM << std::endl;
113 Teko_DEBUG_MSG_END()
114}
115
116InverseLibrary::InverseLibrary(const Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder> & strat)
117 : defaultBuilder_(strat)
118{
119 Teko_DEBUG_SCOPE("InverseLibrary::InverseLibrary", 10);
120
121 RCP<Teuchos::ParameterList> pl = rcp(new Teuchos::ParameterList(*defaultBuilder_->getValidParameters()));
122 Teuchos::ParameterList lst(pl->sublist("Linear Solver Types"));
123 Teuchos::ParameterList pft(pl->sublist("Preconditioner Types"));
124
125 Teuchos::ParameterList::ConstIterator itr;
126
127 // set valid solve factory names
128 for(itr=lst.begin();itr!=lst.end();++itr)
129 stratValidSolver_.push_back(itr->first);
130
131 Teko_DEBUG_MSG_BEGIN(10)
132 DEBUG_STREAM << "Loaded \"Stratimikos\" solvers = ";
133 for(std::size_t i=0;i<stratValidSolver_.size();i++)
134 DEBUG_STREAM << stratValidSolver_[i] << ", ";
135 DEBUG_STREAM << std::endl;
136 Teko_DEBUG_MSG_END()
137
138 // set valid prec factory names
139 for(itr=pft.begin();itr!=pft.end();++itr)
140 stratValidPrecond_.push_back(itr->first);
141
142 Teko_DEBUG_MSG_BEGIN(10)
143 DEBUG_STREAM << "Loaded \"Stratimikos\" preconditioners = ";
144 for(std::size_t i=0;i<stratValidPrecond_.size();i++)
145 DEBUG_STREAM << stratValidPrecond_[i] << ", ";
146 DEBUG_STREAM << std::endl;
147 Teko_DEBUG_MSG_END()
148
149 // set valid Teko preconditioner factory names
150 PreconditionerFactory::getPreconditionerFactoryNames(blockValidPrecond_);
151
152 Teko_DEBUG_MSG_BEGIN(10)
153 DEBUG_STREAM << "Loaded \"block\" preconditioners = ";
154 for(std::size_t i=0;i<blockValidPrecond_.size();i++)
155 DEBUG_STREAM << blockValidPrecond_[i] << ", ";
156 DEBUG_STREAM << std::endl;
157 Teko_DEBUG_MSG_END()
158}
159
161void InverseLibrary::addInverse(const std::string & label,const Teuchos::ParameterList & pl)
162{
163 // strip out the label
164 const std::string type = pl.get<std::string>("Type");
165
166 // copy the parameter list so we can modify it
167 Teuchos::ParameterList settingsList;
168 settingsList.set(type,pl);
169 settingsList.sublist(type).remove("Type");
170
171 // is this a Stratimikos preconditioner or solver
172 if(std::find(stratValidPrecond_.begin(),stratValidPrecond_.end(),type)!=stratValidPrecond_.end()) {
173 // this is a Stratimikos preconditioner factory
174 addStratPrecond(label,type,settingsList);
175 }
176 else if(std::find(stratValidSolver_.begin(),stratValidSolver_.end(),type)!=stratValidSolver_.end()) {
177 // this is a Stratimikos preconditioner factory
178 addStratSolver(label,type,settingsList);
179 }
180 else if(std::find(blockValidPrecond_.begin(),blockValidPrecond_.end(),type)!=blockValidPrecond_.end()) {
181 // this is a Teko preconditioner factory
182 addBlockPrecond(label,type,settingsList);
183 }
184 else {
185 Teuchos::FancyOStream & os = *Teko::getOutputStream();
186 os << "ERROR: Could not find inverse type \"" << type
187 << "\" required by inverse name \"" << label << "\"" << std::endl;
188 TEUCHOS_ASSERT(false);
189 }
190}
191
193void InverseLibrary::addStratSolver(const std::string & label,const std::string & type,const Teuchos::ParameterList & pl)
194{
195 // add some additional parameters onto the list
196 RCP<Teuchos::ParameterList> stratList = rcp(new Teuchos::ParameterList());
197 stratList->set("Linear Solver Type",type);
198 stratList->set("Linear Solver Types",pl);
199 stratList->set("Preconditioner Type","None");
200
201 stratSolver_[label] = stratList;
202}
203
205void InverseLibrary::addStratPrecond(const std::string & label,const std::string & type,const Teuchos::ParameterList & pl)
206{
207 // add some additional parameters onto the list
208 RCP<Teuchos::ParameterList> stratList = rcp(new Teuchos::ParameterList());
209 stratList->set("Preconditioner Type",type);
210 stratList->set("Preconditioner Types",pl);
211
212 stratPrecond_[label] = stratList;
213}
214
216void InverseLibrary::addBlockPrecond(const std::string & label,const std::string & type,const Teuchos::ParameterList & pl)
217{
218 // add some additional parameters onto the list
219 RCP<Teuchos::ParameterList> blockList = rcp(new Teuchos::ParameterList());
220 blockList->set("Preconditioner Type",type);
221 blockList->set("Preconditioner Settings",pl.sublist(type));
222
223 // add the Teko preconditioner parameter list into the library
224 blockPrecond_[label] = blockList;
225}
226
234Teuchos::RCP<const Teuchos::ParameterList> InverseLibrary::getParameterList(const std::string & label) const
235{
236 std::map<std::string,RCP<const Teuchos::ParameterList> >::const_iterator itr;
237
238 // check preconditioners
239 itr = stratPrecond_.find(label);
240 if(itr!=stratPrecond_.end()) return itr->second;
241
242 // check solvers
243 itr = stratSolver_.find(label);
244 if(itr!=stratSolver_.end()) return itr->second;
245
246 // check solvers
247 itr = blockPrecond_.find(label);
248 if(itr!=blockPrecond_.end()) return itr->second;
249
250 return Teuchos::null;
251}
252
254Teuchos::RCP<InverseFactory> InverseLibrary::getInverseFactory(const std::string & label) const
255{
256 Teko_DEBUG_SCOPE("InverseLibrary::getInverseFactory",10);
257
258 std::map<std::string,RCP<const Teuchos::ParameterList> >::const_iterator itr;
259
260 bool isStratSolver=false,isStratPrecond=false,isBlockPrecond=false;
261
262 // is this a Stratimikos solver?
263 itr = stratPrecond_.find(label);
264 isStratPrecond = itr!=stratPrecond_.end();
265
266 // is this a Stratimikos preconditioner?
267 if(not isStratPrecond) {
268 itr = stratSolver_.find(label);
269 isStratSolver = itr!=stratSolver_.end();
270 }
271
272 // must be a "block" preconditioner
273 if(not (isStratSolver || isStratPrecond)) {
274 itr = blockPrecond_.find(label);
275 isBlockPrecond = itr!=blockPrecond_.end();
276 }
277
278 Teko_DEBUG_MSG("Inverse \"" << label << "\" is of type "
279 << "strat prec = " << isStratPrecond << ", "
280 << "strat solv = " << isStratSolver << ", "
281 << "block prec = " << isBlockPrecond,3);
282
283 // Must be one of Strat solver, strat preconditioner, block preconditioner
284 if(not (isStratSolver || isStratPrecond || isBlockPrecond)) {
285 RCP<Teuchos::FancyOStream> out = Teuchos::VerboseObjectBase::getDefaultOStream();
286
287 *out << "InverseLibrary::getInverseFactory could not find \"" << label << "\" ... aborting\n";
288 *out << "Choose one of: " << std::endl;
289
290 *out << " Stratimikos preconditioners = ";
291 for(itr=stratPrecond_.begin();itr!=stratPrecond_.end();++itr)
292 *out << " \"" << itr->first << "\"\n";
293 *out << std::endl;
294
295 *out << " Stratimikos solvers = ";
296 for(itr=stratSolver_.begin();itr!=stratSolver_.end();++itr)
297 *out << " \"" << itr->first << "\"\n";
298 *out << std::endl;
299
300 *out << " Block preconditioners = ";
301 for(itr=blockPrecond_.begin();itr!=blockPrecond_.end();++itr)
302 *out << " \"" << itr->first << "\"\n";
303 *out << std::endl;
304
305 TEUCHOS_ASSERT(isStratSolver || isStratPrecond || isBlockPrecond);
306 }
307
308 RCP<const Teuchos::ParameterList> pl = itr->second;
309
310 // build inverse factory
311 if(isStratPrecond) {
312 // remove required parameters
313 RCP<Teuchos::ParameterList> plCopy = rcp(new Teuchos::ParameterList(*pl));
314 std::string type = plCopy->get<std::string>("Preconditioner Type");
315 RCP<Teuchos::ParameterList> xtraParams;
316 if(plCopy->sublist("Preconditioner Types").sublist(type).isParameter("Required Parameters")) {
317 xtraParams = rcp(new Teuchos::ParameterList(
318 plCopy->sublist("Preconditioner Types").sublist(type).sublist("Required Parameters")));
319 plCopy->sublist("Preconditioner Types").sublist(type).remove("Required Parameters");
320 }
321
322 // print some debuggin info
323 Teko_DEBUG_MSG_BEGIN(10);
324 DEBUG_STREAM << "Printing parameter list: " << std::endl;
325 Teko_DEBUG_PUSHTAB(); plCopy->print(DEBUG_STREAM); Teko_DEBUG_POPTAB();
326
327 if(xtraParams!=Teuchos::null) {
328 DEBUG_STREAM << "Printing extra parameters: " << std::endl;
329 Teko_DEBUG_PUSHTAB(); xtraParams->print(DEBUG_STREAM); Teko_DEBUG_POPTAB();
330 }
331 Teko_DEBUG_MSG_END();
332
333 // Stratimikos::DefaultLinearSolverBuilder strat;
334 // addToStratimikosBuilder(strat);
335 defaultBuilder_->setParameterList(plCopy);
336
337 // try to build a preconditioner factory
338 RCP<Thyra::PreconditionerFactoryBase<double> > precFact = defaultBuilder_->createPreconditioningStrategy(type);
339
340 // string must map to a preconditioner
341 RCP<Teko::PreconditionerInverseFactory> precInvFact
342 = rcp(new PreconditionerInverseFactory(precFact,xtraParams,getRequestHandler()));
343 precInvFact->setupParameterListFromRequestHandler();
344 return precInvFact;
345 }
346 else if(isStratSolver) {
347 RCP<Teuchos::ParameterList> solveList = rcp(new Teuchos::ParameterList(*pl));
348 std::string type = solveList->get<std::string>("Linear Solver Type");
349
350 // get preconditioner name, remove "Use Preconditioner" parameter
351 Teuchos::ParameterList & solveSettings = solveList->sublist("Linear Solver Types").sublist(type);
352 std::string precKeyWord = "Use Preconditioner";
353 std::string precName = "None";
354 if(solveSettings.isParameter(precKeyWord)) {
355 precName = solveSettings.get<std::string>(precKeyWord);
356 solveSettings.remove(precKeyWord);
357 }
358
359 // build Thyra preconditioner factory
360 RCP<Thyra::PreconditionerFactoryBase<double> > precFactory;
361 if(precName!="None") {
362 // we will manually set the preconditioner, so set this to null
363 solveList->set<std::string>("Preconditioner Type","None");
364
365 // build inverse that preconditioner corresponds to
366 RCP<PreconditionerInverseFactory> precInvFactory
367 = Teuchos::rcp_dynamic_cast<PreconditionerInverseFactory>(getInverseFactory(precName));
368
369 // extract preconditioner factory from preconditioner _inverse_ factory
370 precFactory = precInvFactory->getPrecFactory();
371 }
372
373 // Stratimikos::DefaultLinearSolverBuilder strat;
374 // addToStratimikosBuilder(strat);
375 defaultBuilder_->setParameterList(solveList);
376
377 // try to build a solver factory
378 RCP<Thyra::LinearOpWithSolveFactoryBase<double> > solveFact = defaultBuilder_->createLinearSolveStrategy(type);
379 if(precFactory!=Teuchos::null)
380 solveFact->setPreconditionerFactory(precFactory,precName);
381
382 // if its around, build a InverseFactory
383 return rcp(new SolveInverseFactory(solveFact));
384 }
385 else if(isBlockPrecond) {
386 try {
387 std::string type = pl->get<std::string>("Preconditioner Type");
388 const Teuchos::ParameterList & settings = pl->sublist("Preconditioner Settings");
389
390 // build preconditioner factory from the string
391 RCP<PreconditionerFactory> precFact
392 = PreconditionerFactory::buildPreconditionerFactory(type,settings,Teuchos::rcpFromRef(*this));
393
394 TEUCHOS_ASSERT(precFact!=Teuchos::null);
395
396 // return the inverse factory object
397 return rcp(new PreconditionerInverseFactory(precFact,getRequestHandler()));
398 }
399 catch(std::exception & e) {
400 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
401
402 *out << "Teko: \"getInverseFactory\" failed, Parameter List =\n";
403 pl->print(*out);
404
405 *out << "*** THROWN EXCEPTION ***\n";
406 *out << e.what() << std::endl;
407 *out << "************************\n";
408
409 throw e;
410 }
411 }
412
413 TEUCHOS_ASSERT(false);
414}
415
417void InverseLibrary::PrintAvailableInverses(std::ostream & os) const
418{
419 std::map<std::string,Teuchos::RCP<const Teuchos::ParameterList> >::const_iterator itr;
420
421 os << "Stratimikos Solvers: " << std::endl;
422 os << "********************************" << std::endl;
423 for(itr=stratSolver_.begin();itr!=stratSolver_.end();++itr) {
424 os << "name = \"" << itr->first << "\"" << std::endl;
425 itr->second->print(os);
426 os << std::endl;
427 }
428
429 os << "Stratimikos Preconditioners: " << std::endl;
430 os << "********************************" << std::endl;
431 for(itr=stratPrecond_.begin();itr!=stratPrecond_.end();++itr) {
432 os << "name = \"" << itr->first << "\"" << std::endl;
433 itr->second->print(os);
434 os << std::endl;
435 }
436
437 os << "Teko Preconditioners: " << std::endl;
438 os << "********************************" << std::endl;
439 for(itr=blockPrecond_.begin();itr!=blockPrecond_.end();++itr) {
440 os << "name = \"" << itr->first << "\"" << std::endl;
441 itr->second->print(os);
442 os << std::endl;
443 }
444}
445
455RCP<InverseLibrary> InverseLibrary::buildFromParameterList(const Teuchos::ParameterList & pl,bool useStratDefaults)
456{
457 // build from Stratimikos or allocate a new inverse library
458 RCP<InverseLibrary> invLib;
459 if(useStratDefaults)
460 invLib = InverseLibrary::buildFromStratimikos();
461 else
462 invLib = rcp(new InverseLibrary());
463
464 // to convert the void* like entry
465 Teuchos::ParameterList * temp = 0;
466
467 // loop over all entries in parameter list
468 Teuchos::ParameterList::ConstIterator itr;
469 for(itr=pl.begin();itr!=pl.end();++itr) {
470 // get current entry
471 std::string label = itr->first;
472 Teuchos::ParameterList & list = itr->second.getValue(temp);
473
474 // add to library
475 invLib->addInverse(label,list);
476 }
477
478 return invLib;
479}
480
491RCP<InverseLibrary> InverseLibrary::buildFromParameterList(const Teuchos::ParameterList & pl,
492 const Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder> & strat)
493{
494 // if strat is set to null, use the defaults
495 if(strat==Teuchos::null)
496 return buildFromParameterList(pl,true);
497
498 // build from Stratimikos or allocate a new inverse library
499 RCP<InverseLibrary> invLib = InverseLibrary::buildFromStratimikos(strat);
500
501 // to convert the void* like entry
502 Teuchos::ParameterList * temp = 0;
503
504 // loop over all entries in parameter list
505 Teuchos::ParameterList::ConstIterator itr;
506 for(itr=pl.begin();itr!=pl.end();++itr) {
507 // get current entry
508 std::string label = itr->first;
509 Teuchos::ParameterList & list = itr->second.getValue(temp);
510
511 // add to library
512 invLib->addInverse(label,list);
513 }
514
515 return invLib;
516}
517
526Teuchos::RCP<InverseLibrary> InverseLibrary::buildFromStratimikos()
527{
528 RCP<InverseLibrary> invLib = rcp(new InverseLibrary());
529
530 // get default inveres in Stratimikos
531 RCP<Stratimikos::DefaultLinearSolverBuilder> strat = invLib->defaultBuilder_;
532 RCP<Teuchos::ParameterList> pl = rcp(new Teuchos::ParameterList(*strat->getValidParameters()));
533 Teuchos::ParameterList lst(pl->sublist("Linear Solver Types"));
534 Teuchos::ParameterList pft(pl->sublist("Preconditioner Types"));
535
536 Teuchos::ParameterList::ConstIterator itr;
537 Teuchos::ParameterList * temp = 0;
538
539 // loop over all entries in solver list
540 for(itr=lst.begin();itr!=lst.end();++itr) {
541 // get current entry
542 std::string label = itr->first;
543 Teuchos::ParameterList & list = itr->second.getValue(temp);
544 list.set("Type",label);
545
546 // add to library
547 invLib->addInverse(label,list);
548 }
549
550 // loop over all entries in preconditioner list
551 for(itr=pft.begin();itr!=pft.end();++itr) {
552 // get current entry
553 std::string label = itr->first;
554 Teuchos::ParameterList & list = itr->second.getValue(temp);
555 list.set("Type",label);
556
557 // add to library
558 invLib->addInverse(label,list);
559 }
560
561 return invLib;
562}
563
573Teuchos::RCP<InverseLibrary> InverseLibrary::buildFromStratimikos(const Stratimikos::DefaultLinearSolverBuilder & strat)
574{
575 RCP<InverseLibrary> invLib = rcp(new InverseLibrary());
576
577 // get default inveres in Stratimikos
578 RCP<Teuchos::ParameterList> pl = rcp(new Teuchos::ParameterList(*strat.getValidParameters()));
579 Teuchos::ParameterList lst(pl->sublist("Linear Solver Types"));
580 Teuchos::ParameterList pft(pl->sublist("Preconditioner Types"));
581
582 Teuchos::ParameterList::ConstIterator itr;
583 Teuchos::ParameterList * temp = 0;
584
585 // loop over all entries in solver list
586 for(itr=lst.begin();itr!=lst.end();++itr) {
587 // get current entry
588 std::string label = itr->first;
589 Teuchos::ParameterList & list = itr->second.getValue(temp);
590 list.set("Type",label);
591
592 // add to library
593 invLib->addInverse(label,list);
594 }
595
596 // loop over all entries in preconditioner list
597 for(itr=pft.begin();itr!=pft.end();++itr) {
598 // get current entry
599 std::string label = itr->first;
600 Teuchos::ParameterList & list = itr->second.getValue(temp);
601 list.set("Type",label);
602
603 // add to library
604 invLib->addInverse(label,list);
605 }
606
607 return invLib;
608}
609
619Teuchos::RCP<InverseLibrary> InverseLibrary::buildFromStratimikos(const Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder> & strat)
620{
621 RCP<InverseLibrary> invLib = rcp(new InverseLibrary(strat));
622
623 // get default inveres in Stratimikos
624 RCP<Teuchos::ParameterList> pl = rcp(new Teuchos::ParameterList(*strat->getValidParameters()));
625 Teuchos::ParameterList lst(pl->sublist("Linear Solver Types"));
626 Teuchos::ParameterList pft(pl->sublist("Preconditioner Types"));
627
628 Teuchos::ParameterList::ConstIterator itr;
629 Teuchos::ParameterList * temp = 0;
630
631 // loop over all entries in solver list
632 for(itr=lst.begin();itr!=lst.end();++itr) {
633 // get current entry
634 std::string label = itr->first;
635 Teuchos::ParameterList & list = itr->second.getValue(temp);
636 list.set("Type",label);
637
638 // add to library
639 invLib->addInverse(label,list);
640 }
641
642 // loop over all entries in preconditioner list
643 for(itr=pft.begin();itr!=pft.end();++itr) {
644 // get current entry
645 std::string label = itr->first;
646 Teuchos::ParameterList & list = itr->second.getValue(temp);
647 list.set("Type",label);
648
649 // add to library
650 invLib->addInverse(label,list);
651 }
652
653 return invLib;
654}
655
656} // end namespace Teko
static Teuchos::RCP< PreconditionerFactory > buildPreconditionerFactory(const std::string &name, const Teuchos::ParameterList &settings, const Teuchos::RCP< const InverseLibrary > &invLib=Teuchos::null)
Builder function for creating preconditioner factories (yes this is a factory factory).
static void getPreconditionerFactoryNames(std::vector< std::string > &names)
Get the names of the block preconditioner factories.
virtual Teuchos::RCP< RequestHandler > getRequestHandler() const =0
Get the request handler with pointers to the appropriate callbacks.