// @HEADER // ***************************************************************************** // Xpetra: A linear algebra interface package // // Copyright 2012 NTESS and the Xpetra contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef XPETRA_MPIPLATFORM_HPP #define XPETRA_MPIPLATFORM_HPP #include #include #include #include "Xpetra_ConfigDefs.hpp" namespace Xpetra { //! \brief A implementation of the Platform class for MPI-based platforms. /*! This class is templated on \c Scalar, \c LocalOrdinal and \c GlobalOrdinal. The \c LocalOrdinal type, if omitted, defaults to \c int. The \c GlobalOrdinal type, if omitted, defaults to the \c LocalOrdinal type. */ template class MpiPlatform : public Teuchos::Describable { public: //! Typedef indicating the node type over which the platform is templated. This default to the Kokkos default node type. typedef Node NodeType; //! @name Constructor/Destructor Methods //@{ //! Constructor explicit MpiPlatform(Teuchos::RCP node); //! Constructor MpiPlatform(Teuchos::RCP node, const Teuchos::RCP > &rawMpiComm); //! Destructor ~MpiPlatform(); //@} //! @name Class Creation and Accessor Methods //@{ //! Comm Instance Teuchos::RCP > getComm() const; //@} private: Teuchos::RCP > comm_; MpiPlatform(const MpiPlatform &platform); }; template MpiPlatform::MpiPlatform(Teuchos::RCP /* node */, const Teuchos::RCP > &rawMpiComm) : comm_(Teuchos::createMpiComm(rawMpiComm)) {} template MpiPlatform::MpiPlatform(Teuchos::RCP /* node */) : comm_(Teuchos::createMpiComm(Teuchos::opaqueWrapper(MPI_COMM_WORLD))) {} // CHECK: ALLOW MPI_COMM_WORLD template MpiPlatform::~MpiPlatform() {} template MpiPlatform::MpiPlatform(const MpiPlatform &platform) { comm_ = platform.comm_; } template Teuchos::RCP > MpiPlatform::getComm() const { return comm_; } } // namespace Xpetra #endif // XPETRA_MPIPLATFORM_HPP