PlayaLinearSolverBaseImpl.hpp

00001 /* @HEADER@ */
00002 //   
00003 /* @HEADER@ */
00004 
00005 #ifndef PLAYA_LINEARSOLVERBASEIMPL_HPP
00006 #define PLAYA_LINEARSOLVERBASEIMPL_HPP
00007 
00008 #include "PlayaLinearSolverBaseDecl.hpp"
00009 #include "PlayaPreconditioner.hpp"
00010 #include "PlayaPreconditionerFactory.hpp"
00011 #include "Teuchos_ParameterList.hpp"
00012 
00013 
00014 using namespace Teuchos;
00015 
00016 
00017 namespace Playa
00018 {
00019 
00020 template <class Scalar> inline
00021 const ParameterList& LinearSolverBase<Scalar>::parameters() const 
00022 {return params_;}
00023 
00024 template <class Scalar> inline
00025 LinearSolverBase<Scalar>::LinearSolverBase(const ParameterList& params)
00026   : ObjectWithVerbosity(), params_(params) 
00027 {
00028   if (this->parameters().isParameter(this->verbosityParam()))
00029   {
00030     this->setVerb(this->parameters().get<int>(this->verbosityParam()));
00031   }
00032 }
00033 
00034 template <class Scalar> inline
00035 ParameterList& LinearSolverBase<Scalar>::parameters() {return params_;}
00036 
00037 
00038 template <class Scalar> inline
00039 string LinearSolverBase<Scalar>::verbosityParam() const {return "Verbosity";}
00040 
00041 template <class Scalar>
00042 template <typename T> inline
00043 void LinearSolverBase<Scalar>::setParameter(const ParameterList& params,
00044   T* dataPtr,
00045   const std::string& name)
00046 {
00047   if (!params.isParameter(name)) return;
00048 
00049   TEUCHOS_TEST_FOR_EXCEPTION(!params.template isType<T>(name), std::runtime_error,
00050     "invalid type for parameter [" << name << "]"); 
00051 
00052   *dataPtr = params.template get<T>(name);
00053 }
00054 
00055 template <class Scalar> inline
00056 void LinearSolverBase<Scalar>::setUserPrec(const PreconditionerFactory<Scalar>& pf)
00057 {
00058   TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
00059     "User-defined preconditioning not allowed for generic "
00060     "linear solver subtypes");
00061 }
00062 
00063 template <class Scalar> inline
00064 void LinearSolverBase<Scalar>::setUserPrec(const LinearOperator<Scalar>& P,
00065   const LinearSolver<Scalar>& pSolver)
00066 {
00067   TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
00068     "User-defined preconditioning not allowed for generic "
00069     "linear solver subtypes");
00070 }
00071 
00072 }
00073 
00074 #endif

doxygen