Anasazi Version of the Day
TsqrCommFactory_Tpetra.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_TsqrCommFactory_Tpetra_hpp
00030 #define __TSQR_Trilinos_TsqrCommFactory_Tpetra_hpp
00031 
00036 
00037 #include "Tpetra_MultiVector.hpp"
00038 #include "Tsqr_TpetraMessenger.hpp"
00039 
00042 
00043 namespace TSQR {
00044   namespace Trilinos {
00045 
00046     template< class S, class LO, class GO, class Node >
00047     class TpetraCommFactory :
00048       public CommFactory< S, LO, GO, Tpetra::MultiVector< S, LO, GO, Node > >
00049     {
00050     public:
00051       // MV def looks circular but is not, because C++ does not pass
00052       // typedefs from a base class to a derived class when both the
00053       // base and derived classes are templated.  MV here is just a
00054       // shorthand so that the base_type typedef fits in one line.
00055       typedef Tpetra::MultiVector< S, LO, GO, Node > MV;
00056       typedef CommFactory< S, LO, GO, MV > base_type;
00057 
00058       // C++ doesn't pass typedefs from a templated base class to a
00059       // templated derived class.  Here, we avoid repeating code from
00060       // the base class by pulling in its typedefs into the derived
00061       // class.
00062       typedef typename base_type::comm_ptr comm_ptr;
00063       typedef typename base_type::scalar_messenger_ptr scalar_messenger_ptr;
00064       typedef typename base_type::ordinal_messenger_ptr ordinal_messenger_ptr;
00065 
00066       TpetraCommFactory () {}
00067       virtual ~TpetraCommFactory () {}
00068 
00069       virtual void
00070       makeMessengers (const comm_ptr& comm,
00071           scalar_messenger_ptr& scalarMessenger,
00072           ordinal_messenger_ptr& ordinalMessenger)
00073       {
00074   using TSQR::Trilinos::TpetraMessenger;
00075 
00076   scalarMessenger = Teuchos::rcp (new TpetraMessenger< S > (comm));
00077   ordinalMessenger = Teuchos::rcp (new TpetraMessenger< LO > (comm));
00078       }
00079     };
00080   } // namespace Trilinos
00081 } // namespace TSQR
00082 
00083 #endif // __TSQR_Trilinos_TsqrCommFactory_Tpetra_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends