|
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 00030 #ifndef THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DECL_HPP 00031 #define THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DECL_HPP 00032 00033 00034 #include "Thyra_LinearOpWithSolveBase.hpp" 00035 #include "Teuchos_ConstNonconstObjectContainer.hpp" 00036 00037 00038 namespace Thyra { 00039 00040 00046 template<class Scalar> 00047 class DefaultAdjointLinearOpWithSolve : virtual public LinearOpWithSolveBase<Scalar> 00048 { 00049 public: 00050 00053 00055 DefaultAdjointLinearOpWithSolve(); 00056 00058 void initialize( const RCP<LinearOpWithSolveBase<Scalar> > &lows, 00059 const EOpTransp transp ); 00060 00062 void initialize( const RCP<const LinearOpWithSolveBase<Scalar> > &lows, 00063 const EOpTransp transp ); 00064 00066 const RCP<LinearOpWithSolveBase<Scalar> > getNonconstOp(); 00067 00069 const RCP<const LinearOpWithSolveBase<Scalar> > getOp() const; 00070 00072 00075 00077 RCP<const VectorSpaceBase<Scalar> > range() const; 00079 RCP<const VectorSpaceBase<Scalar> > domain() const; 00080 00082 00083 protected: 00084 00088 bool opSupportedImpl(EOpTransp M_trans) const; 00090 void applyImpl( 00091 const EOpTransp M_trans, 00092 const MultiVectorBase<Scalar> &X, 00093 const Ptr<MultiVectorBase<Scalar> > &Y, 00094 const Scalar alpha, 00095 const Scalar beta 00096 ) const; 00098 00102 bool solveSupportsImpl(EOpTransp M_trans) const; 00104 bool solveSupportsSolveMeasureTypeImpl( 00105 EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const; 00107 SolveStatus<Scalar> solveImpl( 00108 const EOpTransp transp, 00109 const MultiVectorBase<Scalar> &B, 00110 const Ptr<MultiVectorBase<Scalar> > &X, 00111 const Ptr<const SolveCriteria<Scalar> > solveCriteria 00112 ) const; 00114 00115 private: 00116 00117 // ////////////////////////// 00118 // Private types 00119 00120 typedef Teuchos::ConstNonconstObjectContainer<LinearOpWithSolveBase<Scalar> > 00121 CNCLOWS; 00122 00123 // ///////////////////////// 00124 // Private data members 00125 00126 CNCLOWS lows_; 00127 EOpTransp transp_; 00128 00129 }; 00130 00131 00136 template<class Scalar> 00137 RCP<DefaultAdjointLinearOpWithSolve<Scalar> > 00138 defaultAdjointLinearOpWithSolve( 00139 const RCP<const LinearOpWithSolveBase<Scalar> > &lows, 00140 const EOpTransp transp ) 00141 { 00142 RCP<DefaultAdjointLinearOpWithSolve<Scalar> > 00143 dalows = Teuchos::rcp(new DefaultAdjointLinearOpWithSolve<Scalar>); 00144 dalows->initialize(lows, transp); 00145 return dalows; 00146 } 00147 00148 00153 template<class Scalar> 00154 RCP<DefaultAdjointLinearOpWithSolve<Scalar> > 00155 defaultAdjointLinearOpWithSolveNonconst( 00156 const RCP<LinearOpWithSolveBase<Scalar> > &lows, 00157 const EOpTransp transp ) 00158 { 00159 RCP<DefaultAdjointLinearOpWithSolve<Scalar> > 00160 dalows = Teuchos::rcp(new DefaultAdjointLinearOpWithSolve<Scalar>); 00161 dalows->initialize(lows, transp); 00162 return dalows; 00163 } 00164 00165 00170 template<class Scalar> 00171 RCP<const LinearOpWithSolveBase<Scalar> > 00172 adjointLows( const RCP<const LinearOpWithSolveBase<Scalar> > &lows ) 00173 { 00174 return defaultAdjointLinearOpWithSolve<Scalar>(lows, CONJTRANS); 00175 } 00176 00177 00182 template<class Scalar> 00183 RCP<LinearOpWithSolveBase<Scalar> > 00184 nonconstAdjointLows( const RCP<LinearOpWithSolveBase<Scalar> > &lows ) 00185 { 00186 return defaultAdjointLinearOpWithSolveNonconst<Scalar>(lows, CONJTRANS); 00187 } 00188 00189 00190 00191 } // end namespace Thyra 00192 00193 00194 #endif // THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DECL_HPP
1.7.4