Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef XPETRA_MPIPLATFORM_HPP
00047 #define XPETRA_MPIPLATFORM_HPP
00048
00049 #include <Teuchos_DefaultMpiComm.hpp>
00050 #include <Teuchos_Describable.hpp>
00051 #include <Kokkos_DefaultNode.hpp>
00052
00053 #include "Xpetra_ConfigDefs.hpp"
00054
00055 namespace Xpetra {
00056
00058
00063 template<class Node=KokkosClassic::DefaultNode::DefaultNodeType>
00064 class MpiPlatform : public Teuchos::Describable {
00065 public:
00067 typedef Node NodeType;
00069
00070
00072 explicit MpiPlatform(Teuchos::RCP<Node> node);
00073
00075 MpiPlatform(Teuchos::RCP<Node> node, const Teuchos::RCP<const Teuchos::OpaqueWrapper<MPI_Comm> > &rawMpiComm);
00076
00078 ~MpiPlatform();
00079
00081
00083
00084
00086 Teuchos::RCP< const Teuchos::Comm<int> > getComm() const;
00087
00089 Teuchos::RCP<Node> getNode() const;
00090
00092
00093 protected:
00095 Teuchos::RCP<Node> node_;
00096
00097 private:
00098 Teuchos::RCP<Teuchos::MpiComm<int> > comm_;
00099 MpiPlatform(const MpiPlatform<Node> &platform);
00100 };
00101
00102 template <class Node>
00103 MpiPlatform<Node>::MpiPlatform(Teuchos::RCP<Node> node, const Teuchos::RCP<const Teuchos::OpaqueWrapper<MPI_Comm> > &rawMpiComm)
00104 : node_(node) {
00105 comm_ = Teuchos::createMpiComm<int>(rawMpiComm);
00106 }
00107
00108 template <class Node>
00109 MpiPlatform<Node>::MpiPlatform(Teuchos::RCP<Node> node)
00110 : node_(node) {
00111 comm_ = Teuchos::createMpiComm<int>(Teuchos::opaqueWrapper<MPI_Comm>(MPI_COMM_WORLD));
00112 }
00113
00114 template <class Node>
00115 MpiPlatform<Node>::~MpiPlatform() { }
00116
00117 template <class Node>
00118 MpiPlatform<Node>::MpiPlatform(const MpiPlatform<Node> &platform) {
00119 comm_ = platform.comm_;
00120 }
00121
00122 template <class Node>
00123 Teuchos::RCP< const Teuchos::Comm<int> >
00124 MpiPlatform<Node>::getComm() const {
00125 return comm_;
00126 }
00127
00128 template <class Node>
00129 Teuchos::RCP<Node> MpiPlatform<Node>::getNode() const
00130 { return node_; }
00131
00132 }
00133
00134 #endif // XPETRA_MPIPLATFORM_HPP
00135