|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Thyra: Interfaces and Support for Abstract Numerical Algorithms 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef THYRA_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP 00030 #define THYRA_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP 00031 00032 00033 #include "Thyra_LinearOpWithSolveBase.hpp" 00034 #include "Thyra_DefaultDiagonalLinearOp.hpp" 00035 #include "Thyra_LinearOpWithSolveBase.hpp" 00036 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp" 00037 #include "Teuchos_ConstNonconstObjectContainer.hpp" 00038 00039 00040 namespace Thyra { 00041 00042 00048 template<class Scalar> 00049 class DefaultMultiVectorLinearOpWithSolve 00050 : virtual public LinearOpWithSolveBase<Scalar> 00051 { 00052 public: 00053 00056 00058 DefaultMultiVectorLinearOpWithSolve(); 00059 00061 void nonconstInitialize( 00062 const RCP<LinearOpWithSolveBase<Scalar> > &lows, 00063 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange, 00064 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain 00065 ); 00066 00068 void initialize( 00069 const RCP<const LinearOpWithSolveBase<Scalar> > &lows, 00070 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange, 00071 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain 00072 ); 00073 00075 RCP<LinearOpWithSolveBase<Scalar> > 00076 getNonconstLinearOpWithSolve(); 00077 00079 RCP<const LinearOpWithSolveBase<Scalar> > 00080 getLinearOpWithSolve() const; 00081 00082 // 2007/05/24: rabartl: ToDo: Add a const version of the above function once 00083 // needed 00084 00086 void uninitialize(); 00087 00089 00092 00094 RCP< const VectorSpaceBase<Scalar> > range() const; 00095 00097 RCP< const VectorSpaceBase<Scalar> > domain() const; 00098 00100 RCP<const LinearOpBase<Scalar> > clone() const; 00101 00103 00104 protected: 00105 00109 bool opSupportedImpl(EOpTransp M_trans) const; 00111 void applyImpl( 00112 const EOpTransp M_trans, 00113 const MultiVectorBase<Scalar> &X, 00114 const Ptr<MultiVectorBase<Scalar> > &Y, 00115 const Scalar alpha, 00116 const Scalar beta 00117 ) const; 00119 00123 bool solveSupportsImpl(EOpTransp M_trans) const; 00125 bool solveSupportsSolveMeasureTypeImpl( 00126 EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const; 00128 SolveStatus<Scalar> solveImpl( 00129 const EOpTransp transp, 00130 const MultiVectorBase<Scalar> &B, 00131 const Ptr<MultiVectorBase<Scalar> > &X, 00132 const Ptr<const SolveCriteria<Scalar> > solveCriteria 00133 ) const; 00135 00136 private: 00137 00138 // ////////////////////////////// 00139 // Private types 00140 00141 typedef Teuchos::ConstNonconstObjectContainer<LinearOpWithSolveBase<Scalar> > CNLOWS; 00142 00143 // ////////////////////////////// 00144 // Private data members 00145 00146 CNLOWS lows_; 00147 RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > multiVecRange_; 00148 RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > multiVecDomain_; 00149 00150 // ////////////////////////////// 00151 // Private member functions 00152 00153 static void validateInitialize( 00154 const RCP<const LinearOpWithSolveBase<Scalar> > &lows, 00155 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange, 00156 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain 00157 ); 00158 00159 00160 }; 00161 00162 00167 template<class Scalar> 00168 RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> > 00169 multiVectorLinearOpWithSolve() 00170 { 00171 return Teuchos::rcp(new DefaultMultiVectorLinearOpWithSolve<Scalar>()); 00172 } 00173 00174 00179 template<class Scalar> 00180 RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> > 00181 nonconstMultiVectorLinearOpWithSolve( 00182 const RCP<LinearOpWithSolveBase<Scalar> > &lows, 00183 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange, 00184 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain 00185 ) 00186 { 00187 RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> > 00188 mvlows = Teuchos::rcp(new DefaultMultiVectorLinearOpWithSolve<Scalar>()); 00189 mvlows->initialize(lows,multiVecRange,multiVecDomain); 00190 return mvlows; 00191 } 00192 00193 00198 template<class Scalar> 00199 RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> > 00200 multiVectorLinearOpWithSolve( 00201 const RCP<const LinearOpWithSolveBase<Scalar> > &lows, 00202 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange, 00203 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain 00204 ) 00205 { 00206 RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> > 00207 mvlows = Teuchos::rcp(new DefaultMultiVectorLinearOpWithSolve<Scalar>()); 00208 mvlows->initialize(lows,multiVecRange,multiVecDomain); 00209 return mvlows; 00210 } 00211 00212 00213 } // end namespace Thyra 00214 00215 00216 #endif // THYRA_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP
1.7.4