Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DelayedLinearOpWithSolve_decl.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP
11 #define THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP
12 
13 
14 #include "Thyra_LinearOpWithSolveBase.hpp"
15 #include "Thyra_LinearOpSourceBase.hpp"
16 
17 
18 namespace Thyra {
19 
20 
32 template <class Scalar>
33 class DelayedLinearOpWithSolve : virtual public LinearOpWithSolveBase<Scalar>
34 {
35 public:
36 
39 
42 
44  void initialize(
45  const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
46  const RCP<const PreconditionerBase<Scalar> > &prec,
47  const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
48  const ESupportSolveUse supportSolveUse,
50  );
51 
54 
57 
60 
63 
65 
68 
70  std::string description() const;
71 
73 
76 
83 
85 
86 protected:
87 
91  void informUpdatedVerbosityState() const;
93 
97  virtual bool opSupportedImpl(EOpTransp M_trans) const;
99  virtual void applyImpl(
100  const EOpTransp M_trans,
101  const MultiVectorBase<Scalar> &X,
102  const Ptr<MultiVectorBase<Scalar> > &Y,
103  const Scalar alpha,
104  const Scalar beta
105  ) const;
107 
111  virtual bool solveSupportsImpl(EOpTransp M_trans) const;
114  EOpTransp M_trans, const SolveMeasureType& solveMeasureType
115  ) const;
118  const EOpTransp transp,
119  const MultiVectorBase<Scalar> &B,
120  const Ptr<MultiVectorBase<Scalar> > &X,
121  const Ptr<const SolveCriteria<Scalar> > solveCriteria
122  ) const;
124 
125 private:
126 
127  // //////////////////////
128  // Private data members
129 
132  RCP<const LinearOpSourceBase<Scalar> > approxFwdOpSrc_;
133  ESupportSolveUse supportSolveUse_;
135 
137 
138  mutable bool lows_is_valid_;
139  mutable RCP<LinearOpWithSolveBase<Scalar> > lows_;
140 
141  // ///////////////////////////
142  // Private member functions
143 
144  void updateSolver() const;
145 
146 };
147 
148 
153 template <class Scalar>
155 {
157 }
158 
159 
164 template <class Scalar>
167  const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
169  )
170 {
171  using Teuchos::null;
173  delayedLinearOpWithSolve<Scalar>();
174  dlows->initialize(fwdOpSrc, null, null, SUPPORT_SOLVE_UNSPECIFIED, lowsf);
175  return dlows;
176 }
177 
178 
179 } // namespace Thyra
180 
181 
182 #endif // THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP
How the output LOWSB object will be useded for solves in unspecified.
RCP< const PreconditionerBase< Scalar > > getPrec() const
Base class for all linear operators that can support a high-level solve operation.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
RCP< DelayedLinearOpWithSolve< Scalar > > delayedLinearOpWithSolve()
Nonmember constuctor.
Simple interface class to access a precreated preconditioner as one or more linear operators objects ...
RCP< const VectorSpaceBase< Scalar > > domain() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RCP< const LinearOpSourceBase< Scalar > > getFwdOpSrc() const
Interface for a collection of column vectors called a multi-vector.
Factory interface for creating LinearOpWithSolveBase objects from compatible LinearOpBase objects...
void informUpdatedVerbosityState() const
Overridden from Teuchos::VerboseObjectBase.
void initialize(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const PreconditionerBase< Scalar > > &prec, const RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, const ESupportSolveUse supportSolveUse, const RCP< LinearOpWithSolveFactoryBase< Scalar > > &lowsf)
Simple struct for the return status from a solve.
Base interface for objects that can return a linear operator.
RCP< DelayedLinearOpWithSolve< Scalar > > delayedLinearOpWithSolve(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< LinearOpWithSolveFactoryBase< Scalar > > &lowsf)
Nonmember constuctor.
RCP< const LinearOpSourceBase< Scalar > > getApproxFwdOpSrc() const
RCP< const VectorSpaceBase< Scalar > > range() const
ESupportSolveUse
Enum that specifies how a LinearOpWithSolveBase object will be used for solves after it is constructe...
virtual void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
virtual bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
virtual bool opSupportedImpl(EOpTransp M_trans) const
virtual bool solveSupportsImpl(EOpTransp M_trans) const
Simple struct that defines the requested solution criteria for a solve.
Delayed linear solver construction LinearOpWithSolveBase decorator class.
RCP< const LinearOpBase< Scalar > > clone() const