Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Thyra_AmesosLinearOpWithSolveFactory.cpp
Go to the documentation of this file.
00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 //         Stratimikos: Thyra-based strategies for linear solvers
00006 //                Copyright (2006) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00039 // 
00040 // ***********************************************************************
00041 // @HEADER
00042 */
00043 
00044 #ifndef SUN_CXX
00045 
00046 #include "Thyra_AmesosLinearOpWithSolveFactory.hpp"
00047 
00048 #include "Thyra_AmesosLinearOpWithSolve.hpp"
00049 #include "Thyra_EpetraOperatorViewExtractorStd.hpp"
00050 #include "Amesos.h"
00051 #include "Teuchos_dyn_cast.hpp"
00052 #include "Teuchos_TimeMonitor.hpp"
00053 #include "Teuchos_TypeNameTraits.hpp"
00054 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
00055 
00056 #ifdef HAVE_AMESOS_KLU
00057 #include "Amesos_Klu.h"
00058 #endif
00059 #ifdef HAVE_AMESOS_PASTIX
00060 #include "Amesos_Pastix.h"
00061 #endif
00062 #ifdef HAVE_AMESOS_LAPACK
00063 #include "Amesos_Lapack.h"
00064 #endif
00065 #ifdef HAVE_AMESOS_MUMPS
00066 #include "Amesos_Mumps.h"
00067 #endif
00068 #ifdef HAVE_AMESOS_SCALAPACK
00069 #include "Amesos_Scalapack.h"
00070 #endif
00071 #ifdef HAVE_AMESOS_UMFPACK
00072 #include "Amesos_Umfpack.h"
00073 #endif
00074 #ifdef HAVE_AMESOS_SUPERLUDIST
00075 #include "Amesos_Superludist.h"
00076 #endif
00077 #ifdef HAVE_AMESOS_SUPERLU
00078 #include "Amesos_Superlu.h"
00079 #endif
00080 #ifdef HAVE_AMESOS_DSCPACK
00081 #include "Amesos_Dscpack.h"
00082 #endif
00083 #ifdef HAVE_AMESOS_PARDISO
00084 #include "Amesos_Pardiso.h"
00085 #endif
00086 #ifdef HAVE_AMESOS_TAUCS
00087 #include "Amesos_Taucs.h"
00088 #endif
00089 #ifdef HAVE_AMESOS_PARAKLETE
00090 #include "Amesos_Paraklete.h"
00091 #endif
00092 
00093 namespace {
00094 
00095 const std::string epetraFwdOp_str = "epetraFwdOp";
00096 
00097 } // namespace
00098 
00099 namespace Thyra {
00100 
00101 
00102 // Parameter names for Paramter List
00103 
00104 const std::string AmesosLinearOpWithSolveFactory::SolverType_name = "Solver Type";
00105 
00106 const std::string AmesosLinearOpWithSolveFactory::RefactorizationPolicy_name = "Refactorization Policy";
00107 
00108 const std::string AmesosLinearOpWithSolveFactory::ThrowOnPreconditionerInput_name = "Throw on Preconditioner Input";
00109 
00110 const std::string AmesosLinearOpWithSolveFactory::Amesos_Settings_name = "Amesos Settings";
00111 
00112 // Constructors/initializers/accessors
00113 
00114 AmesosLinearOpWithSolveFactory::~AmesosLinearOpWithSolveFactory()
00115 {
00116 #ifdef TEUCHOS_DEBUG
00117   if(paramList_.get())
00118     paramList_->validateParameters(
00119       *this->getValidParameters(),0  // Only validate this level for now!
00120       );
00121 #endif
00122 }
00123 
00124 AmesosLinearOpWithSolveFactory::AmesosLinearOpWithSolveFactory(
00125   const Amesos::ESolverType                            solverType
00126   ,const Amesos::ERefactorizationPolicy                refactorizationPolicy
00127   ,const bool                                          throwOnPrecInput
00128     )
00129   :epetraFwdOpViewExtractor_(Teuchos::rcp(new EpetraOperatorViewExtractorStd()))
00130   ,solverType_(solverType)
00131   ,refactorizationPolicy_(refactorizationPolicy)
00132   ,throwOnPrecInput_(throwOnPrecInput)
00133 {}
00134 
00135 // Overridden from LinearOpWithSolveFactoryBase
00136 
00137 bool AmesosLinearOpWithSolveFactory::isCompatible(
00138   const LinearOpSourceBase<double> &fwdOpSrc
00139   ) const
00140 {
00141   using Teuchos::outArg;
00142   RCP<const LinearOpBase<double> >
00143     fwdOp = fwdOpSrc.getOp();
00144   RCP<const Epetra_Operator> epetraFwdOp;
00145   EOpTransp epetraFwdOpTransp;
00146   EApplyEpetraOpAs epetraFwdOpApplyAs;
00147   EAdjointEpetraOp epetraFwdOpAdjointSupport;
00148   double epetraFwdOpScalar;
00149   epetraFwdOpViewExtractor_->getEpetraOpView(
00150     fwdOp,
00151     outArg(epetraFwdOp), outArg(epetraFwdOpTransp),
00152     outArg(epetraFwdOpApplyAs), outArg(epetraFwdOpAdjointSupport),
00153     outArg(epetraFwdOpScalar)
00154     );
00155   if( !dynamic_cast<const Epetra_RowMatrix*>(&*epetraFwdOp) )
00156     return false;
00157   return true;
00158 }
00159 
00160 RCP<LinearOpWithSolveBase<double> >
00161 AmesosLinearOpWithSolveFactory::createOp() const
00162 {
00163   return Teuchos::rcp(new AmesosLinearOpWithSolve());
00164 }
00165 
00166 void AmesosLinearOpWithSolveFactory::initializeOp(
00167   const RCP<const LinearOpSourceBase<double> >    &fwdOpSrc
00168   ,LinearOpWithSolveBase<double>                                   *Op
00169   ,const ESupportSolveUse                                          supportSolveUse
00170   ) const
00171 {
00172   using Teuchos::outArg;
00173   THYRA_FUNC_TIME_MONITOR("Stratimikos: AmesosLOWSF");
00174 #ifdef TEUCHOS_DEBUG
00175   TEUCHOS_TEST_FOR_EXCEPT(Op==NULL);
00176 #endif
00177   const RCP<const LinearOpBase<double> > 
00178     fwdOp = fwdOpSrc->getOp();
00179   //
00180   // Unwrap and get the forward Epetra_Operator object
00181   //
00182   RCP<const Epetra_Operator> epetraFwdOp;
00183   EOpTransp epetraFwdOpTransp;
00184   EApplyEpetraOpAs epetraFwdOpApplyAs;
00185   EAdjointEpetraOp epetraFwdOpAdjointSupport;
00186   double epetraFwdOpScalar;
00187   epetraFwdOpViewExtractor_->getEpetraOpView(
00188     fwdOp,
00189     outArg(epetraFwdOp), outArg(epetraFwdOpTransp),
00190     outArg(epetraFwdOpApplyAs), outArg(epetraFwdOpAdjointSupport),
00191     outArg(epetraFwdOpScalar)
00192     );
00193   // Get the AmesosLinearOpWithSolve object
00194   AmesosLinearOpWithSolve
00195     *amesosOp = &Teuchos::dyn_cast<AmesosLinearOpWithSolve>(*Op);
00196   //
00197   // Determine if we must start over or not
00198   //
00199   bool startOver = ( amesosOp->get_amesosSolver()==Teuchos::null );
00200   if(!startOver) {
00201     startOver =
00202       (
00203         epetraFwdOpTransp != amesosOp->get_amesosSolverTransp() ||
00204         epetraFwdOp.get() != amesosOp->get_epetraLP()->GetOperator()
00205         // We must start over if the matrix object changes.  This is a
00206         // weakness of Amesos but there is nothing I can do about this right
00207         // now!
00208         );
00209   }
00210   //
00211   // Update the amesos solver
00212   //
00213   if(startOver) {
00214     //
00215     // This LOWS object has not be initialized yet or is not compatible with the existing
00216     // 
00217     // so this is where we setup everything from the ground up.
00218     //
00219     // Create the linear problem and set the operator with memory of RCP to Epetra_Operator view!
00220     RCP<Epetra_LinearProblem>
00221       epetraLP = Teuchos::rcp(new Epetra_LinearProblem());
00222     epetraLP->SetOperator(const_cast<Epetra_Operator*>(&*epetraFwdOp));
00223     Teuchos::set_extra_data< RCP<const Epetra_Operator> >( epetraFwdOp, epetraFwdOp_str,
00224      Teuchos::inOutArg(epetraLP) );
00225     // Create the concrete solver
00226     RCP<Amesos_BaseSolver>
00227       amesosSolver;
00228     {
00229       THYRA_FUNC_TIME_MONITOR_DIFF("Stratimikos: AmesosLOWSF:InitConstruct",
00230         InitConstruct);
00231       switch(solverType_) {
00232         case Thyra::Amesos::LAPACK :
00233           amesosSolver = Teuchos::rcp(new Amesos_Lapack(*epetraLP));
00234           break;
00235 #ifdef HAVE_AMESOS_KLU
00236         case Thyra::Amesos::KLU :
00237           amesosSolver = Teuchos::rcp(new Amesos_Klu(*epetraLP));
00238           break;
00239 #endif
00240 #ifdef HAVE_AMESOS_PASTIX
00241         case Thyra::Amesos::PASTIX :
00242           amesosSolver = Teuchos::rcp(new Amesos_Pastix(*epetraLP));
00243           break;
00244 #endif
00245 #ifdef HAVE_AMESOS_MUMPS
00246         case Thyra::Amesos::MUMPS :
00247           amesosSolver = Teuchos::rcp(new Amesos_Mumps(*epetraLP));
00248           break;
00249 #endif
00250 #ifdef HAVE_AMESOS_SCALAPACK
00251         case Thyra::Amesos::SCALAPACK :
00252           amesosSolver = Teuchos::rcp(new Amesos_Scalapack(*epetraLP));
00253           break;
00254 #endif
00255 #ifdef HAVE_AMESOS_UMFPACK
00256         case Thyra::Amesos::UMFPACK :
00257           amesosSolver = Teuchos::rcp(new Amesos_Umfpack(*epetraLP));
00258           break;
00259 #endif
00260 #ifdef HAVE_AMESOS_SUPERLUDIST
00261         case Thyra::Amesos::SUPERLUDIST :
00262           amesosSolver = Teuchos::rcp(new Amesos_Superludist(*epetraLP));
00263           break;
00264 #endif
00265 #ifdef HAVE_AMESOS_SUPERLU
00266         case Thyra::Amesos::SUPERLU :
00267           amesosSolver = Teuchos::rcp(new Amesos_Superlu(*epetraLP));
00268           break;
00269 #endif
00270 #ifdef HAVE_AMESOS_DSCPACK
00271         case Thyra::Amesos::DSCPACK :
00272           amesosSolver = Teuchos::rcp(new Amesos_Dscpack(*epetraLP));
00273           break;
00274 #endif
00275 #ifdef HAVE_AMESOS_PARDISO
00276         case Thyra::Amesos::PARDISO :
00277           amesosSolver = Teuchos::rcp(new Amesos_Pardiso(*epetraLP));
00278           break;
00279 #endif
00280 #ifdef HAVE_AMESOS_TAUCS
00281         case Thyra::Amesos::TAUCS :
00282           amesosSolver = Teuchos::rcp(new Amesos_Taucs(*epetraLP));
00283           break;
00284 #endif
00285 #ifdef HAVE_AMESOS_PARAKLETE
00286         case Thyra::Amesos::PARAKLETE :
00287           amesosSolver = Teuchos::rcp(new Amesos_Paraklete(*epetraLP));
00288           break;
00289 #endif
00290         default:
00291           TEUCHOS_TEST_FOR_EXCEPTION(
00292             true, std::logic_error
00293             ,"Error, the solver type ID = " << solverType_ << " is invalid!"
00294             );
00295       }
00296     }
00297     // Set the parameters
00298     if(paramList_.get()) amesosSolver->SetParameters(paramList_->sublist("Amesos Settings"));
00299     // Do the initial factorization
00300     {
00301       THYRA_FUNC_TIME_MONITOR_DIFF("Stratimikos: AmesosLOWSF:Symbolic", Symbolic);
00302       const int err = amesosSolver->SymbolicFactorization();
00303       TEUCHOS_TEST_FOR_EXCEPTION( 0!=err, CatastrophicSolveFailure,
00304         "Error, SymbolicFactorization() on amesos solver of type \'"<<Teuchos::typeName(*amesosSolver)<<"\'\n"
00305         "returned error code "<<err<<"!" );
00306     }
00307     {
00308       THYRA_FUNC_TIME_MONITOR_DIFF("Stratimikos: AmesosLOWSF:Factor", Factor);
00309       const int err = amesosSolver->NumericFactorization();
00310       TEUCHOS_TEST_FOR_EXCEPTION( 0!=err, CatastrophicSolveFailure,
00311         "Error, NumericFactorization() on amesos solver of type \'"<<Teuchos::typeName(*amesosSolver)<<"\'\n"
00312         "returned error code "<<err<<"!" );
00313     }
00314     // Initialize the LOWS object and we are done!
00315     amesosOp->initialize(fwdOp,fwdOpSrc,epetraLP,amesosSolver,epetraFwdOpTransp,epetraFwdOpScalar);
00316   }
00317   else {
00318     //
00319     // This LOWS object has already be initialized once so we must just reset
00320     // the matrix and refactor it.
00321     //
00322     // Get non-const pointers to the linear problem and the amesos solver.
00323     // These const-casts are just fine since the amesosOp in non-const.
00324     RCP<Epetra_LinearProblem>
00325       epetraLP = Teuchos::rcp_const_cast<Epetra_LinearProblem>(amesosOp->get_epetraLP());
00326     RCP<Amesos_BaseSolver>
00327       amesosSolver = amesosOp->get_amesosSolver();
00328     // Reset the forward operator with memory of RCP to Epetra_Operator view!
00329     epetraLP->SetOperator(const_cast<Epetra_Operator*>(&*epetraFwdOp));
00330     Teuchos::get_nonconst_extra_data<RCP<const Epetra_Operator> >(epetraLP,epetraFwdOp_str) = epetraFwdOp;
00331     // Reset the parameters
00332     if(paramList_.get()) amesosSolver->SetParameters(paramList_->sublist(Amesos_Settings_name));
00333     // Repivot if asked
00334     if(refactorizationPolicy_==Amesos::REPIVOT_ON_REFACTORIZATION) {
00335       THYRA_FUNC_TIME_MONITOR_DIFF("Stratimikos: AmesosLOWSF:Symbolic", Symbolic);
00336       const int err = amesosSolver->SymbolicFactorization();
00337       TEUCHOS_TEST_FOR_EXCEPTION( 0!=err, CatastrophicSolveFailure,
00338         "Error, SymbolicFactorization() on amesos solver of type \'"<<Teuchos::typeName(*amesosSolver)<<"\'\n"
00339         "returned error code "<<err<<"!" );
00340     }
00341     {
00342       THYRA_FUNC_TIME_MONITOR_DIFF("Stratimikos: AmesosLOWSF::Factor", Factor);
00343       const int err = amesosSolver->NumericFactorization();
00344       TEUCHOS_TEST_FOR_EXCEPTION( 0!=err, CatastrophicSolveFailure,
00345         "Error, NumericFactorization() on amesos solver of type \'"<<Teuchos::typeName(*amesosSolver)<<"\'\n"
00346         "returned error code "<<err<<"!" );
00347     }
00348     /* ToDo: Put this back in once PrintStatus accepts an std::ostream!
00349     OsTab tab(out);
00350     amesosSolver->PrintStatus()
00351     */
00352     // Reinitialize the LOWS object and we are done! (we must do this to get the
00353     // possibly new transpose and scaling factors back in)
00354     amesosOp->initialize(fwdOp,fwdOpSrc,epetraLP,amesosSolver,epetraFwdOpTransp,epetraFwdOpScalar);
00355   }
00356   amesosOp->setOStream(this->getOStream());
00357   amesosOp->setVerbLevel(this->getVerbLevel());
00358 }
00359 
00360 bool AmesosLinearOpWithSolveFactory::supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
00361 {
00362   return false;
00363 }
00364 
00365 void AmesosLinearOpWithSolveFactory::initializePreconditionedOp(
00366   const RCP<const LinearOpSourceBase<double> >       &fwdOpSrc
00367   ,const RCP<const PreconditionerBase<double> >      &prec
00368   ,LinearOpWithSolveBase<double>                                      *Op
00369   ,const ESupportSolveUse                                             supportSolveUse
00370   ) const
00371 {
00372   TEUCHOS_TEST_FOR_EXCEPTION(
00373     this->throwOnPrecInput_, std::logic_error
00374     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' does not support preconditioners "
00375     "and has been configured to throw this exception when the  initializePreconditionedOp(...) function is called!"
00376     );
00377   this->initializeOp(fwdOpSrc,Op,supportSolveUse); // Ignore the preconditioner!
00378 }
00379 
00380 void AmesosLinearOpWithSolveFactory::initializePreconditionedOp(
00381   const RCP<const LinearOpSourceBase<double> >       &fwdOpSrc
00382   ,const RCP<const LinearOpSourceBase<double> >      &approxFwdOpSrc
00383   ,LinearOpWithSolveBase<double>                                      *Op
00384   ,const ESupportSolveUse                                             supportSolveUse
00385   ) const
00386 {
00387   TEUCHOS_TEST_FOR_EXCEPTION(
00388     this->throwOnPrecInput_, std::logic_error
00389     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' does not support preconditioners "
00390     "and has been configured to throw this exception when the  initializePreconditionedOp(...) function is called!"
00391     );
00392   this->initializeOp(fwdOpSrc,Op,supportSolveUse); // Ignore the preconditioner!
00393 }
00394 
00395 void AmesosLinearOpWithSolveFactory::uninitializeOp(
00396   LinearOpWithSolveBase<double>                               *Op
00397   ,RCP<const LinearOpSourceBase<double> >    *fwdOpSrc
00398   ,RCP<const PreconditionerBase<double> >    *prec
00399   ,RCP<const LinearOpSourceBase<double> >    *approxFwdOpSrc
00400   ,ESupportSolveUse                                           *supportSolveUse
00401   ) const
00402 {
00403 #ifdef TEUCHOS_DEBUG
00404   TEUCHOS_TEST_FOR_EXCEPT(Op==NULL);
00405 #endif
00406   AmesosLinearOpWithSolve
00407     *amesosOp = &Teuchos::dyn_cast<AmesosLinearOpWithSolve>(*Op);
00408   RCP<const LinearOpSourceBase<double> >
00409     _fwdOpSrc = amesosOp->extract_fwdOpSrc(); // Will be null if uninitialized!
00410   if(_fwdOpSrc.get()) {
00411     // Erase the Epetra_Operator view of the forward operator!
00412     RCP<Epetra_LinearProblem> epetraLP = amesosOp->get_epetraLP();
00413     Teuchos::get_nonconst_extra_data< RCP<const Epetra_Operator> >(
00414       epetraLP,epetraFwdOp_str
00415       )
00416       = Teuchos::null;
00417     // Note, we did not erase the address of the operator in
00418     // epetraLP->GetOperator() since it seems that the amesos solvers do not
00419     // recheck the value of GetProblem()->GetOperator() so you had better not
00420     // rest this!
00421   }
00422   if(fwdOpSrc) *fwdOpSrc = _fwdOpSrc; // It is fine if the client does not want this object back!
00423   if(prec) *prec = Teuchos::null; // We never keep a preconditioner!
00424   if(approxFwdOpSrc) *approxFwdOpSrc = Teuchos::null; // We never keep an approximate fwd operator!
00425 }
00426 
00427 // Overridden from ParameterListAcceptor
00428 
00429 void AmesosLinearOpWithSolveFactory::setParameterList(
00430   RCP<Teuchos::ParameterList> const& paramList
00431   )
00432 {
00433   TEUCHOS_TEST_FOR_EXCEPT(paramList.get()==NULL);
00434   paramList->validateParameters(*this->getValidParameters(),0); // Only validate this level for now!
00435   paramList_ = paramList;
00436   solverType_ =
00437     Amesos::solverTypeNameToEnumMap.get<Amesos::ESolverType>(
00438       paramList_->get(
00439         SolverType_name
00440         ,Amesos::toString(solverType_)
00441         )
00442       ,paramList_->name()+"->"+SolverType_name
00443       );
00444   refactorizationPolicy_ = 
00445     Amesos::refactorizationPolicyNameToEnumMap.get<Amesos::ERefactorizationPolicy>(
00446       paramList_->get(
00447         RefactorizationPolicy_name
00448         ,Amesos::toString(refactorizationPolicy_)
00449         )
00450       ,paramList_->name()+"->"+RefactorizationPolicy_name
00451       );
00452   throwOnPrecInput_ = paramList_->get(ThrowOnPreconditionerInput_name,throwOnPrecInput_);
00453   Teuchos::readVerboseObjectSublist(&*paramList_,this);
00454 }
00455 
00456 RCP<Teuchos::ParameterList>
00457 AmesosLinearOpWithSolveFactory::getNonconstParameterList()
00458 {
00459   return paramList_;
00460 }
00461 
00462 RCP<Teuchos::ParameterList>
00463 AmesosLinearOpWithSolveFactory::unsetParameterList()
00464 {
00465   RCP<Teuchos::ParameterList> _paramList = paramList_;
00466   paramList_ = Teuchos::null;
00467   return _paramList;
00468 }
00469 
00470 RCP<const Teuchos::ParameterList>
00471 AmesosLinearOpWithSolveFactory::getParameterList() const
00472 {
00473   return paramList_;
00474 }
00475 
00476 RCP<const Teuchos::ParameterList>
00477 AmesosLinearOpWithSolveFactory::getValidParameters() const
00478 {
00479   return generateAndGetValidParameters();
00480 }
00481 
00482 // Public functions overridden from Teuchos::Describable
00483 
00484 std::string AmesosLinearOpWithSolveFactory::description() const
00485 {
00486   std::ostringstream oss;
00487   oss << "Thyra::AmesosLinearOpWithSolveFactory{";
00488   oss << "solverType=" << toString(solverType_);
00489   oss << "}";
00490   return oss.str();
00491 }
00492 
00493 // private
00494 
00495 RCP<const Teuchos::ParameterList>
00496 AmesosLinearOpWithSolveFactory::generateAndGetValidParameters()
00497 {
00498   static RCP<Teuchos::ParameterList> validParamList;
00499   if(validParamList.get()==NULL) {
00500     validParamList = Teuchos::rcp(new Teuchos::ParameterList("Amesos"));
00501     validParamList->set(
00502       SolverType_name
00503 #ifdef HAVE_AMESOS_KLU
00504       ,Amesos::toString(Amesos::KLU)
00505 #else
00506       ,Amesos::toString(Amesos::LAPACK)
00507 #endif
00508       );
00509     validParamList->set(RefactorizationPolicy_name,Amesos::toString(Amesos::REPIVOT_ON_REFACTORIZATION));
00510     validParamList->set(ThrowOnPreconditionerInput_name,bool(true));
00511     validParamList->sublist(Amesos_Settings_name).setParameters(::Amesos::GetValidParameters());
00512     Teuchos::setupVerboseObjectSublist(&*validParamList);
00513   }
00514   return validParamList;
00515 }
00516 
00517 } // namespace Thyra
00518 
00519 #endif // SUN_CXX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines