Arcane  4.2.3.0
User documentation
Loading...
Searching...
No Matches
MessagePassingMpiGlobal.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* MessagePassingMpiGlobal.h (C) 2000-2026 */
9/* */
10/* Global definitions for the 'MessagePassingMpi' component of 'Arccore'. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arccore/message_passing_mpi/MessagePassingMpiGlobal.h"
15
16#include "arccore/message_passing/IMessagePassingMng.h"
17#include "arccore/message_passing/Communicator.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
30{
31 MPI_Comm mpi_comm = MPI_COMM_NULL;
32 if (mpm) {
33 Communicator comm = mpm->communicator();
34 if (comm.isValid())
35 mpi_comm = static_cast<MPI_Comm>(comm);
36 }
37 return mpi_comm;
38}
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
44fillMpiCommunicatorIfValid(IMessagePassingMng* mpm, MPI_Comm* mpi_comm)
45{
46 if (!mpm)
47 return false;
48 Communicator comm = mpm->communicator();
49 if (!comm.isValid())
50 return false;
51 *mpi_comm = static_cast<MPI_Comm>(comm);
52 return true;
53}
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58} // namespace Arcane
59
60/*---------------------------------------------------------------------------*/
61/*---------------------------------------------------------------------------*/
Communicator for message exchange.
bool isValid() const
Indicates if the communicator is valid.
Interface of the message passing manager.
virtual Communicator communicator() const
MPI communicator associated with this instance.
ARCCORE_MESSAGEPASSINGMPI_EXPORT bool fillMpiCommunicatorIfValid(IMessagePassingMng *mpm, MPI_Comm *mpi_comm)
Set mpi_comm with the MPI communicator associated to mpm if it is valid.
ARCCORE_MESSAGEPASSINGMPI_EXPORT MPI_Comm toMpiCommunicator(IMessagePassingMng *mpm)
Return the MPI communicator associated to mpm.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --