Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_ReusePreconditionerFactory.hpp
Go to the documentation of this file.
1 //@HEADER
2 // *****************************************************************************
3 // Tempus: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef Thyra_ReusePreconditionerFactory_hpp
11 #define Thyra_ReusePreconditionerFactory_hpp
12 
13 #include "Thyra_PreconditionerFactoryBase.hpp"
14 
15 namespace Thyra {
16 
20 template <class Scalar>
22  : virtual public PreconditionerFactoryBase<Scalar> {
23  public:
26 
29 
31  {
32 #ifdef TEUCHOS_DEBUG
34 #endif
35  prec_ = prec;
36  }
37 
38  RCP<PreconditionerBase<Scalar> > getNonconstPreconditioner() { return prec_; }
39 
40  RCP<const PreconditionerBase<Scalar> > getPreconditioner() const
41  {
42  return prec_;
43  }
44 
45  void uninitialize() { prec_ = Teuchos::null; }
46 
49 
50  std::string description() const
51  {
52  std::ostringstream oss;
53  oss << this->Teuchos::Describable::description() << "{"
54  << "prec=";
55  if (!is_null(prec_))
56  oss << prec_->description();
57  else
58  oss << "NULL";
59  oss << "}";
60  return oss.str();
61  }
62 
64 
68 
69  void setParameterList(RCP<ParameterList> const & /* paramList */) {}
70 
71  RCP<ParameterList> getNonconstParameterList() { return Teuchos::null; }
72 
73  RCP<ParameterList> unsetParameterList() { return Teuchos::null; }
74 
75  RCP<const ParameterList> getParameterList() const { return Teuchos::null; }
76 
77  RCP<const ParameterList> getValidParameters() const
78  {
79  return rcp(new ParameterList);
80  }
81 
83 
85 
88 
89  bool isCompatible(const LinearOpSourceBase<Scalar> & /* fwdOpSrc */) const
90  {
91  return false;
92  }
93 
94  RCP<PreconditionerBase<Scalar> > createPrec() const { return prec_; }
95 
97  const RCP<const LinearOpSourceBase<Scalar> > & /* fwdOpSrc */,
98  PreconditionerBase<Scalar> * /* precOp */,
99  const ESupportSolveUse /* supportSolveUse */ =
101  {
102  }
103 
105  RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
106  ESupportSolveUse *supportSolveUse = NULL) const
107  {
108  }
109 
111 
112  private:
113  // //////////////////////////////
114  // Private data members
115 
116  RCP<PreconditionerBase<Scalar> > prec_;
117 };
118 
123 template <class Scalar>
124 RCP<ReusePreconditionerFactory<Scalar> > reusePreconditionerFactory()
125 {
127 }
128 
133 template <class Scalar>
134 RCP<ReusePreconditionerFactory<Scalar> > reusePreconditionerFactory(
135  const RCP<PreconditionerBase<Scalar> > &prec)
136 {
137  RCP<ReusePreconditionerFactory<Scalar> > fac =
139  fac->initialize(prec);
140  return fac;
141 }
142 
143 } // end namespace Thyra
144 
145 #endif
Concrete PreconditionerFactoryBase subclass that just returns an already created/initialized precondi...
RCP< const ParameterList > getParameterList() const
RCP< ReusePreconditionerFactory< Scalar > > reusePreconditionerFactory(const RCP< PreconditionerBase< Scalar > > &prec)
Nonmember constructor function.
bool is_null(const boost::shared_ptr< T > &p)
void setParameterList(RCP< ParameterList > const &)
ReusePreconditionerFactory()
Construct to uninitialized.
void initialize(const RCP< PreconditionerBase< Scalar > > &prec)
RCP< const ParameterList > getValidParameters() const
Teuchos::RCP< PreconditionerBase< Scalar > > prec(const PreconditionerFactoryBase< Scalar > &precFactory, const Teuchos::RCP< const LinearOpBase< Scalar > > &fwdOp, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED)
void initializePrec(const RCP< const LinearOpSourceBase< Scalar > > &, PreconditionerBase< Scalar > *, const ESupportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual std::string description() const
RCP< ReusePreconditionerFactory< Scalar > > reusePreconditionerFactory()
Nonmember constructor function.
RCP< PreconditionerBase< Scalar > > getNonconstPreconditioner()
ESupportSolveUse
RCP< PreconditionerBase< Scalar > > createPrec() const
RCP< const PreconditionerBase< Scalar > > getPreconditioner() const
bool isCompatible(const LinearOpSourceBase< Scalar > &) const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
void uninitializePrec(PreconditionerBase< Scalar > *, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc=NULL, ESupportSolveUse *supportSolveUse=NULL) const