Anasazi Version of the Day
Tsqr_MpiCommFactory.hpp
00001 #ifndef __TSQR_MpiCommFactory_hpp
00002 #define __TSQR_MpiCommFactory_hpp
00003 
00004 #include <mpi.h>
00005 #include <Tsqr_Config.hpp>
00006 #include <Tsqr_MpiMessenger.hpp>
00007 #include <Teuchos_RCP.hpp>
00008 
00011 
00012 namespace TSQR {
00013   namespace MPI {
00014 
00015     namespace details {
00016 
00017       template< class Scalar >
00018       Teuchos::RCP< MessengerBase< Scalar > >
00019       makeMpiComm (MPI_Comm comm)
00020       {
00021   return Teuchos::rcp_implicit_cast< MessengerBase< Scalar > >(new MpiMessenger< Scalar > (comm));
00022       }
00023     } // namespace details
00024 
00025 #ifdef HAVE_MPI_COMM_NETWORK
00026 
00027 
00028     template< class Scalar >
00029     Teuchos::RCP< MessengerBase< Scalar > >
00030     makeMpiCommNetwork () 
00031     {
00032       makeMpiComm (MPI_COMM_NETWORK);
00033     }
00034 #endif // HAVE_MPI_COMM_NETWORK
00035     
00036 #ifdef HAVE_MPI_COMM_NODE
00037 
00038 
00039     template< class Scalar >
00040     Teuchos::RCP< MessengerBase< Scalar > >
00041     makeMpiCommNode () 
00042     {
00043       makeMpiComm (MPI_COMM_NODE);
00044     }
00045 #endif // HAVE_MPI_COMM_NODE
00046 
00051     template< class Scalar >
00052     Teuchos::RCP< MessengerBase< Scalar > >
00053     makeMpiCommWorld () 
00054     {
00055       makeMpiComm (MPI_COMM_WORLD);
00056     }
00057 
00058   } // namespace MPI
00059 } // namespace TSQR
00060 
00061 #endif // __TSQR_MpiCommFactory_hpp
00062 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends