Kokkos Node API and Local Linear Algebra Kernels Version of the Day
TsqrFactory_SequentialTsqr.hpp
Go to the documentation of this file.
00001 //@HEADER
00002 // ************************************************************************
00003 // 
00004 //          Kokkos: Node API and Parallel Node Kernels
00005 //              Copyright (2009) 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 __TSQR_Trilinos_TsqrFactory_SequentialTsqr_hpp
00030 #define __TSQR_Trilinos_TsqrFactory_SequentialTsqr_hpp
00031 
00035 
00036 #include "Tsqr_SequentialTsqr.hpp"
00037 #include "Tsqr.hpp"
00038 #include "Teuchos_ParameterListExceptions.hpp"
00039 
00042 
00043 namespace TSQR {
00044   namespace Trilinos {
00045 
00050     template<class LO, class S>
00051     class SequentialTsqrFactory :
00052       public TsqrFactory<LO, S, SequentialTsqr<LO, S>, DistTsqr<LO, S> >
00053     {
00054     public:
00055       // This class' parent class.
00056       typedef TsqrFactory<LO, S, SequentialTsqr<LO, S>, DistTsqr<LO, S> > base_type;
00057 
00058       // Pull in the typedefs from the base class.  C++ doesn't do
00059       // this when both the base and the derived classes are
00060       // templated.
00061       typedef typename base_type::scalar_messenger_ptr scalar_messenger_ptr;
00062       typedef typename base_type::node_tsqr_type node_tsqr_type;
00063       typedef typename base_type::node_tsqr_ptr  node_tsqr_ptr;
00064       typedef typename base_type::dist_tsqr_type dist_tsqr_type;
00065       typedef typename base_type::dist_tsqr_ptr  dist_tsqr_ptr;
00066       typedef typename base_type::tsqr_type tsqr_type;
00067       typedef typename base_type::tsqr_ptr  tsqr_ptr;
00068 
00069       SequentialTsqrFactory () {}
00070       virtual ~SequentialTsqrFactory () {}
00071 
00072     private:
00073 
00084       virtual node_tsqr_ptr
00085       makeNodeTsqr (const Teuchos::ParameterList& plist) const
00086       {
00087   using Teuchos::Exceptions::InvalidParameter;
00088   size_t cacheBlockHint = 0;
00089 
00090   // All this try/catch stuff is because the C++ compiler can't
00091   // deduce the right two-argument get() function (second argument
00092   // would be the default).
00093   try {
00094     const std::string cacheBlockHintParamName ("cacheBlockHint");
00095     cacheBlockHint = plist.get< size_t > (cacheBlockHintParamName);
00096   } catch (InvalidParameter&) {
00097     cacheBlockHint = 0;
00098   }
00099   
00100   node_tsqr_ptr node_tsqr (new node_tsqr_type (cacheBlockHint));
00101   return node_tsqr;
00102       }
00103 
00105       virtual dist_tsqr_ptr
00106       makeDistTsqr (const scalar_messenger_ptr& messenger,
00107         const Teuchos::ParameterList& plist) const
00108       {
00109   return Teuchos::rcp (new dist_tsqr_type (messenger));
00110       }
00111     };
00112 
00113   } // namespace Trilinos
00114 } // namespace TSQR
00115 
00116 #endif // __TSQR_Trilinos_TsqrFactory_SequentialTsqr_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends