Thyra Version of the Day
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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 
00043 #ifndef THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
00044 #define THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
00045 
00046 
00047 #include "Thyra_DefaultAdjointLinearOpWithSolve_decl.hpp"
00048 #include "Thyra_LinearOpWithSolveBase.hpp"
00049 
00050 
00051 namespace Thyra {
00052 
00053 
00054 // Constructors/initializers/accessors
00055 
00056 
00057 template<class Scalar>
00058 DefaultAdjointLinearOpWithSolve<Scalar>::DefaultAdjointLinearOpWithSolve()
00059   : transp_(NOTRANS)
00060 {}
00061 
00062 
00063 template<class Scalar>
00064 void DefaultAdjointLinearOpWithSolve<Scalar>::initialize(
00065   const RCP<LinearOpWithSolveBase<Scalar> > &lows,
00066   const EOpTransp transp )
00067 {
00068   lows_ = lows;
00069   transp_ = transp;
00070 }
00071 
00072 
00073 template<class Scalar>
00074 void DefaultAdjointLinearOpWithSolve<Scalar>::initialize(
00075   const RCP<const LinearOpWithSolveBase<Scalar> > &lows,
00076   const EOpTransp transp )
00077 {
00078   lows_ = lows;
00079   transp_ = transp;
00080 }
00081 
00082 
00083 template<class Scalar>
00084 const RCP<LinearOpWithSolveBase<Scalar> >
00085 DefaultAdjointLinearOpWithSolve<Scalar>::getNonconstOp()
00086 {
00087   return lows_.getNonconstObj();
00088 }
00089 
00090 
00091 template<class Scalar>
00092 const RCP<const LinearOpWithSolveBase<Scalar> >
00093 DefaultAdjointLinearOpWithSolve<Scalar>::getOp() const
00094 {
00095   return lows_.getConstObj();
00096 }
00097 
00098 
00099 // Overridden from LinearOpBase */
00100 
00101 
00102 template<class Scalar>
00103 RCP<const VectorSpaceBase<Scalar> >
00104 DefaultAdjointLinearOpWithSolve<Scalar>::range() const
00105 {
00106   return ( real_trans(transp_) == NOTRANS
00107     ? lows_()->range() : lows_()->domain() );
00108 }
00109 
00110 
00111 template<class Scalar>
00112 RCP<const VectorSpaceBase<Scalar> >
00113 DefaultAdjointLinearOpWithSolve<Scalar>::domain() const
00114 {
00115   return ( real_trans(transp_) == NOTRANS
00116     ? lows_()->domain() : lows_()->range() );
00117 }
00118 
00119 
00120 // protected
00121 
00122   
00123 // Overridden from LinearOpBase
00124 
00125 
00126 template<class Scalar>
00127 bool DefaultAdjointLinearOpWithSolve<Scalar>::opSupportedImpl(
00128   EOpTransp M_trans) const
00129 {
00130   return Thyra::opSupported(*lows_(), trans_trans(transp_, M_trans));
00131 }
00132 
00133 
00134 template<class Scalar>
00135 void DefaultAdjointLinearOpWithSolve<Scalar>::applyImpl(
00136   const EOpTransp M_trans,
00137   const MultiVectorBase<Scalar> &X,
00138   const Ptr<MultiVectorBase<Scalar> > &Y,
00139   const Scalar alpha,
00140   const Scalar beta
00141   ) const
00142 {
00143   Thyra::apply( *lows_(), trans_trans(transp_, M_trans),
00144     X, Y, alpha, beta );
00145 }
00146 
00147 
00148 // Overridden from LinearOpWithSolveBase
00149 
00150 
00151 template<class Scalar>
00152 bool DefaultAdjointLinearOpWithSolve<Scalar>::solveSupportsImpl(EOpTransp M_trans) const
00153 {
00154   return Thyra::solveSupports(*lows_(), trans_trans(transp_, M_trans));
00155 }
00156 
00157 
00158 template<class Scalar>
00159 bool DefaultAdjointLinearOpWithSolve<Scalar>::solveSupportsSolveMeasureTypeImpl(
00160   EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const
00161 {
00162   return Thyra::solveSupportsSolveMeasureType(*lows_(),
00163     trans_trans(transp_, M_trans), solveMeasureType );
00164 }
00165 
00166 
00167 
00168 template<class Scalar>
00169 SolveStatus<Scalar>
00170 DefaultAdjointLinearOpWithSolve<Scalar>::solveImpl(
00171   const EOpTransp transp,
00172   const MultiVectorBase<Scalar> &B,
00173   const Ptr<MultiVectorBase<Scalar> > &X,
00174   const Ptr<const SolveCriteria<Scalar> > solveCriteria
00175   ) const
00176 {
00177   return Thyra::solve( *lows_(), trans_trans(transp_, transp),
00178     B, X, solveCriteria );
00179 }
00180 
00181 
00182 } // namespace Thyra
00183 
00184 
00185 #endif // THYRA_DEFAULT_ADJOINT_LINEAR_OP_WITH_SOLVE_DEF_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines