Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
Thyra_AztecOOLinearOpWithSolveFactory.cpp
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 
43 #ifndef SUN_CXX
44 
45 
48 #include "Thyra_PreconditionerFactoryHelpers.hpp"
49 #include "Thyra_EpetraOperatorViewExtractorStd.hpp"
50 #include "Thyra_ScaledAdjointLinearOpBase.hpp"
51 #include "Thyra_EpetraLinearOpBase.hpp"
52 #include "Thyra_EpetraOperatorWrapper.hpp"
53 #include "EpetraExt_ProductOperator.h"
56 #include "Teuchos_dyn_cast.hpp"
57 #include "AztecOOParameterList.hpp"
58 
59 
60 namespace {
61 
62 
63 const std::string AOOLOWSF_epetraPrecOp_str
64 = "AOOLOWSF::epetraPrecOp";
65 const std::string AOOLOWSF_aztec_epetra_epetraFwdOp_str
66 = "AOOLOWSF::aztec_epetra_epetraFwdOp";
67 const std::string AOOLOWSF_aztec_epetra_epetraAdjOp_str
68 = "AOOLOWSF::aztec_epetra_epetraAdjOp";
69 const std::string AOOLOWSF_rowmatrix_epetraFwdOp_str
70 = "AOOLOWSF::rowmatrix_epetraFwdOp";
71 const std::string AOOLOWSF_rowmatrix_epetraPrecOp_str
72 = "AOOLOWSF::rowmatrix_epetraPrecOp";
73 const std::string AOOLOWSF_aztec_fwd_epetra_epetraPrecOp_str
74 = "AOOLOWSF::aztec_fwd_epetra_epetraPrecOp";
75 const std::string AOOLOWSF_aztec_adj_epetra_epetraPrecOp_str
76 = "AOOLOWSF::aztec_adj_epetra_epetraPrecOp";
77 const std::string AOOLOWSF_setPrecondtionerOperator_str
78 = "AOOLOWSF::setPrecondtionerOperator";
79 const std::string AOOLOWSF_constructedAztecPreconditoner_str
80 = "AOOLOWSF::constructedAztecPreconditoner";
81 
82 
83 const std::string ForwardSolve_name = "Forward Solve";
84 const std::string AdjointSolve_name = "Adjoint Solve";
85 const std::string MaxIterations_name = "Max Iterations";
86 const int MaxIterations_default = 400;
87 const std::string Tolerance_name = "Tolerance";
88 const double Tolerance_default = 1e-6;
89 const std::string OutputEveryRhs_name = "Output Every RHS";
90 const bool OutputEveryRhs_default = false;
91 const std::string AztecOO_Settings_name = "AztecOO Settings";
92 
93 
94 } // namespace
95 
96 
97 namespace Thyra {
98 
99 
100 // Constructors/initializers/accessors
101 
102 
104  Teuchos::RCP<Teuchos::ParameterList> const& paramList
105  )
106  :epetraFwdOpViewExtractor_(Teuchos::rcp(new EpetraOperatorViewExtractorStd()))
107  ,defaultFwdMaxIterations_(MaxIterations_default)
108  ,defaultFwdTolerance_(Tolerance_default)
109  ,defaultAdjMaxIterations_(MaxIterations_default)
110  ,defaultAdjTolerance_(Tolerance_default)
111  ,outputEveryRhs_(OutputEveryRhs_default)
112 {
114  if(paramList.get())
115  setParameterList(paramList);
116 }
117 
118 
119 // Overridden from LinearOpWithSolveFactoryBase
120 
121 
123 {
124  return true;
125 }
126 
127 
129  const Teuchos::RCP<PreconditionerFactoryBase<double> > &precFactory,
130  const std::string &precFactoryName
131  )
132 {
133  TEUCHOS_TEST_FOR_EXCEPT(!precFactory.get());
135  precFactoryValidPL = precFactory->getValidParameters();
136  const std::string _precFactoryName =
137  ( precFactoryName != ""
138  ? precFactoryName
139  : ( precFactoryValidPL.get()
140  ? precFactoryValidPL->name()
141  : "GENERIC PRECONDITIONER FACTORY"
142  )
143  );
144  precFactory_ = precFactory;
145  precFactoryName_ = _precFactoryName;
147 }
148 
149 
152 {
153  return precFactory_;
154 }
155 
156 
158  Teuchos::RCP<PreconditionerFactoryBase<double> > *precFactory,
159  std::string *precFactoryName
160  )
161 {
162  if(precFactory) *precFactory = precFactory_;
163  if(precFactoryName) *precFactoryName = precFactoryName_;
164  precFactory_ = Teuchos::null;
165  precFactoryName_ = "";
167 }
168 
169 
171  const LinearOpSourceBase<double> &fwdOpSrc
172  ) const
173 {
174  return epetraFwdOpViewExtractor_->isCompatible(*fwdOpSrc.getOp());
175 }
176 
177 
180 {
182 }
183 
184 
186  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc,
187  LinearOpWithSolveBase<double> *Op,
188  const ESupportSolveUse supportSolveUse
189  ) const
190 {
191  this->initializeOp_impl(fwdOpSrc,Teuchos::null,Teuchos::null,false,Op);
192 }
193 
194 
196  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc,
197  LinearOpWithSolveBase<double> *Op
198  ) const
199 {
200  this->initializeOp_impl(fwdOpSrc,Teuchos::null,Teuchos::null,true,Op);
201 }
202 
203 
205  const EPreconditionerInputType precOpType
206  ) const
207 {
208  const_cast<bool&>(useAztecPrec_) = (
209  paramList_.get()
210  &&
211  paramList_->sublist(ForwardSolve_name).sublist(AztecOO_Settings_name).get(
212  "Aztec Preconditioner","none"
213  )!="none"
214  );
215  switch(precOpType) {
216  case PRECONDITIONER_INPUT_TYPE_AS_OPERATOR:
217  return true;
218  break;
219  case PRECONDITIONER_INPUT_TYPE_AS_MATRIX:
220  return useAztecPrec_;
221  break;
222  default:
224  }
225  return PRECONDITIONER_INPUT_TYPE_AS_OPERATOR; // Should never be called!
226 }
227 
228 
230  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc,
231  const Teuchos::RCP<const PreconditionerBase<double> > &prec,
232  LinearOpWithSolveBase<double> *Op,
233  const ESupportSolveUse supportSolveUse
234  ) const
235 {
236  TEUCHOS_TEST_FOR_EXCEPT(prec.get()==NULL);
237  this->initializeOp_impl(fwdOpSrc,prec,Teuchos::null,false,Op);
238 }
239 
240 
242  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc,
243  const Teuchos::RCP<const LinearOpSourceBase<double> > &approxFwdOpSrc,
244  LinearOpWithSolveBase<double> *Op,
245  const ESupportSolveUse supportSolveUse
246  ) const
247 {
248  TEUCHOS_TEST_FOR_EXCEPT(approxFwdOpSrc.get()==NULL);
249  TEUCHOS_TEST_FOR_EXCEPT(approxFwdOpSrc->getOp().get()==NULL);
250  this->initializeOp_impl(fwdOpSrc,Teuchos::null,approxFwdOpSrc,false,Op);
251 }
252 
253 
255  LinearOpWithSolveBase<double> *Op,
256  Teuchos::RCP<const LinearOpSourceBase<double> > *fwdOpSrc,
257  Teuchos::RCP<const PreconditionerBase<double> > *prec,
258  Teuchos::RCP<const LinearOpSourceBase<double> > *approxFwdOpSrc,
259  ESupportSolveUse *supportSolveUse
260  ) const
261 {
262 #ifdef TEUCHOS_DEBUG
263  TEUCHOS_TEST_FOR_EXCEPT(Op==NULL);
264 #endif
267  // Extract and unset the fwdOP and approxFwdOp objects
269  _fwdOpSrc = aztecOp->extract_fwdOpSrc(), // Will be null if not initialized!
270  _approxFwdOpSrc = aztecOp->extract_approxFwdOpSrc(); // Will be null if not set
271  if(fwdOpSrc) *fwdOpSrc = _fwdOpSrc;
272  if(approxFwdOpSrc) *approxFwdOpSrc = _approxFwdOpSrc;
273  // Only extract and uset the prec object if it is external. If it is
274  // internal, then we need to hold on to this so that we can reinitialize it
275  // later.
276  if(aztecOp->isExternalPrec()) {
278  _prec = aztecOp->extract_prec(); // Will be null if not external preconditioner was set
279  if(prec) *prec = _prec;
280  }
281  // ToDo: Extract the Epetra_Operator views what where used to initialize the
282  // forward and adjoint solvers! This is needed to make this totally
283  // stateless.
284 }
285 
286 
287 // Overridden from ParameterListAcceptor
288 
289 
291  Teuchos::RCP<Teuchos::ParameterList> const& paramList
292  )
293 {
294  TEUCHOS_TEST_FOR_EXCEPT(paramList.get()==NULL);
295  paramList->validateParameters(*this->getValidParameters());
296  paramList_ = paramList;
297  //
298  outputEveryRhs_ = paramList_->get(OutputEveryRhs_name,OutputEveryRhs_default);
299  // Foward Solve parameters
301  &fwdSolvePL = paramList_->sublist(ForwardSolve_name);
302  defaultFwdMaxIterations_ = fwdSolvePL.get(MaxIterations_name,defaultFwdMaxIterations_);
303  defaultFwdTolerance_ = fwdSolvePL.get(Tolerance_name,defaultFwdTolerance_);
304  // Adjoint Solve parameters
305  if( !paramList_->getPtr<Teuchos::ParameterList>(AdjointSolve_name) ) {
306  // If adjoint solve sublist is not set, then use the forward solve parameters
307  paramList_->sublist(AdjointSolve_name).setParameters(fwdSolvePL);
308  }
310  &adjSolvePL = paramList_->sublist(AdjointSolve_name);
311  defaultAdjMaxIterations_ = adjSolvePL.get(MaxIterations_name,defaultAdjMaxIterations_);
312  defaultAdjTolerance_ = adjSolvePL.get(Tolerance_name,defaultAdjTolerance_);
313  //
314  if(precFactory_.get()) {
315  // Only reset the PF's PL if the sublist exists or the PF does not already
316  // have a PL. We don't want to overwrite an externally set PL for the PF
317  // if we don't have a nested sublist defined here!
318  const bool nestedPFSublistExists = paramList_->isSublist(precFactoryName_);
319  const bool alreadyHasSublist = !is_null(precFactory_->getParameterList());
320  if( nestedPFSublistExists || !alreadyHasSublist ) {
321  precFactory_->setParameterList(Teuchos::sublist(paramList_,precFactoryName_));
322  }
323  }
324  Teuchos::readVerboseObjectSublist(&*paramList_,this);
325 }
326 
327 
330 {
331  return paramList_;
332 }
333 
334 
337 {
339  paramList_ = Teuchos::null;
340  return _paramList;
341 }
342 
343 
346 {
347  return paramList_;
348 }
349 
350 
353 {
354  return thisValidParamList_;
355 }
356 
357 
358 // Public functions overridden from Teuchos::Describable
359 
360 
362 {
363  std::ostringstream oss;
364  oss << "Thyra::AztecOOLinearOpWithSolveFactory{";
365  oss << "precFactory=";
366  if(!is_null(precFactory_))
367  oss << precFactory_->description();
368  else
369  oss << "NULL";
370  oss << "}";
371  return oss.str();
372 }
373 
374 
375 // private
376 
377 
380 {
381  static Teuchos::RCP<Teuchos::ParameterList> validParamList;
382  if(validParamList.get()==NULL) {
383  validParamList = Teuchos::rcp(
384  new Teuchos::ParameterList("AztecOOLinearOpWithSolveFactory"));
385  validParamList->set(
386  OutputEveryRhs_name,OutputEveryRhs_default
387  ,"Determines if output is created for each individual RHS (true or 1) or if output\n"
388  "is just created for an entire set of RHSs (false or 0)."
389  );
391  aztecParamList = getValidAztecOOParameters();
393  &fwdSolvePL = validParamList->sublist(
394  ForwardSolve_name, false
395  ,"Gives the options for the forward solve."
396  );
397  fwdSolvePL.set(
398  Tolerance_name,Tolerance_default
399  ,"The tolerence used in the convergence check (see the convergence test\n"
400  "in the sublist \"" + AztecOO_Settings_name + "\")"
401  );
402  fwdSolvePL.set(
403  MaxIterations_name,MaxIterations_default
404  ,"The maximum number of iterations the AztecOO solver is allowed to perform."
405  );
406  fwdSolvePL.sublist(
407  AztecOO_Settings_name,false
408  ,"Sets the parameters on the AztecOO object itself."
409  ).setParameters(*aztecParamList);
411  &adjSolvePL = validParamList->sublist(
412  AdjointSolve_name, false
413  ,"The options for the adjoint solve.\n"
414  "If this sublist is missing then the parameters from the\n"
415  "\""+ForwardSolve_name+"\" sublist are used instead."
416  );
417  // Make the adjoint solve have same defaults as forward solve
418  adjSolvePL.setParameters(fwdSolvePL);
419  }
420  return validParamList;
421 }
422 
423 
425 {
428  );
429  if(precFactory_.get()) {
431  precFactoryValidParamList = precFactory_->getValidParameters();
432  if(precFactoryValidParamList.get()) {
434  *precFactoryValidParamList);
435  }
436  }
437  Teuchos::setupVerboseObjectSublist(&*thisValidParamList_);
438 }
439 
440 
442  const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc,
443  const Teuchos::RCP<const PreconditionerBase<double> > &prec,
444  const Teuchos::RCP<const LinearOpSourceBase<double> > &approxFwdOpSrc,
445  const bool reusePrec,
446  LinearOpWithSolveBase<double> *Op
447  ) const
448 {
449  using Teuchos::RCP;
450  using Teuchos::null;
451  using Teuchos::rcp;
452  using Teuchos::rcp_dynamic_cast;
453  using Teuchos::rcp_const_cast;
454  using Teuchos::set_extra_data;
455  using Teuchos::get_optional_extra_data;
456  using Teuchos::get_optional_nonconst_extra_data;
457  using Teuchos::outArg;
458  typedef EpetraExt::ProductOperator PO;
459 
460  const Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
461  const Teuchos::EVerbosityLevel verbLevel = this->getVerbLevel();
462  Teuchos::OSTab tab(out);
463  if(out.get() && static_cast<int>(verbLevel) > static_cast<int>(Teuchos::VERB_LOW))
464  *out << "\nEntering Thyra::AztecOOLinearOpWithSolveFactory::initializeOp_impl(...) ...\n";
465 
467  VOTSPF precFactoryOutputTempState(precFactory_,out,verbLevel);
468 
469 #ifdef TEUCHOS_DEBUG
470  TEUCHOS_TEST_FOR_EXCEPT(Op==NULL);
471  TEUCHOS_TEST_FOR_EXCEPT(fwdOpSrc.get()==NULL);
472  TEUCHOS_TEST_FOR_EXCEPT(fwdOpSrc->getOp().get()==NULL);
473 #endif
474 
475  //
476  // Determine whether the operators are EpetraLinearOp objects. If so, we're
477  // good to go. If not, we need to wrap it as an Epetra_Operator with some
478  // invasive code.
479  //
481  tmpFwdOp = fwdOpSrc->getOp(),
482  tmpApproxFwdOp = ( approxFwdOpSrc.get() ? approxFwdOpSrc->getOp() : Teuchos::null );
485  if ( dynamic_cast<const EpetraLinearOpBase*>(tmpFwdOp.get())!=0 )
486  {
487  fwdOp = tmpFwdOp;
488  approxFwdOp = tmpApproxFwdOp;
489  }
490  else
491  {
492  fwdOp = makeEpetraWrapper(tmpFwdOp);
493  if (
494  tmpApproxFwdOp.get()
495  &&
496  dynamic_cast<const EpetraLinearOpBase*>(&*tmpApproxFwdOp.get())
497  )
498  {
499  approxFwdOp = makeEpetraWrapper(tmpApproxFwdOp);
500  }
501  }
502 
503  //
504  // Get the AztecOOLinearOpWithSolve object
505  //
508 
509  //
510  // Unwrap and get the forward operator or matrix
511  //
512  Teuchos::RCP<const Epetra_Operator> epetra_epetraFwdOp;
513  EOpTransp epetra_epetraFwdOpTransp;
514  EApplyEpetraOpAs epetra_epetraFwdOpApplyAs;
515  EAdjointEpetraOp epetra_epetraFwdOpAdjointSupport;
516  double epetra_epetraFwdOpScalar;
517  epetraFwdOpViewExtractor_->getEpetraOpView(
518  fwdOp,
519  outArg(epetra_epetraFwdOp), outArg(epetra_epetraFwdOpTransp),
520  outArg(epetra_epetraFwdOpApplyAs), outArg(epetra_epetraFwdOpAdjointSupport),
521  outArg(epetra_epetraFwdOpScalar)
522  );
524  epetra_epetraFwdOp.get()==NULL, std::logic_error
525  ,"Error, The input fwdOp object must be fully initialized "
526  "before calling this function!"
527  );
528 
529  //
530  // Get the preconditioner object to use
531  //
534  if (prec.get()) {
535  // We will be used the passed in external preconditioner
536  precUsed = prec;
537  }
538  else if (precFactory_.get() ) {
539  // We will be creating our own preconditioner using an externally set
540  // preconditioner factory
541  myPrec =
542  ( !aztecOp->isExternalPrec()
543  ? Teuchos::rcp_const_cast<PreconditionerBase<double> >(
544  aztecOp->extract_prec())
545  : Teuchos::null
546  );
547  if(myPrec.get()) {
548  // ToDo: Get the forward operator and validate that it is the same
549  // operator that is used here!
550  }
551  else {
552  myPrec = precFactory_->createPrec();
553  }
554  precFactory_->initializePrec(fwdOpSrc,&*myPrec);
555  precUsed = myPrec;
556  }
557 
558  //
559  // Unwrap and get the preconditioner operator
560  //
561  RCP<const LinearOpBase<double> > rightPrecOp;
562  if (precUsed.get()) {
563  RCP<const LinearOpBase<double> > unspecified = precUsed->getUnspecifiedPrecOp();
564  RCP<const LinearOpBase<double> > left = precUsed->getLeftPrecOp();
565  RCP<const LinearOpBase<double> > right = precUsed->getRightPrecOp();
567  !( left.get() || right.get() || unspecified.get() ), std::logic_error
568  ,"Error, at least one preconditoner linear operator objects must be set!"
569  );
570  if(unspecified.get()) {
571  rightPrecOp = unspecified;
572  }
573  else {
574  // Set a left, right or split preconditioner
576  left.get(),std::logic_error
577  ,"Error, we can not currently handle a left"
578  " preconditioner with the AztecOO/Thyra adapters!"
579  );
580  rightPrecOp = right;
581  }
582  }
583  double wrappedPrecOpScalar = 0.0;
584  EOpTransp wrappedPrecOpTransp = NOTRANS;
585  RCP<const LinearOpBase<double> > wrappedPrecOp = null;
586  RCP<const EpetraLinearOpBase> epetraPrecOp;
587  Teuchos::RCP<const Epetra_Operator> epetra_epetraPrecOp;
588  EOpTransp epetra_epetraPrecOpTransp;
589  EApplyEpetraOpAs epetra_epetraPrecOpApplyAs;
590  EAdjointEpetraOp epetra_epetraPrecOpAdjointSupport;
591  EOpTransp overall_epetra_epetraPrecOpTransp;
592  if(rightPrecOp.get()) {
593  RCP<const LinearOpBase<double> > tmpWrappedPrecOp;
594  unwrap(
595  rightPrecOp,&wrappedPrecOpScalar,&wrappedPrecOpTransp,&tmpWrappedPrecOp);
596  if( dynamic_cast<const EpetraLinearOpBase*>(&*tmpWrappedPrecOp) ) {
597  wrappedPrecOp = tmpWrappedPrecOp;
598  }
599  else {
600  wrappedPrecOp = makeEpetraWrapper(tmpWrappedPrecOp);
601  }
602  epetraPrecOp = rcp_dynamic_cast<const EpetraLinearOpBase>(
603  wrappedPrecOp,true);
604  epetraPrecOp->getEpetraOpView(
605  outArg(epetra_epetraPrecOp), outArg(epetra_epetraPrecOpTransp),
606  outArg(epetra_epetraPrecOpApplyAs), outArg(epetra_epetraPrecOpAdjointSupport));
608  epetra_epetraPrecOp.get()==NULL,std::logic_error
609  ,"Error, The input prec object and its embedded preconditioner"
610  " operator must be fully initialized before calling this function!"
611  );
612  // 2007/08/10: rabartl: This next set_extra_data(...) call is likely to be
613  // setting up a circular reference! Since epetra_epetraPrecOp was
614  // gotten from epetraPrecOp, if you set epetraPrecOp as extra data
615  // on the RCP epetra_epetraPrecOp then you have a circular reference!
616  //set_extra_data(
617  // epetraPrecOp, AOOLOWSF_epetraPrecOp_str, &epetra_epetraPrecOp,
618  // Teuchos::POST_DESTROY, false );
619  overall_epetra_epetraPrecOpTransp
620  = trans_trans(
621  real_trans(wrappedPrecOpTransp),
622  real_trans(epetra_epetraPrecOpTransp)
623  );
624  }
625 
626  //
627  // Unwrap and get the approximate forward operator to be used to generate a
628  // preconditioner
629  //
630  if(approxFwdOp.get()) {
631  // Note, here we just use the same members data that would be set for an
632  // extenral preconditioner operator since it is not getting used.
633  unwrap(approxFwdOp,&wrappedPrecOpScalar,&wrappedPrecOpTransp,&wrappedPrecOp);
634  epetraPrecOp = rcp_dynamic_cast<const EpetraLinearOpBase>(
635  wrappedPrecOp,true);
636  epetraPrecOp->getEpetraOpView(
637  outArg(epetra_epetraPrecOp), outArg(epetra_epetraPrecOpTransp),
638  outArg(epetra_epetraPrecOpApplyAs), outArg(epetra_epetraPrecOpAdjointSupport)
639  );
641  epetra_epetraPrecOp.get()==NULL,std::logic_error
642  ,"Error, The input approxFwdOp object must be fully initialized"
643  " before calling this function!"
644  );
645  // 2007/08/10: rabartl: This next set_extra_data(...) call is likely to be
646  // setting up a circular reference! Since epetra_epetraPrecOp was
647  // gotten from epetraPrecOp, if you set epetraPrecOp as extra data
648  // on the RCP epetra_epetraPrecOp then you have a circular reference!
649  //set_extra_data(
650  // epetraPrecOp, AOOLOWSF_epetraPrecOp_str, &epetra_epetraPrecOp,
651  // Teuchos::POST_DESTROY, false
652  // );
653  overall_epetra_epetraPrecOpTransp
654  = trans_trans(
655  real_trans(wrappedPrecOpTransp),
656  real_trans(epetra_epetraPrecOpTransp)
657  );
658  }
659 
660  //
661  // Determine if the forward and preconditioner operators are a row matrices
662  // or not
663  //
665  rowmatrix_epetraFwdOp = rcp_dynamic_cast<const Epetra_RowMatrix>(
666  epetra_epetraFwdOp),
667  rowmatrix_epetraPrecOp = rcp_dynamic_cast<const Epetra_RowMatrix>(
668  epetra_epetraPrecOp);
669  //
670  // Determine the type of preconditoner
671  //
672  // Update useAztecPrec_, input value does not matter
673  this->supportsPreconditionerInputType(PRECONDITIONER_INPUT_TYPE_AS_MATRIX);
674  enum ELocalPrecType {
675  PT_NONE, PT_AZTEC_FROM_OP, PT_AZTEC_FROM_APPROX_FWD_MATRIX,
676  PT_FROM_PREC_OP
677  };
678  ELocalPrecType localPrecType;
679  if( precUsed.get()==NULL && approxFwdOp.get()==NULL && !useAztecPrec_ ) {
680  // No preconditioning at all!
681  localPrecType = PT_NONE;
682  }
683  else if( precUsed.get()==NULL && approxFwdOp.get()==NULL && useAztecPrec_ ) {
684  // We are using the forward matrix for the preconditioner using aztec
685  // preconditioners
686  localPrecType = PT_AZTEC_FROM_OP;
687  }
688  else if( approxFwdOp.get() && useAztecPrec_ ) {
689  // The preconditioner comes from the input as a matrix and we are using
690  // aztec preconditioners
691  localPrecType = PT_AZTEC_FROM_APPROX_FWD_MATRIX;
692  }
693  else if( precUsed.get() ) {
694  // The preconditioner comes as an external operator so let's use it as
695  // such
696  localPrecType = PT_FROM_PREC_OP;
697  }
698 
699  //
700  // Determine if aztecOp already contains solvers and if we need to
701  // reinitialize or not
702  //
703  RCP<AztecOO> aztecFwdSolver, aztecAdjSolver;
704  bool startingOver;
705  {
706  // Let's assume that fwdOp, prec and/or approxFwdOp are compatible with
707  // the already created AztecOO objects. If they are not, then the client
708  // should have created a new LOWSB object from scratch!
712  bool old_isExternalPrec;
714  Teuchos::RCP<AztecOO> old_aztecFwdSolver;
715  Teuchos::RCP<AztecOO> old_aztecAdjSolver;
716  double old_aztecSolverScalar;
717  aztecOp->uninitialize(
718  &old_fwdOp
719  ,&old_fwdOpSrc
720  ,&old_prec
721  ,&old_isExternalPrec
722  ,&old_approxFwdOpSrc
723  ,&old_aztecFwdSolver
724  ,NULL
725  ,&old_aztecAdjSolver
726  ,NULL
727  ,&old_aztecSolverScalar
728  );
729  if( old_aztecFwdSolver.get()==NULL ) {
730  // This has never been initialized before
731  startingOver = true;
732  }
733  else {
734  // Let's assume that fwdOp, prec and/or approxFwdOp are compatible with
735  // the already created AztecOO objects. If they are not, then the
736  // client should have created a new LOWSB object from scratch!
737  aztecFwdSolver = old_aztecFwdSolver;
738  aztecAdjSolver = old_aztecAdjSolver;
739  startingOver = false;
740  // We must wipe out the old preconditoner if we are not reusing the
741  // preconditioner
742  Ptr<bool> constructedAztecPreconditioner;
743  if(
744  !reusePrec
745  &&
746  !is_null(constructedAztecPreconditioner = get_optional_nonconst_extra_data<bool>(
747  aztecFwdSolver, "AOOLOWSF::constructedAztecPreconditoner") )
748  &&
749  *constructedAztecPreconditioner
750  )
751  {
752  aztecFwdSolver->DestroyPreconditioner();
753  *constructedAztecPreconditioner = false;
754  }
755  // We must see if we set an external preconditioner but will not do so
756  // again in which case we must blow away AztecOO and start over again!
757  Ptr<bool> setPreconditionerOperator;
758  if(
759  localPrecType != PT_FROM_PREC_OP
760  && !is_null( setPreconditionerOperator = get_optional_nonconst_extra_data<bool>(
761  aztecFwdSolver,"AOOLOWSF::setPreconditonerOperator") )
762  && *setPreconditionerOperator
763  )
764  {
765  // We must start over again since there is no way to unset an external
766  // preconditioner!
767  startingOver = true;
768  }
769  }
770  }
771 
772  //
773  // Create the AztecOO solvers if we are starting over
774  //
775  startingOver = true; // ToDo: Remove this and figure out why this is not working!
776  if(startingOver) {
777  // Forward solver
778  aztecFwdSolver = rcp(new AztecOO());
779  aztecFwdSolver->SetAztecOption(AZ_diagnostics,AZ_none); // This was turned off in NOX?
780  aztecFwdSolver->SetAztecOption(AZ_keep_info,1);
781  // Adjoint solver (if supported)
782  if(
783  epetra_epetraFwdOpAdjointSupport==EPETRA_OP_ADJOINT_SUPPORTED
784  &&
785  localPrecType!=PT_AZTEC_FROM_OP && localPrecType!=PT_AZTEC_FROM_APPROX_FWD_MATRIX
786  )
787  {
788  aztecAdjSolver = rcp(new AztecOO());
789  aztecAdjSolver->SetAztecOption(AZ_diagnostics,AZ_none);
790  //aztecAdjSolver->SetAztecOption(AZ_keep_info,1);
791  }
792  }
793 
794  //
795  // Set the options on the AztecOO solvers
796  //
797  if( startingOver ) {
798  if(paramList_.get())
800  &paramList_->sublist(ForwardSolve_name).sublist(AztecOO_Settings_name),
801  &*aztecFwdSolver
802  );
803  if(aztecAdjSolver.get() && paramList_.get())
805  &paramList_->sublist(AdjointSolve_name).sublist(AztecOO_Settings_name),
806  &*aztecAdjSolver
807  );
808  }
809 
810  //
811  // Process the forward operator
812  //
814  aztec_epetra_epetraFwdOp,
815  aztec_epetra_epetraAdjOp;
816  // Forward solve
818  epetraOps[]
819  = { epetra_epetraFwdOp };
821  epetraOpsTransp[]
822  = { epetra_epetraFwdOpTransp==NOTRANS ? Teuchos::NO_TRANS : Teuchos::TRANS };
823  PO::EApplyMode
824  epetraOpsApplyMode[]
825  = { epetra_epetraFwdOpApplyAs==EPETRA_OP_APPLY_APPLY
826  ? PO::APPLY_MODE_APPLY
827  : PO::APPLY_MODE_APPLY_INVERSE };
828  if(
829  epetraOpsTransp[0] == Teuchos::NO_TRANS
830  &&
831  epetraOpsApplyMode[0] == PO::APPLY_MODE_APPLY
832  )
833  {
834  aztec_epetra_epetraFwdOp = epetra_epetraFwdOp;
835  }
836  else
837  {
838  aztec_epetra_epetraFwdOp = rcp(
839  new PO(1,epetraOps,epetraOpsTransp,epetraOpsApplyMode));
840  }
841  if(
842  startingOver
843  ||
844  aztec_epetra_epetraFwdOp.get() != aztecFwdSolver->GetUserOperator()
845  )
846  {
847  // Here we will be careful not to reset the forward operator in fears that
848  // it will blow out the internally created stuff.
849  aztecFwdSolver->SetUserOperator(
850  const_cast<Epetra_Operator*>(&*aztec_epetra_epetraFwdOp));
851  set_extra_data(
852  aztec_epetra_epetraFwdOp, AOOLOWSF_aztec_epetra_epetraFwdOp_str,
853  Teuchos::inOutArg(aztecFwdSolver), Teuchos::POST_DESTROY, false
854  );
855  }
856  // Adjoint solve
857  if( aztecAdjSolver.get() ) {
858  epetraOpsTransp[0] = (
859  epetra_epetraFwdOpTransp==NOTRANS
862  );
863  if(
864  epetraOpsTransp[0] == Teuchos::NO_TRANS
865  &&
866  epetraOpsApplyMode[0] == PO::APPLY_MODE_APPLY
867  )
868  {
869  aztec_epetra_epetraAdjOp = epetra_epetraFwdOp;
870  }
871  else {
872  aztec_epetra_epetraAdjOp = rcp(
873  new PO(1,epetraOps,epetraOpsTransp,epetraOpsApplyMode));
874  }
875  aztecAdjSolver->SetUserOperator(
876  const_cast<Epetra_Operator*>(&*aztec_epetra_epetraAdjOp));
877  set_extra_data(
878  aztec_epetra_epetraAdjOp, AOOLOWSF_aztec_epetra_epetraAdjOp_str,
879  Teuchos::inOutArg(aztecAdjSolver), Teuchos::POST_DESTROY, false
880  );
881  }
882 
883  //
884  // Process the preconditioner
885  //
887  aztec_fwd_epetra_epetraPrecOp,
888  aztec_adj_epetra_epetraPrecOp;
889  bool setAztecPreconditioner = false;
890  switch(localPrecType) {
891  case PT_NONE: {
892  //
893  // No preconditioning at all!
894  //
895  break;
896  }
897  case PT_AZTEC_FROM_OP: {
898  //
899  // We are using the forward matrix for the preconditioner using aztec
900  // preconditioners
901  //
902  if( startingOver || !reusePrec ) {
904  rowmatrix_epetraFwdOp.get()==NULL, std::logic_error,
905  "AztecOOLinearOpWithSolveFactory::initializeOp_impl(...): "
906  "Error, There is no preconditioner given by client, but the client "
907  "passed in an Epetra_Operator for the forward operator of type \'"
908  <<typeName(*epetra_epetraFwdOp)<<"\' that does not "
909  "support the Epetra_RowMatrix interface!"
910  );
912  epetra_epetraFwdOpTransp!=NOTRANS, std::logic_error,
913  "AztecOOLinearOpWithSolveFactory::initializeOp_impl(...):"
914  " Error, There is no preconditioner given by client and the client "
915  "passed in an Epetra_RowMatrix for the forward operator but the "
916  "overall transpose is not NOTRANS and therefore we can can just "
917  "hand this over to aztec without making a copy which is not supported here!"
918  );
919  aztecFwdSolver->SetPrecMatrix(
920  const_cast<Epetra_RowMatrix*>(&*rowmatrix_epetraFwdOp));
921  set_extra_data(
922  rowmatrix_epetraFwdOp, AOOLOWSF_rowmatrix_epetraFwdOp_str,
923  Teuchos::inOutArg(aztecFwdSolver), Teuchos::POST_DESTROY, false
924  );
925  }
926  setAztecPreconditioner = true;
927  break;
928  }
929  case PT_AZTEC_FROM_APPROX_FWD_MATRIX: {
930  //
931  // The preconditioner comes from the input as a matrix and we are using
932  // aztec preconditioners
933  //
934  if( startingOver || !reusePrec ) {
936  rowmatrix_epetraPrecOp.get()==NULL, std::logic_error
937  ,"AztecOOLinearOpWithSolveFactor::initializeOp_impl(...): The client "
938  "passed in an Epetra_Operator for the preconditioner matrix of type \'"
939  <<typeName(*epetra_epetraPrecOp)<<"\' that does not "
940  "support the Epetra_RowMatrix interface!"
941  );
943  overall_epetra_epetraPrecOpTransp!=NOTRANS, std::logic_error
944  ,"AztecOOLinearOpWithSolveFactor::initializeOp_impl(...): Error, The client "
945  "passed in an Epetra_RowMatrix for the preconditoner matrix but the overall "
946  "transpose is not NOTRANS and therefore we can can just "
947  "hand this over to aztec without making a copy which is not supported here!"
948  );
949  aztecFwdSolver->SetPrecMatrix(
950  const_cast<Epetra_RowMatrix*>(&*rowmatrix_epetraPrecOp));
951  set_extra_data(
952  rowmatrix_epetraPrecOp, AOOLOWSF_rowmatrix_epetraPrecOp_str,
953  Teuchos::inOutArg(aztecFwdSolver), Teuchos::POST_DESTROY, false
954  );
955  }
956  setAztecPreconditioner = true;
957  break;
958  }
959  case PT_FROM_PREC_OP: {
960  //
961  // The preconditioner comes as an operator so let's use it as such
962  //
963  // Forward solve
965  epetraOps[]
966  = { epetra_epetraPrecOp };
968  epetraOpsTransp[]
969  = { overall_epetra_epetraPrecOpTransp==NOTRANS
971  : Teuchos::TRANS };
972  // Here we must toggle the apply mode since aztecoo applies the
973  // preconditioner using ApplyInverse(...)
974  PO::EApplyMode
975  epetraOpsApplyMode[]
976  = { epetra_epetraPrecOpApplyAs==EPETRA_OP_APPLY_APPLY
977  ? PO::APPLY_MODE_APPLY_INVERSE
978  : PO::APPLY_MODE_APPLY };
979  if(
980  epetraOpsTransp[0] == Teuchos::NO_TRANS
981  &&
982  epetra_epetraPrecOpApplyAs==EPETRA_OP_APPLY_APPLY_INVERSE
983  )
984  {
985  aztec_fwd_epetra_epetraPrecOp = epetra_epetraPrecOp;
986  }
987  else {
988  aztec_fwd_epetra_epetraPrecOp = rcp(new PO(1,epetraOps,epetraOpsTransp,epetraOpsApplyMode));
989  }
990  aztecFwdSolver->SetPrecOperator(
991  const_cast<Epetra_Operator*>(&*aztec_fwd_epetra_epetraPrecOp));
992  set_extra_data(
993  aztec_fwd_epetra_epetraPrecOp, AOOLOWSF_aztec_fwd_epetra_epetraPrecOp_str,
994  Teuchos::inOutArg(aztecFwdSolver), Teuchos::POST_DESTROY, false
995  );
996  // Adjoint solve
997  if(
998  aztecAdjSolver.get()
999  &&
1000  epetra_epetraPrecOpAdjointSupport == EPETRA_OP_ADJOINT_SUPPORTED
1001  )
1002  {
1003  epetraOpsTransp[0] = (
1004  overall_epetra_epetraPrecOpTransp==NOTRANS
1005  ? Teuchos::TRANS
1007  );
1008  if(
1009  epetraOpsTransp[0] == Teuchos::NO_TRANS
1010  &&
1011  epetra_epetraPrecOpApplyAs==EPETRA_OP_APPLY_APPLY_INVERSE
1012  )
1013  {
1014  aztec_adj_epetra_epetraPrecOp = epetra_epetraPrecOp;
1015  }
1016  else {
1017  aztec_adj_epetra_epetraPrecOp = rcp(
1018  new PO(1,epetraOps,epetraOpsTransp,epetraOpsApplyMode));
1019  }
1020  aztecAdjSolver->SetPrecOperator(
1021  const_cast<Epetra_Operator*>(&*aztec_adj_epetra_epetraPrecOp));
1022  set_extra_data(
1023  aztec_adj_epetra_epetraPrecOp, AOOLOWSF_aztec_adj_epetra_epetraPrecOp_str,
1024  Teuchos::inOutArg(aztecAdjSolver), Teuchos::POST_DESTROY, false
1025  );
1026  set_extra_data<bool>(
1027  true, AOOLOWSF_setPrecondtionerOperator_str,
1028  Teuchos::inOutArg(aztecFwdSolver), Teuchos::POST_DESTROY, false
1029  );
1030  }
1031  break;
1032  }
1033  default:
1035  }
1036 
1037  //
1038  // Initialize the interal aztec preconditioner
1039  //
1040  if(setAztecPreconditioner) {
1041  if( startingOver || !reusePrec ) {
1042  double condNumEst = -1.0;
1043  TEUCHOS_TEST_FOR_EXCEPT(0!=aztecFwdSolver->ConstructPreconditioner(condNumEst));
1044  //aztecFwdSolver->SetAztecOption(AZ_pre_calc, AZ_calc);
1045  set_extra_data<bool>(
1046  true, AOOLOWSF_constructedAztecPreconditoner_str,
1047  Teuchos::inOutArg(aztecFwdSolver), Teuchos::POST_DESTROY, false
1048  );
1049  }
1050  else {
1051  //aztecFwdSolver->SetAztecOption(AZ_pre_calc, AZ_reuse);
1052  }
1053  }
1054 
1055  //
1056  // Initialize the AztecOOLinearOpWithSolve object and set its options
1057  //
1058  if(aztecAdjSolver.get() && aztecAdjSolver->GetPrecOperator()) {
1059  aztecOp->initialize(
1060  fwdOp, fwdOpSrc,precUsed, prec.get()!=NULL, approxFwdOpSrc,
1061  aztecFwdSolver, true, aztecAdjSolver, true, epetra_epetraFwdOpScalar
1062  );
1063  }
1064  else {
1065  aztecOp->initialize(
1066  fwdOp, fwdOpSrc, precUsed, prec.get()!=NULL, approxFwdOpSrc,
1067  aztecFwdSolver, true, null, false, epetra_epetraFwdOpScalar
1068  );
1069  }
1070  aztecOp->fwdDefaultMaxIterations(defaultFwdMaxIterations_);
1071  aztecOp->fwdDefaultTol(defaultFwdTolerance_);
1072  aztecOp->adjDefaultMaxIterations(defaultAdjMaxIterations_);
1073  aztecOp->adjDefaultTol(defaultAdjTolerance_);
1074  aztecOp->outputEveryRhs(outputEveryRhs_);
1075  aztecOp->setOStream(this->getOStream());
1076  if(!is_null(this->getOverridingOStream()))
1077  aztecOp->setOverridingOStream(this->getOverridingOStream());
1078  aztecOp->setVerbLevel(this->getVerbLevel());
1079 
1080 #ifdef TEUCHOS_DEBUG
1081  if(paramList_.get())
1082  paramList_->validateParameters(*this->getValidParameters());
1083 #endif
1084 
1085  if(out.get() && static_cast<int>(verbLevel) > static_cast<int>(Teuchos::VERB_LOW))
1086  *out << "\nLeaving Thyra::AztecOOLinearOpWithSolveFactory::initializeOp_impl(...) ...\n";
1087 
1088 }
1089 
1090 
1091 } // namespace Thyra
1092 
1093 
1094 #endif // SUN_CXX
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.
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
Teuchos::RCP< Teuchos::ParameterList > thisValidParamList_
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
T & get(ParameterList &l, const std::string &name)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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 &paramList=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 > &paramList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
T * get() const
bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) 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 &paramList)
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)
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.
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)
Concrete LinearOpWithSolveBase subclass implemented using AztecOO.
NOTRANS
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.