deal.II version GIT relicensing-6846-gd1ccc50c04 2026-10-05 21:50:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
mpi_stub.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2022 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_mpi_stub_h
14#define dealii_mpi_stub_h
15
16#include <deal.II/base/config.h>
17
18// If we have mpi.h then include it. Otherwise, define some common MPI data
19// types and global constants for the no-MPI case. This way we can still use,
20// e.g., MPI_Comm in the API.
21
22#if defined(DEAL_II_WITH_MPI)
23
25// Avoid a macro collision between mpc.h and MPICH's C++ headers by
26// undefining DOUBLE_COMPLEX and LONG_DOUBLE_COMPLEX before including <mpi.h>
27// On some macOS setups mpc.h (from libmpc) defines macros
28// DOUBLE_COMPLEX/LONG_DOUBLE_COMPLEX that expand into C keywords
29// (e.g. double _Complex). These break MPICH's mpicxx.h declarations
30// (e.g. extern Datatype DOUBLE_COMPLEX;), causing compile errors.
31# ifdef DOUBLE_COMPLEX
32# undef DOUBLE_COMPLEX
33# endif
34# ifdef LONG_DOUBLE_COMPLEX
35# undef LONG_DOUBLE_COMPLEX
36# endif
37# include <mpi.h>
39
40#endif
41
42
44
45#ifndef DEAL_II_WITH_MPI
46
47// Without MPI, we would still like to use some constructs with MPI
48// data types. Therefore, create some dummies. Since we only ever use
49// them inside our own constructs, the right thing to do is to put
50// them into namespace dealii:
51
52using MPI_Comm = int;
53using MPI_Request = int;
54using MPI_Datatype = int;
55using MPI_Op = int;
56
57constexpr MPI_Comm MPI_COMM_WORLD = 0;
58constexpr MPI_Comm MPI_COMM_SELF = 0;
59constexpr MPI_Comm MPI_COMM_NULL = 0;
60constexpr MPI_Request MPI_REQUEST_NULL = 0;
61constexpr MPI_Op MPI_MIN = 0;
62constexpr MPI_Op MPI_MAX = 0;
63constexpr MPI_Op MPI_SUM = 0;
64constexpr MPI_Op MPI_LAND = 0;
65constexpr MPI_Op MPI_LOR = 0;
66#endif
67
69
70#endif
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:636
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:680