15 #include "Thyra_PreconditionerFactoryHelpers.hpp"
17 #include "Thyra_ScaledAdjointLinearOpBase.hpp"
20 #include "EpetraExt_ProductOperator.h"
30 const std::string AOOLOWSF_epetraPrecOp_str
31 =
"AOOLOWSF::epetraPrecOp";
32 const std::string AOOLOWSF_aztec_epetra_epetraFwdOp_str
33 =
"AOOLOWSF::aztec_epetra_epetraFwdOp";
34 const std::string AOOLOWSF_aztec_epetra_epetraAdjOp_str
35 =
"AOOLOWSF::aztec_epetra_epetraAdjOp";
36 const std::string AOOLOWSF_rowmatrix_epetraFwdOp_str
37 =
"AOOLOWSF::rowmatrix_epetraFwdOp";
38 const std::string AOOLOWSF_rowmatrix_epetraPrecOp_str
39 =
"AOOLOWSF::rowmatrix_epetraPrecOp";
40 const std::string AOOLOWSF_aztec_fwd_epetra_epetraPrecOp_str
41 =
"AOOLOWSF::aztec_fwd_epetra_epetraPrecOp";
42 const std::string AOOLOWSF_aztec_adj_epetra_epetraPrecOp_str
43 =
"AOOLOWSF::aztec_adj_epetra_epetraPrecOp";
44 const std::string AOOLOWSF_setPrecondtionerOperator_str
45 =
"AOOLOWSF::setPrecondtionerOperator";
46 const std::string AOOLOWSF_constructedAztecPreconditoner_str
47 =
"AOOLOWSF::constructedAztecPreconditoner";
50 const std::string ForwardSolve_name =
"Forward Solve";
51 const std::string AdjointSolve_name =
"Adjoint Solve";
52 const std::string MaxIterations_name =
"Max Iterations";
53 const int MaxIterations_default = 400;
54 const std::string Tolerance_name =
"Tolerance";
55 const double Tolerance_default = 1e-6;
56 const std::string OutputEveryRhs_name =
"Output Every RHS";
57 const bool OutputEveryRhs_default =
false;
58 const std::string AztecOO_Settings_name =
"AztecOO Settings";
74 ,defaultFwdMaxIterations_(MaxIterations_default)
75 ,defaultFwdTolerance_(Tolerance_default)
76 ,defaultAdjMaxIterations_(MaxIterations_default)
77 ,defaultAdjTolerance_(Tolerance_default)
78 ,outputEveryRhs_(OutputEveryRhs_default)
97 const Teuchos::RCP<PreconditionerFactoryBase<double> > &precFactory,
98 const std::string &precFactoryName
103 precFactoryValidPL = precFactory->getValidParameters();
104 const std::string _precFactoryName =
105 ( precFactoryName !=
""
107 : ( precFactoryValidPL.get()
108 ? precFactoryValidPL->name()
109 :
"GENERIC PRECONDITIONER FACTORY"
126 Teuchos::RCP<PreconditionerFactoryBase<double> > *precFactory,
127 std::string *precFactoryName
139 const LinearOpSourceBase<double> &fwdOpSrc
142 return epetraFwdOpViewExtractor_->isCompatible(*fwdOpSrc.getOp());
154 const Teuchos::RCP<
const LinearOpSourceBase<double> > &fwdOpSrc,
155 LinearOpWithSolveBase<double> *Op,
156 const ESupportSolveUse
164 const Teuchos::RCP<
const LinearOpSourceBase<double> > &fwdOpSrc,
165 LinearOpWithSolveBase<double> *Op
173 const EPreconditionerInputType precOpType
180 "Aztec Preconditioner",
"none"
184 case PRECONDITIONER_INPUT_TYPE_AS_OPERATOR:
186 case PRECONDITIONER_INPUT_TYPE_AS_MATRIX:
196 const Teuchos::RCP<
const LinearOpSourceBase<double> > &fwdOpSrc,
197 const Teuchos::RCP<
const PreconditionerBase<double> > &prec,
198 LinearOpWithSolveBase<double> *Op,
199 const ESupportSolveUse
208 const Teuchos::RCP<
const LinearOpSourceBase<double> > &fwdOpSrc,
209 const Teuchos::RCP<
const LinearOpSourceBase<double> > &approxFwdOpSrc,
210 LinearOpWithSolveBase<double> *Op,
211 const ESupportSolveUse
221 LinearOpWithSolveBase<double> *Op,
222 Teuchos::RCP<
const LinearOpSourceBase<double> > *fwdOpSrc,
224 Teuchos::RCP<
const LinearOpSourceBase<double> > *approxFwdOpSrc,
237 if(fwdOpSrc) *fwdOpSrc = _fwdOpSrc;
238 if(approxFwdOpSrc) *approxFwdOpSrc = _approxFwdOpSrc;
245 if(prec) *prec = _prec;
286 if( nestedPFSublistExists || !alreadyHasSublist ) {
290 Teuchos::readVerboseObjectSublist(&*
paramList_,
this);
329 std::ostringstream oss;
330 oss <<
"Thyra::AztecOOLinearOpWithSolveFactory{";
331 oss <<
"precFactory=";
348 if(validParamList.
get()==NULL) {
352 OutputEveryRhs_name,OutputEveryRhs_default
353 ,
"Determines if output is created for each individual RHS (true or 1) or if output\n"
354 "is just created for an entire set of RHSs (false or 0)."
359 &fwdSolvePL = validParamList->
sublist(
360 ForwardSolve_name,
false
361 ,
"Gives the options for the forward solve."
364 Tolerance_name,Tolerance_default
365 ,
"The tolerence used in the convergence check (see the convergence test\n"
366 "in the sublist \"" + AztecOO_Settings_name +
"\")"
369 MaxIterations_name,MaxIterations_default
370 ,
"The maximum number of iterations the AztecOO solver is allowed to perform."
373 AztecOO_Settings_name,
false
374 ,
"Sets the parameters on the AztecOO object itself."
375 ).setParameters(*aztecParamList);
377 &adjSolvePL = validParamList->
sublist(
378 AdjointSolve_name,
false
379 ,
"The options for the adjoint solve.\n"
380 "If this sublist is missing then the parameters from the\n"
381 "\""+ForwardSolve_name+
"\" sublist are used instead."
386 return validParamList;
397 precFactoryValidParamList =
precFactory_->getValidParameters();
398 if(precFactoryValidParamList.
get()) {
400 *precFactoryValidParamList);
408 const Teuchos::RCP<
const LinearOpSourceBase<double> > &fwdOpSrc,
409 const Teuchos::RCP<
const PreconditionerBase<double> > &prec,
410 const Teuchos::RCP<
const LinearOpSourceBase<double> > &approxFwdOpSrc,
411 const bool reusePrec,
412 LinearOpWithSolveBase<double> *Op
418 using Teuchos::rcp_dynamic_cast;
419 using Teuchos::rcp_const_cast;
420 using Teuchos::set_extra_data;
421 using Teuchos::get_optional_extra_data;
422 using Teuchos::get_optional_nonconst_extra_data;
423 using Teuchos::outArg;
424 typedef EpetraExt::ProductOperator PO;
430 *out <<
"\nEntering Thyra::AztecOOLinearOpWithSolveFactory::initializeOp_impl(...) ...\n";
433 VOTSPF precFactoryOutputTempState(
precFactory_,out,verbLevel);
447 tmpFwdOp = fwdOpSrc->getOp(),
448 tmpApproxFwdOp = ( approxFwdOpSrc.get() ? approxFwdOpSrc->getOp() :
Teuchos::null );
451 if ( dynamic_cast<const EpetraLinearOpBase*>(tmpFwdOp.get())!=0 )
454 approxFwdOp = tmpApproxFwdOp;
458 fwdOp = makeEpetraWrapper(tmpFwdOp);
465 approxFwdOp = makeEpetraWrapper(tmpApproxFwdOp);
479 EOpTransp epetra_epetraFwdOpTransp;
482 double epetra_epetraFwdOpScalar;
483 epetraFwdOpViewExtractor_->getEpetraOpView(
485 outArg(epetra_epetraFwdOp), outArg(epetra_epetraFwdOpTransp),
486 outArg(epetra_epetraFwdOpApplyAs), outArg(epetra_epetraFwdOpAdjointSupport),
487 outArg(epetra_epetraFwdOpScalar)
490 epetra_epetraFwdOp.
get()==NULL, std::logic_error
491 ,
"Error, The input fwdOp object must be fully initialized "
492 "before calling this function!"
509 ? Teuchos::rcp_const_cast<PreconditionerBase<double> >(
528 if (precUsed.
get()) {
533 !( left.
get() || right.
get() || unspecified.
get() ), std::logic_error
534 ,
"Error, at least one preconditoner linear operator objects must be set!"
536 if(unspecified.
get()) {
537 rightPrecOp = unspecified;
542 left.
get(),std::logic_error
543 ,
"Error, we can not currently handle a left"
544 " preconditioner with the AztecOO/Thyra adapters!"
549 double wrappedPrecOpScalar = 0.0;
550 EOpTransp wrappedPrecOpTransp =
NOTRANS;
554 EOpTransp epetra_epetraPrecOpTransp;
557 EOpTransp overall_epetra_epetraPrecOpTransp=
NOTRANS;
558 if(rightPrecOp.
get()) {
561 rightPrecOp,&wrappedPrecOpScalar,&wrappedPrecOpTransp,&tmpWrappedPrecOp);
562 if( dynamic_cast<const EpetraLinearOpBase*>(&*tmpWrappedPrecOp) ) {
563 wrappedPrecOp = tmpWrappedPrecOp;
566 wrappedPrecOp = makeEpetraWrapper(tmpWrappedPrecOp);
570 epetraPrecOp->getEpetraOpView(
571 outArg(epetra_epetraPrecOp), outArg(epetra_epetraPrecOpTransp),
572 outArg(epetra_epetraPrecOpApplyAs), outArg(epetra_epetraPrecOpAdjointSupport));
574 epetra_epetraPrecOp.
get()==NULL,std::logic_error
575 ,
"Error, The input prec object and its embedded preconditioner"
576 " operator must be fully initialized before calling this function!"
585 overall_epetra_epetraPrecOpTransp
587 real_trans(wrappedPrecOpTransp),
588 real_trans(epetra_epetraPrecOpTransp)
596 if(approxFwdOp.
get()) {
599 unwrap(approxFwdOp,&wrappedPrecOpScalar,&wrappedPrecOpTransp,&wrappedPrecOp);
602 epetraPrecOp->getEpetraOpView(
603 outArg(epetra_epetraPrecOp), outArg(epetra_epetraPrecOpTransp),
604 outArg(epetra_epetraPrecOpApplyAs), outArg(epetra_epetraPrecOpAdjointSupport)
607 epetra_epetraPrecOp.
get()==NULL,std::logic_error
608 ,
"Error, The input approxFwdOp object must be fully initialized"
609 " before calling this function!"
619 overall_epetra_epetraPrecOpTransp
621 real_trans(wrappedPrecOpTransp),
622 real_trans(epetra_epetraPrecOpTransp)
631 rowmatrix_epetraFwdOp = rcp_dynamic_cast<
const Epetra_RowMatrix>(
633 rowmatrix_epetraPrecOp = rcp_dynamic_cast<const Epetra_RowMatrix>(
634 epetra_epetraPrecOp);
640 enum ELocalPrecType {
641 PT_NONE, PT_AZTEC_FROM_OP, PT_AZTEC_FROM_APPROX_FWD_MATRIX,
642 PT_FROM_PREC_OP, PT_UPPER_BOUND
644 ELocalPrecType localPrecType = PT_UPPER_BOUND;
647 localPrecType = PT_NONE;
652 localPrecType = PT_AZTEC_FROM_OP;
657 localPrecType = PT_AZTEC_FROM_APPROX_FWD_MATRIX;
659 else if( precUsed.
get() ) {
662 localPrecType = PT_FROM_PREC_OP;
665 (localPrecType == PT_UPPER_BOUND, std::logic_error,
666 "AztecOOLinearOpWithSolveFactory::initializeOp_impl(...): "
667 "localPrecType == PT_UPPER_BOUND. This means that previously, "
668 "this value might have been used uninitialized. "
669 "Please report this bug to the Stratimikos developers.");
684 bool old_isExternalPrec;
688 double old_aztecSolverScalar;
699 ,&old_aztecSolverScalar
701 if( old_aztecFwdSolver.
get()==NULL ) {
709 aztecFwdSolver = old_aztecFwdSolver;
710 aztecAdjSolver = old_aztecAdjSolver;
711 startingOver =
false;
714 Ptr<bool> constructedAztecPreconditioner;
718 !
is_null(constructedAztecPreconditioner = get_optional_nonconst_extra_data<bool>(
719 aztecFwdSolver,
"AOOLOWSF::constructedAztecPreconditoner") )
721 *constructedAztecPreconditioner
724 aztecFwdSolver->DestroyPreconditioner();
725 *constructedAztecPreconditioner =
false;
729 Ptr<bool> setPreconditionerOperator;
731 localPrecType != PT_FROM_PREC_OP
732 && !
is_null( setPreconditionerOperator = get_optional_nonconst_extra_data<bool>(
733 aztecFwdSolver,
"AOOLOWSF::setPreconditonerOperator") )
734 && *setPreconditionerOperator
750 aztecFwdSolver =
rcp(
new AztecOO());
751 aztecFwdSolver->SetAztecOption(AZ_diagnostics,AZ_none);
752 aztecFwdSolver->SetAztecOption(AZ_keep_info,1);
757 localPrecType!=PT_AZTEC_FROM_OP && localPrecType!=PT_AZTEC_FROM_APPROX_FWD_MATRIX
760 aztecAdjSolver =
rcp(
new AztecOO());
761 aztecAdjSolver->SetAztecOption(AZ_diagnostics,AZ_none);
786 aztec_epetra_epetraFwdOp,
787 aztec_epetra_epetraAdjOp;
791 = { epetra_epetraFwdOp };
798 ? PO::APPLY_MODE_APPLY
799 : PO::APPLY_MODE_APPLY_INVERSE };
803 epetraOpsApplyMode[0] == PO::APPLY_MODE_APPLY
806 aztec_epetra_epetraFwdOp = epetra_epetraFwdOp;
810 aztec_epetra_epetraFwdOp =
rcp(
811 new PO(1,epetraOps,epetraOpsTransp,epetraOpsApplyMode));
816 aztec_epetra_epetraFwdOp.
get() != aztecFwdSolver->GetUserOperator()
821 aztecFwdSolver->SetUserOperator(
822 const_cast<Epetra_Operator*>(&*aztec_epetra_epetraFwdOp));
824 aztec_epetra_epetraFwdOp, AOOLOWSF_aztec_epetra_epetraFwdOp_str,
829 if( aztecAdjSolver.
get() ) {
830 epetraOpsTransp[0] = (
831 epetra_epetraFwdOpTransp==
NOTRANS
838 epetraOpsApplyMode[0] == PO::APPLY_MODE_APPLY
841 aztec_epetra_epetraAdjOp = epetra_epetraFwdOp;
844 aztec_epetra_epetraAdjOp =
rcp(
845 new PO(1,epetraOps,epetraOpsTransp,epetraOpsApplyMode));
847 aztecAdjSolver->SetUserOperator(
848 const_cast<Epetra_Operator*>(&*aztec_epetra_epetraAdjOp));
850 aztec_epetra_epetraAdjOp, AOOLOWSF_aztec_epetra_epetraAdjOp_str,
859 aztec_fwd_epetra_epetraPrecOp,
860 aztec_adj_epetra_epetraPrecOp;
861 bool setAztecPreconditioner =
false;
862 switch(localPrecType) {
869 case PT_AZTEC_FROM_OP: {
874 if( startingOver || !reusePrec ) {
876 rowmatrix_epetraFwdOp.
get()==NULL, std::logic_error,
877 "AztecOOLinearOpWithSolveFactory::initializeOp_impl(...): "
878 "Error, There is no preconditioner given by client, but the client "
879 "passed in an Epetra_Operator for the forward operator of type \'"
880 <<
typeName(*epetra_epetraFwdOp)<<
"\' that does not "
881 "support the Epetra_RowMatrix interface!"
884 epetra_epetraFwdOpTransp!=
NOTRANS, std::logic_error,
885 "AztecOOLinearOpWithSolveFactory::initializeOp_impl(...):"
886 " Error, There is no preconditioner given by client and the client "
887 "passed in an Epetra_RowMatrix for the forward operator but the "
888 "overall transpose is not NOTRANS and therefore we can can just "
889 "hand this over to aztec without making a copy which is not supported here!"
891 aztecFwdSolver->SetPrecMatrix(
892 const_cast<Epetra_RowMatrix*>(&*rowmatrix_epetraFwdOp));
894 rowmatrix_epetraFwdOp, AOOLOWSF_rowmatrix_epetraFwdOp_str,
898 setAztecPreconditioner =
true;
901 case PT_AZTEC_FROM_APPROX_FWD_MATRIX: {
906 if( startingOver || !reusePrec ) {
908 rowmatrix_epetraPrecOp.get()==NULL, std::logic_error
909 ,
"AztecOOLinearOpWithSolveFactor::initializeOp_impl(...): The client "
910 "passed in an Epetra_Operator for the preconditioner matrix of type \'"
911 <<
typeName(*epetra_epetraPrecOp)<<
"\' that does not "
912 "support the Epetra_RowMatrix interface!"
915 overall_epetra_epetraPrecOpTransp!=
NOTRANS, std::logic_error
916 ,
"AztecOOLinearOpWithSolveFactor::initializeOp_impl(...): Error, The client "
917 "passed in an Epetra_RowMatrix for the preconditoner matrix but the overall "
918 "transpose is not NOTRANS and therefore we can can just "
919 "hand this over to aztec without making a copy which is not supported here!"
921 aztecFwdSolver->SetPrecMatrix(
922 const_cast<Epetra_RowMatrix*>(&*rowmatrix_epetraPrecOp));
924 rowmatrix_epetraPrecOp, AOOLOWSF_rowmatrix_epetraPrecOp_str,
928 setAztecPreconditioner =
true;
931 case PT_FROM_PREC_OP: {
938 = { epetra_epetraPrecOp };
941 = { overall_epetra_epetraPrecOpTransp==
NOTRANS
947 theEpetraOpsApplyMode[]
949 ? PO::APPLY_MODE_APPLY_INVERSE
950 : PO::APPLY_MODE_APPLY };
957 aztec_fwd_epetra_epetraPrecOp = epetra_epetraPrecOp;
960 aztec_fwd_epetra_epetraPrecOp =
rcp(
new PO(1,theEpetraOps,theEpetraOpsTransp,theEpetraOpsApplyMode));
962 aztecFwdSolver->SetPrecOperator(
963 const_cast<Epetra_Operator*>(&*aztec_fwd_epetra_epetraPrecOp));
965 aztec_fwd_epetra_epetraPrecOp, AOOLOWSF_aztec_fwd_epetra_epetraPrecOp_str,
975 theEpetraOpsTransp[0] = (
976 overall_epetra_epetraPrecOpTransp==
NOTRANS
986 aztec_adj_epetra_epetraPrecOp = epetra_epetraPrecOp;
989 aztec_adj_epetra_epetraPrecOp =
rcp(
990 new PO(1,theEpetraOps,theEpetraOpsTransp,theEpetraOpsApplyMode));
992 aztecAdjSolver->SetPrecOperator(
993 const_cast<Epetra_Operator*>(&*aztec_adj_epetra_epetraPrecOp));
995 aztec_adj_epetra_epetraPrecOp, AOOLOWSF_aztec_adj_epetra_epetraPrecOp_str,
998 set_extra_data<bool>(
999 true, AOOLOWSF_setPrecondtionerOperator_str,
1012 if(setAztecPreconditioner) {
1013 if( startingOver || !reusePrec ) {
1014 double condNumEst = -1.0;
1017 set_extra_data<bool>(
1018 true, AOOLOWSF_constructedAztecPreconditoner_str,
1030 if(aztecAdjSolver.
get() && aztecAdjSolver->GetPrecOperator()) {
1032 fwdOp, fwdOpSrc,precUsed, prec.
get()!=NULL, approxFwdOpSrc,
1033 aztecFwdSolver,
true, aztecAdjSolver,
true, epetra_epetraFwdOpScalar
1038 fwdOp, fwdOpSrc, precUsed, prec.
get()!=NULL, approxFwdOpSrc,
1039 aztecFwdSolver,
true, null,
false, epetra_epetraFwdOpScalar
1047 aztecOp->setOStream(this->getOStream());
1048 if(!
is_null(this->getOverridingOStream()))
1049 aztecOp->setOverridingOStream(this->getOverridingOStream());
1050 aztecOp->setVerbLevel(this->getVerbLevel());
1052 #ifdef TEUCHOS_DEBUG
1058 *out <<
"\nLeaving Thyra::AztecOOLinearOpWithSolveFactory::initializeOp_impl(...) ...\n";
void uninitializeOp(LinearOpWithSolveBase< double > *Op, Teuchos::RCP< const LinearOpSourceBase< double > > *fwdOpSrc, Teuchos::RCP< const PreconditionerBase< double > > *prec, Teuchos::RCP< const LinearOpSourceBase< double > > *approxFwdOpSrc, ESupportSolveUse *supportSolveUse) const
void setAztecOOParameters(Teuchos::ParameterList *pl, AztecOO *solver)
Setup an AztecOO solver object with a set of parameters.
Teuchos::RCP< Teuchos::ParameterList > paramList_
void initializeAndReuseOp(const Teuchos::RCP< const LinearOpSourceBase< double > > &fwdOpSrc, LinearOpWithSolveBase< double > *Op) const
std::string typeName(const T &t)
bool is_null(const boost::shared_ptr< T > &p)
void initializeOp_impl(const Teuchos::RCP< const LinearOpSourceBase< double > > &fwdOpSrc, const Teuchos::RCP< const PreconditionerBase< double > > &prec, const Teuchos::RCP< const LinearOpSourceBase< double > > &approxFwdOpSrc, const bool reusePrec, LinearOpWithSolveBase< double > *Op) const
bool acceptsPreconditionerFactory() const
Returns true .
Teuchos::RCP< Teuchos::ParameterList > thisValidParamList_
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
T & get(ParameterList &l, const std::string &name)
double defaultFwdTolerance_
Teuchos::RCP< PreconditionerFactoryBase< double > > precFactory_
RCP< const LinearOpSourceBase< double > > extract_fwdOpSrc()
Extract the forward LinearOpBase<double> object so that it can be modified.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
bool isExternalPrec() const
Determine if the preconditioner was external or not.
AztecOOLinearOpWithSolveFactory(Teuchos::RCP< Teuchos::ParameterList > const ¶mList=Teuchos::null)
Construct uninitialized.
void initializeApproxPreconditionedOp(const Teuchos::RCP< const LinearOpSourceBase< double > > &fwdOpSrc, const Teuchos::RCP< const LinearOpSourceBase< double > > &approxFwdOpSrc, LinearOpWithSolveBase< double > *Op, const ESupportSolveUse supportSolveUse) const
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
void updateThisValidParamList()
bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
int defaultFwdMaxIterations_
double defaultAdjTolerance_
std::string description() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool isCompatible(const LinearOpSourceBase< double > &fwdOpSrc) const
bool isSublist(const std::string &name) const
T_To & dyn_cast(T_From &from)
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void unsetPreconditionerFactory(Teuchos::RCP< PreconditionerFactoryBase< double > > *precFactory, std::string *precFactoryName)
void initializeOp(const Teuchos::RCP< const LinearOpSourceBase< double > > &fwdOpSrc, LinearOpWithSolveBase< double > *Op, const ESupportSolveUse supportSolveUse) const
T * getPtr(const std::string &name)
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const ¶mList)
Teuchos::RCP< PreconditionerFactoryBase< double > > getPreconditionerFactory() const
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
ParameterList & setParameters(const ParameterList &source)
std::string precFactoryName_
void initializePreconditionedOp(const Teuchos::RCP< const LinearOpSourceBase< double > > &fwdOpSrc, const Teuchos::RCP< const PreconditionerBase< double > > &prec, LinearOpWithSolveBase< double > *Op, const ESupportSolveUse supportSolveUse) const
void uninitialize(RCP< const LinearOpBase< double > > *fwdOp=NULL, RCP< const LinearOpSourceBase< double > > *fwdOpSrc=NULL, RCP< const PreconditionerBase< double > > *prec=NULL, bool *isExternalPrec=NULL, RCP< const LinearOpSourceBase< double > > *approxFwdOpSrc=NULL, RCP< AztecOO > *aztecFwdSolver=NULL, bool *allowInexactFwdSolve=NULL, RCP< AztecOO > *aztecAdjSolver=NULL, bool *allowInexactAdjSolve=NULL, double *aztecSolverScalar=NULL)
Uninitialize.
RCP< const PreconditionerBase< double > > extract_prec()
Extract the preconditioner.
int defaultAdjMaxIterations_
void initialize(const RCP< const LinearOpBase< double > > &fwdOp, const RCP< const LinearOpSourceBase< double > > &fwdOpSrc, const RCP< const PreconditionerBase< double > > &prec, const bool isExternalPrec, const RCP< const LinearOpSourceBase< double > > &approxFwdOpSrc, const RCP< AztecOO > &aztecFwdSolver, const bool allowInexactFwdSolve=false, const RCP< AztecOO > &aztecAdjSolver=Teuchos::null, const bool allowInexactAdjSolve=false, const double aztecSolverScalar=1.0)
Sets up this object.
Teuchos::RCP< const Teuchos::ParameterList > getValidAztecOOParameters()
Return the list of all valid AztecOO parameters (to validate against).
void setPreconditionerFactory(const Teuchos::RCP< PreconditionerFactoryBase< double > > &precFactory, const std::string &precFactoryName)
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Teuchos::RCP< LinearOpWithSolveBase< double > > createOp() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Concrete LinearOpWithSolveBase subclass implemented using AztecOO.
static Teuchos::RCP< const Teuchos::ParameterList > generateAndGetValidParameters()
RCP< const LinearOpSourceBase< double > > extract_approxFwdOpSrc()
Extract the approximate forward LinearOpBase<double> object used to build the preconditioner.