|
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_DEFUALT_PRECONDITIONER_DECL_HPP 00030 #define THYRA_DEFUALT_PRECONDITIONER_DECL_HPP 00031 00032 #include "Thyra_PreconditionerBase.hpp" 00033 #include "Teuchos_ConstNonconstObjectContainer.hpp" 00034 00035 00036 namespace Thyra { 00037 00038 00066 template <class Scalar> 00067 class DefaultPreconditioner : virtual public PreconditionerBase<Scalar> 00068 { 00069 public: 00070 00073 00076 DefaultPreconditioner(); 00077 00081 DefaultPreconditioner( 00082 const Teuchos::RCP<LinearOpBase<Scalar> > &leftPrecOp, 00083 const Teuchos::RCP<LinearOpBase<Scalar> > &rightPrecOp 00084 ); 00085 00089 DefaultPreconditioner( 00090 const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp, 00091 const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp 00092 ); 00093 00096 DefaultPreconditioner( 00097 const Teuchos::RCP<LinearOpBase<Scalar> > &unspecifiedPrecOp 00098 ); 00099 00102 DefaultPreconditioner( 00103 const Teuchos::RCP<const LinearOpBase<Scalar> > &unspecifiedPrecOp 00104 ); 00105 00108 void initializeLeft( 00109 const Teuchos::RCP<LinearOpBase<Scalar> > &leftPrecOp 00110 ); 00111 00114 void initializeLeft( 00115 const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp 00116 ); 00117 00120 void initializeRight( 00121 const Teuchos::RCP<LinearOpBase<Scalar> > &rightPrecOp 00122 ); 00123 00126 void initializeRight( 00127 const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp 00128 ); 00129 00132 void initializeLeftRight( 00133 const Teuchos::RCP<LinearOpBase<Scalar> > &leftPrecOp 00134 ,const Teuchos::RCP<LinearOpBase<Scalar> > &rightPrecOp 00135 ); 00136 00139 void initializeLeftRight( 00140 const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp 00141 ,const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp 00142 ); 00143 00147 void initializeUnspecified( 00148 const Teuchos::RCP<LinearOpBase<Scalar> > &unspecifiedPrecOp 00149 ); 00150 00154 void initializeUnspecified( 00155 const Teuchos::RCP<const LinearOpBase<Scalar> > &unspecifiedPrecOp 00156 ); 00157 00164 void uninitialize(); 00165 00167 00171 std::string description() const; 00173 void describe( 00174 Teuchos::FancyOStream &out, 00175 const Teuchos::EVerbosityLevel verbLevel 00176 ) const; 00178 00182 bool isLeftPrecOpConst() const; 00184 Teuchos::RCP<LinearOpBase<Scalar> > getNonconstLeftPrecOp(); 00186 Teuchos::RCP<const LinearOpBase<Scalar> > getLeftPrecOp() const; 00188 bool isRightPrecOpConst() const; 00190 Teuchos::RCP<LinearOpBase<Scalar> > getNonconstRightPrecOp(); 00192 Teuchos::RCP<const LinearOpBase<Scalar> > getRightPrecOp() const; 00194 bool isUnspecifiedPrecOpConst() const; 00196 Teuchos::RCP<LinearOpBase<Scalar> > getNonconstUnspecifiedPrecOp(); 00198 Teuchos::RCP<const LinearOpBase<Scalar> > getUnspecifiedPrecOp() const; 00200 00201 private: 00202 00203 Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > leftPrecOp_; 00204 Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > rightPrecOp_; 00205 Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar> > unspecifiedPrecOp_; 00206 00207 }; 00208 00209 // /////////////////////// 00210 // Related functions 00211 00217 template <class Scalar> 00218 Teuchos::RCP<const DefaultPreconditioner<Scalar> > 00219 unspecifiedPrec( 00220 const Teuchos::RCP<const LinearOpBase<Scalar> > &unspecifiedPrecOp 00221 ) 00222 { 00223 return Teuchos::rcp(new DefaultPreconditioner<Scalar>(unspecifiedPrecOp)); 00224 } 00225 00231 template <class Scalar> 00232 Teuchos::RCP<const DefaultPreconditioner<Scalar> > 00233 leftPrec( 00234 const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp 00235 ) 00236 { 00237 return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,Teuchos::null)); 00238 } 00239 00245 template <class Scalar> 00246 Teuchos::RCP<const DefaultPreconditioner<Scalar> > 00247 rightPrec( 00248 const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp 00249 ) 00250 { 00251 return Teuchos::rcp(new DefaultPreconditioner<Scalar>(Teuchos::null,rightPrecOp)); 00252 } 00253 00259 template <class Scalar> 00260 Teuchos::RCP<const DefaultPreconditioner<Scalar> > 00261 splitPrec( 00262 const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp 00263 ,const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp 00264 ) 00265 { 00266 return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,rightPrecOp)); 00267 } 00268 00269 00270 } // namespace Thyra 00271 00272 00273 #endif // THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
1.7.4