Thyra_DefaultAdjointLinearOpWithSolve_def.hpp

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_DEF_HPP
00031 #define THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
00032 
00033 
00034 #include "Thyra_DefaultAdjointLinearOpWithSolve_decl.hpp"
00035 #include "Thyra_LinearOpWithSolveBase.hpp"
00036 
00037 
00038 namespace Thyra {
00039 
00040 
00041 // Constructors/initializers/accessors
00042 
00043 
00044 template<class Scalar>
00045 DefaultAdjointLinearOpWithSolve<Scalar>::DefaultAdjointLinearOpWithSolve()
00046   : transp_(NOTRANS)
00047 {}
00048 
00049 
00050 template<class Scalar>
00051 void DefaultAdjointLinearOpWithSolve<Scalar>::initialize(
00052   const RCP<LinearOpWithSolveBase<Scalar> > &lows,
00053   const EOpTransp transp )
00054 {
00055   lows_ = lows;
00056   transp_ = transp;
00057 }
00058 
00059 
00060 template<class Scalar>
00061 void DefaultAdjointLinearOpWithSolve<Scalar>::initialize(
00062   const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
00063   const EOpTransp transp )
00064 {
00065   lows_ = lows;
00066   transp_ = transp;
00067 }
00068 
00069 
00070 template<class Scalar>
00071 const RCP<LinearOpWithSolveBase<Scalar> >
00072 DefaultAdjointLinearOpWithSolve<Scalar>::getNonconstOp()
00073 {
00074   return lows_.getNonconstObj();
00075 }
00076 
00077 
00078 template<class Scalar>
00079 const RCP<const LinearOpWithSolveBase<Scalar> >
00080 DefaultAdjointLinearOpWithSolve<Scalar>::getOp() const
00081 {
00082   return lows_.getConstObj();
00083 }
00084 
00085 
00086 // Overridden from LinearOpBase */
00087 
00088 
00089 template<class Scalar>
00090 RCP<const VectorSpaceBase<Scalar> >
00091 DefaultAdjointLinearOpWithSolve<Scalar>::range() const
00092 {
00093   return ( real_trans(transp_) == NOTRANS
00094     ? lows_()->range() : lows_()->domain() );
00095 }
00096 
00097 
00098 template<class Scalar>
00099 RCP<const VectorSpaceBase<Scalar> >
00100 DefaultAdjointLinearOpWithSolve<Scalar>::domain() const
00101 {
00102   return ( real_trans(transp_) == NOTRANS
00103     ? lows_()->domain() : lows_()->range() );
00104 }
00105 
00106 
00107 // protected
00108 
00109   
00110 // Overridden from LinearOpBase
00111 
00112 
00113 template<class Scalar>
00114 bool DefaultAdjointLinearOpWithSolve<Scalar>::opSupportedImpl(
00115   EOpTransp M_trans) const
00116 {
00117   return Thyra::opSupported(*lows_(), trans_trans(transp_, M_trans));
00118 }
00119 
00120 
00121 template<class Scalar>
00122 void DefaultAdjointLinearOpWithSolve<Scalar>::applyImpl(
00123   const EOpTransp M_trans,
00124   const MultiVectorBase<Scalar> &X,
00125   const Ptr<MultiVectorBase<Scalar> > &Y,
00126   const Scalar alpha,
00127   const Scalar beta
00128   ) const
00129 {
00130   Thyra::apply( *lows_(), trans_trans(transp_, M_trans),
00131     X, Y, alpha, beta );
00132 }
00133 
00134 
00135 // Overridden from LinearOpWithSolveBase
00136 
00137 
00138 template<class Scalar>
00139 bool DefaultAdjointLinearOpWithSolve<Scalar>::solveSupportsImpl(EOpTransp M_trans) const
00140 {
00141   return Thyra::solveSupports(*lows_(), trans_trans(transp_, M_trans));
00142 }
00143 
00144 
00145 template<class Scalar>
00146 bool DefaultAdjointLinearOpWithSolve<Scalar>::solveSupportsSolveMeasureTypeImpl(
00147   EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const
00148 {
00149   return Thyra::solveSupportsSolveMeasureType(*lows_(),
00150     trans_trans(transp_, M_trans), solveMeasureType );
00151 }
00152 
00153 
00154 
00155 template<class Scalar>
00156 SolveStatus<Scalar>
00157 DefaultAdjointLinearOpWithSolve<Scalar>::solveImpl(
00158   const EOpTransp transp,
00159   const MultiVectorBase<Scalar> &B,
00160   const Ptr<MultiVectorBase<Scalar> > &X,
00161   const Ptr<const SolveCriteria<Scalar> > solveCriteria
00162   ) const
00163 {
00164   return Thyra::solve( *lows_(), trans_trans(transp_, transp),
00165     B, X, solveCriteria );
00166 }
00167 
00168 
00169 } // namespace Thyra
00170 
00171 
00172 #endif // THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:00:06 2011 for Thyra by  doxygen 1.6.3