Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_DefaultAddedLinearOp_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_DEFAULT_ADDED_LINEAR_OP_DECL_HPP
11#define THYRA_DEFAULT_ADDED_LINEAR_OP_DECL_HPP
12
13
14#include "Thyra_AddedLinearOpBase.hpp"
15#include "Teuchos_ConstNonconstObjectContainer.hpp"
16
17
18namespace Thyra {
19
20
52template<class Scalar>
53class DefaultAddedLinearOp : virtual public AddedLinearOpBase<Scalar>
54{
55public:
56
59
67
74
80 DefaultAddedLinearOp(const ArrayView<const RCP<const LinearOpBase<Scalar> > > &Ops);
81
99 void initialize(const ArrayView<const RCP<LinearOpBase<Scalar> > > &Ops);
100
120 void initialize(const ArrayView<const RCP<const LinearOpBase<Scalar> > > &Ops);
121
128 void uninitialize();
129
131
134
136 int numOps() const;
138 bool opIsConst(const int k) const;
142 RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
143
145
148
153
158
161
163
166
170 std::string description() const;
171
179 void describe(
181 const Teuchos::EVerbosityLevel verbLevel
182 ) const;
183
185
186protected:
187
190
194 bool opSupportedImpl(EOpTransp M_trans) const;
195
197 void applyImpl(
198 const EOpTransp M_trans,
200 const Ptr<MultiVectorBase<Scalar> > &Y,
201 const Scalar alpha,
202 const Scalar beta
203 ) const;
204
206
207private:
208
209 std::vector<Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > > Ops_;
210
211 inline void assertInitialized() const;
212 inline std::string getClassName() const;
213 inline Ordinal getRangeDim() const;
214 inline Ordinal getDomainDim() const;
215
216 void validateOps();
217 void setupDefaultObjectLabel();
218
219 // Not defined and not to be called
222
223};
224
225
227template<class Scalar>
228inline
230defaultAddedLinearOp()
231{
233}
234
235
237template<class Scalar>
238inline
239RCP<DefaultAddedLinearOp<Scalar> >
240defaultAddedLinearOp(const ArrayView<const RCP<LinearOpBase<Scalar> > > &Ops)
241{
242 return Teuchos::rcp(new DefaultAddedLinearOp<Scalar>(Ops));
243}
244
245
247template<class Scalar>
248inline
249RCP<DefaultAddedLinearOp<Scalar> >
250defaultAddedLinearOp(const ArrayView<const RCP<const LinearOpBase<Scalar> > > &Ops)
251{
252 return Teuchos::rcp(new DefaultAddedLinearOp<Scalar>(Ops));
253}
254
255
260template<class Scalar>
261RCP<LinearOpBase<Scalar> >
263 const RCP<LinearOpBase<Scalar> > &A,
264 const RCP<LinearOpBase<Scalar> > &B,
265 const std::string &label = ""
266 );
267
268
273template<class Scalar>
276 const RCP<const LinearOpBase<Scalar> > &A,
277 const RCP<const LinearOpBase<Scalar> > &B,
278 const std::string &label = ""
279 );
280
281
286template<class Scalar>
289 const RCP<LinearOpBase<Scalar> > &A,
290 const RCP<LinearOpBase<Scalar> > &B,
291 const std::string &label = ""
292 );
293
294
299template<class Scalar>
302 const RCP<const LinearOpBase<Scalar> > &A,
303 const RCP<const LinearOpBase<Scalar> > &B,
304 const std::string &label = ""
305 );
306
307
308} // end namespace Thyra
309
310
311#endif // THYRA_DEFAULT_ADDED_LINEAR_OP_DECL_HPP
Interface class for implicitly added linear operators.
Concrete composite LinearOpBase subclass that creates an implicitly added linear operator out of one ...
RCP< LinearOpBase< Scalar > > nonconstSubtract(const RCP< LinearOpBase< Scalar > > &A, const RCP< LinearOpBase< Scalar > > &B, const std::string &label="")
Form an implicit subtraction of two linear operators: M = A - B.
RCP< LinearOpBase< Scalar > > getNonconstOp(const int k)
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
std::string description() const
Prints just the name DefaultAddedLinearOp along with the overall dimensions and the number of constit...
RCP< const VectorSpaceBase< Scalar > > domain() const
Returns this->getOp(this->numOps()-1).domain() if <t>this->numOps() > 0 and returns Teuchos::null oth...
RCP< LinearOpBase< Scalar > > nonconstAdd(const RCP< LinearOpBase< Scalar > > &A, const RCP< LinearOpBase< Scalar > > &B, const std::string &label="")
Form an implicit addition of two linear operators: M = A + B.
RCP< const VectorSpaceBase< Scalar > > range() const
Returns this->getOp(0).range() if <t>this->numOps() > 0 and returns Teuchos::null otherwise.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent linear operators.
DefaultAddedLinearOp()
Constructs to uninitialized.
void initialize(const ArrayView< const RCP< LinearOpBase< Scalar > > > &Ops)
Initialize given a list of non-const linear operators.
RCP< const LinearOpBase< Scalar > > add(const RCP< const LinearOpBase< Scalar > > &A, const RCP< const LinearOpBase< Scalar > > &B, const std::string &label="")
Form an implicit addition of two linear operators: M = A + B.
bool opSupportedImpl(EOpTransp M_trans) const
Returns true only if all constituent operators support M_trans.
RCP< const LinearOpBase< Scalar > > subtract(const RCP< const LinearOpBase< Scalar > > &A, const RCP< const LinearOpBase< Scalar > > &B, const std::string &label="")
Form an implicit subtraction of two linear operators: M = A - B.
RCP< const LinearOpBase< Scalar > > clone() const
RCP< const LinearOpBase< Scalar > > getOp(const int k) const
Base class for all linear operators.
Interface for a collection of column vectors called a multi-vector.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)