Anasazi Version of the Day
TsqrFactory.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 //
00004 //                 Anasazi: Block Eigensolvers Package
00005 //                 Copyright (2010) 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_hpp
00030 #define __TSQR_Trilinos_TsqrFactory_hpp
00031 
00035 
00036 #include "Teuchos_Comm.hpp"
00037 #include "Teuchos_ParameterList.hpp"
00038 #include "Teuchos_RCP.hpp"
00039 #include "Tsqr_MessengerBase.hpp"
00040 #include "Tsqr.hpp"
00041 
00044 
00045 namespace TSQR {
00046   namespace Trilinos {
00047 
00078     template< class LO, class S, class NodeTsqrType, class DistTsqrType >
00079     class TsqrFactory {
00080     public:
00081       typedef NodeTsqrType                       node_tsqr_type;
00082       typedef Teuchos::RCP< node_tsqr_type >     node_tsqr_ptr;
00083 
00084       typedef Teuchos::RCP< MessengerBase< S > > scalar_messenger_ptr;
00085       typedef DistTsqrType                       dist_tsqr_type;
00086       typedef Teuchos::RCP< dist_tsqr_type >     dist_tsqr_ptr;
00087 
00088       typedef Tsqr< LO, S, node_tsqr_type, dist_tsqr_type > tsqr_type;
00089       typedef Teuchos::RCP< tsqr_type >                     tsqr_ptr;
00090 
00108       virtual void
00109       makeTsqr (const Teuchos::ParameterList& plist,
00110     const scalar_messenger_ptr& messenger,
00111     tsqr_ptr& tsqr) const
00112       {
00113   node_tsqr_ptr nodeTsqr = makeNodeTsqr (plist);
00114   dist_tsqr_ptr distTsqr = makeDistTsqr (messenger, plist);
00115   tsqr = Teuchos::rcp (new tsqr_type (nodeTsqr, distTsqr));
00116       }
00117 
00118       TsqrFactory () {}
00119       virtual ~TsqrFactory () {};
00120 
00121     private:
00140       virtual node_tsqr_ptr
00141       makeNodeTsqr (const Teuchos::ParameterList& plist) const = 0;
00142 
00158       virtual dist_tsqr_ptr
00159       makeDistTsqr (const scalar_messenger_ptr& messenger,
00160         const Teuchos::ParameterList& plist) const = 0;
00161     };
00162   } // namespace Trilinos
00163 } // namespace TSQR
00164 
00165 #endif // __TSQR_Trilinos_TsqrFactory_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends