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: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Thyra_ReusePreconditionerFactory_hpp
10 #define Thyra_ReusePreconditionerFactory_hpp
11 
12 #include "Thyra_PreconditionerFactoryBase.hpp"
13 
14 namespace Thyra {
15 
19 template<class Scalar>
21  : virtual public PreconditionerFactoryBase<Scalar>
22 {
23 public:
24 
27 
30 
31  void initialize(
32  const RCP<PreconditionerBase<Scalar> > &prec
33  ) {
34 #ifdef TEUCHOS_DEBUG
36 #endif
37  prec_ = prec;
38  }
39 
40  RCP<PreconditionerBase<Scalar> >
42 
43  RCP<const PreconditionerBase<Scalar> >
44  getPreconditioner() const { return prec_; }
45 
46  void uninitialize() {
47  prec_ = Teuchos::null;
48  }
49 
52 
53  std::string description() const
54  {
55  std::ostringstream oss;
57  << "{"
58  << "prec=";
59  if (!is_null(prec_))
60  oss << prec_->description();
61  else
62  oss << "NULL";
63  oss << "}";
64  return oss.str();
65  }
66 
68 
71 
72  void setParameterList(RCP<ParameterList> const& /* paramList */)
73  {
74  }
75 
76  RCP<ParameterList> getNonconstParameterList()
77  {
78  return Teuchos::null;
79  }
80 
81  RCP<ParameterList> unsetParameterList()
82  {
83  return Teuchos::null;
84  }
85 
86  RCP<const ParameterList> getParameterList() const
87  {
88  return Teuchos::null;
89  }
90 
91  RCP<const ParameterList> getValidParameters() const
92  {
93  return rcp(new ParameterList);
94  }
95 
97 
99 
102 
103  bool isCompatible(const LinearOpSourceBase<Scalar> &/* fwdOpSrc */) const
104  { return false; }
105 
106  RCP<PreconditionerBase<Scalar> > createPrec() const
107  { return prec_; }
108 
110  const RCP<const LinearOpSourceBase<Scalar> > &/* fwdOpSrc */,
111  PreconditionerBase<Scalar> * /* precOp */,
112  const ESupportSolveUse /* supportSolveUse */ = SUPPORT_SOLVE_UNSPECIFIED
113  ) const
114  {
115  }
116 
118  PreconditionerBase<Scalar> * /* precOp */,
119  RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
120  ESupportSolveUse *supportSolveUse = NULL
121  ) const
122  {
123  }
124 
126 
127 private:
128 
129  // //////////////////////////////
130  // Private data members
131 
132  RCP< PreconditionerBase<Scalar> > prec_;
133 
134 };
135 
140 template<class Scalar>
141 RCP<ReusePreconditionerFactory<Scalar> >
143 {
145 }
146 
151 template<class Scalar>
152 RCP<ReusePreconditionerFactory<Scalar> >
154  const RCP<PreconditionerBase<Scalar> > &prec
155  )
156 {
157  RCP<ReusePreconditionerFactory<Scalar> >
159  fac->initialize(prec);
160  return fac;
161 }
162 
163 } // end namespace Thyra
164 
165 #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