Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultMultiVectorLinearOpWithSolve_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_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP
43 #define THYRA_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP
44 
45 
46 #include "Thyra_LinearOpWithSolveBase.hpp"
47 #include "Thyra_DefaultDiagonalLinearOp.hpp"
48 #include "Thyra_LinearOpWithSolveBase.hpp"
49 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
50 #include "Teuchos_ConstNonconstObjectContainer.hpp"
51 
52 
53 namespace Thyra {
54 
55 
61 template<class Scalar>
63  : virtual public LinearOpWithSolveBase<Scalar>
64 {
65 public:
66 
69 
72 
74  void nonconstInitialize(
75  const RCP<LinearOpWithSolveBase<Scalar> > &lows,
76  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
77  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
78  );
79 
81  void initialize(
82  const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
83  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
84  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
85  );
86 
90 
93  getLinearOpWithSolve() const;
94 
95  // 2007/05/24: rabartl: ToDo: Add a const version of the above function once
96  // needed
97 
99  void uninitialize();
100 
102 
105 
108 
111 
114 
116 
117 protected:
118 
122  bool opSupportedImpl(EOpTransp M_trans) const;
124  void applyImpl(
125  const EOpTransp M_trans,
126  const MultiVectorBase<Scalar> &X,
127  const Ptr<MultiVectorBase<Scalar> > &Y,
128  const Scalar alpha,
129  const Scalar beta
130  ) const;
132 
136  bool solveSupportsImpl(EOpTransp M_trans) const;
139  EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const;
142  const EOpTransp transp,
143  const MultiVectorBase<Scalar> &B,
144  const Ptr<MultiVectorBase<Scalar> > &X,
145  const Ptr<const SolveCriteria<Scalar> > solveCriteria
146  ) const;
148 
149 private:
150 
151  // //////////////////////////////
152  // Private types
153 
155 
156  // //////////////////////////////
157  // Private data members
158 
159  CNLOWS lows_;
162 
163  // //////////////////////////////
164  // Private member functions
165 
166  static void validateInitialize(
167  const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
168  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
169  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
170  );
171 
172 
173 };
174 
175 
180 template<class Scalar>
183 {
185 }
186 
187 
192 template<class Scalar>
195  const RCP<LinearOpWithSolveBase<Scalar> > &lows,
196  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
197  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
198  )
199 {
202  mvlows->nonconstInitialize(lows,multiVecRange,multiVecDomain);
203  return mvlows;
204 }
205 
206 
211 template<class Scalar>
214  const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
215  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
216  const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
217  )
218 {
221  mvlows->initialize(lows,multiVecRange,multiVecDomain);
222  return mvlows;
223 }
224 
225 
226 } // end namespace Thyra
227 
228 
229 #endif // THYRA_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP
Implicit concrete LinearOpWithSolveBase subclass that takes a flattended out multi-vector and perform...
Base class for all linear operators that can support a high-level solve operation.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RCP< const LinearOpWithSolveBase< Scalar > > getLinearOpWithSolve() const
Interface for a collection of column vectors called a multi-vector.
void nonconstInitialize(const RCP< LinearOpWithSolveBase< Scalar > > &lows, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
Simple struct for the return status from a solve.
Standard concrete implementation of a product vector space that creates product vectors fromed implic...
SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
RCP< DefaultMultiVectorLinearOpWithSolve< Scalar > > nonconstMultiVectorLinearOpWithSolve(const RCP< LinearOpWithSolveBase< Scalar > > &lows, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
Nonmember constructor function.
RCP< DefaultMultiVectorLinearOpWithSolve< Scalar > > multiVectorLinearOpWithSolve()
Nonmember constructor function.
Simple struct that defines the requested solution criteria for a solve.
RCP< DefaultMultiVectorLinearOpWithSolve< Scalar > > multiVectorLinearOpWithSolve(const RCP< const LinearOpWithSolveBase< Scalar > > &lows, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
Nonmember constructor function.
bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
void initialize(const RCP< const LinearOpWithSolveBase< Scalar > > &lows, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)