Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultMultipliedLinearOp_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) 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 (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
43 #define THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
44 
45 #include "Thyra_MultipliedLinearOpBase.hpp"
46 #include "Teuchos_ConstNonconstObjectContainer.hpp"
47 
48 
49 namespace Thyra {
50 
51 
119 template<class Scalar>
120 class DefaultMultipliedLinearOp : virtual public MultipliedLinearOpBase<Scalar>
121 {
122 public:
123 
126 
134 
152  void initialize(const ArrayView<const RCP<LinearOpBase<Scalar> > > &Ops);
153 
171  void initialize(const ArrayView<const RCP<const LinearOpBase<Scalar> > > &Ops );
172 
179  void uninitialize();
180 
182 
185 
187  int numOps() const;
189  bool opIsConst(const int k) const;
193  RCP<const LinearOpBase<Scalar> > getOp(const int k) const;
194 
196 
199 
204 
209 
212 
214 
217 
221  std::string description() const;
222 
230  void describe(
232  const Teuchos::EVerbosityLevel verbLevel
233  ) const;
234 
236 
237 protected:
238 
241 
245  bool opSupportedImpl(EOpTransp M_trans) const;
246 
248  void applyImpl(
249  const EOpTransp M_trans,
250  const MultiVectorBase<Scalar> &X,
251  const Ptr<MultiVectorBase<Scalar> > &Y,
252  const Scalar alpha,
253  const Scalar beta
254  ) const;
255 
257 
258 public:
259 
260 private:
261 
263 
264  inline void assertInitialized() const;
265  inline std::string getClassName() const;
266  inline Ordinal getRangeDim() const;
267  inline Ordinal getDomainDim() const;
268 
269  void validateOps();
270  void setupDefaultObjectLabel();
271 
272  // Not defined and not to be called
275 
276 };
277 
278 
283 template<class Scalar>
284 inline
287 {
289 }
290 
291 
296 template<class Scalar>
299 {
300  RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
301  dmlo->initialize(Ops);
302  return dmlo;
303 }
304 
305 
310 template<class Scalar>
313 {
314  RCP<DefaultMultipliedLinearOp<Scalar> > dmlo = defaultMultipliedLinearOp<Scalar>();
315  dmlo->initialize(Ops);
316  return dmlo;
317 }
318 
319 
325 template<class Scalar>
327 nonconstMultiply(
328  const RCP<LinearOpBase<Scalar> > &A,
329  const RCP<LinearOpBase<Scalar> > &B,
330  const std::string &M_label = ""
331  );
332 
333 
339 template<class Scalar>
341 multiply(
342  const RCP<const LinearOpBase<Scalar> > &A,
343  const RCP<const LinearOpBase<Scalar> > &B,
344  const std::string &M_label = ""
345  );
346 
347 
353 template<class Scalar>
355 multiply(
356  const RCP<const LinearOpBase<Scalar> > &A,
357  const RCP<const LinearOpBase<Scalar> > &B,
358  const RCP<const LinearOpBase<Scalar> > &C,
359  const std::string &M_label = ""
360  );
361 
362 
363 } // end namespace Thyra
364 
365 
366 #endif // THYRA_DEFAULT_MULTIPLIED_LINEAR_OP_DECL_HPP
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
RCP< const VectorSpaceBase< Scalar > > domain() const
Returns this-&gt;getOp(this-&gt;numOps()-1).domain() if &lt;t&gt;this-&gt;numOps() &gt; 0 and returns Teuchos::null oth...
DefaultMultipliedLinearOp()
Constructs to uninitialized.
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp(const ArrayView< const RCP< const LinearOpBase< Scalar > > > &Ops)
Nonmember constructor.
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp()
Nonmember constructor.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent linear operators.
void initialize(const ArrayView< const RCP< LinearOpBase< Scalar > > > &Ops)
Initialize given a list of non-const linear operators.
Interface class for implicitly multiplied linear operators.
bool opSupportedImpl(EOpTransp M_trans) const
Returns true only if all constituent operators support M_trans.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
RCP< const LinearOpBase< Scalar > > clone() const
RCP< LinearOpBase< Scalar > > getNonconstOp(const int k)
Concrete composite LinearOpBase subclass that creates an implicitly multiplied linear operator out of...
RCP< DefaultMultipliedLinearOp< Scalar > > defaultMultipliedLinearOp(const ArrayView< const RCP< LinearOpBase< Scalar > > > &Ops)
Nonmember constructor.
Base class for all linear operators.
std::string description() const
Prints just the name DefaultMultipliedLinearOp along with the overall dimensions and the number of co...
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
RCP< const LinearOpBase< Scalar > > getOp(const int k) const
RCP< const VectorSpaceBase< Scalar > > range() const
Returns this-&gt;getOp(0).range() if &lt;t&gt;this-&gt;numOps() &gt; 0 and returns Teuchos::null otherwise...