#include <deal.II/base/config.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
#include <deal.II/base/geometry_info.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/point.h>
#include <deal.II/base/table.h>
#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/mutex.h>
#include <deal.II/base/utilities.h>
# endif
#endif
-#if defined(DEAL_II_WITH_MPI) || defined(DEAL_II_WITH_PETSC)
-# include <mpi.h>
-#else
-using MPI_Comm = int;
-# ifndef MPI_COMM_WORLD
-# define MPI_COMM_WORLD 0
-# endif
-#endif
-
DEAL_II_NAMESPACE_OPEN
/**
#include <deal.II/base/config.h>
#include <deal.II/base/array_view.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/mpi_tags.h>
#include <deal.II/base/numbers.h>
#include <deal.II/base/template_constraints.h>
#include <set>
#include <vector>
-#if !defined(DEAL_II_WITH_MPI) && !defined(DEAL_II_WITH_PETSC)
-// without MPI, we would still like to use
-// some constructs with MPI data
-// types. Therefore, create some dummies
-using MPI_Comm = int;
-using MPI_Request = int;
-using MPI_Datatype = int;
-using MPI_Op = int;
-# ifndef MPI_COMM_WORLD
-# define MPI_COMM_WORLD 0
-# endif
-# ifndef MPI_COMM_SELF
-# define MPI_COMM_SELF 0
-# endif
-# ifndef MPI_COMM_NULL
-# define MPI_COMM_NULL 0
-# endif
-# ifndef MPI_REQUEST_NULL
-# define MPI_REQUEST_NULL 0
-# endif
-# ifndef MPI_MIN
-# define MPI_MIN 0
-# endif
-# ifndef MPI_MAX
-# define MPI_MAX 0
-# endif
-# ifndef MPI_SUM
-# define MPI_SUM 0
-# endif
-# ifndef MPI_LOR
-# define MPI_LOR 0
-# endif
-#endif
-
/**
#include <deal.II/base/config.h>
-#include <deal.II/base/mpi.h>
#include <deal.II/base/mpi_consensus_algorithms.h>
+#include <deal.II/base/mpi_stub.h>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/mpi.h>
#include <deal.II/base/mpi.templates.h>
+#include <deal.II/base/mpi_tags.h>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
#include <deal.II/base/communication_pattern_base.h>
-#include <deal.II/base/mpi.h>
#include <deal.II/base/mpi_compute_index_owner_internal.h>
-#include <deal.II/base/mpi_tags.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/lac/vector_space_vector.h>
#include <deal.II/base/mpi.templates.h>
#include <deal.II/base/mpi_compute_index_owner_internal.h>
#include <deal.II/base/mpi_noncontiguous_partitioner.h>
+#include <deal.II/base/mpi_tags.h>
#include <deal.II/lac/vector_space_vector.h>
#include <deal.II/base/config.h>
+#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_tags.h>
+
#include <deal.II/dofs/dof_handler.h>
DEAL_II_NAMESPACE_OPEN
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2011 - 2022 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+#ifndef dealii_mpi_stub_h
+#define dealii_mpi_stub_h
+
+#include <deal.II/base/config.h>
+
+// If we have mpi.h then include it. Otherwise, define some common MPI data
+// types and global constants for the no-MPI case. This way we can still use,
+// e.g., MPI_Comm in the API.
+
+#if defined(DEAL_II_WITH_MPI) || defined(DEAL_II_WITH_PETSC)
+DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
+# include <mpi.h>
+DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
+#else
+// without MPI, we would still like to use
+// some constructs with MPI data
+// types. Therefore, create some dummies
+using MPI_Comm = int;
+using MPI_Request = int;
+using MPI_Datatype = int;
+using MPI_Op = int;
+# ifndef MPI_COMM_WORLD
+# define MPI_COMM_WORLD 0
+# endif
+# ifndef MPI_COMM_SELF
+# define MPI_COMM_SELF 0
+# endif
+# ifndef MPI_COMM_NULL
+# define MPI_COMM_NULL 0
+# endif
+# ifndef MPI_REQUEST_NULL
+# define MPI_REQUEST_NULL 0
+# endif
+# ifndef MPI_MIN
+# define MPI_MIN 0
+# endif
+# ifndef MPI_MAX
+# define MPI_MAX 0
+# endif
+# ifndef MPI_SUM
+# define MPI_SUM 0
+# endif
+# ifndef MPI_LOR
+# define MPI_LOR 0
+# endif
+#endif
+
+#endif
#include <deal.II/base/communication_pattern_base.h>
#include <deal.II/base/index_set.h>
#include <deal.II/base/memory_space.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/types.h>
#include <deal.II/lac/vector_operation.h>
#include <limits>
-
+#include <memory>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
#include <deal.II/base/cuda_size.h>
+#include <deal.II/base/mpi_tags.h>
#include <deal.II/base/partitioner.h>
#include <deal.II/lac/cuda_kernels.templates.h>
#include <deal.II/base/config.h>
+#include <deal.II/base/mpi_stub.h>
+
#include <deal.II/distributed/repartitioning_policy_tools.h>
#include <deal.II/distributed/tria_base.h>
#include <vector>
-#ifdef DEAL_II_WITH_MPI
-# include <mpi.h>
-#endif
-
DEAL_II_NAMESPACE_OPEN
// Forward declarations
#include <deal.II/base/config.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/template_constraints.h>
#include <utility>
#include <vector>
-#ifdef DEAL_II_WITH_MPI
-# include <mpi.h>
-#endif
-
-
DEAL_II_NAMESPACE_OPEN
namespace parallel
#include <deal.II/base/config.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/template_constraints.h>
#include <utility>
#include <vector>
-#ifdef DEAL_II_WITH_MPI
-# include <mpi.h>
-#endif
-
#ifdef DEAL_II_WITH_P4EST
# include <p4est.h>
# include <p4est_connectivity.h>
#include <deal.II/base/config.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/partitioner.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/config.h>
#include <deal.II/base/index_set.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <vector>
#include <deal.II/base/config.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/grid/cell_id.h>
#include <deal.II/grid/reference_cell.h>
#include <deal.II/base/communication_pattern_base.h>
#include <deal.II/base/memory_space.h>
#include <deal.II/base/memory_space_data.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/numbers.h>
#include <deal.II/base/parallel.h>
#include <deal.II/base/partitioner.h>
#include <deal.II/base/cuda.h>
#include <deal.II/base/cuda_size.h>
+#include <deal.II/base/mpi.h>
#include <deal.II/lac/exceptions.h>
#include <deal.II/lac/la_parallel_vector.h>
#include <deal.II/base/communication_pattern_base.h>
#include <deal.II/base/index_set.h>
#include <deal.II/base/memory_consumption.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/parallel.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/template_constraints.h>
// Forward declarations
#ifndef DOXYGEN
+template <typename>
+class Vector;
+
namespace LinearAlgebra
{
template <typename>
# include <deal.II/base/exceptions.h>
# include <deal.II/base/mpi.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/mutex.h>
# include <deal.II/base/process_grid.h>
# include <deal.II/lac/lapack_full_matrix.h>
# include <deal.II/lac/lapack_support.h>
-# include <mpi.h>
-
# include <memory>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/config.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/lac/identity_matrix.h>
#include <deal.II/lac/sparsity_pattern.h>
#include <deal.II/lac/vector_operation.h>
-#ifdef DEAL_II_WITH_MPI
-# include <mpi.h>
-#endif
#include <iterator>
#include <memory>
#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
+#include <deal.II/base/index_set.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/lac/block_sparsity_pattern.h>
#include <deal.II/lac/dynamic_sparsity_pattern.h>
#include <memory>
#include <vector>
-#ifdef DEAL_II_WITH_MPI
-# include <deal.II/base/index_set.h>
-
-# include <mpi.h>
-#endif
-
DEAL_II_NAMESPACE_OPEN
#ifdef DEAL_II_WITH_TRILINOS
# include <deal.II/base/index_set.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/subscriptor.h>
# include <deal.II/lac/trilinos_epetra_communication_pattern.h>
# include <deal.II/lac/vector_type_traits.h>
# include <Epetra_FEVector.h>
-# include <mpi.h>
# include <memory>
# ifdef DEAL_II_WITH_TRILINOS
# include <deal.II/base/index_set.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/subscriptor.h>
# include <deal.II/lac/exceptions.h>
# include <Epetra_MpiComm.h>
# include <Epetra_MultiVector.h>
# include <Epetra_Operator.h>
-# include <mpi.h>
# include <cmath>
# include <iterator>
# ifdef DEAL_II_WITH_TRILINOS
# include <deal.II/base/index_set.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/subscriptor.h>
# include <deal.II/lac/exceptions.h>
# include <Epetra_FECrsGraph.h>
# include <Epetra_Map.h>
# include <Epetra_MpiComm.h>
-# include <mpi.h>
# include <cmath>
# include <memory>
#ifdef DEAL_II_TRILINOS_WITH_TPETRA
# include <deal.II/base/index_set.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/subscriptor.h>
# include <deal.II/lac/trilinos_tpetra_communication_pattern.h>
# include <Tpetra_Core.hpp>
# include <Tpetra_Vector.hpp>
# include <Tpetra_Version.hpp>
-# include <mpi.h>
# include <memory>
#ifdef DEAL_II_WITH_TRILINOS
# include <deal.II/base/index_set.h>
-# include <deal.II/base/mpi.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/subscriptor.h>
# include <deal.II/base/utilities.h>
# include <Epetra_LocalMap.h>
# include <Epetra_Map.h>
# include <Epetra_MpiComm.h>
-# include <mpi.h>
# include <memory>
# include <utility>
#ifdef DEAL_II_COMPILER_CUDA_AWARE
# include <deal.II/base/cuda_size.h>
-# include <deal.II/base/mpi.h>
+# include <deal.II/base/mpi_stub.h>
+# include <deal.II/base/partitioner.h>
# include <deal.II/base/quadrature.h>
# include <deal.II/base/tensor.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/memory_consumption.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/base/tensor.h>
#include <deal.II/base/utilities.h>
#include <deal.II/base/vectorization.h>
#include <deal.II/base/config.h>
#include <deal.II/base/array_view.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
+#include <deal.II/base/partitioner.h>
#include <deal.II/lac/vector_operation.h>
+#include <memory>
DEAL_II_NAMESPACE_OPEN
#include <deal.II/base/array_view.h>
#include <deal.II/base/bounding_box.h>
#include <deal.II/base/function.h>
-#include <deal.II/base/mpi.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/config.h>
-#include <deal.II/base/mpi.h>
#ifdef DEAL_II_WITH_SUNDIALS
# include <deal.II/base/conditional_ostream.h>
# include <deal.II/base/exceptions.h>
# include <deal.II/base/logstream.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/parameter_handler.h>
+
# ifdef DEAL_II_WITH_PETSC
# include <deal.II/lac/petsc_block_vector.h>
# include <deal.II/lac/petsc_vector.h>
#include <deal.II/base/config.h>
-#include <deal.II/base/mpi.h>
#ifdef DEAL_II_WITH_SUNDIALS
# include <deal.II/base/conditional_ostream.h>
# include <deal.II/base/exceptions.h>
# include <deal.II/base/logstream.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/parameter_handler.h>
+
# ifdef DEAL_II_WITH_PETSC
# include <deal.II/lac/petsc_block_vector.h>
# include <deal.II/lac/petsc_vector.h>
# include <deal.II/base/conditional_ostream.h>
# include <deal.II/base/exceptions.h>
# include <deal.II/base/logstream.h>
-# include <deal.II/base/mpi.h>
+# include <deal.II/base/mpi_stub.h>
# include <deal.II/base/parameter_handler.h>
# include <deal.II/lac/vector.h>
// ---------------------------------------------------------------------
#include <deal.II/base/bounding_box.h>
-#include <deal.II/base/mpi.h>
+#include <deal.II/base/mpi_stub.h>
#include <deal.II/grid/filtered_iterator.h>
#include <deal.II/grid/grid_tools.h>
#ifdef DEAL_II_WITH_TRILINOS
# include <deal.II/base/index_set.h>
+# include <deal.II/base/mpi.h>
# include <deal.II/lac/read_write_vector.h>