Thyra_DefaultPreconditioner.hpp

Go to the documentation of this file.
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_HPP
00030 #define THYRA_DEFUALT_PRECONDITIONER_HPP
00031 
00032 #include "Thyra_DefaultPreconditionerDecl.hpp"
00033 
00034 namespace Thyra {
00035 
00036 // Constructors/initializers/accessors
00037 
00038 template <class RangeScalar, class DomainScalar>
00039 DefaultPreconditioner<RangeScalar,DomainScalar>::DefaultPreconditioner()
00040 {}
00041 
00042 template <class RangeScalar, class DomainScalar>
00043 DefaultPreconditioner<RangeScalar,DomainScalar>::DefaultPreconditioner(
00044   const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00045   ,const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00046   )
00047 {
00048 #ifdef TEUCHOS_DEBUG
00049   TEST_FOR_EXCEPT( leftPrecOp.get()==NULL && rightPrecOp.get()==NULL ); 
00050 #endif
00051   if(leftPrecOp.get()) leftPrecOp_.initialize(leftPrecOp);
00052   if(rightPrecOp.get()) rightPrecOp_.initialize(rightPrecOp);
00053 }
00054 
00055 template <class RangeScalar, class DomainScalar>
00056 DefaultPreconditioner<RangeScalar,DomainScalar>::DefaultPreconditioner(
00057   const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00058   ,const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00059   )
00060 {
00061 #ifdef TEUCHOS_DEBUG
00062   TEST_FOR_EXCEPT( leftPrecOp.get()==NULL && rightPrecOp.get()==NULL ); 
00063 #endif
00064   if(leftPrecOp.get())
00065     leftPrecOp_.initialize(leftPrecOp);
00066   if(rightPrecOp.get())
00067     rightPrecOp_.initialize(rightPrecOp);
00068 }
00069 
00070 template <class RangeScalar, class DomainScalar>
00071 DefaultPreconditioner<RangeScalar,DomainScalar>::DefaultPreconditioner(
00072   const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00073   )
00074 {
00075   unspecifiedPrecOp_.initialize(unspecifiedPrecOp);
00076 }
00077 
00078 template <class RangeScalar, class DomainScalar>
00079 DefaultPreconditioner<RangeScalar,DomainScalar>::DefaultPreconditioner(
00080   const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00081   )
00082 {
00083   unspecifiedPrecOp_.initialize(unspecifiedPrecOp);
00084 }
00085 
00086 template <class RangeScalar, class DomainScalar>
00087 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeLeft(
00088   const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00089   )
00090 {
00091   uninitialize();
00092   leftPrecOp_.initialize(leftPrecOp);
00093 }
00094 
00095 template <class RangeScalar, class DomainScalar>
00096 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeLeft(
00097   const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00098   )
00099 {
00100   uninitialize();
00101   leftPrecOp_.initialize(leftPrecOp);
00102 }
00103 
00104 template <class RangeScalar, class DomainScalar>
00105 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeRight(
00106   const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &rightPrecOp
00107   )
00108 {
00109   uninitialize();
00110   rightPrecOp_.initialize(rightPrecOp);
00111 }
00112 
00113 template <class RangeScalar, class DomainScalar>
00114 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeRight(
00115   const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &rightPrecOp
00116   )
00117 {
00118   uninitialize();
00119   rightPrecOp_.initialize(rightPrecOp);
00120 }
00121 
00122 template <class RangeScalar, class DomainScalar>
00123 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeLeftRight(
00124   const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00125   ,const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00126   )
00127 {
00128   uninitialize();
00129   rightPrecOp_.initialize(rightPrecOp);
00130   leftPrecOp_.initialize(leftPrecOp);
00131 }
00132 
00133 template <class RangeScalar, class DomainScalar>
00134 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeLeftRight(
00135   const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00136   ,const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00137   )
00138 {
00139   uninitialize();
00140   rightPrecOp_.initialize(rightPrecOp);
00141   leftPrecOp_.initialize(leftPrecOp);
00142 }
00143 
00144 template <class RangeScalar, class DomainScalar>
00145 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeUnspecified(
00146   const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00147   )
00148 {
00149   uninitialize();
00150   unspecifiedPrecOp_.initialize(unspecifiedPrecOp);
00151 }
00152 
00153 template <class RangeScalar, class DomainScalar>
00154 void DefaultPreconditioner<RangeScalar,DomainScalar>::initializeUnspecified(
00155   const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00156   )
00157 {
00158   uninitialize();
00159   unspecifiedPrecOp_.initialize(unspecifiedPrecOp);
00160 }
00161 
00162 template <class RangeScalar, class DomainScalar>
00163 void DefaultPreconditioner<RangeScalar,DomainScalar>::uninitialize()
00164 {
00165   leftPrecOp_.uninitialize();
00166   rightPrecOp_.uninitialize();
00167   unspecifiedPrecOp_.uninitialize();
00168 }
00169 
00170 // Overridden from PreconditionerBase
00171 
00172 template <class RangeScalar, class DomainScalar>
00173 bool DefaultPreconditioner<RangeScalar,DomainScalar>::isLeftPrecOpConst() const
00174 {
00175   return leftPrecOp_.isConst();
00176 }
00177 
00178 template <class RangeScalar, class DomainScalar>
00179 Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >
00180 DefaultPreconditioner<RangeScalar,DomainScalar>::getNonconstLeftPrecOp()
00181 {
00182   return leftPrecOp_.getNonconstObj();
00183 }
00184 
00185 template <class RangeScalar, class DomainScalar>
00186 Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >
00187 DefaultPreconditioner<RangeScalar,DomainScalar>::getLeftPrecOp() const
00188 {
00189   return leftPrecOp_.getConstObj();
00190 }
00191 
00192 template <class RangeScalar, class DomainScalar>
00193 bool DefaultPreconditioner<RangeScalar,DomainScalar>::isRightPrecOpConst() const
00194 {
00195   return rightPrecOp_.isConst();
00196 }
00197 
00198 template <class RangeScalar, class DomainScalar>
00199 Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >
00200 DefaultPreconditioner<RangeScalar,DomainScalar>::getNonconstRightPrecOp()
00201 {
00202   return rightPrecOp_.getNonconstObj();
00203 }
00204 
00205 template <class RangeScalar, class DomainScalar>
00206 Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >
00207 DefaultPreconditioner<RangeScalar,DomainScalar>::getRightPrecOp() const
00208 {
00209   return rightPrecOp_.getConstObj();
00210 }
00211 
00212 template <class RangeScalar, class DomainScalar>
00213 bool DefaultPreconditioner<RangeScalar,DomainScalar>::isUnspecifiedPrecOpConst() const
00214 {
00215   return unspecifiedPrecOp_.isConst();
00216 }
00217 
00218 template <class RangeScalar, class DomainScalar>
00219 Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >
00220 DefaultPreconditioner<RangeScalar,DomainScalar>::getNonconstUnspecifiedPrecOp()
00221 {
00222   return unspecifiedPrecOp_.getNonconstObj();
00223 }
00224 
00225 template <class RangeScalar, class DomainScalar>
00226 Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >
00227 DefaultPreconditioner<RangeScalar,DomainScalar>::getUnspecifiedPrecOp() const
00228 {
00229   return unspecifiedPrecOp_.getConstObj();
00230 }
00231 
00232 } // namespace Thyra
00233 
00234 #endif // THYRA_DEFUALT_PRECONDITIONER_HPP

Generated on Thu Sep 18 12:33:02 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1