Anasazi  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Tsqr_MpiCommFactory.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Anasazi: Block Eigensolvers Package
4 //
5 // Copyright 2004 NTESS and the Anasazi contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 #ifndef __TSQR_MpiCommFactory_hpp
10 #define __TSQR_MpiCommFactory_hpp
11 
12 #include <mpi.h>
13 #include <Tsqr_Config.hpp>
14 #include <Tsqr_MpiMessenger.hpp>
15 #include <Teuchos_RCP.hpp>
16 
19 
20 namespace TSQR {
21  namespace MPI {
22 
23  namespace details {
24 
25  template< class Scalar >
27  makeMpiComm (MPI_Comm comm)
28  {
29  return Teuchos::rcp_implicit_cast< MessengerBase< Scalar > >(new MpiMessenger< Scalar > (comm));
30  }
31  } // namespace details
32 
33 #ifdef HAVE_MPI_COMM_NETWORK
34  template< class Scalar >
38  makeMpiCommNetwork ()
39  {
40  makeMpiComm (MPI_COMM_NETWORK);
41  }
42 #endif // HAVE_MPI_COMM_NETWORK
43 
44 #ifdef HAVE_MPI_COMM_NODE
45  template< class Scalar >
49  makeMpiCommNode ()
50  {
51  makeMpiComm (MPI_COMM_NODE);
52  }
53 #endif // HAVE_MPI_COMM_NODE
54 
59  template< class Scalar >
61  makeMpiCommWorld ()
62  {
63  makeMpiComm (MPI_COMM_WORLD);
64  }
65 
66  } // namespace MPI
67 } // namespace TSQR
68 
69 #endif // __TSQR_MpiCommFactory_hpp
70