From: David Wells Date: Fri, 12 Aug 2022 12:24:36 +0000 (-0400) Subject: Move 'using MPI_Comm = int' et al to a separate header. X-Git-Tag: v9.5.0-rc1~1044^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14185%2Fhead;p=dealii.git Move 'using MPI_Comm = int' et al to a separate header. Most of the time we only need declarations of MPI classes (like MPI_Comm) and not our own utility functions in headers. To this end, we can just put mpi.h (or our equivalent stub declarations) in a separate header and use that most of the time. --- diff --git a/include/deal.II/base/communication_pattern_base.h b/include/deal.II/base/communication_pattern_base.h index 02c626ce0c..94c27e16a1 100644 --- a/include/deal.II/base/communication_pattern_base.h +++ b/include/deal.II/base/communication_pattern_base.h @@ -18,7 +18,7 @@ #include -#include +#include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/data_out_base.h b/include/deal.II/base/data_out_base.h index 5011030015..1eee188989 100644 --- a/include/deal.II/base/data_out_base.h +++ b/include/deal.II/base/data_out_base.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index 9afd33f187..f4d09b1dff 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -37,15 +38,6 @@ DEAL_II_ENABLE_EXTRA_DIAGNOSTICS # endif #endif -#if defined(DEAL_II_WITH_MPI) || defined(DEAL_II_WITH_PETSC) -# include -#else -using MPI_Comm = int; -# ifndef MPI_COMM_WORLD -# define MPI_COMM_WORLD 0 -# endif -#endif - DEAL_II_NAMESPACE_OPEN /** diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index f233f0a783..ded9b27026 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -32,40 +33,6 @@ #include #include -#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 - /** diff --git a/include/deal.II/base/mpi_compute_index_owner_internal.h b/include/deal.II/base/mpi_compute_index_owner_internal.h index 195b19e155..ed4d141909 100644 --- a/include/deal.II/base/mpi_compute_index_owner_internal.h +++ b/include/deal.II/base/mpi_compute_index_owner_internal.h @@ -18,8 +18,8 @@ #include -#include #include +#include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/mpi_consensus_algorithms.h b/include/deal.II/base/mpi_consensus_algorithms.h index ce6c84a42b..373dbbd28e 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.h +++ b/include/deal.II/base/mpi_consensus_algorithms.h @@ -20,6 +20,7 @@ #include #include +#include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/mpi_noncontiguous_partitioner.h b/include/deal.II/base/mpi_noncontiguous_partitioner.h index 28c5ecdc08..776436167f 100644 --- a/include/deal.II/base/mpi_noncontiguous_partitioner.h +++ b/include/deal.II/base/mpi_noncontiguous_partitioner.h @@ -19,9 +19,8 @@ #include #include -#include #include -#include +#include #include diff --git a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h index 62f9079dbd..0c03316436 100644 --- a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h +++ b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h @@ -22,6 +22,7 @@ #include #include #include +#include #include diff --git a/include/deal.II/base/mpi_remote_point_evaluation.h b/include/deal.II/base/mpi_remote_point_evaluation.h index 01d9c73267..7f3c121978 100644 --- a/include/deal.II/base/mpi_remote_point_evaluation.h +++ b/include/deal.II/base/mpi_remote_point_evaluation.h @@ -18,6 +18,9 @@ #include +#include +#include + #include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/mpi_stub.h b/include/deal.II/base/mpi_stub.h new file mode 100644 index 0000000000..bcfe0c0cc7 --- /dev/null +++ b/include/deal.II/base/mpi_stub.h @@ -0,0 +1,63 @@ +// --------------------------------------------------------------------- +// +// 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 + +// 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 +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 diff --git a/include/deal.II/base/partitioner.h b/include/deal.II/base/partitioner.h index 8664d39236..c1ec508ff7 100644 --- a/include/deal.II/base/partitioner.h +++ b/include/deal.II/base/partitioner.h @@ -22,13 +22,13 @@ #include #include #include -#include +#include #include #include #include - +#include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index 67097adb61..b933700dd1 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -19,6 +19,7 @@ #include #include +#include #include #include diff --git a/include/deal.II/distributed/fully_distributed_tria.h b/include/deal.II/distributed/fully_distributed_tria.h index cebde819aa..20f7de6238 100644 --- a/include/deal.II/distributed/fully_distributed_tria.h +++ b/include/deal.II/distributed/fully_distributed_tria.h @@ -19,15 +19,13 @@ #include +#include + #include #include #include -#ifdef DEAL_II_WITH_MPI -# include -#endif - DEAL_II_NAMESPACE_OPEN // Forward declarations diff --git a/include/deal.II/distributed/shared_tria.h b/include/deal.II/distributed/shared_tria.h index f9d56f0839..781b37c62d 100644 --- a/include/deal.II/distributed/shared_tria.h +++ b/include/deal.II/distributed/shared_tria.h @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -33,11 +34,6 @@ #include #include -#ifdef DEAL_II_WITH_MPI -# include -#endif - - DEAL_II_NAMESPACE_OPEN namespace parallel diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index 2d979acd2c..ccb7e18a2f 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -37,10 +38,6 @@ #include #include -#ifdef DEAL_II_WITH_MPI -# include -#endif - #ifdef DEAL_II_WITH_P4EST # include # include diff --git a/include/deal.II/distributed/tria_base.h b/include/deal.II/distributed/tria_base.h index c9c40be302..011c2d3229 100644 --- a/include/deal.II/distributed/tria_base.h +++ b/include/deal.II/distributed/tria_base.h @@ -19,7 +19,7 @@ #include -#include +#include #include #include #include diff --git a/include/deal.II/dofs/number_cache.h b/include/deal.II/dofs/number_cache.h index 7624072a08..8bd8fc4604 100644 --- a/include/deal.II/dofs/number_cache.h +++ b/include/deal.II/dofs/number_cache.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include diff --git a/include/deal.II/grid/tria_description.h b/include/deal.II/grid/tria_description.h index b2c26cf4c3..888353316b 100644 --- a/include/deal.II/grid/tria_description.h +++ b/include/deal.II/grid/tria_description.h @@ -18,7 +18,7 @@ #include -#include +#include #include #include diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index 137ff816e0..c8f09024f2 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 39d1d1c08f..f6bd7941ca 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -21,6 +21,7 @@ #include #include +#include #include #include diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index 9a915f0f5b..4af5b1c6b2 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,6 +47,9 @@ DEAL_II_NAMESPACE_OPEN // Forward declarations #ifndef DOXYGEN +template +class Vector; + namespace LinearAlgebra { template diff --git a/include/deal.II/lac/scalapack.h b/include/deal.II/lac/scalapack.h index da65f8c183..16fad15087 100644 --- a/include/deal.II/lac/scalapack.h +++ b/include/deal.II/lac/scalapack.h @@ -22,6 +22,7 @@ # include # include +# include # include # include @@ -29,8 +30,6 @@ # include # include -# include - # include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/lac/sparse_matrix.h b/include/deal.II/lac/sparse_matrix.h index f3c71bd7ff..a27f2bb07f 100644 --- a/include/deal.II/lac/sparse_matrix.h +++ b/include/deal.II/lac/sparse_matrix.h @@ -18,6 +18,7 @@ #include +#include #include #include @@ -25,9 +26,6 @@ #include #include #include -#ifdef DEAL_II_WITH_MPI -# include -#endif #include #include diff --git a/include/deal.II/lac/sparsity_tools.h b/include/deal.II/lac/sparsity_tools.h index cfcf74bc04..454654e659 100644 --- a/include/deal.II/lac/sparsity_tools.h +++ b/include/deal.II/lac/sparsity_tools.h @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include @@ -28,12 +30,6 @@ #include #include -#ifdef DEAL_II_WITH_MPI -# include - -# include -#endif - DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/lac/trilinos_epetra_vector.h b/include/deal.II/lac/trilinos_epetra_vector.h index fd717964c6..10abb5ce7b 100644 --- a/include/deal.II/lac/trilinos_epetra_vector.h +++ b/include/deal.II/lac/trilinos_epetra_vector.h @@ -22,6 +22,7 @@ #ifdef DEAL_II_WITH_TRILINOS # include +# include # include # include @@ -30,7 +31,6 @@ # include # include -# include # include diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index 3f8c6f669e..51ca742d5d 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -22,6 +22,7 @@ # ifdef DEAL_II_WITH_TRILINOS # include +# include # include # include @@ -41,7 +42,6 @@ # include # include # include -# include # include # include diff --git a/include/deal.II/lac/trilinos_sparsity_pattern.h b/include/deal.II/lac/trilinos_sparsity_pattern.h index aa417bd35e..74c8ea1ea8 100644 --- a/include/deal.II/lac/trilinos_sparsity_pattern.h +++ b/include/deal.II/lac/trilinos_sparsity_pattern.h @@ -22,6 +22,7 @@ # ifdef DEAL_II_WITH_TRILINOS # include +# include # include # include @@ -29,7 +30,6 @@ # include # include # include -# include # include # include diff --git a/include/deal.II/lac/trilinos_tpetra_vector.h b/include/deal.II/lac/trilinos_tpetra_vector.h index 8e3a56b8b1..26c1f1675a 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.h @@ -22,6 +22,7 @@ #ifdef DEAL_II_TRILINOS_WITH_TPETRA # include +# include # include # include @@ -34,7 +35,6 @@ # include # include # include -# include # include diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index cd2f45619c..2161e19f2b 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -21,7 +21,7 @@ #ifdef DEAL_II_WITH_TRILINOS # include -# include +# include # include # include @@ -35,7 +35,6 @@ # include # include # include -# include # include # include diff --git a/include/deal.II/matrix_free/cuda_matrix_free.h b/include/deal.II/matrix_free/cuda_matrix_free.h index b0a36ba45b..24cbc64f3f 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.h @@ -22,7 +22,8 @@ #ifdef DEAL_II_COMPILER_CUDA_AWARE # include -# include +# include +# include # include # include diff --git a/include/deal.II/matrix_free/task_info.h b/include/deal.II/matrix_free/task_info.h index 3c66a98499..3f89b4a365 100644 --- a/include/deal.II/matrix_free/task_info.h +++ b/include/deal.II/matrix_free/task_info.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/deal.II/matrix_free/vector_data_exchange.h b/include/deal.II/matrix_free/vector_data_exchange.h index 6a2e349740..a6f4abd320 100644 --- a/include/deal.II/matrix_free/vector_data_exchange.h +++ b/include/deal.II/matrix_free/vector_data_exchange.h @@ -21,10 +21,12 @@ #include #include -#include +#include +#include #include +#include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/particles/particle_handler.h b/include/deal.II/particles/particle_handler.h index f09497ab9a..5fa175b031 100644 --- a/include/deal.II/particles/particle_handler.h +++ b/include/deal.II/particles/particle_handler.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include diff --git a/include/deal.II/sundials/arkode.h b/include/deal.II/sundials/arkode.h index b001106d8c..dd1cfa0ca0 100644 --- a/include/deal.II/sundials/arkode.h +++ b/include/deal.II/sundials/arkode.h @@ -19,14 +19,15 @@ #include -#include #ifdef DEAL_II_WITH_SUNDIALS # include # include # include +# include # include + # ifdef DEAL_II_WITH_PETSC # include # include diff --git a/include/deal.II/sundials/ida.h b/include/deal.II/sundials/ida.h index a4df31be69..81f6d0d87a 100644 --- a/include/deal.II/sundials/ida.h +++ b/include/deal.II/sundials/ida.h @@ -19,12 +19,13 @@ #include -#include #ifdef DEAL_II_WITH_SUNDIALS # include # include # include +# include # include + # ifdef DEAL_II_WITH_PETSC # include # include diff --git a/include/deal.II/sundials/kinsol.h b/include/deal.II/sundials/kinsol.h index 98b2bab8e9..943ffc0c35 100644 --- a/include/deal.II/sundials/kinsol.h +++ b/include/deal.II/sundials/kinsol.h @@ -25,7 +25,7 @@ # include # include # include -# include +# include # include # include diff --git a/source/grid/grid_tools_cache.cc b/source/grid/grid_tools_cache.cc index 2227b0388a..76bc5507c5 100644 --- a/source/grid/grid_tools_cache.cc +++ b/source/grid/grid_tools_cache.cc @@ -14,7 +14,7 @@ // --------------------------------------------------------------------- #include -#include +#include #include #include diff --git a/source/lac/trilinos_epetra_vector.cc b/source/lac/trilinos_epetra_vector.cc index 7f2c755434..eaf4fb047a 100644 --- a/source/lac/trilinos_epetra_vector.cc +++ b/source/lac/trilinos_epetra_vector.cc @@ -18,6 +18,7 @@ #ifdef DEAL_II_WITH_TRILINOS # include +# include # include