Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stratimikos_LinearSolverBuilder_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stratimikos: Thyra-based strategies for linear solvers
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef STRATIMIKOS_LINEARSOLVERBUILDER_DEF_HPP
43 #define STRATIMIKOS_LINEARSOLVERBUILDER_DEF_HPP
44 
45 //#define THYRA_DEFAULT_REAL_LINEAR_SOLVER_BUILDER_DUMP
46 
47 #include "Stratimikos_InternalConfig.h"
48 #include "Thyra_DelayedLinearOpWithSolveFactory.hpp"
53 
54 #ifdef HAVE_STRATIMIKOS_AMESOS
56 #endif
57 #ifdef HAVE_STRATIMIKOS_AMESOS2
58 # include "Thyra_Amesos2LinearOpWithSolveFactory.hpp"
59 #endif
60 #if defined(HAVE_STRATIMIKOS_EPETRAEXT) && defined(HAVE_STRATIMIKOS_AZTECOO)
62 #endif
63 #ifdef HAVE_STRATIMIKOS_BELOS
64 # include "Thyra_BelosLinearOpWithSolveFactory.hpp"
65 #endif
66 #ifdef HAVE_STRATIMIKOS_IFPACK
68 #endif
69 #if defined(HAVE_STRATIMIKOS_IFPACK2) && defined(HAVE_STRATIMIKOS_THYRATPETRAADAPTERS)
70 # include "Thyra_Ifpack2PreconditionerFactory.hpp"
71 # include "Tpetra_CrsMatrix.hpp"
72 #endif
73 #ifdef HAVE_STRATIMIKOS_ML
75 #endif
76 
77 
78 namespace {
79 
80 
81 const std::string LinearSolverType_name = "Linear Solver Type";
82 const std::string LinearSolverTypes_name = "Linear Solver Types";
83 const std::string PreconditionerType_name = "Preconditioner Type";
84 const std::string PreconditionerTypes_name = "Preconditioner Types";
85 const std::string None_name = "None";
86 const std::string EnableDelayedSolverConstruction_name = "Enable Delayed Solver Construction";
87 const bool EnableDelayedSolverConstruction_default = false;
88 
89 
90 } // namespace
91 
92 
93 namespace Stratimikos {
94 
95 
96 // Constructors/Initializers/Accessors
97 
98 
99 template<class Scalar>
101  const std::string &paramsXmlFileName_in,
102  const std::string &extraParamsXmlString_in,
103  const std::string &paramsUsedXmlOutFileName_in,
104  const std::string &paramsXmlFileNameOption_in,
105  const std::string &extraParamsXmlStringOption_in,
106  const std::string &paramsUsedXmlOutFileNameOption_in,
107  const bool &replaceDuplicateFactories_in
108  )
109  :paramsXmlFileName_(paramsXmlFileName_in)
110  ,extraParamsXmlString_(extraParamsXmlString_in)
111  ,paramsUsedXmlOutFileName_(paramsUsedXmlOutFileName_in)
112  ,paramsXmlFileNameOption_(paramsXmlFileNameOption_in)
113  ,extraParamsXmlStringOption_(extraParamsXmlStringOption_in)
114  ,paramsUsedXmlOutFileNameOption_(paramsUsedXmlOutFileNameOption_in)
115  ,replaceDuplicateFactories_(replaceDuplicateFactories_in)
116  ,enableDelayedSolverConstruction_(EnableDelayedSolverConstruction_default)
117 {
118  this->initializeDefaults();
119 }
120 
121 
122 template<class Scalar>
123 LinearSolverBuilder<Scalar>::~LinearSolverBuilder<Scalar>()
124 {
125 #ifdef TEUCHOS_DEBUG
126  // Validate that we read the parameters correctly!
127  if (nonnull(paramList_)) {
128  paramList_->validateParameters(*this->getValidParameters());
129  }
130 #endif
131 }
132 
133 
134 template<class Scalar>
136  const RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<Scalar> > >
137  &solveStrategyFactory,
138  const std::string &solveStrategyName,
139  const bool makeDefault
140  )
141 {
142  const int existingNameIdx =
143  this->getAndAssertExistingFactoryNameIdx("setLinearSolveStrategyFactory()",
144  validLowsfNames_(), solveStrategyName);
145  if (existingNameIdx >= 0) {
146  validLowsfNames_[existingNameIdx] = solveStrategyName;
147  lowsfArray_[existingNameIdx] = solveStrategyFactory;
148  }
149  else {
150  validLowsfNames_.push_back(solveStrategyName);
151  lowsfArray_.push_back(solveStrategyFactory);
152  }
153  validParamList_ = Teuchos::null;
154  if (makeDefault) {
155  setDefaultLinearSolveStrategyFactoryName(solveStrategyName);
156  }
157 }
158 
159 
160 template<class Scalar>
162  const std::string &solveStrategyName)
163 {
164  defaultLOWSF_ = solveStrategyName;
165 }
166 
167 
168 template<class Scalar>
170  const RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<Scalar>>>
171  &precStrategyFactory,
172  const std::string &precStrategyName,
173  const bool makeDefault
174  )
175 {
176  const int existingNameIdx =
177  this->getAndAssertExistingFactoryNameIdx("setPreconditioningStrategyFactory()",
178  validPfNames_(), precStrategyName);
179  if (existingNameIdx >= 0) {
180  validPfNames_[existingNameIdx] = precStrategyName;
181  pfArray_[existingNameIdx-1] = precStrategyFactory; // We offset by -1 since "None" is first!
182  }
183  else {
184  validPfNames_.push_back(precStrategyName);
185  pfArray_.push_back(precStrategyFactory);
186  }
187  validParamList_ = Teuchos::null;
188  if (makeDefault) {
189  setDefaultPreconditioningStrategyFactoryName(precStrategyName);
190  }
191 }
192 
193 
194 template<class Scalar>
196  const std::string &precStrategyName)
197 {
198  defaultPF_ = precStrategyName;
199 }
200 
201 
202 template<class Scalar>
204 {
205  TEUCHOS_TEST_FOR_EXCEPT(clp==NULL);
206  clp->setOption(
207  paramsXmlFileNameOption().c_str(),&paramsXmlFileName_
208  ,"Name of an XML file containing parameters for linear solver "
209  "options to be appended first."
210  );
211  clp->setOption(
212  extraParamsXmlStringOption().c_str(),&extraParamsXmlString_
213  ,"An XML string containing linear solver parameters to be appended second."
214  );
215  clp->setOption(
216  paramsUsedXmlOutFileNameOption().c_str(),&paramsUsedXmlOutFileName_
217  ,"Name of an XML file that can be written with the parameter list after it "
218  "has been used on completion of this program."
219  );
220 }
221 
222 
223 template<class Scalar>
225 {
226  using Teuchos::parameterList;
227  using Teuchos::ptr;
228  using Teuchos::updateParametersFromXmlFile;
229  using Teuchos::updateParametersFromXmlString;
230  using std::endl;
231 
232  if (!paramList_.get()) {
233  paramList_ = parameterList("LinearSolverBuilder");
234  }
235  if (paramsXmlFileName().length()) {
236  if (out) {
237  *out << endl << "Reading parameters from XML file \""
238  << paramsXmlFileName() << "\" ..." << endl;
239  }
240  updateParametersFromXmlFile (paramsXmlFileName (), paramList_.ptr());
241  }
242  if (extraParamsXmlString().length()) {
243  if (out) {
244  *out << endl << "Appending extra parameters from the XML string \""
245  << extraParamsXmlString() << "\" ..." << endl;
246  }
247  updateParametersFromXmlString (extraParamsXmlString (), paramList_.ptr());
248  }
249  setParameterList(paramList_);
250 }
251 
252 
253 template<class Scalar>
255  const Thyra::LinearOpWithSolveFactoryBase<Scalar> &/* lowsFactory */,
256  const std::string &outputXmlFileName
257  ) const
258 {
259  justInTimeInitialize();
260  const std::string xmlOutputFile =
261  ( outputXmlFileName.length() ? outputXmlFileName : paramsUsedXmlOutFileName() );
262  if (xmlOutputFile.length()) {
263  Teuchos::writeParameterListToXmlFile(*paramList_, xmlOutputFile);
264  }
265 }
266 
267 
268 template<class Scalar>
269 std::string
271 {
272  justInTimeInitialize();
273  return lowsfValidator_->getStringValue(*paramList_, LinearSolverType_name,
274  defaultLOWSF_);
275 }
276 
277 
278 template<class Scalar>
279 std::string
281 {
282  justInTimeInitialize();
283  return pfValidator_->getStringValue(*paramList_, PreconditionerType_name,
284  defaultPF_);
285 }
286 
287 
288 // Overridden from ParameterListAcceptor
289 
290 
291 template<class Scalar>
293  RCP<Teuchos::ParameterList> const& paramList
294  )
295 {
296  TEUCHOS_TEST_FOR_EXCEPT(is_null(paramList));
297  paramList->validateParameters(*this->getValidParameters());
298  paramList_ = paramList;
299  enableDelayedSolverConstruction_ = paramList_->get(
300  EnableDelayedSolverConstruction_name, EnableDelayedSolverConstruction_default );
301 }
302 
303 
304 template<class Scalar>
307 {
308  return paramList_;
309 }
310 
311 
312 template<class Scalar>
315 {
316  RCP<Teuchos::ParameterList> _paramList = paramList_;
317  paramList_ = Teuchos::null;
318  return _paramList;
319 }
320 
321 
322 template<class Scalar>
325 {
326  return paramList_;
327 }
328 
329 
330 template<class Scalar>
333 {
334  using Teuchos::rcp_implicit_cast;
336  if (is_null(validParamList_)) {
338  validParamList = Teuchos::rcp(new Teuchos::ParameterList);
339  // Linear Solver Types
340  lowsfValidator_ = Teuchos::rcp(
342  validLowsfNames_,LinearSolverType_name
343  )
344  );
345  validParamList->set(
346  LinearSolverType_name, defaultLOWSF_,
347  (std::string("Determines the type of linear solver that will be used.\n")
348  + "The parameters for each solver type are specified in the sublist \""
349  + LinearSolverTypes_name + "\"").c_str(),
350  rcp_implicit_cast<const PEV>(lowsfValidator_)
351  );
352  Teuchos::ParameterList &linearSolverTypesSL = validParamList->sublist(
353  LinearSolverTypes_name,false,
354  "Sublists for each of the linear solver types set using the parameter\n"
355  "\"" + LinearSolverType_name + "\". Note that the options for each\n"
356  "linear solver type given below will only be used if linear solvers\n"
357  "of that type are created. It is fine to list parameter sublists for\n"
358  "linear solver types that are not used."
359  );
360  for( int i = 0; i < static_cast<int>(lowsfArray_.size()); ++i ) {
361  const std::string
362  &lsname = validLowsfNames_[i];
364  lowsf = lowsfArray_[i]->create();
365  linearSolverTypesSL.sublist(lsname).setParameters(*lowsf->getValidParameters()
366  ).disableRecursiveValidation();
367  }
368  // Preconditioner Type
369  pfValidator_ = Teuchos::rcp(
371  validPfNames_, PreconditionerType_name ) );
372  validParamList->set(
373  PreconditionerType_name, defaultPF_,
374  (std::string("Determines the type of preconditioner that will be used.\n")
375  + "This option is only meaningful for linear solvers that accept preconditioner"
376  + " factory objects!\n"
377  + "The parameters for each preconditioner are specified in the sublist \""
378  + PreconditionerTypes_name + "\"").c_str(),
379  rcp_implicit_cast<const PEV>(pfValidator_)
380  );
381  Teuchos::ParameterList &precTypesSL = validParamList->sublist(
382  PreconditionerTypes_name,false,
383  "Sublists for each of the preconditioner types set using the parameter\n"
384  "\"" + PreconditionerType_name + "\". Note that the options for each\n"
385  "preconditioner type given below will only be used if preconditioners\n"
386  "of that type are created. It is fine to list parameter sublists for\n"
387  "preconditioner types that are not used."
388  );
389  for( int i = 0; i < static_cast<int>(pfArray_.size()); ++i ) {
390  const std::string
391  &pfname = validPfNames_[i+1]; // "None" is the 0th entry!
393  pf = pfArray_[i]->create();
394  precTypesSL.sublist(pfname).setParameters(*pf->getValidParameters()
395  ).disableRecursiveValidation();
396  }
397  //
398  validParamList->set(
399  EnableDelayedSolverConstruction_name, EnableDelayedSolverConstruction_default,
400  "When this option is set to true, the linear solver factory will be wrapped\n"
401  "in a delayed evaluation Decorator factory object. This results in a delay\n"
402  "in the creation of a linear solver (and the associated preconditioner) until\n"
403  "the first solve is actually performed. This helps in cases where it is not\n"
404  "known a-priori if a linear solve will be needed on a given linear operator and\n"
405  "therefore can significantly improve performance for some types of algorithms\n"
406  "such as NOX and LOCA."
407  );
408  //
409  validParamList_ = validParamList;
410  }
411  return validParamList_;
412 }
413 
414 
415 // Overridden from LinearSolverBuilderBase.
416 
417 
418 template<class Scalar>
421  const std::string &linearSolveStrategyName
422  ) const
423 {
424  justInTimeInitialize();
425 
426  // Get the name of the linear solve strategy
427 #ifdef THYRA_DEFAULT_REAL_LINEAR_SOLVER_BUILDER_DUMP
428  std::cout << "\nEntering LinearSolverBuilder"
429  << "::createLinearSolveStrategy(...) ...\n";
430  std::cout << "\nlinearSolveStrategyName = \""
431  << linearSolveStrategyName << "\"\n";
432  std::cout << "\nlinearSolveStrategyName.length() = "
433  << linearSolveStrategyName.length() << "\n";
434  std::cout << "\ndefaultLOWSF_ = \"" << defaultLOWSF_ << "\"\n";
435  std::cout << "\nthis->getLinearSolveStrategyName() = \""
436  << this->getLinearSolveStrategyName() << "\"\n";
437 #endif
438  const std::string
439  lsname = ( linearSolveStrategyName.length()
440  ? linearSolveStrategyName
441  : this->getLinearSolveStrategyName() );
442 #ifdef THYRA_DEFAULT_REAL_LINEAR_SOLVER_BUILDER_DUMP
443  std::cout << "\nlsname = \"" << lsname << "\"\n";
444 #endif
445 
446  // Get the index of this linear solver strategy (this will validate!)
447  const int
448  ls_idx = lowsfValidator_->getIntegralValue(lsname, LinearSolverType_name);
449 
450  // Create the uninitialized LOWSFB object
452  lowsf = lowsfArray_[ls_idx]->create();
453 
454  // First, set the preconditioner factory and its parameters
455  if(lowsf->acceptsPreconditionerFactory()) {
456  const std::string &pfName = this->getPreconditionerStrategyName();
458  pf = this->createPreconditioningStrategy(pfName);
459  if(pf.get())
460  lowsf->setPreconditionerFactory(pf,pfName);
461  }
462 
463  // Now set the parameters for the linear solver (some of which might
464  // override some preconditioner factory parameters).
465  lowsf->setParameterList(
466  sublist(sublist(paramList_, LinearSolverTypes_name), lsname));
467  //
468  if (enableDelayedSolverConstruction_) {
469  return Teuchos::rcp(
470  new Thyra::DelayedLinearOpWithSolveFactory<Scalar>(lowsf)
471  );
472  }
473 
474  return lowsf;
475 
476 }
477 
478 
479 template<class Scalar>
482  const std::string &preconditioningStrategyName
483  ) const
484 {
485  justInTimeInitialize();
486 
487  // Get the name of the preconditioning strategy
488  const std::string
489  pfname = ( preconditioningStrategyName.length()
490  ? preconditioningStrategyName
491  : this->getPreconditionerStrategyName() );
493  pf = Teuchos::null;
494 
495  // Get the index of this preconditioning strategy (this will validate!)
496  const int
497  pf_idx = pfValidator_->getIntegralValue(pfname, PreconditionerType_name);
498  if( pf_idx != 0 ) {
499  pf = pfArray_[pf_idx-1]->create(); // We offset by -1 since "None" is first!
500  pf->setParameterList(
501  sublist(sublist(paramList_, PreconditionerTypes_name), pfname));
502  }
503 
504  return pf;
505 
506 }
507 
508 
509 // private
510 
511 template<class Scalar>
513 {
514 
515  using Teuchos::rcp;
516  using Teuchos::abstractFactoryStd;
517 
518  defaultLOWSF_ = "";
519  defaultPF_ = None_name;
520  validLowsfNames_.resize(0);
521  validPfNames_.resize(0);
522  validPfNames_.push_back(None_name); // This will offset everything!
523 
524  //
525  // Linear Solvers
526  //
527 
528 #ifdef HAVE_STRATIMIKOS_AMESOS2
529  setLinearSolveStrategyFactory(
530  abstractFactoryStd<Thyra::LinearOpWithSolveFactoryBase<Scalar>,
532  "Amesos2", true
533  );
534 #endif
535 
536 #ifdef HAVE_STRATIMIKOS_BELOS
537  setLinearSolveStrategyFactory(
538  abstractFactoryStd<Thyra::LinearOpWithSolveFactoryBase<Scalar>,
540  "Belos", true
541  );
542 #endif
543 
544 #if defined(HAVE_STRATIMIKOS_IFPACK2) && defined(HAVE_STRATIMIKOS_THYRATPETRAADAPTERS)
545  setPreconditioningStrategyFactory(
546  abstractFactoryStd<Thyra::PreconditionerFactoryBase<Scalar>,
547  Thyra::Ifpack2PreconditionerFactory<Tpetra::CrsMatrix<Scalar>>>(),
548  "Ifpack2", true
549  );
550 #endif
551 
552 
553  // Note: Above, the last PF object set will be the default!
554 
555 }
556 
557 template<>
559 {
560  using Scalar = double;
561  using Teuchos::rcp;
562  using Teuchos::abstractFactoryStd;
563 
564  defaultLOWSF_ = "";
565  defaultPF_ = None_name;
566  validLowsfNames_.resize(0);
567  validPfNames_.resize(0);
568  validPfNames_.push_back(None_name); // This will offset everything!
569 
570  //
571  // Linear Solvers
572  //
573 
574 #ifdef HAVE_STRATIMIKOS_AMESOS2
575  setLinearSolveStrategyFactory(
576  abstractFactoryStd<Thyra::LinearOpWithSolveFactoryBase<Scalar>,
578  "Amesos2", true
579  );
580 #endif
581 
582 #ifdef HAVE_STRATIMIKOS_BELOS
583  setLinearSolveStrategyFactory(
584  abstractFactoryStd<Thyra::LinearOpWithSolveFactoryBase<Scalar>,
586  "Belos", true
587  );
588 #endif
589 
590 #ifdef HAVE_STRATIMIKOS_AMESOS
591  setLinearSolveStrategyFactory(
592  abstractFactoryStd<Thyra::LinearOpWithSolveFactoryBase<Scalar>,
594  "Amesos", true
595  );
596 #endif
597 
598 #if defined(HAVE_STRATIMIKOS_EPETRAEXT) && defined(HAVE_STRATIMIKOS_AZTECOO)
599  setLinearSolveStrategyFactory(
600  abstractFactoryStd<Thyra::LinearOpWithSolveFactoryBase<Scalar>,
602  "AztecOO", true
603  );
604 #endif
605 
606  // Note: Above, the last LOWSF object set will be the default!
607  // (unless we have only one processor, see below:)
608 
609 #ifdef HAVE_STRATIMIKOS_AMESOS
611  setDefaultLinearSolveStrategyFactoryName("Amesos");
612  }
613 #endif
614 
615  //
616  // Preconditioners
617  //
618 
619 #ifdef HAVE_STRATIMIKOS_ML
620  setPreconditioningStrategyFactory(
621  abstractFactoryStd<Thyra::PreconditionerFactoryBase<Scalar>,
623  "ML", true
624  );
625 #endif
626 
627 #if defined(HAVE_STRATIMIKOS_IFPACK2) && defined(HAVE_STRATIMIKOS_THYRATPETRAADAPTERS)
628  setPreconditioningStrategyFactory(
629  abstractFactoryStd<Thyra::PreconditionerFactoryBase<Scalar>,
630  Thyra::Ifpack2PreconditionerFactory<Tpetra::CrsMatrix<Scalar>>>(),
631  "Ifpack2", true
632  );
633 #endif
634 
635 #ifdef HAVE_STRATIMIKOS_IFPACK
636  setPreconditioningStrategyFactory(
637  abstractFactoryStd<Thyra::PreconditionerFactoryBase<Scalar>,
639  "Ifpack", true
640  );
641 #endif
642 
643  // Note: Above, the last PF object set will be the default!
644 
645 }
646 
647 
648 template<class Scalar>
650 {
651  paramList_.assert_not_null();
652  if (is_null(validParamList_)) {
653  // Create the validators
654  this->getValidParameters();
655  }
656 }
657 
658 
659 template<class Scalar>
661  const std::string &setFunctionName, const Teuchos::ArrayView<std::string> namesArray,
662  const std::string &name) const
663 {
664  const int existingNameIdx =
667  (!replaceDuplicateFactories_ && existingNameIdx >= 0), std::logic_error,
668  "ERROR: "<<setFunctionName<<": the name='"<<name<<"' already exists"
669  << " at index="<<existingNameIdx<<"!\n"
670  << "\n"
671  << "TIP: To allow duplicates, change the property replaceDuplicateFactories from"
672  << " false to true by calling <thisObject>.replaceDuplicateFactories(true)"
673  << " where <thisObject> is of type Stratimikos::LinearSolverBuilder<Scalar>!");
674  return existingNameIdx;
675 }
676 
677 
678 //
679 // Explicit instantiation macro
680 //
681 // Must be expanded from within the Stratimikos namespace!
682 //
683 
684 
685 #define STRATIMIKOS_LINEARSOLVERBUILDER_INSTANT(SCALAR) \
686  \
687  template class LinearSolverBuilder<SCALAR >;
688 
689 
690 
691 } // namespace Stratimikos
692 
693 #endif // STRATIMIKOS_LINEARSOLVERBUILDER_DEF_HPP
Concrete LinearOpWithSolveFactoryBase adapter subclass that uses Amesos direct solvers.
Concrete preconditioner factory subclass based on Ifpack.
LinearOpWithSolveFactoryBase subclass implemented in terms of AztecOO.
bool is_null(const boost::shared_ptr< T > &p)
RCP< const ParameterList > getParameterList() const
T & get(ParameterList &l, const std::string &name)
LinearSolverBuilder(const std::string &paramsXmlFileName="", const std::string &extraParamsXmlString="", const std::string &paramsUsedXmlOutFileName="", const std::string &paramsXmlFileNameOption="linear-solver-params-file", const std::string &extraParamsXmlStringOption="extra-linear-solver-params", const std::string &paramsUsedXmlOutFileNameOption="linear-solver-params-used-file", const bool &replaceDuplicateFactories=true)
Construct with default parameters.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void setLinearSolveStrategyFactory(const RCP< const AbstractFactory< Thyra::LinearOpWithSolveFactoryBase< Scalar > > > &solveStrategyFactory, const std::string &solveStrategyName, const bool makeDefault=false)
Set a new linear solver strategy factory object.
void setDefaultLinearSolveStrategyFactoryName(const std::string &solveStrategyName)
Set the default linear solver factory name.
RCP< ParameterList > sublist(const RCP< ParameterList > &paramList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
T * get() const
Concrete preconditioner factory subclass based on ML.
RCP< Thyra::PreconditionerFactoryBase< Scalar > > createPreconditioningStrategy(const std::string &preconditioningStrategyName) const
std::string getPreconditionerStrategyName() const
Get the name of the preconditioner strategy that will be created on the next call to this-&gt;createPrec...
void readParameters(std::ostream *out)
Force the parameters to be read from a file and/or an extra XML string.
void setPreconditioningStrategyFactory(const RCP< const AbstractFactory< Thyra::PreconditionerFactoryBase< Scalar > > > &precStrategyFactory, const std::string &precStrategyName, const bool makeDefault=false)
Set a new preconditioner strategy factory object.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void setParameterList(RCP< ParameterList > const &paramList)
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
std::string getLinearSolveStrategyName() const
Get the name of the linear solver strategy that will be created on the next call to this-&gt;createLinea...
LinearOpWithSolveFactoryBase subclass implemented in terms of Belos.
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
RCP< Thyra::LinearOpWithSolveFactoryBase< Scalar > > createLinearSolveStrategy(const std::string &linearSolveStrategyName) const
bool nonnull(const boost::shared_ptr< T > &p)
int getAndAssertExistingFactoryNameIdx(const std::string &setFunctionName, const Teuchos::ArrayView< std::string > namesArray, const std::string &name) const
Concrete subclass of Thyra::LinearSolverBuilderBase for creating Thyra::LinearOpWithSolveFactoryBase ...
void setDefaultPreconditioningStrategyFactoryName(const std::string &precStrategyName)
Set the default linear solver factory name.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
int existingNameIndex(const Teuchos::ArrayView< std::string > namesArray, const std::string &name)
Return the index of a name in an array of names.
void writeParamsFile(const Thyra::LinearOpWithSolveFactoryBase< Scalar > &lowsFactory, const std::string &outputXmlFileName="") const
Write the parameters list for a LinearOpWithSolveFactoryBase object to a file after the parameters ar...
void setupCLP(Teuchos::CommandLineProcessor *clp)
Setup the command-line processor to read in the needed data to extra the parameters from...
RCP< const ParameterList > getValidParameters() const